summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/CMakeLists.txt8
-rw-r--r--tools/COPYING13
-rw-r--r--tools/Makefile.am2
-rw-r--r--tools/Makefile.in68
-rw-r--r--tools/lib/CMakeLists.txt17
-rw-r--r--tools/lib/Makefile.am2
-rw-r--r--tools/lib/Makefile.in66
-rw-r--r--tools/lib/h5diff.c1233
-rw-r--r--tools/lib/h5diff.h159
-rw-r--r--tools/lib/h5diff_array.c2198
-rw-r--r--tools/lib/h5diff_attr.c332
-rw-r--r--tools/lib/h5diff_dset.c610
-rw-r--r--tools/lib/h5diff_util.c335
-rw-r--r--tools/lib/h5tools.c867
-rw-r--r--tools/lib/h5tools.h411
-rw-r--r--tools/lib/h5tools_dump.c3116
-rw-r--r--tools/lib/h5tools_dump.h108
-rw-r--r--tools/lib/h5tools_error.h298
-rw-r--r--tools/lib/h5tools_filters.c184
-rw-r--r--tools/lib/h5tools_ref.c81
-rw-r--r--tools/lib/h5tools_ref.h7
-rw-r--r--tools/lib/h5tools_str.c1053
-rw-r--r--tools/lib/h5tools_str.h51
-rw-r--r--tools/lib/h5tools_type.c12
-rw-r--r--tools/lib/h5tools_utils.c521
-rw-r--r--tools/lib/h5tools_utils.h138
-rw-r--r--tools/lib/h5trav.c552
-rw-r--r--tools/lib/h5trav.h105
-rw-r--r--tools/lib/io_timer.c118
-rw-r--r--tools/lib/io_timer.h54
-rw-r--r--tools/lib/ph5diff.h39
-rw-r--r--tools/libtest/CMakeLists.txt9
-rw-r--r--tools/libtest/CMakeTests.cmake2
-rw-r--r--tools/libtest/Makefile.am18
-rw-r--r--tools/libtest/Makefile.in81
-rw-r--r--tools/libtest/h5tools_test_utils.c432
-rw-r--r--tools/src/CMakeLists.txt5
-rw-r--r--tools/src/Makefile.am4
-rw-r--r--tools/src/Makefile.in68
-rw-r--r--tools/src/h5copy/CMakeLists.txt15
-rw-r--r--tools/src/h5copy/Makefile.am2
-rw-r--r--tools/src/h5copy/Makefile.in66
-rw-r--r--tools/src/h5copy/h5copy.c342
-rw-r--r--tools/src/h5diff/CMakeLists.txt21
-rw-r--r--tools/src/h5diff/Makefile.am2
-rw-r--r--tools/src/h5diff/Makefile.in66
-rw-r--r--tools/src/h5diff/h5diff_common.c832
-rw-r--r--tools/src/h5diff/h5diff_common.h13
-rw-r--r--tools/src/h5diff/h5diff_main.c56
-rw-r--r--tools/src/h5diff/ph5diff_main.c122
-rw-r--r--tools/src/h5dump/CMakeLists.txt27
-rw-r--r--tools/src/h5dump/Makefile.am2
-rw-r--r--tools/src/h5dump/Makefile.in66
-rw-r--r--tools/src/h5dump/h5dump.c1304
-rw-r--r--tools/src/h5dump/h5dump.h108
-rw-r--r--tools/src/h5dump/h5dump_ddl.c1512
-rw-r--r--tools/src/h5dump/h5dump_ddl.h35
-rw-r--r--tools/src/h5dump/h5dump_defines.h63
-rw-r--r--tools/src/h5dump/h5dump_extern.h103
-rw-r--r--tools/src/h5dump/h5dump_xml.c3050
-rw-r--r--tools/src/h5dump/h5dump_xml.h24
-rw-r--r--tools/src/h5format_convert/CMakeLists.txt15
-rw-r--r--tools/src/h5format_convert/Makefile.am2
-rw-r--r--tools/src/h5format_convert/Makefile.in66
-rw-r--r--tools/src/h5format_convert/h5format_convert.c254
-rw-r--r--tools/src/h5import/CMakeLists.txt19
-rw-r--r--tools/src/h5import/Makefile.am2
-rw-r--r--tools/src/h5import/Makefile.in66
-rw-r--r--tools/src/h5import/h5import.c5056
-rw-r--r--tools/src/h5import/h5import.h202
-rw-r--r--tools/src/h5jam/CMakeLists.txt21
-rw-r--r--tools/src/h5jam/Makefile.am2
-rw-r--r--tools/src/h5jam/Makefile.in66
-rw-r--r--tools/src/h5jam/h5jam.c317
-rw-r--r--tools/src/h5jam/h5unjam.c209
-rw-r--r--tools/src/h5ls/CMakeLists.txt15
-rw-r--r--tools/src/h5ls/Makefile.am2
-rw-r--r--tools/src/h5ls/Makefile.in66
-rw-r--r--tools/src/h5ls/h5ls.c1230
-rw-r--r--tools/src/h5perf/CMakeLists.txt103
-rw-r--r--tools/src/h5perf/Makefile.am63
-rw-r--r--tools/src/h5perf/Makefile.in1597
-rw-r--r--tools/src/h5perf/perf.c803
-rw-r--r--tools/src/h5perf/pio_engine.c2747
-rw-r--r--tools/src/h5perf/pio_perf.c (renamed from tools/test/perform/pio_perf.c)1114
-rw-r--r--tools/src/h5perf/pio_perf.h109
-rw-r--r--tools/src/h5perf/sio_engine.c1330
-rw-r--r--tools/src/h5perf/sio_perf.c (renamed from tools/test/perform/sio_perf.c)929
-rw-r--r--tools/src/h5perf/sio_perf.h104
-rw-r--r--tools/src/h5repack/CMakeLists.txt16
-rw-r--r--tools/src/h5repack/Makefile.am2
-rw-r--r--tools/src/h5repack/Makefile.in66
-rw-r--r--tools/src/h5repack/h5repack.c229
-rw-r--r--tools/src/h5repack/h5repack.h207
-rw-r--r--tools/src/h5repack/h5repack_copy.c1504
-rw-r--r--tools/src/h5repack/h5repack_filters.c313
-rw-r--r--tools/src/h5repack/h5repack_main.c405
-rw-r--r--tools/src/h5repack/h5repack_opttable.c110
-rw-r--r--tools/src/h5repack/h5repack_parse.c316
-rw-r--r--tools/src/h5repack/h5repack_refs.c546
-rw-r--r--tools/src/h5repack/h5repack_verify.c374
-rw-r--r--tools/src/h5stat/CMakeLists.txt15
-rw-r--r--tools/src/h5stat/Makefile.am2
-rw-r--r--tools/src/h5stat/Makefile.in66
-rw-r--r--tools/src/h5stat/h5stat.c1108
-rw-r--r--tools/src/misc/CMakeLists.txt35
-rw-r--r--tools/src/misc/Makefile.am2
-rw-r--r--tools/src/misc/Makefile.in66
-rw-r--r--tools/src/misc/h5clear.c177
-rw-r--r--tools/src/misc/h5debug.c479
-rw-r--r--tools/src/misc/h5mkgrp.c115
-rw-r--r--tools/src/misc/h5repart.c339
-rw-r--r--tools/test/Makefile.am2
-rw-r--r--tools/test/Makefile.in66
-rw-r--r--tools/test/h5copy/CMakeLists.txt21
-rw-r--r--tools/test/h5copy/CMakeTests.cmake24
-rw-r--r--tools/test/h5copy/Makefile.am2
-rw-r--r--tools/test/h5copy/Makefile.in66
-rw-r--r--tools/test/h5copy/dynlib_copy.c68
-rw-r--r--tools/test/h5copy/h5copygentest.c467
-rw-r--r--tools/test/h5copy/testh5copy.sh.in2
-rw-r--r--tools/test/h5diff/CMakeLists.txt20
-rw-r--r--tools/test/h5diff/CMakeTests.cmake73
-rw-r--r--tools/test/h5diff/Makefile.am2
-rw-r--r--tools/test/h5diff/Makefile.in66
-rw-r--r--tools/test/h5diff/dynlib_diff.c68
-rw-r--r--tools/test/h5diff/h5diff_plugin.sh.in2
-rw-r--r--tools/test/h5diff/h5diffgentest.c3703
-rw-r--r--tools/test/h5diff/testfiles/h5diff_10.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_600.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_603.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_606.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_612.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_615.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_621.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_622.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_623.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_624.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_830.txt30
-rw-r--r--tools/test/h5diff/testh5diff.sh.in8
-rw-r--r--tools/test/h5diff/testph5diff.sh.in2
-rw-r--r--tools/test/h5dump/CMakeLists.txt20
-rw-r--r--tools/test/h5dump/CMakeTests.cmake27
-rw-r--r--tools/test/h5dump/CMakeTestsPBITS.cmake2
-rw-r--r--tools/test/h5dump/CMakeTestsVDS.cmake2
-rw-r--r--tools/test/h5dump/CMakeTestsXML.cmake2
-rw-r--r--tools/test/h5dump/CMakeVFDTests.cmake4
-rw-r--r--tools/test/h5dump/Makefile.am2
-rw-r--r--tools/test/h5dump/Makefile.in66
-rw-r--r--tools/test/h5dump/binread.c23
-rw-r--r--tools/test/h5dump/dynlib_dump.c68
-rw-r--r--tools/test/h5dump/h5dump_plugin.sh.in2
-rw-r--r--tools/test/h5dump/h5dumpgentest.c6610
-rw-r--r--tools/test/h5dump/testh5dump.sh.in51
-rw-r--r--tools/test/h5dump/testh5dumppbits.sh.in2
-rw-r--r--tools/test/h5dump/testh5dumpvds.sh.in2
-rw-r--r--tools/test/h5dump/testh5dumpxml.sh.in2
-rw-r--r--tools/test/h5format_convert/CMakeLists.txt18
-rw-r--r--tools/test/h5format_convert/CMakeTests.cmake2
-rw-r--r--tools/test/h5format_convert/Makefile.am2
-rw-r--r--tools/test/h5format_convert/Makefile.in66
-rw-r--r--tools/test/h5format_convert/h5fc_chk_idx.c55
-rw-r--r--tools/test/h5format_convert/h5fc_gentest.c589
-rw-r--r--tools/test/h5format_convert/testh5fc.sh.in2
-rw-r--r--tools/test/h5import/CMakeLists.txt9
-rw-r--r--tools/test/h5import/CMakeTests.cmake2
-rw-r--r--tools/test/h5import/Makefile.am2
-rw-r--r--tools/test/h5import/Makefile.in66
-rw-r--r--tools/test/h5import/h5importtest.c507
-rw-r--r--tools/test/h5import/h5importtestutil.sh.in2
-rw-r--r--tools/test/h5jam/CMakeLists.txt21
-rw-r--r--tools/test/h5jam/CMakeTests.cmake2
-rw-r--r--tools/test/h5jam/Makefile.am2
-rw-r--r--tools/test/h5jam/Makefile.in66
-rw-r--r--tools/test/h5jam/getub.c80
-rw-r--r--tools/test/h5jam/h5jamgentest.c586
-rw-r--r--tools/test/h5jam/tellub.c70
-rw-r--r--tools/test/h5jam/testh5jam.sh.in2
-rw-r--r--tools/test/h5ls/CMakeLists.txt12
-rw-r--r--tools/test/h5ls/CMakeTests.cmake6
-rw-r--r--tools/test/h5ls/CMakeTestsVDS.cmake6
-rw-r--r--tools/test/h5ls/Makefile.am2
-rw-r--r--tools/test/h5ls/Makefile.in66
-rw-r--r--tools/test/h5ls/dynlib_ls.c68
-rw-r--r--tools/test/h5ls/h5ls_plugin.sh.in2
-rw-r--r--tools/test/h5ls/testh5ls.sh.in2
-rw-r--r--tools/test/h5ls/testh5lsvds.sh.in2
-rw-r--r--tools/test/h5repack/CMakeLists.txt30
-rw-r--r--tools/test/h5repack/CMakeTests.cmake16
-rw-r--r--tools/test/h5repack/CMakeVFDTests.cmake4
-rw-r--r--tools/test/h5repack/Makefile.am2
-rw-r--r--tools/test/h5repack/Makefile.in66
-rw-r--r--tools/test/h5repack/dynlib_rpk.c62
-rw-r--r--tools/test/h5repack/dynlib_vrpk.c77
-rw-r--r--tools/test/h5repack/h5repack.sh.in72
-rw-r--r--tools/test/h5repack/h5repack_plugin.sh.in2
-rw-r--r--tools/test/h5repack/h5repackgentest.c203
-rw-r--r--tools/test/h5repack/h5repacktst.c3905
-rw-r--r--tools/test/h5repack/testfiles/h5repack-help.txt1
-rw-r--r--tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5bin0 -> 2560 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5bin0 -> 7648 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl14
-rw-r--r--tools/test/h5repack/testh5repack_detect_szip.c11
-rw-r--r--tools/test/h5stat/CMakeLists.txt9
-rw-r--r--tools/test/h5stat/CMakeTests.cmake4
-rw-r--r--tools/test/h5stat/Makefile.am2
-rw-r--r--tools/test/h5stat/Makefile.in66
-rw-r--r--tools/test/h5stat/h5stat_gentest.c440
-rw-r--r--tools/test/h5stat/testh5stat.sh.in4
-rw-r--r--tools/test/misc/CMakeLists.txt36
-rw-r--r--tools/test/misc/CMakeTestsClear.cmake6
-rw-r--r--tools/test/misc/CMakeTestsMkgrp.cmake2
-rw-r--r--tools/test/misc/CMakeTestsRepart.cmake2
-rw-r--r--tools/test/misc/Makefile.am2
-rw-r--r--tools/test/misc/Makefile.in66
-rw-r--r--tools/test/misc/clear_open_chk.c12
-rw-r--r--tools/test/misc/h5clear_gentest.c314
-rw-r--r--tools/test/misc/h5perf_gentest.c654
-rw-r--r--tools/test/misc/h5repart_gentest.c52
-rw-r--r--tools/test/misc/repart_test.c51
-rw-r--r--tools/test/misc/talign.c117
-rw-r--r--tools/test/misc/testh5clear.sh.in6
-rw-r--r--tools/test/misc/testh5mkgrp.sh.in2
-rw-r--r--tools/test/misc/testh5repart.sh.in2
-rw-r--r--tools/test/misc/vds/CMakeLists.txt13
-rw-r--r--tools/test/misc/vds/Makefile.am2
-rw-r--r--tools/test/misc/vds/Makefile.in66
-rw-r--r--tools/test/misc/vds/UC_1.h57
-rw-r--r--tools/test/misc/vds/UC_1_one_dim_gen.c179
-rw-r--r--tools/test/misc/vds/UC_2.h74
-rw-r--r--tools/test/misc/vds/UC_2_two_dims_gen.c194
-rw-r--r--tools/test/misc/vds/UC_3.h44
-rw-r--r--tools/test/misc/vds/UC_3_gaps_gen.c148
-rw-r--r--tools/test/misc/vds/UC_4.h40
-rw-r--r--tools/test/misc/vds/UC_4_printf_gen.c140
-rw-r--r--tools/test/misc/vds/UC_5.h33
-rw-r--r--tools/test/misc/vds/UC_5_stride_gen.c155
-rw-r--r--tools/test/misc/vds/UC_common.h21
-rw-r--r--tools/test/perform/CMakeLists.txt132
-rw-r--r--tools/test/perform/CMakeTests.cmake2
-rw-r--r--tools/test/perform/COPYING13
-rw-r--r--tools/test/perform/Makefile.am25
-rw-r--r--tools/test/perform/Makefile.in222
-rw-r--r--tools/test/perform/build_h5perf_alone.sh2
-rw-r--r--tools/test/perform/build_h5perf_serial_alone.sh2
-rw-r--r--tools/test/perform/chunk.c582
-rw-r--r--tools/test/perform/chunk_cache.c323
-rw-r--r--tools/test/perform/direct_write_perf.c432
-rw-r--r--tools/test/perform/gen_report.pl2
-rw-r--r--tools/test/perform/iopipe.c191
-rw-r--r--tools/test/perform/overhead.c308
-rw-r--r--tools/test/perform/perf.c491
-rw-r--r--tools/test/perform/perf_meta.c624
-rw-r--r--tools/test/perform/pio_engine.c2713
-rw-r--r--tools/test/perform/pio_perf.h102
-rw-r--r--tools/test/perform/pio_standalone.c244
-rw-r--r--tools/test/perform/pio_standalone.h700
-rw-r--r--tools/test/perform/sio_engine.c1334
-rw-r--r--tools/test/perform/sio_perf.h104
-rw-r--r--tools/test/perform/sio_standalone.c110
-rw-r--r--tools/test/perform/sio_standalone.h720
-rw-r--r--tools/test/perform/zip_perf.c296
-rw-r--r--tools/testfiles/h5dump-help.txt4
-rw-r--r--tools/testfiles/pbits/tnofilename-with-packed-bits.ddl4
-rw-r--r--tools/testfiles/pbits/tpbitsIncomplete.ddl4
-rw-r--r--tools/testfiles/pbits/tpbitsLengthExceeded.ddl4
-rw-r--r--tools/testfiles/pbits/tpbitsLengthPositive.ddl4
-rw-r--r--tools/testfiles/pbits/tpbitsMaxExceeded.ddl4
-rw-r--r--tools/testfiles/pbits/tpbitsOffsetExceeded.ddl4
-rw-r--r--tools/testfiles/pbits/tpbitsOffsetNegative.ddl4
-rw-r--r--tools/testfiles/tCVE_2018_11206_fill_new.h5bin0 -> 1752 bytes
-rw-r--r--tools/testfiles/tCVE_2018_11206_fill_old.h5bin0 -> 2560 bytes
-rw-r--r--tools/testfiles/tfloatsattrs.ddl621
-rw-r--r--tools/testfiles/tfloatsattrs.h5bin0 -> 47264 bytes
-rw-r--r--tools/testfiles/tfloatsattrs.wddl621
-rw-r--r--tools/testfiles/tldouble.ddl11
-rwxr-xr-xtools/testfiles/tldouble_scalar.ddl26
-rw-r--r--tools/testfiles/tldouble_scalar.h5bin0 -> 2144 bytes
-rw-r--r--tools/testfiles/tnbit.ddl2
-rw-r--r--tools/testfiles/treadintfilter.ddl2
280 files changed, 40804 insertions, 35888 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 57173a6..f453ad5 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -9,5 +9,11 @@ add_subdirectory (src)
#-- Add the tests
if (BUILD_TESTING)
add_subdirectory (test)
- add_subdirectory (libtest)
+
+# --------------------------------------------------------------------
+# If S3 or HDFS enabled, then we need to test the tools library
+# --------------------------------------------------------------------
+ if (HDF5_ENABLE_ROS3_VFD OR HDF5_ENABLE_HDFS)
+ add_subdirectory (libtest)
+ endif ()
endif ()
diff --git a/tools/COPYING b/tools/COPYING
deleted file mode 100644
index 6497ace..0000000
--- a/tools/COPYING
+++ /dev/null
@@ -1,13 +0,0 @@
-
- Copyright by The HDF Group and
- The Board of Trustees of the University of Illinois.
- All rights reserved.
-
- The files and subdirectories in this directory are part of HDF5.
- The full HDF5 copyright notice, including terms governing use,
- modification, and redistribution, is contained in the COPYING file
- which can be found at the root of the source code distribution tree
- or in https://support.hdfgroup.org/ftp/HDF5/releases. If you do
- not have access to either file, you may request a copy from
- help@hdfgroup.org.
-
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 3e62c8d..0ad0531 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 720eeb2..70476c1 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -113,6 +113,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -387,7 +388,7 @@ am__set_b = \
DIST_SUBDIRS = lib src test libtest
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/bin/test-driver \
$(top_srcdir)/config/commence.am \
- $(top_srcdir)/config/conclude.am COPYING
+ $(top_srcdir)/config/conclude.am
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
@@ -423,9 +424,9 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -463,11 +464,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -499,8 +545,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -514,7 +558,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -524,6 +570,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -717,7 +764,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1241,8 +1288,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index ff9ca43..6e4d3e6 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -26,16 +26,18 @@ set (H5_TOOLS_LIB_HDRS
${HDF5_TOOLS_LIB_SOURCE_DIR}/h5trav.h
${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools.h
${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_dump.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_error.h
${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_utils.h
${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_str.h
${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_ref.h
${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/io_timer.h
)
if (NOT ONLY_SHARED_LIBS)
add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS})
target_include_directories (${HDF5_TOOLS_LIB_TARGET}
- PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
target_compile_options(${HDF5_TOOLS_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
@@ -55,7 +57,7 @@ endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_TOOLS_LIBSH_TARGET} SHARED ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS})
target_include_directories (${HDF5_TOOLS_LIBSH_TARGET}
- PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
target_compile_options(${HDF5_TOOLS_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
@@ -75,6 +77,17 @@ if (BUILD_SHARED_LIBS)
set (install_targets ${install_targets} ${HDF5_TOOLS_LIBSH_TARGET})
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_TOOLS_SRC_FORMAT ${HDF5_TOOLS_LIB_TARGET})
+ else ()
+ clang_format (HDF5_TOOLS_SRC_FORMAT ${HDF5_TOOLS_LIBSH_TARGET})
+ endif ()
+endif ()
+
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
diff --git a/tools/lib/Makefile.am b/tools/lib/Makefile.am
index f07dff7..db14b9f 100644
--- a/tools/lib/Makefile.am
+++ b/tools/lib/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in
index 94a5a8a..9d90a86 100644
--- a/tools/lib/Makefile.in
+++ b/tools/lib/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -418,11 +419,11 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include files in /src directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -460,11 +461,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -496,8 +542,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -511,7 +555,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -521,6 +567,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -714,7 +761,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1247,8 +1294,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index e9b79b4..15ad483 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,7 +17,6 @@
#include "h5diff.h"
#include "ph5diff.h"
-
/*-------------------------------------------------------------------------
* Function: print_objname
*
@@ -27,7 +26,7 @@
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE int
-print_objname (diff_opt_t * opts, hsize_t nfound)
+print_objname(diff_opt_t *opts, hsize_t nfound)
{
return ((opts->mode_verbose || nfound) && !opts->mode_quiet) ? 1 : 0;
}
@@ -39,7 +38,7 @@ print_objname (diff_opt_t * opts, hsize_t nfound)
*-------------------------------------------------------------------------
*/
void
-do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts)
+do_print_objname(const char *OBJ, const char *path1, const char *path2, diff_opt_t *opts)
{
/* if verbose level is higher than 0, put space line before
* displaying any object or symbolic links. This improves
@@ -57,7 +56,7 @@ do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_op
*-------------------------------------------------------------------------
*/
void
-do_print_attrname (const char *attr, const char *path1, const char *path2)
+do_print_attrname(const char *attr, const char *path1, const char *path2)
{
parallel_print("%-7s: <%s> and <%s>\n", attr, path1, path2);
}
@@ -74,10 +73,9 @@ do_print_attrname (const char *attr, const char *path1, const char *path2)
static int
print_warn(diff_opt_t *opts)
{
- return ((opts->mode_verbose)) ? 1: 0;
+ return ((opts->mode_verbose)) ? 1 : 0;
}
-
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
* Function: phdiff_dismiss_workers
@@ -95,7 +93,6 @@ phdiff_dismiss_workers(void)
MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD);
}
-
/*-------------------------------------------------------------------------
* Function: print_incoming_data
*
@@ -109,19 +106,20 @@ phdiff_dismiss_workers(void)
static void
print_incoming_data(void)
{
- char data[PRINT_DATA_MAX_SIZE + 1];
- int incomingMessage;
+ char data[PRINT_DATA_MAX_SIZE + 1];
+ int incomingMessage;
MPI_Status Status;
do {
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage) {
- HDmemset(data, 0, PRINT_DATA_MAX_SIZE+1);
- MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status);
+ if (incomingMessage) {
+ HDmemset(data, 0, PRINT_DATA_MAX_SIZE + 1);
+ MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA,
+ MPI_COMM_WORLD, &Status);
HDprintf("%s", data);
}
- } while(incomingMessage);
+ } while (incomingMessage);
}
#endif
@@ -141,7 +139,7 @@ is_valid_options(diff_opt_t *opts)
/*-----------------------------------------------
* no -q(quiet) with -v (verbose) or -r (report) */
- if(opts->mode_quiet && (opts->mode_verbose || opts->mode_report)) {
+ if (opts->mode_quiet && (opts->mode_verbose || opts->mode_report)) {
parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
opts->err_stat = H5DIFF_ERR;
H5TOOLS_GOTO_DONE(0);
@@ -149,7 +147,7 @@ is_valid_options(diff_opt_t *opts)
/* -------------------------------------------------------
* only allow --no-dangling-links along with --follow-symlinks */
- if(opts->no_dangle_links && !opts->follow_links) {
+ if (opts->no_dangle_links && !opts->follow_links) {
parallel_print("Error: --no-dangling-links must be used along with --follow-symlinks option.\n");
opts->err_stat = H5DIFF_ERR;
H5TOOLS_GOTO_DONE(0);
@@ -169,11 +167,11 @@ done:
* 0 - not excluded path
*------------------------------------------------------------------------*/
static int
-is_exclude_path (char *path, h5trav_type_t type, diff_opt_t *opts)
+is_exclude_path(char *path, h5trav_type_t type, diff_opt_t *opts)
{
struct exclude_path_list *exclude_path_ptr;
- int ret_cmp;
- int ret_value = 0;
+ int ret_cmp;
+ int ret_value = 0;
/* check if exclude path option is given */
if (!opts->exclude_path)
@@ -186,9 +184,8 @@ is_exclude_path (char *path, h5trav_type_t type, diff_opt_t *opts)
while (NULL != exclude_path_ptr) {
/* if exclude path is is group, exclude its members as well */
if (exclude_path_ptr->obj_type == H5TRAV_TYPE_GROUP) {
- ret_cmp = HDstrncmp(exclude_path_ptr->obj_path, path,
- HDstrlen(exclude_path_ptr->obj_path));
- if (ret_cmp == 0) { /* found matching members */
+ ret_cmp = HDstrncmp(exclude_path_ptr->obj_path, path, HDstrlen(exclude_path_ptr->obj_path));
+ if (ret_cmp == 0) { /* found matching members */
size_t len_grp;
/* check if given path belong to an excluding group, if so
@@ -200,14 +197,14 @@ is_exclude_path (char *path, h5trav_type_t type, diff_opt_t *opts)
if (path[len_grp] == '/') {
/* belong to excluded group! */
ret_value = 1;
- break; /* while */
+ break; /* while */
}
}
}
/* exclude target is not group, just exclude the object */
else {
ret_cmp = HDstrcmp(exclude_path_ptr->obj_path, path);
- if (ret_cmp == 0) { /* found matching object */
+ if (ret_cmp == 0) { /* found matching object */
/* excluded non-group object */
ret_value = 1;
/* remember the type of this matching object.
@@ -221,7 +218,7 @@ is_exclude_path (char *path, h5trav_type_t type, diff_opt_t *opts)
}
done:
- return ret_value;
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -234,11 +231,11 @@ done:
* 0 - not excluded path
*------------------------------------------------------------------------*/
static int
-is_exclude_attr (const char *path, h5trav_type_t type, diff_opt_t *opts)
+is_exclude_attr(const char *path, h5trav_type_t type, diff_opt_t *opts)
{
struct exclude_path_list *exclude_ptr;
- int ret_cmp;
- int ret_value = 0;
+ int ret_cmp;
+ int ret_value = 0;
/* check if exclude attr option is given */
if (!opts->exclude_attr_path)
@@ -251,9 +248,8 @@ is_exclude_attr (const char *path, h5trav_type_t type, diff_opt_t *opts)
while (NULL != exclude_ptr) {
/* if exclude path is is group, exclude its members as well */
if (exclude_ptr->obj_type == H5TRAV_TYPE_GROUP) {
- ret_cmp = HDstrncmp(exclude_ptr->obj_path, path,
- HDstrlen(exclude_ptr->obj_path));
- if (ret_cmp == 0) { /* found matching members */
+ ret_cmp = HDstrncmp(exclude_ptr->obj_path, path, HDstrlen(exclude_ptr->obj_path));
+ if (ret_cmp == 0) { /* found matching members */
size_t len_grp;
/* check if given path belong to an excluding group, if so
@@ -265,14 +261,14 @@ is_exclude_attr (const char *path, h5trav_type_t type, diff_opt_t *opts)
if (path[len_grp] == '/') {
/* belong to excluded group! */
ret_value = 1;
- break; /* while */
+ break; /* while */
}
}
}
/* exclude target is not group, just exclude the object */
else {
ret_cmp = HDstrcmp(exclude_ptr->obj_path, path);
- if (ret_cmp == 0) { /* found matching object */
+ if (ret_cmp == 0) { /* found matching object */
/* excluded non-group object */
ret_value = 1;
/* remember the type of this matching object.
@@ -286,10 +282,9 @@ is_exclude_attr (const char *path, h5trav_type_t type, diff_opt_t *opts)
}
done:
- return ret_value;
+ return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: free_exclude_path_list
*
@@ -308,7 +303,6 @@ free_exclude_path_list(diff_opt_t *opts)
}
}
-
/*-------------------------------------------------------------------------
* Function: free_exclude_attr_list
*
@@ -342,21 +336,21 @@ free_exclude_attr_list(diff_opt_t *opts)
* table_out [OUT] : return the list
*------------------------------------------------------------------------*/
static void
-build_match_list (const char *objname1, trav_info_t *info1, const char *objname2, trav_info_t *info2,
- trav_table_t ** table_out, diff_opt_t *opts)
+build_match_list(const char *objname1, trav_info_t *info1, const char *objname2, trav_info_t *info2,
+ trav_table_t **table_out, diff_opt_t *opts)
{
- size_t curr1 = 0;
- size_t curr2 = 0;
- unsigned infile[2];
- char *path1_lp = NULL;
- char *path2_lp = NULL;
+ size_t curr1 = 0;
+ size_t curr2 = 0;
+ unsigned infile[2];
+ char * path1_lp = NULL;
+ char * path2_lp = NULL;
h5trav_type_t type1_l;
h5trav_type_t type2_l;
- size_t path1_offset = 0;
- size_t path2_offset = 0;
- int cmp;
+ size_t path1_offset = 0;
+ size_t path2_offset = 0;
+ int cmp;
trav_table_t *table = NULL;
- size_t idx;
+ size_t idx;
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/* init */
@@ -375,25 +369,25 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
H5TOOLS_DEBUG("objname1 = %s objname2 = %s ", objname1, objname2);
/* if obj1 is not root */
- if (HDstrcmp (objname1,"/") != 0)
+ if (HDstrcmp(objname1, "/") != 0)
path1_offset = HDstrlen(objname1);
/* if obj2 is not root */
- if (HDstrcmp (objname2,"/") != 0)
+ if (HDstrcmp(objname2, "/") != 0)
path2_offset = HDstrlen(objname2);
/*--------------------------------------------------
- * build the list
- */
- while(curr1 < info1->nused && curr2 < info2->nused) {
+ * build the list
+ */
+ while (curr1 < info1->nused && curr2 < info2->nused) {
path1_lp = (info1->paths[curr1].path) + path1_offset;
path2_lp = (info2->paths[curr2].path) + path2_offset;
- type1_l = info1->paths[curr1].type;
- type2_l = info2->paths[curr2].type;
+ type1_l = info1->paths[curr1].type;
+ type2_l = info2->paths[curr2].type;
/* criteria is string compare */
cmp = HDstrcmp(path1_lp, path2_lp);
- if(cmp == 0) {
- if(!is_exclude_path(path1_lp, type1_l, opts)) {
+ if (cmp == 0) {
+ if (!is_exclude_path(path1_lp, type1_l, opts)) {
infile[0] = 1;
infile[1] = 1;
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
@@ -401,15 +395,15 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
* mark that in table */
if (info1->paths[curr1].fileno == info2->paths[curr2].fileno &&
info1->paths[curr1].objno == info2->paths[curr2].objno) {
- idx = table->nobjs - 1;
+ idx = table->nobjs - 1;
table->objs[idx].is_same_trgobj = 1;
}
}
curr1++;
curr2++;
} /* end if */
- else if(cmp < 0) {
- if(!is_exclude_path(path1_lp, type1_l, opts)) {
+ else if (cmp < 0) {
+ if (!is_exclude_path(path1_lp, type1_l, opts)) {
infile[0] = 1;
infile[1] = 0;
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
@@ -424,16 +418,16 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
}
curr2++;
} /* end else */
- } /* end while */
+ } /* end while */
/* list1 did not end */
infile[0] = 1;
infile[1] = 0;
- while(curr1 < info1->nused) {
+ while (curr1 < info1->nused) {
path1_lp = (info1->paths[curr1].path) + path1_offset;
- type1_l = info1->paths[curr1].type;
+ type1_l = info1->paths[curr1].type;
- if(!is_exclude_path(path1_lp, type1_l, opts)) {
+ if (!is_exclude_path(path1_lp, type1_l, opts)) {
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
}
curr1++;
@@ -442,9 +436,9 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
/* list2 did not end */
infile[0] = 0;
infile[1] = 1;
- while(curr2 < info2->nused) {
+ while (curr2 < info2->nused) {
path2_lp = (info2->paths[curr2].path) + path2_offset;
- type2_l = info2->paths[curr2].type;
+ type2_l = info2->paths[curr2].type;
if (!is_exclude_path(path2_lp, type2_l, opts)) {
trav_table_addflags(infile, path2_lp, info2->paths[curr2].type, table);
@@ -452,23 +446,21 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
curr2++;
} /* end while */
- free_exclude_path_list (opts);
+ free_exclude_path_list(opts);
done:
*table_out = table;
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
}
-
/*-------------------------------------------------------------------------
* Function: trav_grp_objs
*
* Purpose: Call back function from h5trav_visit().
*------------------------------------------------------------------------*/
static herr_t
-trav_grp_objs(const char *path, const H5O_info_t *oinfo,
- const char *already_visited, void *udata)
+trav_grp_objs(const char *path, const H5O_info_t *oinfo, const char *already_visited, void *udata)
{
trav_info_visit_obj(path, oinfo, already_visited, udata);
@@ -484,14 +476,14 @@ trav_grp_objs(const char *path, const H5O_info_t *oinfo,
static herr_t
trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
{
- trav_info_t *tinfo = (trav_info_t *)udata;
- diff_opt_t *opts = (diff_opt_t *)tinfo->opts;
+ trav_info_t * tinfo = (trav_info_t *)udata;
+ diff_opt_t * opts = (diff_opt_t *)tinfo->opts;
h5tool_link_info_t lnk_info;
- const char *ext_fname;
- const char *ext_path;
- herr_t ret_value = SUCCEED;
+ const char * ext_fname;
+ const char * ext_path;
+ herr_t ret_value = SUCCEED;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
/* init linkinfo struct */
HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t));
@@ -500,9 +492,9 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
H5TOOLS_GOTO_DONE(SUCCEED);
}
- switch(linfo->type) {
+ switch (linfo->type) {
case H5L_TYPE_SOFT:
- if((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) {
+ if ((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) {
H5TOOLS_GOTO_DONE(FAIL);
}
else if (ret_value == 0) {
@@ -515,15 +507,15 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
}
/* check if already visit the target object */
- if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path))
+ if (symlink_is_visited(&(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path))
H5TOOLS_GOTO_DONE(SUCCEED);
/* add this link as visited link */
- if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path) < 0)
+ if (symlink_visit_add(&(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path) < 0)
H5TOOLS_GOTO_DONE(SUCCEED);
- if(h5trav_visit(tinfo->fid, path, TRUE, TRUE,
- trav_grp_objs,trav_grp_symlinks, tinfo, H5O_INFO_BASIC) < 0) {
+ if (h5trav_visit(tinfo->fid, path, TRUE, TRUE, trav_grp_objs, trav_grp_symlinks, tinfo,
+ H5O_INFO_BASIC) < 0) {
parallel_print("Error: Could not get file contents\n");
opts->err_stat = H5DIFF_ERR;
H5TOOLS_GOTO_ERROR(FAIL, "Error: Could not get file contents");
@@ -535,7 +527,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
H5TOOLS_GOTO_DONE(FAIL);
}
else if (ret_value == 0) {
- /* no dangling link option given and detect dangling link */
+ /* no dangling link option given and detect dangling link */
tinfo->symlink_visited.dangle_link = TRUE;
trav_info_visit_lnk(path, linfo, tinfo);
if (opts->no_dangle_links)
@@ -543,19 +535,19 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
H5TOOLS_GOTO_DONE(SUCCEED);
}
- if(H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0)
+ if (H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0)
H5TOOLS_GOTO_DONE(SUCCEED);
/* check if already visit the target object */
- if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path))
+ if (symlink_is_visited(&(tinfo->symlink_visited), linfo->type, ext_fname, ext_path))
H5TOOLS_GOTO_DONE(SUCCEED);
/* add this link as visited link */
- if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path) < 0)
+ if (symlink_visit_add(&(tinfo->symlink_visited), linfo->type, ext_fname, ext_path) < 0)
H5TOOLS_GOTO_DONE(SUCCEED);
- if(h5trav_visit(tinfo->fid, path, TRUE, TRUE,
- trav_grp_objs,trav_grp_symlinks, tinfo, H5O_INFO_BASIC) < 0) {
+ if (h5trav_visit(tinfo->fid, path, TRUE, TRUE, trav_grp_objs, trav_grp_symlinks, tinfo,
+ H5O_INFO_BASIC) < 0) {
parallel_print("Error: Could not get file contents\n");
opts->err_stat = H5DIFF_ERR;
H5TOOLS_GOTO_ERROR(FAIL, "Error: Could not get file contents\n");
@@ -575,11 +567,10 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
done:
if (lnk_info.trg_path)
HDfree(lnk_info.trg_path);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: h5diff
*
@@ -592,76 +583,76 @@ done:
hsize_t
h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2, diff_opt_t *opts)
{
- hid_t file1_id = H5I_INVALID_HID;
- hid_t file2_id = H5I_INVALID_HID;
- char filenames[2][MAX_FILENAME];
- hsize_t nfound = 0;
- int l_ret1 = -1;
- int l_ret2 = -1;
- char *obj1fullname = NULL;
- char *obj2fullname = NULL;
- int both_objs_grp = 0;
+ hid_t file1_id = H5I_INVALID_HID;
+ hid_t file2_id = H5I_INVALID_HID;
+ char filenames[2][MAX_FILENAME];
+ hsize_t nfound = 0;
+ int l_ret1 = -1;
+ int l_ret2 = -1;
+ char * obj1fullname = NULL;
+ char * obj2fullname = NULL;
+ int both_objs_grp = 0;
/* init to group type */
h5trav_type_t obj1type = H5TRAV_TYPE_GROUP;
h5trav_type_t obj2type = H5TRAV_TYPE_GROUP;
/* for single object */
- H5O_info_t oinfo1, oinfo2; /* object info */
- trav_info_t *info1_obj = NULL;
- trav_info_t *info2_obj = NULL;
+ H5O_info_t oinfo1, oinfo2; /* object info */
+ trav_info_t *info1_obj = NULL;
+ trav_info_t *info2_obj = NULL;
/* for group object */
- trav_info_t *info1_grp = NULL;
- trav_info_t *info2_grp = NULL;
+ trav_info_t *info1_grp = NULL;
+ trav_info_t *info2_grp = NULL;
/* local pointer */
- trav_info_t *info1_lp = NULL;
- trav_info_t *info2_lp = NULL;
+ trav_info_t *info1_lp = NULL;
+ trav_info_t *info2_lp = NULL;
/* link info from specified object */
- H5L_info_t src_linfo1;
- H5L_info_t src_linfo2;
+ H5L_info_t src_linfo1;
+ H5L_info_t src_linfo2;
/* link info from member object */
h5tool_link_info_t trg_linfo1;
h5tool_link_info_t trg_linfo2;
/* list for common objects */
trav_table_t *match_list = NULL;
- diff_err_t ret_value = H5DIFF_NO_ERR;
+ diff_err_t ret_value = H5DIFF_NO_ERR;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
/* init filenames */
HDmemset(filenames, 0, MAX_FILENAME * 2);
/* init link info struct */
HDmemset(&trg_linfo1, 0, sizeof(h5tool_link_info_t));
HDmemset(&trg_linfo2, 0, sizeof(h5tool_link_info_t));
- /*-------------------------------------------------------------------------
- * check invalid combination of options
- *-----------------------------------------------------------------------*/
- if(!is_valid_options(opts))
+ /*-------------------------------------------------------------------------
+ * check invalid combination of options
+ *-----------------------------------------------------------------------*/
+ if (!is_valid_options(opts))
H5TOOLS_GOTO_DONE(0);
- opts->cmn_objs = 1; /* eliminate warning */
+ opts->cmn_objs = 1; /* eliminate warning */
opts->err_stat = H5DIFF_NO_ERR; /* initialize error status */
/*-------------------------------------------------------------------------
- * open the files first; if they are not valid, no point in continuing
- *-------------------------------------------------------------------------
- */
+ * open the files first; if they are not valid, no point in continuing
+ *-------------------------------------------------------------------------
+ */
/* open file 1 */
- if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) {
+ if ((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) {
parallel_print("h5diff: <%s>: unable to open file\n", fname1);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "<%s>: unable to open file\n", fname1);
}
H5TOOLS_DEBUG("file1_id = %s", fname1);
/* open file 2 */
- if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) {
+ if ((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) {
parallel_print("h5diff: <%s>: unable to open file\n", fname2);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "<%s>: unable to open file\n", fname2);
}
H5TOOLS_DEBUG("file2_id = %s", fname2);
/*-------------------------------------------------------------------------
- * Initialize the info structs
- *-------------------------------------------------------------------------
- */
+ * Initialize the info structs
+ *-------------------------------------------------------------------------
+ */
trav_info_init(fname1, file1_id, &info1_obj);
trav_info_init(fname2, file2_id, &info2_obj);
@@ -669,14 +660,14 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
/* if any object is specified */
if (objname1) {
/* make the given object1 fullpath, start with "/" */
- if (HDstrncmp(objname1, "/", 1)) {
+ if (HDstrncmp(objname1, "/", 1) != 0) {
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
- if(HDasprintf(&obj1fullname, "/%s", objname1) < 0)
+ if (HDasprintf(&obj1fullname, "/%s", objname1) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed");
-#else /* H5_HAVE_ASPRINTF */
+#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
- if ((obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2)) == NULL)
+ if ((obj1fullname = (char *)HDmalloc(HDstrlen(objname1) + 2)) == NULL)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed");
HDstrcpy(obj1fullname, "/");
@@ -688,14 +679,14 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
H5TOOLS_DEBUG("obj1fullname = %s", obj1fullname);
/* make the given object2 fullpath, start with "/" */
- if (HDstrncmp(objname2, "/", 1)) {
+ if (HDstrncmp(objname2, "/", 1) != 0) {
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
- if(HDasprintf(&obj2fullname, "/%s", objname2) < 0)
+ if (HDasprintf(&obj2fullname, "/%s", objname2) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed");
-#else /* H5_HAVE_ASPRINTF */
+#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
- if ((obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2)) == NULL)
+ if ((obj2fullname = (char *)HDmalloc(HDstrlen(objname2) + 2)) == NULL)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed");
HDstrcpy(obj2fullname, "/");
HDstrcat(obj2fullname, objname2);
@@ -709,17 +700,17 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
* check if obj1 is root, group, single object or symlink
*/
H5TOOLS_DEBUG("h5diff check if obj1=%s is root, group, single object or symlink", obj1fullname);
- if(!HDstrcmp(obj1fullname, "/")) {
+ if (!HDstrcmp(obj1fullname, "/")) {
obj1type = H5TRAV_TYPE_GROUP;
}
else {
/* check if link itself exist */
- if(H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0) {
- parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
+ if (H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0) {
+ parallel_print("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Object could not be found");
}
/* get info from link */
- if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) {
+ if (H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) {
parallel_print("Unable to get link info from <%s>\n", obj1fullname);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Lget_info failed");
}
@@ -729,20 +720,20 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
/*
* check the type of specified path for hard and symbolic links
*/
- if(src_linfo1.type == H5L_TYPE_HARD) {
+ if (src_linfo1.type == H5L_TYPE_HARD) {
size_t idx;
/* optional data pass */
- info1_obj->opts = (diff_opt_t*)opts;
+ info1_obj->opts = (diff_opt_t *)opts;
- if(H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
parallel_print("Error: Could not get file contents\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Could not get file contents");
}
obj1type = (h5trav_type_t)oinfo1.type;
trav_info_add(info1_obj, obj1fullname, obj1type);
- idx = info1_obj->nused - 1;
- info1_obj->paths[idx].objno = oinfo1.addr;
+ idx = info1_obj->nused - 1;
+ info1_obj->paths[idx].objno = oinfo1.addr;
info1_obj->paths[idx].fileno = oinfo1.fileno;
}
else if (src_linfo1.type == H5L_TYPE_SOFT) {
@@ -759,17 +750,17 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
* check if obj2 is root, group, single object or symlink
*/
H5TOOLS_DEBUG("h5diff check if obj2=%s is root, group, single object or symlink", obj2fullname);
- if(!HDstrcmp(obj2fullname, "/")) {
+ if (!HDstrcmp(obj2fullname, "/")) {
obj2type = H5TRAV_TYPE_GROUP;
}
else {
/* check if link itself exist */
- if(H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0) {
- parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
+ if (H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0) {
+ parallel_print("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Object could not be found");
}
/* get info from link */
- if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) {
+ if (H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) {
parallel_print("Unable to get link info from <%s>\n", obj2fullname);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Lget_info failed");
}
@@ -779,20 +770,20 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
/*
* check the type of specified path for hard and symbolic links
*/
- if(src_linfo2.type == H5L_TYPE_HARD) {
+ if (src_linfo2.type == H5L_TYPE_HARD) {
size_t idx;
/* optional data pass */
- info2_obj->opts = (diff_opt_t*)opts;
+ info2_obj->opts = (diff_opt_t *)opts;
- if(H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
parallel_print("Error: Could not get file contents\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Could not get file contents");
}
obj2type = (h5trav_type_t)oinfo2.type;
trav_info_add(info2_obj, obj2fullname, obj2type);
- idx = info2_obj->nused - 1;
- info2_obj->paths[idx].objno = oinfo2.addr;
+ idx = info2_obj->nused - 1;
+ info2_obj->paths[idx].objno = oinfo2.addr;
info2_obj->paths[idx].fileno = oinfo2.fileno;
}
else if (src_linfo2.type == H5L_TYPE_SOFT) {
@@ -809,10 +800,10 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
else {
H5TOOLS_DEBUG("h5diff no object specified");
/* set root group */
- obj1fullname = (char*)HDstrdup("/");
- obj1type = H5TRAV_TYPE_GROUP;
- obj2fullname = (char*)HDstrdup("/");
- obj2type = H5TRAV_TYPE_GROUP;
+ obj1fullname = (char *)HDstrdup("/");
+ obj1type = H5TRAV_TYPE_GROUP;
+ obj2fullname = (char *)HDstrdup("/");
+ obj2type = H5TRAV_TYPE_GROUP;
}
H5TOOLS_DEBUG("get any symbolic links info - errstat:%d", opts->err_stat);
@@ -825,7 +816,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
*/
if (opts->follow_links) {
/* pass how to handle printing warning to linkinfo option */
- if(print_warn(opts))
+ if (print_warn(opts))
trg_linfo1.opt.msg_mode = trg_linfo2.opt.msg_mode = 1;
/*-------------------------------
@@ -837,33 +828,33 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
H5TOOLS_DEBUG("h5diff ... dangling link");
if (opts->no_dangle_links) {
/* treat dangling link as error */
- if(opts->mode_verbose)
+ if (opts->mode_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "treat dangling link as error");
}
else {
- if(opts->mode_verbose)
+ if (opts->mode_verbose)
parallel_print("obj1 <%s> is a dangling link.\n", obj1fullname);
- if (l_ret1 != 0 || l_ret2 != 0) {
+ if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
print_found(nfound);
H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR);
}
}
}
- else if(l_ret1 < 0) { /* fail */
- parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
+ else if (l_ret1 < 0) { /* fail */
+ parallel_print("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Object could not be found");
}
- else if(l_ret1 != 2) { /* symbolic link */
+ else if (l_ret1 != 2) { /* symbolic link */
obj1type = (h5trav_type_t)trg_linfo1.trg_type;
H5TOOLS_DEBUG("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD");
if (info1_lp != NULL) {
size_t idx = info1_lp->nused - 1;
H5TOOLS_DEBUG("h5diff ... ... ... info1_obj not null");
- info1_lp->paths[idx].type = (h5trav_type_t)trg_linfo1.trg_type;
- info1_lp->paths[idx].objno = trg_linfo1.objno;
+ info1_lp->paths[idx].type = (h5trav_type_t)trg_linfo1.trg_type;
+ info1_lp->paths[idx].objno = trg_linfo1.objno;
info1_lp->paths[idx].fileno = trg_linfo1.fileno;
}
H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished");
@@ -878,12 +869,12 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
H5TOOLS_DEBUG("h5diff ... dangling link");
if (opts->no_dangle_links) {
/* treat dangling link as error */
- if(opts->mode_verbose)
+ if (opts->mode_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "treat dangling link as error");
}
else {
- if(opts->mode_verbose)
+ if (opts->mode_verbose)
parallel_print("obj2 <%s> is a dangling link.\n", obj2fullname);
if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
@@ -892,32 +883,32 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
}
}
}
- else if(l_ret2 < 0) { /* fail */
- parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
+ else if (l_ret2 < 0) { /* fail */
+ parallel_print("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Object could not be found");
}
- else if(l_ret2 != 2) { /* symbolic link */
+ else if (l_ret2 != 2) { /* symbolic link */
obj2type = (h5trav_type_t)trg_linfo2.trg_type;
if (info2_lp != NULL) {
size_t idx = info2_lp->nused - 1;
H5TOOLS_DEBUG("h5diff ... ... ... info2_obj not null");
- info2_lp->paths[idx].type = (h5trav_type_t)trg_linfo2.trg_type;
- info2_lp->paths[idx].objno = trg_linfo2.objno;
+ info2_lp->paths[idx].type = (h5trav_type_t)trg_linfo2.trg_type;
+ info2_lp->paths[idx].objno = trg_linfo2.objno;
info2_lp->paths[idx].fileno = trg_linfo2.fileno;
}
H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished");
}
} /* end of if follow symlinks */
- /*
- * If verbose options is not used, don't need to traverse through the list
- * of objects in the group to display objects information,
- * So use h5tools_is_obj_same() to improve performance by skipping
- * comparing details of same objects.
- */
+ /*
+ * If verbose options is not used, don't need to traverse through the list
+ * of objects in the group to display objects information,
+ * So use h5tools_is_obj_same() to improve performance by skipping
+ * comparing details of same objects.
+ */
- if(!(opts->mode_verbose || opts->mode_report)) {
+ if (!(opts->mode_verbose || opts->mode_report)) {
H5TOOLS_DEBUG("h5diff NOT (opts->mode_verbose || opts->mode_report)");
/* if no danglink links */
if (l_ret1 > 0 && l_ret2 > 0)
@@ -933,10 +924,10 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
*/
trav_info_init(fname1, file1_id, &info1_grp);
/* optional data pass */
- info1_grp->opts = (diff_opt_t*)opts;
+ info1_grp->opts = (diff_opt_t *)opts;
- if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE,
- trav_grp_objs, trav_grp_symlinks, info1_grp, H5O_INFO_BASIC) < 0) {
+ if (h5trav_visit(file1_id, obj1fullname, TRUE, TRUE, trav_grp_objs, trav_grp_symlinks, info1_grp,
+ H5O_INFO_BASIC) < 0) {
parallel_print("Error: Could not get file contents\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not get file contents");
}
@@ -947,23 +938,24 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
*/
trav_info_init(fname2, file2_id, &info2_grp);
/* optional data pass */
- info2_grp->opts = (diff_opt_t*)opts;
+ info2_grp->opts = (diff_opt_t *)opts;
- if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE,
- trav_grp_objs, trav_grp_symlinks, info2_grp, H5O_INFO_BASIC) < 0) {
+ if (h5trav_visit(file2_id, obj2fullname, TRUE, TRUE, trav_grp_objs, trav_grp_symlinks, info2_grp,
+ H5O_INFO_BASIC) < 0) {
parallel_print("Error: Could not get file contents\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not get file contents");
- } /* end if */
+ } /* end if */
info2_lp = info2_grp;
}
H5TOOLS_DEBUG("groups traversed - errstat:%d", opts->err_stat);
#ifdef H5_HAVE_PARALLEL
- if(g_Parallel) {
+ if (g_Parallel) {
int i;
- if((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME)) {
- HDfprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME);
+ if ((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME)) {
+ HDfprintf(stderr, "The parallel diff only supports path names up to %d characters\n",
+ MAX_FILENAME);
MPI_Abort(MPI_COMM_WORLD, 0);
} /* end if */
@@ -971,54 +963,52 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
HDstrcpy(filenames[1], fname2);
/* Alert the worker tasks that there's going to be work. */
- for(i = 1; i < g_nTasks; i++)
+ for (i = 1; i < g_nTasks; i++)
MPI_Send(filenames, (MAX_FILENAME * 2), MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD);
} /* end if */
#endif
H5TOOLS_DEBUG("build_match_list next - errstat:%d", opts->err_stat);
/* process the objects */
- build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp, &match_list, opts);
+ build_match_list(obj1fullname, info1_lp, obj2fullname, info2_lp, &match_list, opts);
H5TOOLS_DEBUG("build_match_list finished - errstat:%d", opts->err_stat);
if (both_objs_grp) {
/*------------------------------------------------------
* print the list
*/
- if(opts->mode_verbose) {
- unsigned u;
+ if (opts->mode_verbose) {
+ unsigned u;
- if(opts->mode_verbose_level > 2) {
+ if (opts->mode_verbose_level > 2) {
parallel_print("file1: %s\n", fname1);
parallel_print("file2: %s\n", fname2);
- }
-
- parallel_print("\n");
- /* if given objects is group under root */
- if (HDstrcmp (obj1fullname,"/") || HDstrcmp (obj2fullname,"/"))
- parallel_print("group1 group2\n");
- else
- parallel_print("file1 file2\n");
- parallel_print("---------------------------------------\n");
- for(u = 0; u < match_list->nobjs; u++) {
- int c1, c2;
- c1 = (match_list->objs[u].flags[0]) ? 'x' : ' ';
- c2 = (match_list->objs[u].flags[1]) ? 'x' : ' ';
- parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[u].name);
- } /* end for */
- parallel_print ("\n");
- } /* end if */
+ }
+
+ parallel_print("\n");
+ /* if given objects is group under root */
+ if (HDstrcmp(obj1fullname, "/") != 0 || HDstrcmp(obj2fullname, "/") != 0)
+ parallel_print("group1 group2\n");
+ else
+ parallel_print("file1 file2\n");
+ parallel_print("---------------------------------------\n");
+ for (u = 0; u < match_list->nobjs; u++) {
+ int c1, c2;
+ c1 = (match_list->objs[u].flags[0]) ? 'x' : ' ';
+ c2 = (match_list->objs[u].flags[1]) ? 'x' : ' ';
+ parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[u].name);
+ } /* end for */
+ parallel_print("\n");
+ } /* end if */
}
H5TOOLS_DEBUG("diff_match next - errstat:%d", opts->err_stat);
- nfound = diff_match(file1_id, obj1fullname, info1_lp,
- file2_id, obj2fullname, info2_lp,
- match_list, opts);
+ nfound = diff_match(file1_id, obj1fullname, info1_lp, file2_id, obj2fullname, info2_lp, match_list, opts);
H5TOOLS_DEBUG("diff_match nfound: %d - errstat:%d", nfound, opts->err_stat);
done:
opts->err_stat = opts->err_stat | ret_value;
#ifdef H5_HAVE_PARALLEL
- if(g_Parallel)
+ if (g_Parallel)
/* All done at this point, let tasks know that they won't be needed */
phdiff_dismiss_workers();
#endif
@@ -1050,15 +1040,14 @@ done:
{
H5Fclose(file1_id);
H5Fclose(file2_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
return nfound;
}
-
-
/*-------------------------------------------------------------------------
* Function: diff_match
*
@@ -1076,29 +1065,28 @@ done:
*-------------------------------------------------------------------------
*/
hsize_t
-diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
- hid_t file2_id, const char *grp2, trav_info_t *info2,
- trav_table_t *table, diff_opt_t *opts)
+diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, const char *grp2,
+ trav_info_t *info2, trav_table_t *table, diff_opt_t *opts)
{
- hsize_t nfound = 0;
- unsigned i;
- const char *grp1_path = "";
- const char *grp2_path = "";
- char *obj1_fullpath = NULL;
- char *obj2_fullpath = NULL;
- diff_args_t argdata;
- size_t idx1 = 0;
- size_t idx2 = 0;
- diff_err_t ret_value = opts->err_stat;
+ hsize_t nfound = 0;
+ unsigned i;
+ const char *grp1_path = "";
+ const char *grp2_path = "";
+ char * obj1_fullpath = NULL;
+ char * obj2_fullpath = NULL;
+ diff_args_t argdata;
+ size_t idx1 = 0;
+ size_t idx2 = 0;
+ diff_err_t ret_value = opts->err_stat;
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/*
* if not root, prepare object name to be pre-appended to group path to
* make full path
*/
- if(HDstrcmp(grp1, "/"))
+ if (HDstrcmp(grp1, "/") != 0)
grp1_path = grp1;
- if(HDstrcmp(grp2, "/"))
+ if (HDstrcmp(grp2, "/") != 0)
grp2_path = grp2;
/*-------------------------------------------------------------------------
@@ -1120,8 +1108,8 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
}
/* objects in one file and not the other */
- for(i = 0; i < table->nobjs; i++) {
- if(table->objs[i].flags[0] != table->objs[i].flags[1]) {
+ for (i = 0; i < table->nobjs; i++) {
+ if (table->objs[i].flags[0] != table->objs[i].flags[1]) {
opts->contents = 0;
break;
}
@@ -1134,29 +1122,30 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
*/
#ifdef H5_HAVE_PARALLEL
{
- char *workerTasks = (char*)HDmalloc((size_t)(g_nTasks - 1) * sizeof(char));
- int n;
- int busyTasks = 0;
- struct diffs_found nFoundbyWorker;
+ char * workerTasks = (char *)HDmalloc((size_t)(g_nTasks - 1) * sizeof(char));
+ int n;
+ int busyTasks = 0;
+ struct diffs_found nFoundbyWorker;
struct diff_mpi_args args;
- int havePrintToken = 1;
- MPI_Status Status;
+ int havePrintToken = 1;
+ MPI_Status Status;
/*set all tasks as free */
HDmemset(workerTasks, 1, (size_t)(g_nTasks - 1) * sizeof(char));
#endif
- for(i = 0; i < table->nobjs; i++) {
- H5TOOLS_DEBUG("diff for common objects[%d] - errstat:%d", i, opts->err_stat);
- if(table->objs[i].flags[0] && table->objs[i].flags[1]) {
- /* make full path for obj1 */
+ for (i = 0; i < table->nobjs; i++) {
+ H5TOOLS_DEBUG("diff for common objects[%d] - errstat:%d", i, opts->err_stat);
+ if (table->objs[i].flags[0] && table->objs[i].flags[1]) {
+ /* make full path for obj1 */
#ifdef H5_HAVE_ASPRINTF
- /* Use the asprintf() routine, since it does what we're trying to do below */
- if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0) {
- H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed");
- }
-#else /* H5_HAVE_ASPRINTF */
- if((obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) {
+ /* Use the asprintf() routine, since it does what we're trying to do below */
+ if (HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0) {
+ H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed");
+ }
+#else /* H5_HAVE_ASPRINTF */
+ if ((obj1_fullpath = (char *)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1)) ==
+ NULL) {
H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed");
}
else {
@@ -1164,16 +1153,17 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
HDstrcat(obj1_fullpath, table->objs[i].name);
}
#endif /* H5_HAVE_ASPRINTF */
- H5TOOLS_DEBUG("diff_match path1 - %s", obj1_fullpath);
+ H5TOOLS_DEBUG("diff_match path1 - %s", obj1_fullpath);
- /* make full path for obj2 */
+ /* make full path for obj2 */
#ifdef H5_HAVE_ASPRINTF
- /* Use the asprintf() routine, since it does what we're trying to do below */
- if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0) {
- H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed");
- }
-#else /* H5_HAVE_ASPRINTF */
- if((obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) {
+ /* Use the asprintf() routine, since it does what we're trying to do below */
+ if (HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0) {
+ H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed");
+ }
+#else /* H5_HAVE_ASPRINTF */
+ if ((obj2_fullpath = (char *)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1)) ==
+ NULL) {
H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed");
}
else {
@@ -1181,269 +1171,293 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
HDstrcat(obj2_fullpath, table->objs[i].name);
}
#endif /* H5_HAVE_ASPRINTF */
- H5TOOLS_DEBUG("diff_match path2 - %s", obj2_fullpath);
-
- /* get index to figure out type of the object in file1 */
- while(info1->paths[idx1].path && (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0))
- idx1++;
- /* get index to figure out type of the object in file2 */
- while(info2->paths[idx2].path && (HDstrcmp(obj2_fullpath, info2->paths[idx2].path) != 0))
- idx2++;
-
- /* Set argdata to pass other args into diff() */
- argdata.type[0] = info1->paths[idx1].type;
- argdata.type[1] = info2->paths[idx2].type;
- argdata.is_same_trgobj = table->objs[i].is_same_trgobj;
-
- opts->cmn_objs = 1;
- if(!g_Parallel) {
- H5TOOLS_DEBUG("diff paths - errstat:%d", opts->err_stat);
- nfound += diff(file1_id, obj1_fullpath, file2_id, obj2_fullpath, opts, &argdata);
- } /* end if */
-#ifdef H5_HAVE_PARALLEL
- else {
- int workerFound = 0;
-
- H5TOOLS_DEBUG("Beginning of big else block");
- /* We're in parallel mode */
- /* Since the data type of diff value is hsize_t which can
- * be arbitary large such that there is no MPI type that
- * matches it, the value is passed between processes as
- * an array of bytes in order to be portable. But this
- * may not work in non-homogeneous MPI environments.
- */
-
- /*Set up args to pass to worker task. */
- if(HDstrlen(obj1_fullpath) > 255 ||
- HDstrlen(obj2_fullpath) > 255) {
- HDprintf("The parallel diff only supports object names up to 255 characters\n");
- MPI_Abort(MPI_COMM_WORLD, 0);
+ H5TOOLS_DEBUG("diff_match path2 - %s", obj2_fullpath);
+
+ /* get index to figure out type of the object in file1 */
+ while (info1->paths[idx1].path && (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0))
+ idx1++;
+ /* get index to figure out type of the object in file2 */
+ while (info2->paths[idx2].path && (HDstrcmp(obj2_fullpath, info2->paths[idx2].path) != 0))
+ idx2++;
+
+ /* Set argdata to pass other args into diff() */
+ argdata.type[0] = info1->paths[idx1].type;
+ argdata.type[1] = info2->paths[idx2].type;
+ argdata.is_same_trgobj = table->objs[i].is_same_trgobj;
+
+ opts->cmn_objs = 1;
+ if (!g_Parallel) {
+ H5TOOLS_DEBUG("diff paths - errstat:%d", opts->err_stat);
+ nfound += diff(file1_id, obj1_fullpath, file2_id, obj2_fullpath, opts, &argdata);
} /* end if */
+#ifdef H5_HAVE_PARALLEL
+ else {
+ int workerFound = 0;
+
+ H5TOOLS_DEBUG("Beginning of big else block");
+ /* We're in parallel mode */
+ /* Since the data type of diff value is hsize_t which can
+ * be arbitary large such that there is no MPI type that
+ * matches it, the value is passed between processes as
+ * an array of bytes in order to be portable. But this
+ * may not work in non-homogeneous MPI environments.
+ */
- /* set args struct to pass */
- HDstrcpy(args.name1, obj1_fullpath);
- HDstrcpy(args.name2, obj2_fullpath);
- args.opts = *opts;
- args.argdata.type[0] = info1->paths[idx1].type;
- args.argdata.type[1] = info2->paths[idx2].type;
- args.argdata.is_same_trgobj = table->objs[i].is_same_trgobj;
-
- /* if there are any outstanding print requests, let's handle one. */
- if(busyTasks > 0) {
- int incomingMessage;
-
- /* check if any tasks freed up, and didn't need to print. */
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &incomingMessage, &Status);
-
- /* first block*/
- if(incomingMessage) {
- workerTasks[Status.MPI_SOURCE - 1] = 1;
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
- busyTasks--;
+ /*Set up args to pass to worker task. */
+ if (HDstrlen(obj1_fullpath) > 255 || HDstrlen(obj2_fullpath) > 255) {
+ HDprintf("The parallel diff only supports object names up to 255 characters\n");
+ MPI_Abort(MPI_COMM_WORLD, 0);
} /* end if */
- /* check to see if the print token was returned. */
- if(!havePrintToken) {
- /* If we don't have the token, someone is probably sending us output */
- print_incoming_data();
+ /* set args struct to pass */
+ HDstrcpy(args.name1, obj1_fullpath);
+ HDstrcpy(args.name2, obj2_fullpath);
+ args.opts = *opts;
+ args.argdata.type[0] = info1->paths[idx1].type;
+ args.argdata.type[1] = info2->paths[idx2].type;
+ args.argdata.is_same_trgobj = table->objs[i].is_same_trgobj;
+
+ /* if there are any outstanding print requests, let's handle one. */
+ if (busyTasks > 0) {
+ int incomingMessage;
- /* check incoming queue for token */
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
+ /* check if any tasks freed up, and didn't need to print. */
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &incomingMessage, &Status);
- /* incoming token implies free task. */
- if(incomingMessage) {
+ /* first block*/
+ if (incomingMessage) {
workerTasks[Status.MPI_SOURCE - 1] = 1;
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE,
+ MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
- havePrintToken = 1;
} /* end if */
- } /* end if */
-
- /* check to see if anyone needs the print token. */
- if(havePrintToken) {
- /* check incoming queue for print token requests */
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage) {
- MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
- MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
- havePrintToken = 0;
- } /* end if */
- } /* end if */
- } /* end if */
-
- /* check array of tasks to see which ones are free.
- * Manager task never does work, so freeTasks[0] is really
- * worker task 0. */
- for(n = 1; (n < g_nTasks) && !workerFound; n++) {
- if(workerTasks[n-1]) {
- /* send file id's and names to first free worker */
- MPI_Send(&args, sizeof(args), MPI_BYTE, n, MPI_TAG_ARGS, MPI_COMM_WORLD);
- /* increment counter for total number of prints. */
- busyTasks++;
-
- /* mark worker as busy */
- workerTasks[n - 1] = 0;
- workerFound = 1;
- } /* end if */
- } /* end for */
-
- if(!workerFound) {
- /* if they were all busy, we've got to wait for one free up
- * before we can move on. If we don't have the token, some
- * task is currently printing so we'll wait for that task to
- * return it.
- */
+ /* check to see if the print token was returned. */
+ if (!havePrintToken) {
+ /* If we don't have the token, someone is probably sending us output */
+ print_incoming_data();
- if(!havePrintToken) {
- while(!havePrintToken) {
- int incomingMessage;
+ /* check incoming queue for token */
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage,
+ &Status);
- print_incoming_data();
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage) {
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
- havePrintToken = 1;
+ /* incoming token implies free task. */
+ if (incomingMessage) {
+ workerTasks[Status.MPI_SOURCE - 1] = 1;
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE,
+ MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
- /* send this task the work unit. */
- MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
+ busyTasks--;
+ havePrintToken = 1;
} /* end if */
- } /* end while */
- } /* end if */
- /* if we do have the token, check for task to free up, or wait for a task to request it */
- else {
- /* But first print all the data in our incoming queue */
- print_incoming_data();
- MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
- if(Status.MPI_TAG == MPI_TAG_DONE) {
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
- MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
+ } /* end if */
+
+ /* check to see if anyone needs the print token. */
+ if (havePrintToken) {
+ /* check incoming queue for print token requests */
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &incomingMessage,
+ &Status);
+ if (incomingMessage) {
+ MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST,
+ MPI_COMM_WORLD, &Status);
+ MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK,
+ MPI_COMM_WORLD);
+ havePrintToken = 0;
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
+ /* check array of tasks to see which ones are free.
+ * Manager task never does work, so freeTasks[0] is really
+ * worker task 0. */
+ for (n = 1; (n < g_nTasks) && !workerFound; n++) {
+ if (workerTasks[n - 1]) {
+ /* send file id's and names to first free worker */
+ MPI_Send(&args, sizeof(args), MPI_BYTE, n, MPI_TAG_ARGS, MPI_COMM_WORLD);
+
+ /* increment counter for total number of prints. */
+ busyTasks++;
+
+ /* mark worker as busy */
+ workerTasks[n - 1] = 0;
+ workerFound = 1;
} /* end if */
- else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) {
- int incomingMessage;
+ } /* end for */
- MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
- MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+ if (!workerFound) {
+ /* if they were all busy, we've got to wait for one free up
+ * before we can move on. If we don't have the token, some
+ * task is currently printing so we'll wait for that task to
+ * return it.
+ */
- do {
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
+ if (!havePrintToken) {
+ while (!havePrintToken) {
+ int incomingMessage;
print_incoming_data();
- } while(!incomingMessage);
-
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
- MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
- } /* end else-if */
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD,
+ &incomingMessage, &Status);
+ if (incomingMessage) {
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE,
+ MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ havePrintToken = 1;
+ nfound += nFoundbyWorker.nfound;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
+ /* send this task the work unit. */
+ MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS,
+ MPI_COMM_WORLD);
+ } /* end if */
+ } /* end while */
+ } /* end if */
+ /* if we do have the token, check for task to free up, or wait for a task to request
+ * it */
else {
- HDprintf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG);
- MPI_Abort(MPI_COMM_WORLD, 0);
- MPI_Finalize();
- } /* end else */
- } /* end else */
- } /* end if */
- } /* end else */
-#endif /* H5_HAVE_PARALLEL */
- if(obj1_fullpath)
- HDfree(obj1_fullpath);
- if(obj2_fullpath)
- HDfree(obj2_fullpath);
- } /* end if */
- } /* end for */
- H5TOOLS_DEBUG("done with for loop - errstat:%d", opts->err_stat);
+ /* But first print all the data in our incoming queue */
+ print_incoming_data();
+ MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+ if (Status.MPI_TAG == MPI_TAG_DONE) {
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE,
+ MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
+ MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS,
+ MPI_COMM_WORLD);
+ } /* end if */
+ else if (Status.MPI_TAG == MPI_TAG_TOK_REQUEST) {
+ int incomingMessage;
-#ifdef H5_HAVE_PARALLEL
- if(g_Parallel) {
- /* make sure all tasks are done */
- while(busyTasks > 0) {
- MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
- if(Status.MPI_TAG == MPI_TAG_DONE) {
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
- busyTasks--;
- } /* end if */
- else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) {
- MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
- if(havePrintToken) {
- int incomingMessage;
+ MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST,
+ MPI_COMM_WORLD, &Status);
+ MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK,
+ MPI_COMM_WORLD);
- MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+ do {
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD,
+ &incomingMessage, &Status);
- do {
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
+ print_incoming_data();
+ } while (!incomingMessage);
- print_incoming_data();
- } while(!incomingMessage);
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE,
+ MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
+ MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS,
+ MPI_COMM_WORLD);
+ } /* end else-if */
+ else {
+ HDprintf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ MPI_Finalize();
+ } /* end else */
+ } /* end else */
+ } /* end if */
+ } /* end else */
+#endif /* H5_HAVE_PARALLEL */
+ if (obj1_fullpath)
+ HDfree(obj1_fullpath);
+ if (obj2_fullpath)
+ HDfree(obj2_fullpath);
+ } /* end if */
+ } /* end for */
+ H5TOOLS_DEBUG("done with for loop - errstat:%d", opts->err_stat);
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+#ifdef H5_HAVE_PARALLEL
+ if (g_Parallel) {
+ /* make sure all tasks are done */
+ while (busyTasks > 0) {
+ MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+ if (Status.MPI_TAG == MPI_TAG_DONE) {
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE,
+ MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
} /* end if */
- /* someone else must have it...wait for them to return it, then give it to the task that just asked for it. */
- else {
- int source = Status.MPI_SOURCE;
- int incomingMessage;
+ else if (Status.MPI_TAG == MPI_TAG_TOK_REQUEST) {
+ MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD,
+ &Status);
+ if (havePrintToken) {
+ int incomingMessage;
- do {
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
+ MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
- print_incoming_data();
- } while(!incomingMessage);
+ do {
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage,
+ &Status);
+ print_incoming_data();
+ } while (!incomingMessage);
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE,
+ MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
+ busyTasks--;
+ } /* end if */
+ /* someone else must have it...wait for them to return it, then give it to the task that
+ * just asked for it. */
+ else {
+ int source = Status.MPI_SOURCE;
+ int incomingMessage;
+
+ do {
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage,
+ &Status);
+
+ print_incoming_data();
+ } while (!incomingMessage);
+
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE,
+ MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
+ nfound += nFoundbyWorker.nfound;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
+ busyTasks--;
+ MPI_Send(NULL, 0, MPI_BYTE, source, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+ } /* end else */
+ } /* end else-if */
+ else if (Status.MPI_TAG == MPI_TAG_TOK_RETURN) {
+ MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE,
+ MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
- MPI_Send(NULL, 0, MPI_BYTE, source, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
+ havePrintToken = 1;
+ } /* end else-if */
+ else if (Status.MPI_TAG == MPI_TAG_PRINT_DATA) {
+ char data[PRINT_DATA_MAX_SIZE + 1];
+ HDmemset(data, 0, PRINT_DATA_MAX_SIZE + 1);
+
+ MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA,
+ MPI_COMM_WORLD, &Status);
+
+ HDprintf("%s", data);
+ } /* end else-if */
+ else {
+ HDprintf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG);
+ MPI_Abort(MPI_COMM_WORLD, 0);
} /* end else */
- } /* end else-if */
- else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) {
- MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
- nfound += nFoundbyWorker.nfound;
- opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
- busyTasks--;
- havePrintToken = 1;
- } /* end else-if */
- else if(Status.MPI_TAG == MPI_TAG_PRINT_DATA) {
- char data[PRINT_DATA_MAX_SIZE + 1];
- HDmemset(data, 0, PRINT_DATA_MAX_SIZE + 1);
-
- MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status);
-
- HDprintf("%s", data);
- } /* end else-if */
- else {
- HDprintf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG);
- MPI_Abort(MPI_COMM_WORLD, 0);
- } /* end else */
- } /* end while */
+ } /* end while */
- for(i = 1; (int)i < g_nTasks; i++)
- MPI_Send(NULL, 0, MPI_BYTE, (int)i, MPI_TAG_END, MPI_COMM_WORLD);
+ for (i = 1; (int)i < g_nTasks; i++)
+ MPI_Send(NULL, 0, MPI_BYTE, (int)i, MPI_TAG_END, MPI_COMM_WORLD);
- /* Print any final data waiting in our queue */
- print_incoming_data();
- } /* end if */
- H5TOOLS_DEBUG("done with if block");
+ /* Print any final data waiting in our queue */
+ print_incoming_data();
+ } /* end if */
+ H5TOOLS_DEBUG("done with if block");
- HDfree(workerTasks);
+ HDfree(workerTasks);
}
#endif /* H5_HAVE_PARALLEL */
opts->err_stat = opts->err_stat | ret_value;
- free_exclude_attr_list (opts);
+ free_exclude_attr_list(opts);
/* free table */
if (table)
@@ -1454,7 +1468,6 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
return nfound;
}
-
/*-------------------------------------------------------------------------
* Function: diff
*
@@ -1469,19 +1482,20 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
*-------------------------------------------------------------------------
*/
hsize_t
-diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t *opts, diff_args_t *argdata)
+diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t *opts,
+ diff_args_t *argdata)
{
- int status = -1;
- hid_t dset1_id = H5I_INVALID_HID;
- hid_t dset2_id = H5I_INVALID_HID;
- hid_t type1_id = H5I_INVALID_HID;
- hid_t type2_id = H5I_INVALID_HID;
- hid_t grp1_id = H5I_INVALID_HID;
- hid_t grp2_id = H5I_INVALID_HID;
+ int status = -1;
+ hid_t dset1_id = H5I_INVALID_HID;
+ hid_t dset2_id = H5I_INVALID_HID;
+ hid_t type1_id = H5I_INVALID_HID;
+ hid_t type2_id = H5I_INVALID_HID;
+ hid_t grp1_id = H5I_INVALID_HID;
+ hid_t grp2_id = H5I_INVALID_HID;
hbool_t is_dangle_link1 = FALSE;
hbool_t is_dangle_link2 = FALSE;
- hbool_t is_hard_link = FALSE;
- hsize_t nfound = 0;
+ hbool_t is_hard_link = FALSE;
+ hsize_t nfound = 0;
h5trav_type_t object_type;
diff_err_t ret_value = opts->err_stat;
@@ -1496,15 +1510,13 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
HDmemset(&linkinfo2, 0, sizeof(h5tool_link_info_t));
/* pass how to handle printing warnings to linkinfo option */
- if(print_warn(opts))
+ if (print_warn(opts))
linkinfo1.opt.msg_mode = linkinfo2.opt.msg_mode = 1;
/* for symbolic links, take care follow symlink and no dangling link
* options */
- if (argdata->type[0] == H5TRAV_TYPE_LINK ||
- argdata->type[0] == H5TRAV_TYPE_UDLINK ||
- argdata->type[1] == H5TRAV_TYPE_LINK ||
- argdata->type[1] == H5TRAV_TYPE_UDLINK) {
+ if (argdata->type[0] == H5TRAV_TYPE_LINK || argdata->type[0] == H5TRAV_TYPE_UDLINK ||
+ argdata->type[1] == H5TRAV_TYPE_LINK || argdata->type[1] == H5TRAV_TYPE_UDLINK) {
/*
* check dangling links for path1 and path2
*/
@@ -1518,7 +1530,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
if (status == 0) {
if (opts->no_dangle_links) {
/* dangling link is error */
- if(opts->mode_verbose)
+ if (opts->mode_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", path1);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "dangling link is error");
}
@@ -1533,7 +1545,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
if (status == 0) {
if (opts->no_dangle_links) {
/* dangling link is error */
- if(opts->mode_verbose)
+ if (opts->mode_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", path2);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "dangling link is error");
}
@@ -1548,8 +1560,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
/* follow symbolic link option */
if (opts->follow_links) {
- if (linkinfo1.linfo.type == H5L_TYPE_SOFT ||
- linkinfo1.linfo.type == H5L_TYPE_EXTERNAL)
+ if (linkinfo1.linfo.type == H5L_TYPE_SOFT || linkinfo1.linfo.type == H5L_TYPE_EXTERNAL)
argdata->type[0] = (h5trav_type_t)linkinfo1.trg_type;
if (linkinfo2.linfo.type == H5L_TYPE_SOFT || linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
@@ -1559,9 +1570,9 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
/* if objects are not the same type */
if (argdata->type[0] != argdata->type[1]) {
H5TOOLS_DEBUG("diff objects are not the same");
- if (opts->mode_verbose||opts->mode_list_not_cmp) {
- parallel_print("Not comparable: <%s> is of type %s and <%s> is of type %s\n",
- path1, get_type(argdata->type[0]), path2, get_type(argdata->type[1]));
+ if (opts->mode_verbose || opts->mode_list_not_cmp) {
+ parallel_print("Not comparable: <%s> is of type %s and <%s> is of type %s\n", path1,
+ get_type(argdata->type[0]), path2, get_type(argdata->type[1]));
}
opts->not_cmp = 1;
@@ -1581,15 +1592,14 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
*
* Perform this to match the outputs as bypassing.
*/
- if (argdata->is_same_trgobj) {
+ if (argdata->is_same_trgobj) {
H5TOOLS_DEBUG("argdata->is_same_trgobj");
- is_hard_link = (object_type == H5TRAV_TYPE_DATASET ||
- object_type == H5TRAV_TYPE_NAMED_DATATYPE ||
+ is_hard_link = (object_type == H5TRAV_TYPE_DATASET || object_type == H5TRAV_TYPE_NAMED_DATATYPE ||
object_type == H5TRAV_TYPE_GROUP);
if (opts->follow_links || is_hard_link) {
/* print information is only verbose option is used */
- if(opts->mode_verbose || opts->mode_report) {
- switch(object_type) {
+ if (opts->mode_verbose || opts->mode_report) {
+ switch (object_type) {
case H5TRAV_TYPE_DATASET:
do_print_objname("dataset", path1, path2, opts);
break;
@@ -1603,15 +1613,16 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
do_print_objname("link", path1, path2, opts);
break;
case H5TRAV_TYPE_UDLINK:
- if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
+ if (linkinfo1.linfo.type == H5L_TYPE_EXTERNAL &&
+ linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
do_print_objname("external link", path1, path2, opts);
else
- do_print_objname ("user defined link", path1, path2, opts);
+ do_print_objname("user defined link", path1, path2, opts);
break;
case H5TRAV_TYPE_UNKNOWN:
default:
- parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n",
- path1, path2, get_type(object_type) );
+ parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", path1,
+ path2, get_type(object_type));
opts->not_cmp = 1;
break;
} /* switch(type)*/
@@ -1624,27 +1635,27 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
}
}
- switch(object_type) {
- /*----------------------------------------------------------------------
- * H5TRAV_TYPE_DATASET
- *----------------------------------------------------------------------
- */
+ switch (object_type) {
+ /*----------------------------------------------------------------------
+ * H5TRAV_TYPE_DATASET
+ *----------------------------------------------------------------------
+ */
case H5TRAV_TYPE_DATASET:
H5TOOLS_DEBUG("diff object type H5TRAV_TYPE_DATASET - errstat:%d", opts->err_stat);
- if((dset1_id = H5Dopen2(file1_id, path1, H5P_DEFAULT)) < 0)
+ if ((dset1_id = H5Dopen2(file1_id, path1, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 failed");
- if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0)
+ if ((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 failed");
H5TOOLS_DEBUG("paths: %s - %s", path1, path2);
/* verbose (-v) and report (-r) mode */
- if(opts->mode_verbose || opts->mode_report) {
+ if (opts->mode_verbose || opts->mode_report) {
do_print_objname("dataset", path1, path2, opts);
H5TOOLS_DEBUG("call diff_dataset 1:%s 2:%s ", path1, path2);
nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
print_found(nfound);
}
/* quiet mode (-q), just count differences */
- else if(opts->mode_quiet) {
+ else if (opts->mode_quiet) {
nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
}
/* the rest (-c, none, ...) */
@@ -1664,39 +1675,39 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
* referenced object
*---------------------------------------------------------
*/
- if(path1 && !is_exclude_attr(path1, object_type, opts)) {
- H5TOOLS_DEBUG( "call diff_attr 1:%s 2:%s ", path1, path2);
+ if (path1 && !is_exclude_attr(path1, object_type, opts)) {
+ H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2);
nfound += diff_attr(dset1_id, dset2_id, path1, path2, opts);
}
- if(H5Dclose(dset1_id) < 0)
+ if (H5Dclose(dset1_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dclose failed");
- if(H5Dclose(dset2_id) < 0)
+ if (H5Dclose(dset2_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dclose failed");
break;
- /*----------------------------------------------------------------------
- * H5TRAV_TYPE_NAMED_DATATYPE
- *----------------------------------------------------------------------
- */
+ /*----------------------------------------------------------------------
+ * H5TRAV_TYPE_NAMED_DATATYPE
+ *----------------------------------------------------------------------
+ */
case H5TRAV_TYPE_NAMED_DATATYPE:
H5TOOLS_DEBUG("H5TRAV_TYPE_NAMED_DATATYPE 1:%s 2:%s ", path1, path2);
- if((type1_id = H5Topen2(file1_id, path1, H5P_DEFAULT)) < 0)
+ if ((type1_id = H5Topen2(file1_id, path1, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Topen2 failed");
- if((type2_id = H5Topen2(file2_id, path2, H5P_DEFAULT)) < 0)
+ if ((type2_id = H5Topen2(file2_id, path2, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Topen2 failed");
- if((status = H5Tequal(type1_id, type2_id)) < 0)
+ if ((status = H5Tequal(type1_id, type2_id)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tequal failed");
/* if H5Tequal is > 0 then the datatypes refer to the same datatype */
nfound = (status > 0) ? 0 : 1;
- if(print_objname(opts, nfound))
+ if (print_objname(opts, nfound))
do_print_objname("datatype", path1, path2, opts);
/* always print the number of differences found in verbose mode */
- if(opts->mode_verbose)
+ if (opts->mode_verbose)
print_found(nfound);
/*-----------------------------------------------------------------
@@ -1705,33 +1716,33 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
* referenced object
*-----------------------------------------------------------------
*/
- if(path1 && !is_exclude_attr(path1, object_type, opts)) {
+ if (path1 && !is_exclude_attr(path1, object_type, opts)) {
H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2);
nfound += diff_attr(type1_id, type2_id, path1, path2, opts);
}
- if(H5Tclose(type1_id) < 0)
+ if (H5Tclose(type1_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose failed");
- if(H5Tclose(type2_id) < 0)
+ if (H5Tclose(type2_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose failed");
break;
- /*----------------------------------------------------------------------
- * H5TRAV_TYPE_GROUP
- *----------------------------------------------------------------------
- */
+ /*----------------------------------------------------------------------
+ * H5TRAV_TYPE_GROUP
+ *----------------------------------------------------------------------
+ */
case H5TRAV_TYPE_GROUP:
H5TOOLS_DEBUG("H5TRAV_TYPE_GROUP 1:%s 2:%s ", path1, path2);
- if(print_objname(opts, nfound))
+ if (print_objname(opts, nfound))
do_print_objname("group", path1, path2, opts);
/* always print the number of differences found in verbose mode */
- if(opts->mode_verbose)
+ if (opts->mode_verbose)
print_found(nfound);
- if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0)
+ if ((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Gclose failed");
- if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0)
+ if ((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Gclose failed");
/*-----------------------------------------------------------------
@@ -1740,97 +1751,92 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
* referenced object
*-----------------------------------------------------------------
*/
- if(path1 && !is_exclude_attr(path1, object_type, opts)) {
+ if (path1 && !is_exclude_attr(path1, object_type, opts)) {
H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2);
nfound += diff_attr(grp1_id, grp2_id, path1, path2, opts);
}
- if(H5Gclose(grp1_id) < 0)
+ if (H5Gclose(grp1_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Gclose failed");
- if(H5Gclose(grp2_id) < 0)
+ if (H5Gclose(grp2_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Gclose failed");
break;
+ /*----------------------------------------------------------------------
+ * H5TRAV_TYPE_LINK
+ *----------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_LINK: {
+ H5TOOLS_DEBUG("H5TRAV_TYPE_LINK 1:%s 2:%s ", path1, path2);
+ status = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path);
- /*----------------------------------------------------------------------
- * H5TRAV_TYPE_LINK
- *----------------------------------------------------------------------
- */
- case H5TRAV_TYPE_LINK:
- {
- H5TOOLS_DEBUG("H5TRAV_TYPE_LINK 1:%s 2:%s ", path1, path2);
- status = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path);
+ /* if the target link name is not same then the links are "different" */
+ nfound = (status != 0) ? 1 : 0;
- /* if the target link name is not same then the links are "different" */
- nfound = (status != 0) ? 1 : 0;
+ if (print_objname(opts, nfound))
+ do_print_objname("link", path1, path2, opts);
- if(print_objname(opts, nfound))
- do_print_objname("link", path1, path2, opts);
+ /* always print the number of differences found in verbose mode */
+ if (opts->mode_verbose)
+ print_found(nfound);
+ } break;
- /* always print the number of differences found in verbose mode */
- if(opts->mode_verbose)
- print_found(nfound);
+ /*----------------------------------------------------------------------
+ * H5TRAV_TYPE_UDLINK
+ *----------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_UDLINK: {
+ H5TOOLS_DEBUG("H5TRAV_TYPE_UDLINK 1:%s 2:%s ", path1, path2);
+ /* Only external links will have a query function registered */
+ if (linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) {
+ /* If the buffers are the same size, compare them */
+ if (linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size) {
+ status = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size);
}
- break;
+ else
+ status = 1;
- /*----------------------------------------------------------------------
- * H5TRAV_TYPE_UDLINK
- *----------------------------------------------------------------------
- */
- case H5TRAV_TYPE_UDLINK:
- {
- H5TOOLS_DEBUG("H5TRAV_TYPE_UDLINK 1:%s 2:%s ", path1, path2);
- /* Only external links will have a query function registered */
- if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) {
- /* If the buffers are the same size, compare them */
- if(linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size) {
- status = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size);
- }
- else
- status = 1;
-
- /* if "linkinfo1.trg_path" != "linkinfo2.trg_path" then the links
- * are "different" extlinkinfo#.path is combination string of
- * file_name and obj_name
- */
- nfound = (status != 0) ? 1 : 0;
+ /* if "linkinfo1.trg_path" != "linkinfo2.trg_path" then the links
+ * are "different" extlinkinfo#.path is combination string of
+ * file_name and obj_name
+ */
+ nfound = (status != 0) ? 1 : 0;
- if(print_objname(opts, nfound))
- do_print_objname("external link", path1, path2, opts);
+ if (print_objname(opts, nfound))
+ do_print_objname("external link", path1, path2, opts);
- } /* end if */
- else {
- /* If one or both of these links isn't an external link, we can only
- * compare information from H5Lget_info since we don't have a query
- * function registered for them.
- *
- * If the link classes or the buffer length are not the
- * same, the links are "different"
- */
- if((linkinfo1.linfo.type != linkinfo2.linfo.type) ||
+ } /* end if */
+ else {
+ /* If one or both of these links isn't an external link, we can only
+ * compare information from H5Lget_info since we don't have a query
+ * function registered for them.
+ *
+ * If the link classes or the buffer length are not the
+ * same, the links are "different"
+ */
+ if ((linkinfo1.linfo.type != linkinfo2.linfo.type) ||
(linkinfo1.linfo.u.val_size != linkinfo2.linfo.u.val_size))
- nfound = 1;
- else
- nfound = 0;
+ nfound = 1;
+ else
+ nfound = 0;
- if (print_objname (opts, nfound))
- do_print_objname ("user defined link", path1, path2, opts);
- } /* end else */
+ if (print_objname(opts, nfound))
+ do_print_objname("user defined link", path1, path2, opts);
+ } /* end else */
- /* always print the number of differences found in verbose mode */
- if(opts->mode_verbose)
- print_found(nfound);
- }
- break;
+ /* always print the number of differences found in verbose mode */
+ if (opts->mode_verbose)
+ print_found(nfound);
+ } break;
case H5TRAV_TYPE_UNKNOWN:
default:
- if(opts->mode_verbose)
- parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n",
- path1, path2, get_type(object_type) );
+ if (opts->mode_verbose)
+ parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", path1, path2,
+ get_type(object_type));
opts->not_cmp = 1;
break;
- }
+ }
done:
opts->err_stat = opts->err_stat | ret_value;
@@ -1839,26 +1845,26 @@ done:
* handle dangling link(s)
*/
/* both path1 and path2 are dangling links */
- if(is_dangle_link1 && is_dangle_link2) {
- if(print_objname(opts, nfound)) {
+ if (is_dangle_link1 && is_dangle_link2) {
+ if (print_objname(opts, nfound)) {
do_print_objname("dangling link", path1, path2, opts);
print_found(nfound);
}
}
/* path1 is dangling link */
else if (is_dangle_link1) {
- if(opts->mode_verbose)
- parallel_print("obj1 <%s> is a dangling link.\n", path1);
+ if (opts->mode_verbose)
+ parallel_print("obj1 <%s> is a dangling link.\n", path1);
nfound++;
- if(print_objname(opts, nfound))
+ if (print_objname(opts, nfound))
print_found(nfound);
}
/* path2 is dangling link */
else if (is_dangle_link2) {
- if(opts->mode_verbose)
+ if (opts->mode_verbose)
parallel_print("obj2 <%s> is a dangling link.\n", path2);
nfound++;
- if(print_objname(opts, nfound))
+ if (print_objname(opts, nfound))
print_found(nfound);
}
@@ -1870,7 +1876,8 @@ done:
/* close */
/* disable error reporting */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dset1_id);
H5Dclose(dset2_id);
H5Tclose(type1_id);
@@ -1878,10 +1885,10 @@ done:
H5Gclose(grp1_id);
H5Gclose(grp2_id);
/* enable error reporting */
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5TOOLS_ENDDEBUG(": %d - errstat:%d", nfound, opts->err_stat);
return nfound;
}
-
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index c7c57ae..f14bcda 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -6,13 +6,13 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5DIFF_H__
-#define H5DIFF_H__
+#ifndef H5DIFF_H
+#define H5DIFF_H
#include "hdf5.h"
#include "h5tools.h"
@@ -27,8 +27,8 @@
* as it doesn't require interface change.
*------------------------------------------------------------------------*/
typedef struct {
- h5trav_type_t type[2];
- hbool_t is_same_trgobj;
+ h5trav_type_t type[2];
+ hbool_t is_same_trgobj;
} diff_args_t;
/*-------------------------------------------------------------------------
* command line options
@@ -36,12 +36,11 @@ typedef struct {
*/
/* linked list to keep exclude path list */
struct exclude_path_list {
- const char *obj_path;
- h5trav_type_t obj_type;
- struct exclude_path_list *next;
+ const char * obj_path;
+ h5trav_type_t obj_type;
+ struct exclude_path_list *next;
};
-
/* Enumeration value for keeping track of whether an error occurred or differences were found */
typedef enum {
H5DIFF_NO_ERR, /* No error occurred */
@@ -50,49 +49,48 @@ typedef enum {
} diff_err_t;
typedef struct {
- int mode_quiet; /* quiet mode: no output at all */
- int mode_report; /* report mode: print the data */
- int mode_verbose; /* verbose mode: print the data, list of objcets, warnings */
- int mode_verbose_level; /* control verbose details */
- int mode_list_not_cmp; /* list not comparable messages */
- int print_header; /* print header */
- int print_percentage; /* print percentage */
- int print_dims; /* print dimension index */
- int delta_bool; /* delta, absolute value to compare */
- double delta; /* delta value */
- int use_system_epsilon; /* flag to use system epsilon (1 or 0) */
- int percent_bool; /* relative error to compare*/
- double percent; /* relative error value */
- hbool_t follow_links; /* follow symbolic links */
- int no_dangle_links; /* return error when find dangling link */
- int cmn_objs; /* do we have common objects */
- int not_cmp; /* are the objects comparable */
- int contents; /* equal contents */
- int do_nans; /* consider Nans while diffing floats */
- int exclude_path; /* exclude path to an object */
- int exclude_attr_path; /* exclude path to an object */
- struct exclude_path_list *exclude; /* keep exclude path list */
- struct exclude_path_list *exclude_attr; /* keep exclude attribute list */
- int count_bool; /* count, compare up to count */
- hsize_t count; /* count value */
- diff_err_t err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */
- hsize_t nelmts; /* total number of elements */
- hsize_t hs_nelmts; /* number of elements to read at a time*/
- int rank; /* dimensionality */
- size_t m_size; /* m_size for diff */
- hid_t m_tid; /* m_tid for diff */
- hsize_t dims[H5S_MAX_RANK]; /* dimensions of object */
- hsize_t p_min_idx[H5S_MAX_RANK]; /* min selected index */
- hsize_t p_max_idx[H5S_MAX_RANK]; /* max selected index */
- hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
- hsize_t pos[H5S_MAX_RANK]; /* matrix position */
- hsize_t sm_pos[H5S_MAX_RANK]; /* stripmine position */
- char *obj_name[2]; /* name for object */
- struct subset_t *sset[2]; /* subsetting parameters */
- hbool_t custom_vol[2]; /* Using a custom input, output VOL? */
+ int mode_quiet; /* quiet mode: no output at all */
+ int mode_report; /* report mode: print the data */
+ int mode_verbose; /* verbose mode: print the data, list of objcets, warnings */
+ int mode_verbose_level; /* control verbose details */
+ int mode_list_not_cmp; /* list not comparable messages */
+ int print_header; /* print header */
+ int print_percentage; /* print percentage */
+ int print_dims; /* print dimension index */
+ int delta_bool; /* delta, absolute value to compare */
+ double delta; /* delta value */
+ int use_system_epsilon; /* flag to use system epsilon (1 or 0) */
+ int percent_bool; /* relative error to compare*/
+ double percent; /* relative error value */
+ hbool_t follow_links; /* follow symbolic links */
+ int no_dangle_links; /* return error when find dangling link */
+ int cmn_objs; /* do we have common objects */
+ int not_cmp; /* are the objects comparable */
+ int contents; /* equal contents */
+ int do_nans; /* consider Nans while diffing floats */
+ int exclude_path; /* exclude path to an object */
+ int exclude_attr_path; /* exclude path to an object */
+ struct exclude_path_list *exclude; /* keep exclude path list */
+ struct exclude_path_list *exclude_attr; /* keep exclude attribute list */
+ int count_bool; /* count, compare up to count */
+ hsize_t count; /* count value */
+ diff_err_t err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */
+ hsize_t nelmts; /* total number of elements */
+ hsize_t hs_nelmts; /* number of elements to read at a time*/
+ int rank; /* dimensionality */
+ size_t m_size; /* m_size for diff */
+ hid_t m_tid; /* m_tid for diff */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of object */
+ hsize_t p_min_idx[H5S_MAX_RANK]; /* min selected index */
+ hsize_t p_max_idx[H5S_MAX_RANK]; /* max selected index */
+ hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
+ hsize_t pos[H5S_MAX_RANK]; /* matrix position */
+ hsize_t sm_pos[H5S_MAX_RANK]; /* stripmine position */
+ char * obj_name[2]; /* name for object */
+ struct subset_t * sset[2]; /* subsetting parameters */
+ hbool_t custom_vol[2]; /* Using a custom input, output VOL? */
} diff_opt_t;
-
/*-------------------------------------------------------------------------
* public functions
*-------------------------------------------------------------------------
@@ -102,9 +100,11 @@ typedef struct {
extern "C" {
#endif
-H5TOOLS_DLL hsize_t h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2, diff_opt_t *opts);
+H5TOOLS_DLL hsize_t h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2,
+ diff_opt_t *opts);
-H5TOOLS_DLL hsize_t diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t *opts, diff_args_t *argdata);
+H5TOOLS_DLL hsize_t diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2,
+ diff_opt_t *opts, diff_args_t *argdata);
#ifdef H5_HAVE_PARALLEL
H5TOOLS_DLL void phdiff_dismiss_workers(void);
@@ -115,38 +115,29 @@ H5TOOLS_DLL void print_manager_output(void);
}
#endif
-
-
/*-------------------------------------------------------------------------
* private functions
*-------------------------------------------------------------------------
*/
+hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *obj2_name,
+ diff_opt_t *opts);
-hsize_t diff_dataset(hid_t file1_id, hid_t file2_id,
- const char *obj1_name, const char *obj2_name, diff_opt_t *opts);
+hsize_t diff_datasetid(hid_t dset1_id, hid_t dset2_id, const char *obj1_name, const char *obj2_name,
+ diff_opt_t *opts);
-hsize_t diff_datasetid(hid_t dset1_id, hid_t dset2_id,
- const char *obj1_name, const char *obj2_name, diff_opt_t *opts);
+hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, const char *grp2,
+ trav_info_t *info2, trav_table_t *table, diff_opt_t *opts);
+hsize_t diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_t container2_id);
-hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
- hid_t file2_id, const char *grp2, trav_info_t *info2,
- trav_table_t *table, diff_opt_t *opts);
-
-hsize_t diff_array(void *_mem1, void *_mem2,
- diff_opt_t *opts, hid_t container1_id, hid_t container2_id);
-
-int diff_can_type(hid_t f_type1, hid_t f_type2, int rank1, int rank2,
- hsize_t *dims1, hsize_t *dims2, hsize_t *maxdim1, hsize_t *maxdim2,
- diff_opt_t *opts, int is_compound);
+int diff_can_type(hid_t f_type1, hid_t f_type2, int rank1, int rank2, hsize_t *dims1, hsize_t *dims2,
+ hsize_t *maxdim1, hsize_t *maxdim2, diff_opt_t *opts, int is_compound);
hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2,
- const char *path1, const char *path2, diff_opt_t *opts);
-
-hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id,
- const char *path1, const char *path2, diff_opt_t *opts);
+ const char *path1, const char *path2, diff_opt_t *opts);
+hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *path2, diff_opt_t *opts);
/*-------------------------------------------------------------------------
* utility functions
@@ -156,18 +147,16 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id,
/* in h5diff_util.c */
void print_found(hsize_t nfound);
void print_type(hid_t type);
-const char* diff_basename(const char *name);
-const char* get_type(h5trav_type_t type);
-const char* get_class(H5T_class_t tclass);
-const char* get_sign(H5T_sign_t sign);
-void print_dimensions (int rank, hsize_t *dims);
-herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
- hid_t *m_tid1, hid_t *m_tid2,
- size_t *m_size1, size_t *m_size2);
+const char *diff_basename(const char *name);
+const char *get_type(h5trav_type_t type);
+const char *get_class(H5T_class_t tclass);
+const char *get_sign(H5T_sign_t sign);
+void print_dimensions(int rank, hsize_t *dims);
+herr_t match_up_memsize(hid_t f_tid1_id, hid_t f_tid2_id, hid_t *m_tid1, hid_t *m_tid2, size_t *m_size1,
+ size_t *m_size2);
/* in h5diff.c */
-int print_objname(diff_opt_t *opts, hsize_t nfound);
-void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts);
-void do_print_attrname (const char *attr, const char *path1, const char *path2);
-
-#endif /* H5DIFF_H__ */
+int print_objname(diff_opt_t *opts, hsize_t nfound);
+void do_print_objname(const char *OBJ, const char *path1, const char *path2, diff_opt_t *opts);
+void do_print_attrname(const char *attr, const char *path1, const char *path2);
+#endif /* H5DIFF_H */
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 9efec66..657bf3c 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,48 +24,52 @@
*-------------------------------------------------------------------------
*/
-#define F_FORMAT "%-15g %-15g %-15g\n"
+#define F_FORMAT "%-15g %-15g %-15g\n"
-#if H5_SIZEOF_LONG_DOUBLE !=0
-#define LD_FORMAT "%-15Lf %-15Lf %-15Lf\n"
+#if H5_SIZEOF_LONG_DOUBLE != 0
+#define LD_FORMAT "%-15Lg %-15Lg %-15Lg\n"
#endif
-#define I_FORMAT "%-15d %-15d %-15d\n"
-#define S_FORMAT "%-16s %-17s\n"
-#define UI_FORMAT "%-15u %-15u %-15u\n"
-#define LI_FORMAT "%-15ld %-15ld %-15ld\n"
-#define ULI_FORMAT "%-15lu %-15lu %-15lu\n"
-#define LLI_FORMAT "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d\n"
-#define ULLI_FORMAT "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u\n"
+#define I_FORMAT "%-15d %-15d %-15d\n"
+#define S_FORMAT "%-16s %-17s\n"
+#define UI_FORMAT "%-15u %-15u %-15u\n"
+#define LI_FORMAT "%-15ld %-15ld %-15ld\n"
+#define ULI_FORMAT "%-15lu %-15lu %-15lu\n"
+#define LLI_FORMAT "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d\n"
+#define ULLI_FORMAT "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u\n"
/* with -p option */
-#define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n"
+#define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n"
-#if H5_SIZEOF_LONG_DOUBLE !=0
-#define LD_FORMAT_P "%-15.10Lf %-15.10Lf %-15.10Lf %-14.10Lf\n"
+#if H5_SIZEOF_LONG_DOUBLE != 0
+#define LD_FORMAT_P "%-15.10Lg %-15.10Lg %-15.10Lg %-14.10Lg\n"
#endif
-#define I_FORMAT_P "%-15d %-15d %-15d %-14f\n"
-#define UI_FORMAT_P "%-15u %-15u %-15u %-14f\n"
-#define LI_FORMAT_P "%-15ld %-15ld %-15ld %-14f\n"
-#define ULI_FORMAT_P "%-15lu %-15lu %-15lu %-14f\n"
-#define LLI_FORMAT_P "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-14f\n"
-#define ULLI_FORMAT_P "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "d %-14f\n"
-#define SPACES " "
+#define I_FORMAT_P "%-15d %-15d %-15d %-14f\n"
+#define UI_FORMAT_P "%-15u %-15u %-15u %-14f\n"
+#define LI_FORMAT_P "%-15ld %-15ld %-15ld %-14f\n"
+#define ULI_FORMAT_P "%-15lu %-15lu %-15lu %-14f\n"
+#define LLI_FORMAT_P \
+ "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-14f\n"
+#define ULLI_FORMAT_P \
+ "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "d %-14f\n"
+#define SPACES " "
/* not comparable */
-#define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n"
+#define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n"
-#if H5_SIZEOF_LONG_DOUBLE !=0
-#define LD_FORMAT_P_NOTCOMP "%-15.10Lf %-15.10Lf %-15.10Lf not comparable\n"
+#if H5_SIZEOF_LONG_DOUBLE != 0
+#define LD_FORMAT_P_NOTCOMP "%-15.10Lg %-15.10Lg %-15.10Lg not comparable\n"
#endif
-#define I_FORMAT_P_NOTCOMP "%-15d %-15d %-15d not comparable\n"
-#define UI_FORMAT_P_NOTCOMP "%-15u %-15u %-15u not comparable\n"
-#define LI_FORMAT_P_NOTCOMP "%-15ld %-15ld %-15ld not comparable\n"
-#define ULI_FORMAT_P_NOTCOMP "%-15lu %-15lu %-15lu not comparable\n"
-#define LLI_FORMAT_P_NOTCOMP "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d not comparable\n"
-#define ULLI_FORMAT_P_NOTCOMP "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "d not comparable\n"
+#define I_FORMAT_P_NOTCOMP "%-15d %-15d %-15d not comparable\n"
+#define UI_FORMAT_P_NOTCOMP "%-15u %-15u %-15u not comparable\n"
+#define LI_FORMAT_P_NOTCOMP "%-15ld %-15ld %-15ld not comparable\n"
+#define ULI_FORMAT_P_NOTCOMP "%-15lu %-15lu %-15lu not comparable\n"
+#define LLI_FORMAT_P_NOTCOMP \
+ "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d not comparable\n"
+#define ULLI_FORMAT_P_NOTCOMP \
+ "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "d not comparable\n"
/* if system EPSILON is defined, use the system EPSILON; otherwise, use
constants that are close to most EPSILON values */
@@ -95,36 +99,38 @@
static hbool_t not_comparable;
-#define PER(A,B) { \
- per = -1; \
- not_comparable = FALSE; \
- both_zero = FALSE; \
- if(H5_DBL_ABS_EQUAL(0, (double)A) && H5_DBL_ABS_EQUAL(0, (double)B)) \
- both_zero = TRUE; \
- if(!H5_DBL_ABS_EQUAL(0, (double)A)) \
- per = (double)ABS((double)((B) - (A)) / (double)(A)); \
- else \
- not_comparable = TRUE; \
-}
-
-#define PER_UNSIGN(TYPE,A,B) { \
- per = -1; \
- not_comparable = FALSE; \
- both_zero = FALSE; \
- if(H5_DBL_ABS_EQUAL(0, (double)A) && H5_DBL_ABS_EQUAL(0, (double)B)) \
- both_zero = TRUE; \
- if(!H5_DBL_ABS_EQUAL(0, (double)A)) \
- per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \
- else \
- not_comparable = TRUE; \
-}
-
-#define PDIFF(a,b) (((b) > (a)) ? ((b) - (a)) : ((a) -(b)))
+#define PER(A, B) \
+ { \
+ per = -1; \
+ not_comparable = FALSE; \
+ both_zero = FALSE; \
+ if (H5_DBL_ABS_EQUAL(0, (double)(A)) && H5_DBL_ABS_EQUAL(0, (double)(B))) \
+ both_zero = TRUE; \
+ if (!H5_DBL_ABS_EQUAL(0, (double)(A))) \
+ per = (double)ABS((double)((B) - (A)) / (double)(A)); \
+ else \
+ not_comparable = TRUE; \
+ }
+
+#define PER_UNSIGN(TYPE, A, B) \
+ { \
+ per = -1; \
+ not_comparable = FALSE; \
+ both_zero = FALSE; \
+ if (H5_DBL_ABS_EQUAL(0, (double)(A)) && H5_DBL_ABS_EQUAL(0, (double)(B))) \
+ both_zero = TRUE; \
+ if (!H5_DBL_ABS_EQUAL(0, (double)(A))) \
+ per = ABS((double)((TYPE)((B) - (A))) / (double)(A)); \
+ else \
+ not_comparable = TRUE; \
+ }
+
+#define PDIFF(a, b) (((b) > (a)) ? ((b) - (a)) : ((a) - (b)))
typedef struct mcomp_t {
- unsigned n; /* number of members */
- hid_t *ids; /* member type id */
- size_t *offsets;
+ unsigned n; /* number of members */
+ hid_t * ids; /* member type id */
+ size_t * offsets;
struct mcomp_t **m; /* members */
} mcomp_t;
@@ -133,59 +139,65 @@ typedef struct mcomp_t {
*-------------------------------------------------------------------------
*/
static hbool_t all_zero(const void *_mem, size_t size);
-static int ull2float(unsigned long long ull_value, float *f_value);
+static int ull2float(unsigned long long ull_value, float *f_value);
static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts);
-static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, diff_opt_t *opts);
+static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno,
+ diff_opt_t *opts);
static hbool_t equal_float(float value, float expected, diff_opt_t *opts);
static hbool_t equal_double(double value, double expected, diff_opt_t *opts);
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts);
#endif
-static int print_data(diff_opt_t *opts);
+static int print_data(diff_opt_t *opts);
static void print_pos(diff_opt_t *opts, hsize_t elemtno, size_t u);
static void h5diff_print_char(char ch);
-static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *opts);
-static hsize_t diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts,
- hid_t container1_id, hid_t container2_id, mcomp_t *members);
+static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id,
+ diff_opt_t *opts);
+static hsize_t diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t container1_id,
+ hid_t container2_id, mcomp_t *members);
/* element diffs */
-static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
-static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
-#if H5_SIZEOF_LONG_DOUBLE !=0
-static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
+static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
+#if H5_SIZEOF_LONG_DOUBLE != 0
+static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
#endif
-static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
-static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
-static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
-static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
+static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
+static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
+static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
-static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
-static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
-static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
-static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
-static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
+static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
+static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
+static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
+static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
/*-------------------------------------------------------------------------
* NaN detection
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE !=0
-typedef enum dtype_t
-{
- FLT_FLOAT,
- FLT_DOUBLE,
- FLT_LDOUBLE
-}dtype_t;
+#if H5_SIZEOF_LONG_DOUBLE != 0
+typedef enum dtype_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE } dtype_t;
#else
-typedef enum dtype_t {
- FLT_FLOAT, FLT_DOUBLE
-} dtype_t;
+typedef enum dtype_t { FLT_FLOAT, FLT_DOUBLE } dtype_t;
#endif
-
/*-------------------------------------------------------------------------
* XCAO, 11/10/2010
* added to improve performance for compound datasets
@@ -205,211 +217,209 @@ static void close_member_types(mcomp_t *members);
hsize_t
diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_t container2_id)
{
- hsize_t nfound = 0; /* number of differences found */
- size_t size; /* size of datum */
- unsigned char *mem1 = (unsigned char*) _mem1;
- unsigned char *mem2 = (unsigned char*) _mem2;
- hsize_t i;
- mcomp_t members;
- H5T_class_t type_class;
-
- H5TOOLS_START_DEBUG(" - rank:%d hs_nelmts:%ld errstat:%d", opts->rank, opts->hs_nelmts, opts->err_stat);
+ hsize_t nfound = 0; /* number of differences found */
+ size_t size; /* size of datum */
+ unsigned char *mem1 = (unsigned char *)_mem1;
+ unsigned char *mem2 = (unsigned char *)_mem2;
+ hsize_t i;
+ mcomp_t members;
+ H5T_class_t type_class;
+
+ H5TOOLS_START_DEBUG(" - rank:%d hs_nelmts:%lld errstat:%d", opts->rank, opts->hs_nelmts, opts->err_stat);
opts->print_header = 1; /* enable print header */
/* get the size. */
- size = H5Tget_size(opts->m_tid);
+ size = H5Tget_size(opts->m_tid);
type_class = H5Tget_class(opts->m_tid);
/* Fast comparison first for atomic type by memcmp().
* It is OK not to list non-atomic type here because it will not be caught
* by the condition, but it gives more clarity for code planning
*/
- if (type_class != H5T_REFERENCE &&
- type_class != H5T_COMPOUND &&
- type_class != H5T_STRING &&
- type_class != H5T_VLEN &&
- HDmemcmp(mem1, mem2, size * opts->hs_nelmts) == 0) {
+ if (type_class != H5T_REFERENCE && type_class != H5T_COMPOUND && type_class != H5T_STRING &&
+ type_class != H5T_VLEN && HDmemcmp(mem1, mem2, size * opts->hs_nelmts) == 0) {
H5TOOLS_ENDDEBUG(":Fast comparison - errstat:%d", opts->err_stat);
return 0;
}
H5TOOLS_DEBUG("type_class:%d", type_class);
switch (type_class) {
- case H5T_NO_CLASS:
- case H5T_TIME:
- case H5T_NCLASSES:
- default:
- H5TOOLS_DEBUG("type_class:INVALID");
- HDassert(0);
- break;
-
- /*-------------------------------------------------------------------------
- * float and integer atomic types
- *-------------------------------------------------------------------------
- */
- case H5T_FLOAT:
- H5TOOLS_DEBUG("type_class:H5T_FLOAT");
- if (H5Tequal(opts->m_tid, H5T_NATIVE_FLOAT)) {
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_float_element(mem1, mem2, i, opts);
+ case H5T_NO_CLASS:
+ case H5T_TIME:
+ case H5T_NCLASSES:
+ default:
+ H5TOOLS_DEBUG("type_class:INVALID");
+ HDassert(0);
+ break;
- mem1 += sizeof(float);
- mem2 += sizeof(float);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_DOUBLE)){
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_double_element(mem1, mem2, i, opts);
-
- mem1 += sizeof(double);
- mem2 += sizeof(double);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
+ /*-------------------------------------------------------------------------
+ * float and integer atomic types
+ *-------------------------------------------------------------------------
+ */
+ case H5T_FLOAT:
+ H5TOOLS_DEBUG("type_class:H5T_FLOAT");
+ if (H5Tequal(opts->m_tid, H5T_NATIVE_FLOAT)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_float_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(float);
+ mem2 += sizeof(float);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_DOUBLE)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_double_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(double);
+ mem2 += sizeof(double);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
#if H5_SIZEOF_LONG_DOUBLE != 0
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_LDOUBLE)) {
- for ( i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_ldouble_element(mem1, mem2, i, opts);
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_LDOUBLE)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_ldouble_element(mem1, mem2, i, opts);
- mem1 += sizeof(long double);
- mem2 += sizeof(long double);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
+ mem1 += sizeof(long double);
+ mem2 += sizeof(long double);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
#endif
- break;
-
- case H5T_INTEGER:
- H5TOOLS_DEBUG("type_class:H5T_INTEGER");
- if (H5Tequal(opts->m_tid, H5T_NATIVE_SCHAR)) {
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_schar_element(mem1, mem2, i, opts);
- mem1 += sizeof(char);
- mem2 += sizeof(char);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_UCHAR)) {
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_uchar_element(mem1, mem2, i, opts);
-
- mem1 += sizeof(unsigned char);
- mem2 += sizeof(unsigned char);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_SHORT)) {
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_short_element(mem1, mem2, i, opts);
-
- mem1 += sizeof(short);
- mem2 += sizeof(short);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_USHORT)) {
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_ushort_element(mem1, mem2, i, opts);
-
- mem1 += sizeof(unsigned short);
- mem2 += sizeof(unsigned short);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_INT)) {
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_int_element(mem1, mem2, i, opts);
-
- mem1 += sizeof(int);
- mem2 += sizeof(int);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_UINT)) {
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_int_element(mem1, mem2, i, opts);
+ break;
+
+ case H5T_INTEGER:
+ H5TOOLS_DEBUG("type_class:H5T_INTEGER");
+ if (H5Tequal(opts->m_tid, H5T_NATIVE_SCHAR)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_schar_element(mem1, mem2, i, opts);
+ mem1 += sizeof(char);
+ mem2 += sizeof(char);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_UCHAR)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_uchar_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(unsigned char);
+ mem2 += sizeof(unsigned char);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_SHORT)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_short_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(short);
+ mem2 += sizeof(short);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_USHORT)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_ushort_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(unsigned short);
+ mem2 += sizeof(unsigned short);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_INT)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_int_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(int);
+ mem2 += sizeof(int);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_UINT)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_int_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(unsigned int);
+ mem2 += sizeof(unsigned int);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_LONG)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_long_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(long);
+ mem2 += sizeof(long);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_ULONG)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_ulong_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(unsigned long);
+ mem2 += sizeof(unsigned long);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_LLONG)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_llong_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(long long);
+ mem2 += sizeof(long long);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_ULLONG)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_ullong_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(unsigned long long);
+ mem2 += sizeof(unsigned long long);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ break;
- mem1 += sizeof(unsigned int);
- mem2 += sizeof(unsigned int);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_LONG)) {
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_long_element(mem1, mem2, i, opts);
-
- mem1 += sizeof(long);
- mem2 += sizeof(long);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_ULONG)) {
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_ulong_element(mem1, mem2, i, opts);
-
- mem1 += sizeof(unsigned long);
- mem2 += sizeof(unsigned long);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_LLONG)) {
- for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_llong_element(mem1, mem2, i, opts);
-
- mem1 += sizeof(long long);
- mem2 += sizeof(long long);
- if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- else if (H5Tequal(opts->m_tid, H5T_NATIVE_ULLONG)) {
+ /*-------------------------------------------------------------------------
+ * Other types than float and integer
+ *-------------------------------------------------------------------------
+ */
+ case H5T_COMPOUND:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ case H5T_VLEN:
+ case H5T_REFERENCE:
+ H5TOOLS_DEBUG("type_class:OTHER");
+ HDmemset(&members, 0, sizeof(mcomp_t));
+ get_member_types(opts->m_tid, &members);
for (i = 0; i < opts->hs_nelmts; i++) {
- nfound += diff_ullong_element(mem1, mem2, i, opts);
-
- mem1 += sizeof(unsigned long long);
- mem2 += sizeof(unsigned long long);
+ H5TOOLS_DEBUG("opts->pos[%lld]:%lld - nelmts:%lld", i, opts->pos[i], opts->hs_nelmts);
+ nfound += diff_datum(mem1 + i * size, mem2 + i * size, i, opts, container1_id, container2_id,
+ &members);
if (opts->count_bool && nfound >= opts->count)
- return nfound;
- } /* nelmts */
- }
- break;
-
- /*-------------------------------------------------------------------------
- * Other types than float and integer
- *-------------------------------------------------------------------------
- */
- case H5T_COMPOUND:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_ARRAY:
- case H5T_VLEN:
- case H5T_REFERENCE:
- H5TOOLS_DEBUG("type_class:OTHER");
- HDmemset(&members, 0, sizeof(mcomp_t));
- get_member_types(opts->m_tid, &members);
- for (i = 0; i < opts->hs_nelmts; i++) {
- H5TOOLS_DEBUG("opts->pos[%ld]:%ld - nelmts:%ld", i, opts->pos[i], opts->hs_nelmts);
- nfound += diff_datum(mem1 + i * size, mem2 + i * size, i, opts, container1_id, container2_id, &members);
- if (opts->count_bool && nfound >= opts->count)
- break;
- } /* i */
- close_member_types(&members);
+ break;
+ } /* i */
+ close_member_types(&members);
} /* switch */
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -447,247 +457,235 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_
*-------------------------------------------------------------------------
*/
static hsize_t
-diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t container1_id, hid_t container2_id, mcomp_t *members)
+diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t container1_id,
+ hid_t container2_id, mcomp_t *members)
{
- unsigned char *mem1 = (unsigned char*) _mem1;
- unsigned char *mem2 = (unsigned char*) _mem2;
- size_t u;
- size_t type_size;
- H5T_sign_t type_sign;
- H5T_class_t type_class;
- size_t offset;
- unsigned nmembs;
- unsigned j;
- size_t size = 0;
- hbool_t iszero1;
- hbool_t iszero2;
- hsize_t nfound = 0; /* differences found */
- double per;
- hbool_t both_zero;
- diff_err_t ret_value = opts->err_stat;
-
- H5TOOLS_START_DEBUG("ph:%d elemtno:%d - errstat:%d", opts->print_header, elemtno, opts->err_stat);
-
- type_size = H5Tget_size(opts->m_tid);
+ unsigned char *mem1 = (unsigned char *)_mem1;
+ unsigned char *mem2 = (unsigned char *)_mem2;
+ size_t u;
+ size_t type_size;
+ H5T_sign_t type_sign;
+ H5T_class_t type_class;
+ size_t offset;
+ unsigned nmembs;
+ unsigned j;
+ size_t size = 0;
+ hbool_t iszero1;
+ hbool_t iszero2;
+ hsize_t nfound = 0; /* differences found */
+ diff_err_t ret_value = opts->err_stat;
+
+ H5TOOLS_START_DEBUG("ph:%d elemtno:%lld - errstat:%d", opts->print_header, elemtno, opts->err_stat);
+
+ type_size = H5Tget_size(opts->m_tid);
type_class = H5Tget_class(opts->m_tid);
/* Fast comparison first for atomic type by memcmp().
* It is OK not to list non-atomic type here because it will not be caught
* by the condition, but it gives more clarity for code planning
*/
- if (type_class != H5T_REFERENCE &&
- type_class != H5T_COMPOUND &&
- type_class != H5T_STRING &&
- type_class != H5T_VLEN &&
- HDmemcmp(mem1, mem2, type_size) == 0)
+ if (type_class != H5T_REFERENCE && type_class != H5T_COMPOUND && type_class != H5T_STRING &&
+ type_class != H5T_VLEN && HDmemcmp(mem1, mem2, type_size) == 0)
H5TOOLS_GOTO_DONE(opts->err_stat);
switch (H5Tget_class(opts->m_tid)) {
- case H5T_NO_CLASS:
- case H5T_TIME:
- case H5T_NCLASSES:
- default:
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Invalid type class");
- break;
+ case H5T_NO_CLASS:
+ case H5T_TIME:
+ case H5T_NCLASSES:
+ default:
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Invalid type class");
+ break;
- /*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
- case H5T_COMPOUND:
- H5TOOLS_DEBUG("H5T_COMPOUND");
- {
- diff_opt_t cmpd_opts;
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ case H5T_COMPOUND:
+ H5TOOLS_DEBUG("H5T_COMPOUND");
+ {
+ diff_opt_t cmpd_opts;
- cmpd_opts = *opts;
- nmembs = members->n;
+ cmpd_opts = *opts;
+ nmembs = members->n;
- for (j = 0; j < nmembs; j++) {
- offset = members->offsets[j];
- cmpd_opts.m_tid = members->ids[j];
+ for (j = 0; j < nmembs; j++) {
+ offset = members->offsets[j];
+ cmpd_opts.m_tid = members->ids[j];
- nfound += diff_datum(mem1 + offset, mem2 + offset, elemtno, &cmpd_opts, container1_id, container2_id, members->m[j]);
+ nfound += diff_datum(mem1 + offset, mem2 + offset, elemtno, &cmpd_opts, container1_id,
+ container2_id, members->m[j]);
+ }
+ opts->err_stat = opts->err_stat | cmpd_opts.err_stat;
+ opts->print_header = cmpd_opts.print_header;
+ opts->not_cmp = cmpd_opts.not_cmp;
}
- opts->err_stat = opts->err_stat | cmpd_opts.err_stat;
- opts->print_header = cmpd_opts.print_header;
- opts->not_cmp = cmpd_opts.not_cmp;
- }
- break;
+ break;
- /*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
- case H5T_STRING:
- H5TOOLS_DEBUG("H5T_STRING");
- {
- char *s = NULL;
- char *sx = NULL;
- char *s1 = NULL;
- char *s2 = NULL;
- size_t size1;
- size_t size2;
- size_t sizex;
- size_t size_mtype = H5Tget_size(opts->m_tid);
- H5T_str_t pad = H5Tget_strpad(opts->m_tid);
-
- /* if variable length string */
- if (H5Tis_variable_str(opts->m_tid)) {
- H5TOOLS_DEBUG("H5T_STRING variable");
- /* Get pointer to first string */
- s1 = *(char **)((void *)mem1);
- if (s1)
- size1 = HDstrlen(s1);
- else
- size1 = 0;
-
- /* Get pointer to second string */
- s2 = *(char **)((void *)mem2);
- if (s2)
- size2 = HDstrlen(s2);
- else
- size2 = 0;
- }
- else if (H5T_STR_NULLTERM == pad) {
- H5TOOLS_DEBUG("H5T_STRING null term");
- /* Get pointer to first string */
- s1 = (char*) mem1;
- if (s1)
- size1 = HDstrlen(s1);
- else
- size1 = 0;
-
- if (size1 > size_mtype)
- size1 = size_mtype;
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ case H5T_STRING:
+ H5TOOLS_DEBUG("H5T_STRING");
+ {
+ char * s = NULL;
+ char * sx = NULL;
+ char * s1 = NULL;
+ char * s2 = NULL;
+ size_t size1;
+ size_t size2;
+ size_t sizex;
+ size_t size_mtype = H5Tget_size(opts->m_tid);
+ H5T_str_t pad = H5Tget_strpad(opts->m_tid);
+
+ /* if variable length string */
+ if (H5Tis_variable_str(opts->m_tid)) {
+ H5TOOLS_DEBUG("H5T_STRING variable");
+ /* Get pointer to first string */
+ s1 = *(char **)((void *)mem1);
+ if (s1)
+ size1 = HDstrlen(s1);
+ else
+ size1 = 0;
+
+ /* Get pointer to second string */
+ s2 = *(char **)((void *)mem2);
+ if (s2)
+ size2 = HDstrlen(s2);
+ else
+ size2 = 0;
+ }
+ else if (H5T_STR_NULLTERM == pad) {
+ H5TOOLS_DEBUG("H5T_STRING null term");
+ /* Get pointer to first string */
+ s1 = (char *)mem1;
+ if (s1)
+ size1 = HDstrlen(s1);
+ else
+ size1 = 0;
+
+ if (size1 > size_mtype)
+ size1 = size_mtype;
+
+ /* Get pointer to second string */
+ s2 = (char *)mem2;
+ if (s2)
+ size2 = HDstrlen(s2);
+ else
+ size2 = 0;
- /* Get pointer to second string */
- s2 = (char*) mem2;
- if (s2)
- size2 = HDstrlen(s2);
- else
- size2 = 0;
+ if (size2 > size_mtype)
+ size2 = size_mtype;
+ }
+ else {
+ /* Get pointer to first string */
+ s1 = (char *)mem1;
+ size1 = size_mtype;
- if (size2 > size_mtype)
+ /* Get pointer to second string */
+ s2 = (char *)mem2;
size2 = size_mtype;
- }
- else {
- /* Get pointer to first string */
- s1 = (char *) mem1;
- size1 = size_mtype;
+ }
- /* Get pointer to second string */
- s2 = (char *) mem2;
- size2 = size_mtype;
- }
+ /*
+ * compare for shorter string
+ * TODO: this code need to be improved to handle the difference
+ * of length of strings.
+ * For now mimic the previous way.
+ */
+ H5TOOLS_DEBUG("string size:%ld", size1);
+ H5TOOLS_DEBUG("string size:%ld", size2);
+ if (size1 != size2) {
+ H5TOOLS_DEBUG("string sizes difference");
+ nfound++;
+ }
+ if (size1 < size2) {
+ size = size1;
+ s = s1;
+ sizex = size2;
+ sx = s2;
+ }
+ else {
+ size = size2;
+ s = s2;
+ sizex = size1;
+ sx = s1;
+ }
- /*
- * compare for shorter string
- * TODO: this code need to be improved to handle the difference
- * of length of strings.
- * For now mimic the previous way.
- */
- H5TOOLS_DEBUG("string size:%d", size1);
- H5TOOLS_DEBUG("string size:%d", size2);
- if (size1 != size2) {
- H5TOOLS_DEBUG("string sizes difference");
- nfound++;
- }
- if (size1 < size2) {
- size = size1;
- s = s1;
- sizex = size2;
- sx = s2;
+ /* check for NULL pointer for string */
+ if (s != NULL) {
+ /* try fast compare first */
+ if ((HDmemcmp(s, sx, size) == 0) && (size1 != size2)) {
+ for (u = size; u < sizex; u++)
+ character_compare(s + u, sx + u, elemtno, u, opts);
+ }
+ else
+ for (u = 0; u < size; u++)
+ nfound += character_compare(s + u, sx + u, elemtno, u, opts);
+ } /* end check for NULL pointer for string */
}
- else {
- size = size2;
- s = s2;
- sizex = size1;
- sx = s1;
- }
-
- /* check for NULL pointer for string */
- if (s != NULL) {
- /* try fast compare first */
- if ((HDmemcmp(s, sx, size) == 0) && (size1 != size2)) {
- for (u = size; u < sizex; u++)
- character_compare(s + u, sx + u, elemtno, u, opts);
- }
- else
- for (u = 0; u < size; u++)
- nfound += character_compare(s + u, sx + u, elemtno, u, opts);
- } /* end check for NULL pointer for string */
- }
- break;
+ break;
- /*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
- case H5T_BITFIELD:
- H5TOOLS_DEBUG("H5T_BITFIELD");
- /* byte-by-byte comparison */
- for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts);
- break;
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+ case H5T_BITFIELD:
+ H5TOOLS_DEBUG("H5T_BITFIELD");
+ /* byte-by-byte comparison */
+ for (u = 0; u < type_size; u++)
+ nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts);
+ break;
- /*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
- case H5T_OPAQUE:
- H5TOOLS_DEBUG("H5T_OPAQUE");
- /* byte-by-byte comparison */
- for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts);
- break;
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ case H5T_OPAQUE:
+ H5TOOLS_DEBUG("H5T_OPAQUE");
+ /* byte-by-byte comparison */
+ for (u = 0; u < type_size; u++)
+ nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts);
+ break;
- /*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
- case H5T_ENUM:
- /* For enumeration types we compare the names instead of the
- * integer values. For each pair of elements being
- * compared, we convert both bit patterns to their corresponding
- * enumeration constant and do a string comparison
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
*/
- H5TOOLS_DEBUG("H5T_ENUM");
- {
- char enum_name1[1024];
- char enum_name2[1024];
- herr_t err1;
- herr_t err2;
-
- /* disable error reporting */
- H5E_BEGIN_TRY {
- /* If the enum value cannot be converted to a string
- * it is set to an error string for later output.
- */
- err1 = H5Tenum_nameof(opts->m_tid, mem1, enum_name1, sizeof enum_name1);
- if (err1 < 0)
- HDsnprintf(enum_name1, sizeof(enum_name1), "**INVALID VALUE**");
-
- err2 = H5Tenum_nameof(opts->m_tid, mem2, enum_name2, sizeof enum_name2);
- if (err2 < 0)
- HDsnprintf(enum_name2, sizeof(enum_name2), "**INVALID VALUE**");
-
- /* One or more bad enum values */
- if (err1 < 0 || err2 < 0) {
- /* If the two values cannot be converted to a string
- * (probably due to them being invalid enum values),
- * don't attempt to convert them - just report errors.
+ case H5T_ENUM:
+ /* For enumeration types we compare the names instead of the
+ * integer values. For each pair of elements being
+ * compared, we convert both bit patterns to their corresponding
+ * enumeration constant and do a string comparison
+ */
+ H5TOOLS_DEBUG("H5T_ENUM");
+ {
+ char enum_name1[1024];
+ char enum_name2[1024];
+ herr_t err1;
+ herr_t err2;
+
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* If the enum value cannot be converted to a string
+ * it is set to an error string for later output.
*/
- nfound += 1;
- opts->print_percentage = 0;
- print_pos(opts, elemtno, 0);
- if (print_data(opts)) {
- parallel_print(S_FORMAT, enum_name1, enum_name2);
- }
- }
- else {
- /* Both enum values were valid */
- if (HDstrcmp(enum_name1, enum_name2) != 0) {
- nfound = 1;
+ err1 = H5Tenum_nameof(opts->m_tid, mem1, enum_name1, sizeof enum_name1);
+ if (err1 < 0)
+ HDsnprintf(enum_name1, sizeof(enum_name1), "**INVALID VALUE**");
+
+ err2 = H5Tenum_nameof(opts->m_tid, mem2, enum_name2, sizeof enum_name2);
+ if (err2 < 0)
+ HDsnprintf(enum_name2, sizeof(enum_name2), "**INVALID VALUE**");
+
+ /* One or more bad enum values */
+ if (err1 < 0 || err2 < 0) {
+ /* If the two values cannot be converted to a string
+ * (probably due to them being invalid enum values),
+ * don't attempt to convert them - just report errors.
+ */
+ nfound += 1;
opts->print_percentage = 0;
print_pos(opts, elemtno, 0);
if (print_data(opts)) {
@@ -695,180 +693,199 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co
}
}
else {
- for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts);
+ /* Both enum values were valid */
+ if (HDstrcmp(enum_name1, enum_name2) != 0) {
+ nfound = 1;
+ opts->print_percentage = 0;
+ print_pos(opts, elemtno, 0);
+ if (print_data(opts)) {
+ parallel_print(S_FORMAT, enum_name1, enum_name2);
+ }
+ }
+ else {
+ for (u = 0; u < type_size; u++)
+ nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts);
+ }
}
+ /* enable error reporting */
}
- /* enable error reporting */
- } H5E_END_TRY;
- }
- break;
+ H5E_END_TRY;
+ }
+ break;
- /*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
- case H5T_ARRAY:
- {
- hsize_t adims[H5S_MAX_RANK];
- int ndims;
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ case H5T_ARRAY: {
+ hsize_t adims[H5S_MAX_RANK];
+ int ndims;
diff_opt_t arr_opts;
H5TOOLS_DEBUG("H5T_ARRAY ph=%d", opts->print_header);
arr_opts = *opts;
- H5TOOLS_DEBUG("Check opts: hs_nelmts:%ld to %ld rank:%d to %ld", opts->hs_nelmts, arr_opts.hs_nelmts, opts->rank, arr_opts.rank);
+ H5TOOLS_DEBUG("Check opts: hs_nelmts:%lld to %lld rank:%d to %d", opts->hs_nelmts,
+ arr_opts.hs_nelmts, opts->rank, arr_opts.rank);
/* get the array's base datatype for each element */
arr_opts.m_tid = H5Tget_super(opts->m_tid);
- size = H5Tget_size(arr_opts.m_tid);
- ndims = H5Tget_array_ndims(opts->m_tid);
+ size = H5Tget_size(arr_opts.m_tid);
+ ndims = H5Tget_array_ndims(opts->m_tid);
H5Tget_array_dims2(opts->m_tid, adims);
HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK);
H5TOOLS_DEBUG("attr ph=%d", arr_opts.print_header);
/* calculate the number of array elements */
- for (u = 0, arr_opts.hs_nelmts = 1; u < (unsigned) ndims; u++)
+ for (u = 0, arr_opts.hs_nelmts = 1; u < (unsigned)ndims; u++)
arr_opts.hs_nelmts *= adims[u];
for (u = 0; u < arr_opts.hs_nelmts; u++) {
- nfound += diff_datum(mem1 + u * size, mem2 + u * size, elemtno, &arr_opts, container1_id, container2_id, members);
+ nfound += diff_datum(mem1 + u * size, mem2 + u * size, elemtno, &arr_opts, container1_id,
+ container2_id, members);
}
- opts->err_stat = opts->err_stat | arr_opts.err_stat;
+ opts->err_stat = opts->err_stat | arr_opts.err_stat;
opts->print_header = arr_opts.print_header;
- opts->not_cmp = arr_opts.not_cmp;
+ opts->not_cmp = arr_opts.not_cmp;
H5Tclose(arr_opts.m_tid);
- }
- break;
+ } break;
- /*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
- case H5T_REFERENCE:
- H5TOOLS_DEBUG("H5T_REFERENCE");
- iszero1 = all_zero(_mem1, H5Tget_size(opts->m_tid));
- iszero2 = all_zero(_mem2, H5Tget_size(opts->m_tid));
- if (iszero1 != iszero2) {
- nfound++;
- H5TOOLS_GOTO_DONE(opts->err_stat);
- }
- else if (!iszero1 && !iszero2) {
- hid_t obj1_id = H5I_INVALID_HID;
- hid_t obj2_id = H5I_INVALID_HID;
- diff_opt_t ref_opts;
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ case H5T_REFERENCE:
+ H5TOOLS_DEBUG("H5T_REFERENCE");
+ iszero1 = all_zero(_mem1, H5Tget_size(opts->m_tid));
+ iszero2 = all_zero(_mem2, H5Tget_size(opts->m_tid));
+ if (iszero1 != iszero2) {
+ nfound++;
+ H5TOOLS_GOTO_DONE(opts->err_stat);
+ }
+ else if (!iszero1 && !iszero2) {
+ hid_t obj1_id = H5I_INVALID_HID;
+ hid_t obj2_id = H5I_INVALID_HID;
+ diff_opt_t ref_opts;
- /*-------------------------------------------------------------------------
- * H5T_STD_REF_OBJ
- * Object references. get the type and OID of the referenced object
- *-------------------------------------------------------------------------
- */
- ref_opts = *opts;
- ref_opts.obj_name[0] = NULL;
- ref_opts.obj_name[1] = NULL;
- if (type_size == H5R_OBJ_REF_BUF_SIZE) {
- H5O_type_t obj1_type;
- H5O_type_t obj2_type;
-
- H5TOOLS_DEBUG("ref_type is H5T_STD_REF_OBJ");
-
- if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) >= 0) {
- if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) >= 0) {
- /* check object type */
- if (obj1_type == obj2_type) {
- if (obj1_type == H5O_TYPE_DATASET) {
- if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) >= 0) {
- if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) >= 0) {
- /* compare */
- nfound = diff_datasetid(obj1_id, obj2_id, opts->obj_name[0], opts->obj_name[1], &ref_opts);
- if(H5Oclose(obj2_id) < 0) {
+ /*-------------------------------------------------------------------------
+ * H5T_STD_REF_OBJ
+ * Object references. get the type and OID of the referenced object
+ *-------------------------------------------------------------------------
+ */
+ ref_opts = *opts;
+ ref_opts.obj_name[0] = NULL;
+ ref_opts.obj_name[1] = NULL;
+ if (type_size == H5R_OBJ_REF_BUF_SIZE) {
+ H5O_type_t obj1_type;
+ H5O_type_t obj2_type;
+
+ H5TOOLS_DEBUG("ref_type is H5T_STD_REF_OBJ");
+
+ if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) >= 0) {
+ if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) >= 0) {
+ /* check object type */
+ if (obj1_type == obj2_type) {
+ if (obj1_type == H5O_TYPE_DATASET) {
+ if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT,
+ _mem1)) >= 0) {
+ if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT,
+ _mem2)) >= 0) {
+ /* compare */
+ nfound = diff_datasetid(obj1_id, obj2_id, opts->obj_name[0],
+ opts->obj_name[1], &ref_opts);
+ if (H5Oclose(obj2_id) < 0) {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Oclose H5T_STD_REF_OBJ 2 failed");
+ }
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Rdereference2 object 2 failed");
+ }
+ if (H5Oclose(obj1_id) < 0) {
ref_opts.err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Oclose H5T_STD_REF_OBJ 2 failed");
+ H5TOOLS_INFO("H5Oclose H5T_STD_REF_OBJ 1 failed");
}
}
else {
ref_opts.err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rdereference2 object 2 failed");
- }
- if(H5Oclose(obj1_id) < 0) {
- ref_opts.err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Oclose H5T_STD_REF_OBJ 1 failed");
+ H5TOOLS_INFO("H5Rdereference2 object 1 failed");
}
}
else {
- ref_opts.err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rdereference2 object 1 failed");
+ if (ref_opts.mode_verbose)
+ parallel_print("Warning: Comparison not possible of object types "
+ "referenced: <%s> and <%s>\n",
+ obj1_type, obj2_type);
+ ref_opts.not_cmp = 1;
}
}
else {
- if (ref_opts.mode_verbose)
- parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1_type, obj2_type);
- ref_opts.not_cmp = 1;
+ parallel_print("Different object types referenced: <%s> and <%s>",
+ opts->obj_name[0], opts->obj_name[1]);
+ ref_opts.not_cmp = 1;
+ ref_opts.err_stat = H5DIFF_ERR;
}
- }
- else {
- parallel_print("Different object types referenced: <%s> and <%s>", opts->obj_name[0], opts->obj_name[1]);
- ref_opts.not_cmp = 1;
- ref_opts.err_stat = H5DIFF_ERR;
- }
- }
- else {
- ref_opts.err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rget_obj_type2 object 2 failed");
- }
- }
- else {
- ref_opts.err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rget_obj_type2 object 1 failed");
- }
- }/*object reference*/
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Rget_obj_type2 object 2 failed");
+ }
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Rget_obj_type2 object 1 failed");
+ }
+ } /*object reference*/
- /*-------------------------------------------------------------------------
- * H5T_STD_REF_DSETREG
- * Dataset region reference
- *-------------------------------------------------------------------------
- */
- else if (type_size == H5R_DSET_REG_REF_BUF_SIZE) {
- hid_t region1_id = H5I_INVALID_HID;
- hid_t region2_id = H5I_INVALID_HID;
-
- H5TOOLS_DEBUG("H5T_REFERENCE - H5T_STD_REF_DSETREG");
-
- if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) >= 0) {
- if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) >= 0) {
- if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) >= 0) {
- if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) >= 0) {
- nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, &ref_opts);
- if(H5Sclose(region2_id) < 0)
- H5TOOLS_INFO("H5Sclose H5T_STD_REF_DSETREG region 2 failed");
+ /*-------------------------------------------------------------------------
+ * H5T_STD_REF_DSETREG
+ * Dataset region reference
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == H5R_DSET_REG_REF_BUF_SIZE) {
+ hid_t region1_id = H5I_INVALID_HID;
+ hid_t region2_id = H5I_INVALID_HID;
+
+ H5TOOLS_DEBUG("H5T_REFERENCE - H5T_STD_REF_DSETREG");
+
+ if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) >=
+ 0) {
+ if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION,
+ _mem2)) >= 0) {
+ if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) >= 0) {
+ if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) >=
+ 0) {
+ nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, &ref_opts);
+ if (H5Sclose(region2_id) < 0)
+ H5TOOLS_INFO("H5Sclose H5T_STD_REF_DSETREG region 2 failed");
+ }
+ if (H5Sclose(region1_id) < 0)
+ H5TOOLS_INFO("H5Sclose H5T_STD_REF_DSETREG region 1 failed");
}
- if(H5Sclose(region1_id) < 0)
- H5TOOLS_INFO("H5Sclose H5T_STD_REF_DSETREG region 1 failed");
+ if (H5Oclose(obj2_id) < 0)
+ H5TOOLS_INFO("H5Oclose H5T_STD_REF_DSETREG region 2 failed");
}
- if(H5Oclose(obj2_id) < 0)
- H5TOOLS_INFO("H5Oclose H5T_STD_REF_DSETREG region 2 failed");
+ else {
+ H5TOOLS_INFO("H5Rdereference2 object 2 failed");
+ }
+ if (H5Oclose(obj1_id) < 0)
+ H5TOOLS_INFO("H5Oclose H5T_STD_REF_DSETREG region 1 failed");
}
else {
- H5TOOLS_INFO("H5Rdereference2 object 2 failed");
+ H5TOOLS_INFO("H5Rdereference2 object 1 failed");
}
- if(H5Oclose(obj1_id) < 0)
- H5TOOLS_INFO("H5Oclose H5T_STD_REF_DSETREG region 1 failed");
- }
- else {
- H5TOOLS_INFO("H5Rdereference2 object 1 failed");
- }
- }/*dataset reference*/
- opts->print_header = ref_opts.print_header;
- opts->not_cmp = ref_opts.not_cmp;
- opts->err_stat = ref_opts.err_stat | ret_value;
- }/*is zero*/
- H5TOOLS_DEBUG("H5T_REFERENCE complete");
- break;
+ } /*dataset reference*/
+ opts->print_header = ref_opts.print_header;
+ opts->not_cmp = ref_opts.not_cmp;
+ opts->err_stat = ref_opts.err_stat | ret_value;
+ } /*is zero*/
+ H5TOOLS_DEBUG("H5T_REFERENCE complete");
+ break;
- /*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
- case H5T_VLEN:
- {
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+ case H5T_VLEN: {
diff_opt_t vl_opts;
H5TOOLS_DEBUG("H5T_VLEN");
@@ -876,176 +893,178 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co
vl_opts = *opts;
/* get the VL sequences's base datatype for each element */
vl_opts.m_tid = H5Tget_super(opts->m_tid);
- size = H5Tget_size(vl_opts.m_tid);
+ size = H5Tget_size(vl_opts.m_tid);
/* get the number of sequence elements */
vl_opts.hs_nelmts = ((hvl_t *)((void *)mem1))->len;
for (j = 0; j < vl_opts.hs_nelmts; j++)
- nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, elemtno, /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */
- &vl_opts, container1_id, container2_id, members);
+ nfound += diff_datum(((char *)(((hvl_t *)((void *)mem1))->p)) + j * size,
+ ((char *)(((hvl_t *)((void *)mem2))->p)) + j * size,
+ elemtno, /* Extra (void *) cast to quiet "cast to create alignment"
+ warning - 2019/07/05, QAK */
+ &vl_opts, container1_id, container2_id, members);
opts->print_header = vl_opts.print_header;
- opts->not_cmp = vl_opts.not_cmp;
- opts->err_stat = opts->err_stat | vl_opts.err_stat;
+ opts->not_cmp = vl_opts.not_cmp;
+ opts->err_stat = opts->err_stat | vl_opts.err_stat;
H5Tclose(vl_opts.m_tid);
- }
- break;
+ } break;
- /*-------------------------------------------------------------------------
- * H5T_INTEGER
- *-------------------------------------------------------------------------
- */
- case H5T_INTEGER:
- H5TOOLS_DEBUG("H5T_INTEGER");
- type_sign = H5Tget_sign(opts->m_tid);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_SCHAR
+ * H5T_INTEGER
*-------------------------------------------------------------------------
*/
- if (type_size == 1 && type_sign != H5T_SGN_NONE) {
- if(type_size != sizeof(char))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not char size");
- nfound += diff_schar_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_SCHAR*/
+ case H5T_INTEGER:
+ H5TOOLS_DEBUG("H5T_INTEGER");
+ type_sign = H5Tget_sign(opts->m_tid);
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_SCHAR
+ *-------------------------------------------------------------------------
+ */
+ if (type_size == 1 && type_sign != H5T_SGN_NONE) {
+ if (type_size != sizeof(char))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not char size");
+ nfound += diff_schar_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_SCHAR*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_UCHAR
- *-------------------------------------------------------------------------
- */
- else if (type_size == 1 && type_sign == H5T_SGN_NONE) {
- if(type_size != sizeof(unsigned char))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned char size");
- nfound += diff_uchar_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_UCHAR*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_UCHAR
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 1 && type_sign == H5T_SGN_NONE) {
+ if (type_size != sizeof(unsigned char))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned char size");
+ nfound += diff_uchar_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_UCHAR*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_SHORT
- *-------------------------------------------------------------------------
- */
- else if (type_size == 2 && type_sign != H5T_SGN_NONE) {
- if(type_size != sizeof(short))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not short size");
- nfound += diff_short_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_SHORT*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_SHORT
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 2 && type_sign != H5T_SGN_NONE) {
+ if (type_size != sizeof(short))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not short size");
+ nfound += diff_short_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_SHORT*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_USHORT
- *-------------------------------------------------------------------------
- */
- else if (type_size == 2 && type_sign == H5T_SGN_NONE) {
- if(type_size != sizeof(unsigned short))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned short size");
- nfound += diff_ushort_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_USHORT*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_USHORT
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 2 && type_sign == H5T_SGN_NONE) {
+ if (type_size != sizeof(unsigned short))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned short size");
+ nfound += diff_ushort_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_USHORT*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_INT
- *-------------------------------------------------------------------------
- */
- else if (type_size == 4 && type_sign != H5T_SGN_NONE) {
- if(type_size != sizeof(int))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not int size");
- nfound += diff_int_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_INT*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_INT
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 4 && type_sign != H5T_SGN_NONE) {
+ if (type_size != sizeof(int))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not int size");
+ nfound += diff_int_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_INT*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_UINT
- *-------------------------------------------------------------------------
- */
- else if (type_size == 4 && type_sign == H5T_SGN_NONE) {
- if(type_size != sizeof(unsigned int))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned int size");
- nfound += diff_uint_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_UINT*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_UINT
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 4 && type_sign == H5T_SGN_NONE) {
+ if (type_size != sizeof(unsigned int))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned int size");
+ nfound += diff_uint_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_UINT*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_LONG
- *-------------------------------------------------------------------------
- */
- else if (type_size == 8 && type_sign != H5T_SGN_NONE) {
- if(type_size != sizeof(long))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long size");
- nfound += diff_long_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_LONG*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LONG
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 8 && type_sign != H5T_SGN_NONE) {
+ if (type_size != sizeof(long))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long size");
+ nfound += diff_long_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_LONG*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_ULONG
- *-------------------------------------------------------------------------
- */
- else if (type_size == 8 && type_sign == H5T_SGN_NONE) {
- if(type_size != sizeof(unsigned long))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned long size");
- nfound += diff_ulong_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_ULONG*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_ULONG
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 8 && type_sign == H5T_SGN_NONE) {
+ if (type_size != sizeof(unsigned long))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned long size");
+ nfound += diff_ulong_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_ULONG*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_LLONG
- *-------------------------------------------------------------------------
- */
- else if (type_size == 16 && type_sign != H5T_SGN_NONE) {
- if(type_size != sizeof(long long))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long long size");
- nfound += diff_llong_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_LLONG*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LLONG
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 16 && type_sign != H5T_SGN_NONE) {
+ if (type_size != sizeof(long long))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long long size");
+ nfound += diff_llong_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_LLONG*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_ULLONG
- *-------------------------------------------------------------------------
- */
- else if (type_size == 16 && type_sign == H5T_SGN_NONE) {
- if(type_size != sizeof(unsigned long long))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned long long size");
- nfound += diff_ullong_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_ULLONG*/
- break; /* H5T_INTEGER class */
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_ULLONG
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 16 && type_sign == H5T_SGN_NONE) {
+ if (type_size != sizeof(unsigned long long))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned long long size");
+ nfound += diff_ullong_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_ULLONG*/
+ break; /* H5T_INTEGER class */
- /*-------------------------------------------------------------------------
- * H5T_FLOAT
- *-------------------------------------------------------------------------
- */
- case H5T_FLOAT:
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_FLOAT
- *-------------------------------------------------------------------------
- */
- H5TOOLS_DEBUG("H5T_FLOAT");
- if (type_size == 4) {
- if(type_size != sizeof(float))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not float size");
- nfound += diff_float_element(mem1, mem2, elemtno, opts);
- }
/*-------------------------------------------------------------------------
- * H5T_NATIVE_DOUBLE
+ * H5T_FLOAT
*-------------------------------------------------------------------------
*/
- else if (type_size == 8) {
- if(type_size != sizeof(double))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not double size");
- nfound += diff_double_element(mem1, mem2, elemtno, opts);
- }
+ case H5T_FLOAT:
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ H5TOOLS_DEBUG("H5T_FLOAT");
+ if (type_size == 4) {
+ if (type_size != sizeof(float))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not float size");
+ nfound += diff_float_element(mem1, mem2, elemtno, opts);
+ }
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_DOUBLE
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 8) {
+ if (type_size != sizeof(double))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not double size");
+ nfound += diff_double_element(mem1, mem2, elemtno, opts);
+ }
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_LDOUBLE
- *-------------------------------------------------------------------------
- */
- else if (type_size == H5_SIZEOF_LONG_DOUBLE) {
- if(type_size != sizeof(long double)) {
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long double size");
- }
- nfound += diff_ldouble_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_LDOUBLE*/
-#endif /* H5_SIZEOF_LONG_DOUBLE */
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LDOUBLE
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == H5_SIZEOF_LONG_DOUBLE) {
+ if (type_size != sizeof(long double)) {
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long double size");
+ }
+ nfound += diff_ldouble_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_LDOUBLE*/
+#endif /* H5_SIZEOF_LONG_DOUBLE */
- break; /* H5T_FLOAT class */
+ break; /* H5T_FLOAT class */
} /* switch */
done:
opts->err_stat = opts->err_stat | ret_value;
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -1058,8 +1077,10 @@ done:
*-------------------------------------------------------------------------
*/
-static hbool_t all_zero(const void *_mem, size_t size) {
- const unsigned char *mem = (const unsigned char *) _mem;
+static hbool_t
+all_zero(const void *_mem, size_t size)
+{
+ const unsigned char *mem = (const unsigned char *)_mem;
while (size-- > 0)
if (mem[size])
@@ -1077,17 +1098,17 @@ static hbool_t all_zero(const void *_mem, size_t size) {
*-------------------------------------------------------------------------
*/
-static
-void print_region_block(int i, hsize_t *ptdata, int ndims) {
+static void
+print_region_block(int i, hsize_t *ptdata, int ndims)
+{
int j;
parallel_print(" ");
for (j = 0; j < ndims; j++)
- parallel_print("%s%lu", j ? "," : " (", (unsigned long) ptdata[i * 2 * ndims + j]);
+ parallel_print("%s%lu", j ? "," : " (", (unsigned long)ptdata[i * 2 * ndims + j]);
for (j = 0; j < ndims; j++)
- parallel_print("%s%lu", j ? "," : ")-(", (unsigned long) ptdata[i * 2 * ndims + j + ndims]);
+ parallel_print("%s%lu", j ? "," : ")-(", (unsigned long)ptdata[i * 2 * ndims + j + ndims]);
parallel_print(")");
-
}
/*-------------------------------------------------------------------------
@@ -1099,15 +1120,15 @@ void print_region_block(int i, hsize_t *ptdata, int ndims) {
*-------------------------------------------------------------------------
*/
-static
-void print_points(int i, hsize_t *ptdata, int ndims) {
+static void
+print_points(int i, hsize_t *ptdata, int ndims)
+{
int j;
parallel_print(" ");
for (j = 0; j < ndims; j++)
- parallel_print("%s%lu", j ? "," : "(", (unsigned long) (ptdata[i * ndims + j]));
+ parallel_print("%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j]));
parallel_print(")");
-
}
/*-------------------------------------------------------------------------
@@ -1119,7 +1140,8 @@ void print_points(int i, hsize_t *ptdata, int ndims) {
*-------------------------------------------------------------------------
*/
-static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *opts)
+static hsize_t
+diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *opts)
{
hssize_t nblocks1, npoints1;
@@ -1130,11 +1152,11 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
int ndims1;
int ndims2;
int i, j;
- hsize_t nfound_b = 0; /* block differences found */
- hsize_t nfound_p = 0; /* point differences found */
+ hsize_t nfound_b = 0; /* block differences found */
+ hsize_t nfound_p = 0; /* point differences found */
hsize_t ret_value = 0;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
ndims1 = H5Sget_simple_extent_ndims(region1_id);
ndims2 = H5Sget_simple_extent_ndims(region2_id);
@@ -1144,15 +1166,17 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
* respectively. They do not currently know how to translate from one to
* the other.
*/
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
nblocks1 = H5Sget_select_hyper_nblocks(region1_id);
nblocks2 = H5Sget_select_hyper_nblocks(region2_id);
npoints1 = H5Sget_select_elem_npoints(region1_id);
npoints2 = H5Sget_select_elem_npoints(region2_id);
- } H5E_END_TRY;
- H5TOOLS_DEBUG("blocks: 1=%ld-2=%ld", nblocks1, nblocks2);
- H5TOOLS_DEBUG("points: 1=%ld-2=%ld", npoints1, npoints2);
+ }
+ H5E_END_TRY;
+ H5TOOLS_DEBUG("blocks: 1=%lld-2=%lld", nblocks1, nblocks2);
+ H5TOOLS_DEBUG("points: 1=%lld-2=%lld", npoints1, npoints2);
if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) {
opts->not_cmp = 1;
@@ -1166,24 +1190,24 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
if (nblocks1 > 0) {
H5TOOLS_DEBUG("region compare blocks");
HDassert(ndims1 > 0);
- alloc_size = (hsize_t) nblocks1 * (unsigned) ndims1 * 2 * sizeof(ptdata1[0]);
- HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/
+ alloc_size = (hsize_t)nblocks1 * (unsigned)ndims1 * 2 * sizeof(ptdata1[0]);
+ HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ if ((ptdata1 = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL) {
opts->err_stat = H5DIFF_ERR;
H5TOOLS_INFO("Buffer allocation failed");
}
else {
H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region1_id, (hsize_t) 0, (hsize_t) nblocks1, ptdata1);
+ H5Sget_select_hyper_blocklist(region1_id, (hsize_t)0, (hsize_t)nblocks1, ptdata1);
- if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ if ((ptdata2 = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL) {
opts->err_stat = H5DIFF_ERR;
H5TOOLS_INFO("Buffer allocation failed");
}
else {
H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region2_id, (hsize_t) 0, (hsize_t) nblocks2, ptdata2);
+ H5Sget_select_hyper_blocklist(region2_id, (hsize_t)0, (hsize_t)nblocks2, ptdata2);
for (i = 0; i < nblocks1; i++) {
/* start coordinates and opposite corner */
@@ -1192,8 +1216,8 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
start1 = ptdata1[i * 2 * ndims1 + j];
start2 = ptdata2[i * 2 * ndims1 + j];
- end1 = ptdata1[i * 2 * ndims1 + j + ndims1];
- end2 = ptdata2[i * 2 * ndims1 + j + ndims1];
+ end1 = ptdata1[i * 2 * ndims1 + j + ndims1];
+ end2 = ptdata2[i * 2 * ndims1 + j + ndims1];
if (start1 != start2 || end1 != end2)
nfound_b++;
}
@@ -1206,8 +1230,9 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
H5Oget_info2(obj1_id, &oi1, H5O_INFO_BASIC);
H5Oget_info2(obj2_id, &oi2, H5O_INFO_BASIC);
- parallel_print("Referenced dataset %lu %lu\n", (unsigned long) oi1.addr, (unsigned long) oi2.addr);
- parallel_print( "------------------------------------------------------------\n");
+ parallel_print("Referenced dataset %lu %lu\n", (unsigned long)oi1.addr,
+ (unsigned long)oi2.addr);
+ parallel_print("------------------------------------------------------------\n");
parallel_print("Region blocks\n");
for (i = 0; i < nblocks1; i++) {
@@ -1230,24 +1255,24 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
*/
if (npoints1 > 0) {
H5TOOLS_DEBUG("region compare points");
- alloc_size = (hsize_t) npoints1 * (unsigned) ndims1 * sizeof(ptdata1[0]);
- HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/
+ alloc_size = (hsize_t)npoints1 * (unsigned)ndims1 * sizeof(ptdata1[0]);
+ HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ if ((ptdata1 = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL) {
opts->err_stat = H5DIFF_ERR;
H5TOOLS_INFO("Buffer allocation failed");
}
else {
H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
- H5Sget_select_elem_pointlist(region1_id, (hsize_t) 0, (hsize_t) npoints1, ptdata1);
+ H5Sget_select_elem_pointlist(region1_id, (hsize_t)0, (hsize_t)npoints1, ptdata1);
- if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ if ((ptdata2 = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL) {
opts->err_stat = H5DIFF_ERR;
H5TOOLS_INFO("Buffer allocation failed");
}
else {
H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
- H5Sget_select_elem_pointlist(region2_id, (hsize_t) 0, (hsize_t) npoints2, ptdata2);
+ H5Sget_select_elem_pointlist(region2_id, (hsize_t)0, (hsize_t)npoints2, ptdata2);
for (i = 0; i < npoints1; i++) {
hsize_t pt1, pt2;
@@ -1264,7 +1289,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
parallel_print("Region points\n");
for (i = 0; i < npoints1; i++) {
hsize_t pt1, pt2;
- int diff_data = 0;
+ int diff_data = 0;
for (j = 0; j < ndims1; j++) {
pt1 = ptdata1[i * ndims1 + j];
@@ -1285,9 +1310,9 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
HDfree(ptdata2);
} /* else ptdata2 */
-#if defined (H5DIFF_DEBUG)
+#if defined(H5DIFF_DEBUG)
for (i = 0; i < npoints1; i++) {
- parallel_print("%sPt%lu: " , i ? "," : "", (unsigned long)i);
+ parallel_print("%sPt%lu: ", i ? "," : "", (unsigned long)i);
for (j = 0; j < ndims1; j++)
parallel_print("%s%lu", j ? "," : "(", (unsigned long)(ptdata1[i * ndims1 + j]));
@@ -1301,13 +1326,13 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
} /* else ptdata1 */
}
- nfound_b = nfound_b / (unsigned) ndims1;
- nfound_p = nfound_p / (unsigned) ndims1;
+ nfound_b = nfound_b / (unsigned)ndims1;
+ nfound_p = nfound_p / (unsigned)ndims1;
ret_value = nfound_p + nfound_b;
done:
- H5TOOLS_ENDDEBUG(" with diffs:%d", ret_value);
+ H5TOOLS_ENDDEBUG(" with diffs:%lld", ret_value);
return ret_value;
}
@@ -1320,7 +1345,8 @@ done:
*-------------------------------------------------------------------------
*/
-static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts)
+static hsize_t
+character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts)
{
hsize_t nfound = 0; /* differences found */
char temp1_uchar;
@@ -1333,7 +1359,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t
if (temp1_uchar != temp2_uchar) {
if (print_data(opts)) {
opts->print_percentage = 0;
- opts->print_dims = 1;
+ opts->print_dims = 1;
print_pos(opts, elemtno, u);
parallel_print(" ");
h5diff_print_char(temp1_uchar);
@@ -1343,7 +1369,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t
}
nfound++;
}
- H5TOOLS_ENDDEBUG(": %d", nfound);
+ H5TOOLS_ENDDEBUG(": %lld", nfound);
return nfound;
}
@@ -1356,7 +1382,8 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t
*-------------------------------------------------------------------------
*/
-static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, diff_opt_t *opts)
+static hsize_t
+character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, diff_opt_t *opts)
{
hsize_t nfound = 0; /* differences found */
unsigned char temp1_uchar;
@@ -1371,7 +1398,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h
/* -d and !-p */
if (opts->delta_bool && !opts->percent_bool) {
- if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ if (PDIFF(temp1_uchar, temp2_uchar) > opts->delta) {
opts->print_percentage = 0;
print_pos(opts, elemtno, 0);
if (print_data(opts)) {
@@ -1395,7 +1422,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h
/* -d and -p */
else if (opts->delta_bool && opts->percent_bool) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
- if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ if (per > opts->percent && PDIFF(temp1_uchar, temp2_uchar) > opts->delta) {
opts->print_percentage = 1;
print_pos(opts, elemtno, 0);
if (print_data(opts)) {
@@ -1413,7 +1440,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h
nfound++;
}
- H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero);
+ H5TOOLS_ENDDEBUG(": %lld zero:%d", nfound, both_zero);
return nfound;
}
@@ -1423,18 +1450,19 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h
* Purpose: diff a single H5T_NATIVE_FLOAT type
*
* Return: number of differences found
-*
+ *
*-------------------------------------------------------------------------
*/
-static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
float temp1_float;
float temp2_float;
double per;
hbool_t both_zero = FALSE;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
@@ -1459,11 +1487,12 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if ((double) ABS(temp1_float - temp2_float) > opts->delta) {
+ if ((double)ABS(temp1_float - temp2_float) > opts->delta) {
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
@@ -1473,15 +1502,16 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
}
/*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
else if (!opts->delta_bool && opts->percent_bool) {
/*-------------------------------------------------------------------------
* detect NaNs
@@ -1499,7 +1529,8 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
@@ -1507,8 +1538,9 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
- (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
+ parallel_print(F_FORMAT_P, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float),
+ (double)ABS(1 - temp2_float / temp1_float));
}
nfound++;
}
@@ -1518,15 +1550,16 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
}
/*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
else if (opts->delta_bool && opts->percent_bool) {
/*-------------------------------------------------------------------------
* detect NaNs
@@ -1545,16 +1578,18 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
- else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) {
+ else if (per > opts->percent && (double)ABS(temp1_float - temp2_float) > opts->delta) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
- (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
+ parallel_print(F_FORMAT_P, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float),
+ (double)ABS(1 - temp2_float / temp1_float));
}
nfound++;
}
@@ -1564,27 +1599,29 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
}
/*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
else {
if (equal_float(temp1_float, temp2_float, opts) == FALSE) {
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
}
- H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero);
+ H5TOOLS_ENDDEBUG(": %lld zero:%d", nfound, both_zero);
return nfound;
}
@@ -1596,15 +1633,16 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
double temp1_double;
double temp2_double;
double per;
hbool_t both_zero = FALSE;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
@@ -1612,14 +1650,14 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
HDmemcpy(&temp2_double, mem2, sizeof(double));
/*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
+ * -d and !-p
+ *-------------------------------------------------------------------------
+ */
if (opts->delta_bool && !opts->percent_bool) {
/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
if (opts->do_nans) {
isnan1 = HDisnan(temp1_double);
isnan2 = HDisnan(temp2_double);
@@ -1627,7 +1665,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > opts->delta) {
+ if (ABS(temp1_double - temp2_double) > opts->delta) {
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -1648,14 +1686,14 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
}
/*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
else if (!opts->delta_bool && opts->percent_bool) {
/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
if (opts->do_nans) {
isnan1 = HDisnan(temp1_double);
isnan2 = HDisnan(temp2_double);
@@ -1668,7 +1706,8 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double,
+ ABS(temp1_double - temp2_double));
}
nfound++;
}
@@ -1676,8 +1715,8 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT_P, temp1_double, temp2_double,
- ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
+ parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double),
+ ABS(1 - temp2_double / temp1_double));
}
nfound++;
}
@@ -1693,14 +1732,14 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
}
}
/*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
else if (opts->delta_bool && opts->percent_bool) {
/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
if (opts->do_nans) {
isnan1 = HDisnan(temp1_double);
isnan2 = HDisnan(temp2_double);
@@ -1710,20 +1749,21 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
if (!isnan1 && !isnan2) {
PER(temp1_double, temp2_double);
- if (not_comparable && !both_zero) {
+ if (not_comparable && !both_zero) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double,
+ ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) {
+ else if (per > opts->percent && ABS(temp1_double - temp2_double) > opts->delta) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(F_FORMAT_P, temp1_double, temp2_double,
- ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
+ parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double),
+ ABS(1 - temp2_double / temp1_double));
}
nfound++;
}
@@ -1739,9 +1779,9 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
}
}
/*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
else {
if (equal_double(temp1_double, temp2_double, opts) == FALSE) {
opts->print_percentage = 0;
@@ -1752,7 +1792,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
nfound++;
}
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -1765,17 +1805,18 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
-static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
long double temp1_double;
long double temp2_double;
double per;
hbool_t both_zero = FALSE;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
@@ -1800,7 +1841,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > opts->delta) {
+ if (ABS(temp1_double - temp2_double) > opts->delta) {
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -1835,13 +1876,14 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- PER(temp1_double,temp2_double);
+ PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double,
+ ABS(temp1_double - temp2_double));
}
nfound++;
}
@@ -1849,7 +1891,8 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
+ parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double),
+ ABS(1 - temp2_double / temp1_double));
}
nfound++;
}
@@ -1880,21 +1923,23 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- PER(temp1_double,temp2_double);
+ PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double,
+ ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) {
+ else if (per > opts->percent && ABS(temp1_double - temp2_double) > opts->delta) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
+ parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double),
+ ABS(1 - temp2_double / temp1_double));
}
nfound++;
}
@@ -1922,7 +1967,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs
nfound++;
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -1936,7 +1981,8 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
char temp1_char;
@@ -1950,7 +1996,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz
/* -d and !-p */
if (opts->delta_bool && !opts->percent_bool) {
- if (ABS(temp1_char-temp2_char) > opts->delta) {
+ if (ABS(temp1_char - temp2_char) > opts->delta) {
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -2010,7 +2056,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz
nfound++;
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2023,7 +2069,8 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
unsigned char temp1_uchar;
@@ -2097,7 +2144,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz
nfound++;
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2110,7 +2157,8 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
short temp1_short;
@@ -2184,7 +2232,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz
nfound++;
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2197,7 +2245,8 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
unsigned short temp1_ushort;
@@ -2228,7 +2277,8 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort,
+ PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
@@ -2236,7 +2286,8 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
+ parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort),
+ per);
}
nfound++;
}
@@ -2249,7 +2300,8 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort,
+ PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
@@ -2257,7 +2309,8 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
+ parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort),
+ per);
}
nfound++;
}
@@ -2271,7 +2324,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi
nfound++;
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2282,9 +2335,10 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi
* Purpose: diff a single H5T_NATIVE_INT type
*
* Return: number of differences found
- *-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
-static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
int temp1_int;
@@ -2298,7 +2352,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_
HDmemcpy(&temp2_int, mem2, sizeof(int));
/* -d and !-p */
if (opts->delta_bool && !opts->percent_bool) {
- if (ABS(temp1_int-temp2_int) > opts->delta) {
+ if (ABS(temp1_int - temp2_int) > opts->delta) {
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -2358,7 +2412,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_
nfound++;
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2371,13 +2425,14 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned int temp1_uint;
unsigned int temp2_uint;
- double per;
- hbool_t both_zero = FALSE;
+ double per;
+ hbool_t both_zero = FALSE;
H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
@@ -2427,7 +2482,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize
}
nfound++;
}
- else if (per > opts->percent && PDIFF(temp1_uint,temp2_uint) > opts->delta) {
+ else if (per > opts->percent && PDIFF(temp1_uint, temp2_uint) > opts->delta) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -2445,7 +2500,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize
nfound++;
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2458,12 +2513,13 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
- long temp1_long;
- long temp2_long;
- double per;
+ long temp1_long;
+ long temp2_long;
+ double per;
hbool_t both_zero = FALSE;
H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
@@ -2472,7 +2528,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize
HDmemcpy(&temp2_long, mem2, sizeof(long));
/* -d and !-p */
if (opts->delta_bool && !opts->percent_bool) {
- if (ABS(temp1_long-temp2_long) > opts->delta) {
+ if (ABS(temp1_long - temp2_long) > opts->delta) {
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -2514,7 +2570,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize
}
nfound++;
}
- else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) {
+ else if (per > opts->percent && ABS(temp1_long - temp2_long) > opts->delta) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -2532,7 +2588,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize
nfound++;
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2545,7 +2601,8 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
unsigned long temp1_ulong;
@@ -2576,7 +2633,8 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
+ parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong,
+ PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
@@ -2597,11 +2655,12 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
+ parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong,
+ PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else if (per > opts->percent && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
+ else if (per > opts->percent && PDIFF(temp1_ulong, temp2_ulong) > opts->delta) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -2619,7 +2678,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz
nfound++;
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2632,7 +2691,8 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
long long temp1_llong;
@@ -2647,7 +2707,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz
/* -d and !-p */
if (opts->delta_bool && !opts->percent_bool) {
- if (ABS( temp1_llong-temp2_llong) > opts->delta) {
+ if (ABS(temp1_llong - temp2_llong) > opts->delta) {
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -2664,7 +2724,8 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
+ parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong,
+ ABS(temp1_llong - temp2_llong));
}
nfound++;
}
@@ -2672,7 +2733,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
+ parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong), per);
}
nfound++;
}
@@ -2685,15 +2746,16 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
+ parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong,
+ ABS(temp1_llong - temp2_llong));
}
nfound++;
}
- else if (per > opts->percent && ABS(temp1_llong-temp2_llong) > opts->delta) {
+ else if (per > opts->percent && ABS(temp1_llong - temp2_llong) > opts->delta) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
+ parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong), per);
}
nfound++;
}
@@ -2709,7 +2771,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz
}
}
- H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2722,7 +2784,8 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+static hsize_t
+diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
unsigned long long temp1_ullong;
@@ -2738,7 +2801,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi
/* -d and !-p */
if (opts->delta_bool && !opts->percent_bool) {
- if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
+ if (PDIFF(temp1_ullong, temp2_ullong) > (unsigned long long)opts->delta) {
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -2757,7 +2820,8 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong));
+ parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong,
+ PDIFF(temp1_ullong, temp2_ullong));
}
nfound++;
}
@@ -2765,7 +2829,8 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong,temp2_ullong), per);
+ parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong),
+ per);
}
nfound++;
}
@@ -2780,15 +2845,17 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong));
+ parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong,
+ PDIFF(temp1_ullong, temp2_ullong));
}
nfound++;
}
- else if (per > opts->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
+ else if (per > opts->percent && PDIFF(temp1_ullong, temp2_ullong) > (unsigned long long)opts->delta) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong), per);
+ parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong),
+ per);
}
nfound++;
}
@@ -2804,7 +2871,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi
}
}
- H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero);
+ H5TOOLS_ENDDEBUG(": %lld zero:%d", nfound, both_zero);
return nfound;
}
@@ -2814,41 +2881,43 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi
* Purpose: convert unsigned long long to float
*-------------------------------------------------------------------------
*/
-static
-int ull2float(unsigned long long ull_value, float *f_value)
+static int
+ull2float(unsigned long long ull_value, float *f_value)
{
hid_t dxpl_id = H5I_INVALID_HID;
- unsigned char *buf = NULL;
+ unsigned char *buf = NULL;
size_t src_size;
size_t dst_size;
int ret_value = 0;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed");
src_size = H5Tget_size(H5T_NATIVE_ULLONG);
dst_size = H5Tget_size(H5T_NATIVE_FLOAT);
- if((buf = (unsigned char*) HDcalloc((size_t )1, MAX(src_size, dst_size))) == NULL)
+ if ((buf = (unsigned char *)HDcalloc((size_t)1, MAX(src_size, dst_size))) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for dims");
HDmemcpy(buf, &ull_value, src_size);
/* do conversion */
- if (H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t) 1, buf, NULL, dxpl_id) < 0)
+ if (H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Tconvert failed");
HDmemcpy(f_value, buf, dst_size);
done:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dxpl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
if (buf)
HDfree(buf);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -2858,26 +2927,28 @@ done:
* Purpose: use a absolute error formula to deal with floating point uncertainty
*-------------------------------------------------------------------------
*/
-static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
+static hbool_t
+equal_double(double value, double expected, diff_opt_t *opts)
+{
if (opts->do_nans) {
/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
hbool_t isnan1 = HDisnan(value);
hbool_t isnan2 = HDisnan(expected);
/*-------------------------------------------------------------------------
- * we consider NaN == NaN to be true
- *-------------------------------------------------------------------------
- */
+ * we consider NaN == NaN to be true
+ *-------------------------------------------------------------------------
+ */
if (isnan1 && isnan2)
return TRUE;
/*-------------------------------------------------------------------------
- * one is a NaN, do not compare but assume difference
- *-------------------------------------------------------------------------
- */
+ * one is a NaN, do not compare but assume difference
+ *-------------------------------------------------------------------------
+ */
if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
return FALSE;
}
@@ -2903,9 +2974,9 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE !=0
-static
-hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
+#if H5_SIZEOF_LONG_DOUBLE != 0
+static hbool_t
+equal_ldouble(long double value, long double expected, diff_opt_t *opts)
{
if (opts->do_nans) {
/*-------------------------------------------------------------------------
@@ -2952,12 +3023,14 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
* Purpose: use a absolute error formula to deal with floating point uncertainty
*-------------------------------------------------------------------------
*/
-static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
+static hbool_t
+equal_float(float value, float expected, diff_opt_t *opts)
+{
if (opts->do_nans) {
/*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
hbool_t isnan1 = HDisnan(value);
hbool_t isnan2 = HDisnan(expected);
@@ -2990,7 +3063,6 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
return FALSE;
}
-
/*-------------------------------------------------------------------------
*
* Local functions
@@ -3004,8 +3076,8 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
* Purpose: print data only in report or verbose modes, and do not print in quiet mode
*-------------------------------------------------------------------------
*/
-static
-int print_data(diff_opt_t *opts)
+static int
+print_data(diff_opt_t *opts)
{
return ((opts->mode_report || opts->mode_verbose) && !opts->mode_quiet) ? 1 : 0;
}
@@ -3016,8 +3088,8 @@ int print_data(diff_opt_t *opts)
* Purpose: print header for difference
*-------------------------------------------------------------------------
*/
-static
-void print_header(diff_opt_t *opts)
+static void
+print_header(diff_opt_t *opts)
{
/* print header */
parallel_print("%-16s", "size:");
@@ -3027,16 +3099,14 @@ void print_header(diff_opt_t *opts)
parallel_print("\n");
if (opts->print_percentage) {
- parallel_print("%-15s %-15s %-15s %-15s %-15s\n", "position",
- opts->obj_name[0], opts->obj_name[1], "difference", "relative");
- parallel_print(
- "------------------------------------------------------------------------\n");
+ parallel_print("%-15s %-15s %-15s %-15s %-15s\n", "position", opts->obj_name[0], opts->obj_name[1],
+ "difference", "relative");
+ parallel_print("------------------------------------------------------------------------\n");
}
else {
- parallel_print("%-15s %-15s %-15s %-20s\n", "position",
- opts->obj_name[0], opts->obj_name[1], "difference");
- parallel_print(
- "------------------------------------------------------------\n");
+ parallel_print("%-15s %-15s %-15s %-20s\n", "position", opts->obj_name[0], opts->obj_name[1],
+ "difference");
+ parallel_print("------------------------------------------------------------\n");
}
}
@@ -3046,76 +3116,90 @@ void print_header(diff_opt_t *opts)
* Purpose: print in matrix notation, converting from an array index position
*-------------------------------------------------------------------------
*/
-static
-void print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
+static void
+print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
{
- int i,j;
-
- H5TOOLS_START_DEBUG(" -- idx:%ld", idx);
+ H5TOOLS_START_DEBUG(" -- idx:%lld", idx);
if (print_data(opts)) {
+ hsize_t curr_pos = idx;
/* print header */
if (opts->print_header == 1) {
opts->print_header = 0;
-
print_header(opts);
} /* end print header */
H5TOOLS_DEBUG("rank=%d", opts->rank);
- if(opts->rank > 0) {
- hsize_t curr_pos = idx;
-
+ if (opts->rank > 0) {
parallel_print("[ ");
- H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", i, opts->hs_nelmts, opts->err_stat);
-
+ H5TOOLS_DEBUG("do calc_acc_pos[%lld] nelmts:%lld - errstat:%d", idx, opts->hs_nelmts,
+ opts->err_stat);
if (opts->sset[0] != NULL) {
/* Subsetting is used - calculate total position */
- hsize_t elmnt_cnt = 1;
- hsize_t dim_cnt = 0; /* previous dim size */
- hsize_t str_cnt = 0; /* previous dim stride */
- hsize_t curr_idx = idx; /* calculated running position */
- hsize_t str_idx = 0;
- hsize_t blk_idx = 0;
- hsize_t cnt_idx = 0;
- hsize_t hs_idx = 0;
- j = opts->rank-1;
- do {
- cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - count:%ld", j, curr_pos, curr_idx, cnt_idx);
- blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - block:%ld", j, curr_pos, curr_idx, blk_idx);
- hs_idx = cnt_idx * blk_idx; /* hyperslab area value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - hs:%ld", j, curr_pos, curr_idx, hs_idx);
- str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - stride:%ld", j, curr_pos, curr_idx, str_idx);
- elmnt_cnt *= opts->dims[j]; /* Total number of elements in dimension */
- H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld", j, elmnt_cnt);
- if (str_idx > blk_idx)
- curr_idx += dim_cnt * (str_idx - blk_idx); /* */
- else if (curr_idx >= hs_idx)
- curr_idx += dim_cnt * str_cnt;
- H5TOOLS_DEBUG("... sset loop:%d with idx:%ld (curr_idx:%ld) - stride:%ld", j, idx, curr_idx, str_idx);
- dim_cnt = elmnt_cnt; /* */
- if (str_idx > blk_idx)
- str_cnt = str_idx - blk_idx; /* */
- else
- str_cnt = str_idx; /* */
- H5TOOLS_DEBUG("... sset loop:%d with dim_cnt:%ld - str_cnt:%ld", j, dim_cnt, str_cnt);
- j--;
- } while (curr_idx >= elmnt_cnt && j >= 0);
- curr_pos = curr_idx; /* New current position */
- H5TOOLS_DEBUG("pos loop:%d,%d with elmnt_cnt:%ld - curr_pos:%ld", i, j, elmnt_cnt, curr_pos);
- } /* if (opts->sset[0] != NULL) */
+ hsize_t curr_idx = 0; /* current pos in the selection space for each dimension */
+
+ curr_pos = 0; /* current position in full space */
+ if (curr_idx < idx) {
+ int j;
+ hsize_t count;
+ hsize_t block;
+ hsize_t stride;
+ hsize_t tmp = 0;
+ hsize_t k0 = 0; /* whole location beyond current dimension */
+ hsize_t k1 = 0; /* partial location within dimension */
+ hsize_t dim_size = 0; /* previous dim size */
+ hsize_t prev_dim_size = 0; /* previous dim size */
+ hsize_t total_dim_size = 1; /* current dim size */
+ hsize_t prev_total_dim_size = 1; /* current dim size */
+
+ prev_dim_size = 1;
+ total_dim_size = 1;
+ curr_idx = idx;
+ /* begin with fastest changing dimension */
+ for (int i = 0; i < opts->rank; i++) {
+ j = opts->rank - i - 1;
+ prev_total_dim_size *= prev_dim_size;
+ dim_size = opts->dims[j];
+ H5TOOLS_DEBUG("j=%d, dim_size=%lld, prev_dim_size=%lld, total_dim_size=%lld, "
+ "prev_total_dim_size=%lld",
+ j, dim_size, prev_dim_size, total_dim_size, prev_total_dim_size);
+ count = opts->sset[0]->count.data[j];
+ block = opts->sset[0]->block.data[j];
+ stride = opts->sset[0]->stride.data[j];
+ H5TOOLS_DEBUG("stride=%lld, count=%lld, block=%lld", stride, count, block);
+ tmp = count * block;
+ k0 = curr_idx / tmp;
+ k1 = curr_idx % tmp;
+ curr_pos += k1 * stride * prev_total_dim_size;
+ H5TOOLS_DEBUG("curr_idx=%lld, k0=%lld, k1=%lld, curr_pos=%lld", curr_idx, k0, k1,
+ curr_pos);
+ if (k0 > 0)
+ curr_idx = k0 * total_dim_size;
+ H5TOOLS_DEBUG("curr_idx=%lld, tmp=%lld", curr_idx, tmp);
+ total_dim_size *= dim_size;
+ /* if last calculation exists within in current dimension */
+ if (k0 == 0)
+ break;
+ H5TOOLS_DEBUG("j=%d, curr_pos=%lld", j, curr_pos);
+ prev_dim_size = dim_size;
+ }
+ /* check if there is a final calculation needed for slowest changing dimension */
+ if (k0 > 0)
+ curr_pos += k0 * stride * prev_total_dim_size;
+ H5TOOLS_DEBUG("4:curr_idx=%lld, curr_pos=%lld", curr_idx, curr_pos);
+ }
+ }
/*
* Calculate the number of elements represented by a unit change in a
* certain index position.
*/
calc_acc_pos((unsigned)opts->rank, curr_pos, opts->acc, opts->pos);
- for (i = 0; i < opts->rank; i++) {
- H5TOOLS_DEBUG("pos loop:%d with opts->pos=%ld opts->sm_pos=%ld", i, opts->pos[i], opts->sm_pos[i]);
- opts->pos[i] += (unsigned long) opts->sm_pos[i];
- H5TOOLS_DEBUG("pos loop:%d with opts->pos=%ld", i, opts->pos[i]);
+ for (int i = 0; i < opts->rank; i++) {
+ H5TOOLS_DEBUG("pos loop:%d with opts->pos=%lld opts->sm_pos=%lld", i, opts->pos[i],
+ opts->sm_pos[i]);
+ opts->pos[i] += (unsigned long)opts->sm_pos[i];
+ H5TOOLS_DEBUG("pos loop:%d with opts->pos=%lld", i, opts->pos[i]);
parallel_print(HSIZE_T_FORMAT, (unsigned long long)opts->pos[i]);
parallel_print(" ");
}
@@ -3134,7 +3218,7 @@ void print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
parallel_print(SPACES);
}
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
}
/*-------------------------------------------------------------------------
@@ -3143,36 +3227,37 @@ void print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
* Purpose: Print a char
*-------------------------------------------------------------------------
*/
-static void h5diff_print_char(char ch)
+static void
+h5diff_print_char(char ch)
{
switch (ch) {
- case '"':
- parallel_print("\\\"");
- break;
- case '\\':
- parallel_print("\\\\");
- break;
- case '\b':
- parallel_print("\\b");
- break;
- case '\f':
- parallel_print("\\f");
- break;
- case '\n':
- parallel_print("\\n");
- break;
- case '\r':
- parallel_print("\\r");
- break;
- case '\t':
- parallel_print("\\t");
- break;
- default:
- if (isprint(ch))
- parallel_print("%c", ch);
- else
- parallel_print("\\%03o", ch);
- break;
+ case '"':
+ parallel_print("\\\"");
+ break;
+ case '\\':
+ parallel_print("\\\\");
+ break;
+ case '\b':
+ parallel_print("\\b");
+ break;
+ case '\f':
+ parallel_print("\\f");
+ break;
+ case '\n':
+ parallel_print("\\n");
+ break;
+ case '\r':
+ parallel_print("\\r");
+ break;
+ case '\t':
+ parallel_print("\\t");
+ break;
+ default:
+ if (isprint(ch))
+ parallel_print("%c", ch);
+ else
+ parallel_print("\\%03o", ch);
+ break;
}
}
@@ -3181,7 +3266,8 @@ static void h5diff_print_char(char ch)
* set up compound datatype structures.
*-------------------------------------------------------------------------
*/
-static void get_member_types(hid_t tid, mcomp_t *members)
+static void
+get_member_types(hid_t tid, mcomp_t *members)
{
int tclass;
unsigned u;
@@ -3200,22 +3286,20 @@ static void get_member_types(hid_t tid, mcomp_t *members)
if ((nmembs = H5Tget_nmembers(tid)) <= 0)
return;
- members->n = (unsigned) nmembs;
+ members->n = (unsigned)nmembs;
- members->ids = (hid_t *) HDcalloc((size_t )members->n, sizeof(hid_t));
- members->offsets = (size_t *) HDcalloc((size_t )members->n, sizeof(size_t));
- members->m = (mcomp_t **) HDcalloc((size_t )members->n, sizeof(mcomp_t *));
+ members->ids = (hid_t *)HDcalloc((size_t)members->n, sizeof(hid_t));
+ members->offsets = (size_t *)HDcalloc((size_t)members->n, sizeof(size_t));
+ members->m = (mcomp_t **)HDcalloc((size_t)members->n, sizeof(mcomp_t *));
for (u = 0; u < members->n; u++) {
- members->ids[u] = H5Tget_member_type(tid, u);
+ members->ids[u] = H5Tget_member_type(tid, u);
members->offsets[u] = H5Tget_member_offset(tid, u);
- members->m[u] = (mcomp_t *) HDmalloc(sizeof(mcomp_t));
+ members->m[u] = (mcomp_t *)HDmalloc(sizeof(mcomp_t));
HDmemset(members->m[u], 0, sizeof(mcomp_t));
get_member_types(members->ids[u], members->m[u]);
}
}
-
- return;
}
/*-------------------------------------------------------------------------
@@ -3223,7 +3307,8 @@ static void get_member_types(hid_t tid, mcomp_t *members)
* clean and close compound members.
*-------------------------------------------------------------------------
*/
-static void close_member_types(mcomp_t *members)
+static void
+close_member_types(mcomp_t *members)
{
unsigned u;
@@ -3242,4 +3327,3 @@ static void close_member_types(mcomp_t *members)
HDfree(members->ids);
HDfree(members->offsets);
}
-
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 1473146..642b57b 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -19,19 +19,18 @@
#define ATTR_NAME_MAX 255
typedef struct table_attr_t {
- char *name;
- unsigned exist[2];
+ char * name;
+ unsigned exist[2];
} match_attr_t;
typedef struct table_attrs_t {
- size_t size;
- size_t nattrs;
- size_t nattrs_only1;
- size_t nattrs_only2;
+ size_t size;
+ size_t nattrs;
+ size_t nattrs_only1;
+ size_t nattrs_only2;
match_attr_t *attrs;
} table_attrs_t;
-
/*-------------------------------------------------------------------------
* Function: table_attrs_init
*
@@ -44,15 +43,16 @@ typedef struct table_attrs_t {
*
* Date: March 15, 2011
*------------------------------------------------------------------------*/
-static void table_attrs_init(table_attrs_t **tbl)
+static void
+table_attrs_init(table_attrs_t **tbl)
{
- table_attrs_t* table_attrs = (table_attrs_t*) HDmalloc(sizeof(table_attrs_t));
+ table_attrs_t *table_attrs = (table_attrs_t *)HDmalloc(sizeof(table_attrs_t));
- table_attrs->size = 0;
- table_attrs->nattrs = 0;
+ table_attrs->size = 0;
+ table_attrs->nattrs = 0;
table_attrs->nattrs_only1 = 0;
table_attrs->nattrs_only2 = 0;
- table_attrs->attrs = NULL;
+ table_attrs->attrs = NULL;
*tbl = table_attrs;
}
@@ -69,7 +69,8 @@ static void table_attrs_init(table_attrs_t **tbl)
*
* Date: March 15, 2011
*------------------------------------------------------------------------*/
-static void table_attrs_free( table_attrs_t *table )
+static void
+table_attrs_free(table_attrs_t *table)
{
unsigned int i;
@@ -102,24 +103,25 @@ static void table_attrs_free( table_attrs_t *table )
*
* Date: March 15, 2011
*------------------------------------------------------------------------*/
-static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *table)
+static void
+table_attr_mark_exist(const unsigned *exist, char *name, table_attrs_t *table)
{
- if(table->nattrs == table->size) {
+ if (table->nattrs == table->size) {
match_attr_t *new_attrs;
table->size = MAX(1, table->size * 2);
- new_attrs = (match_attr_t *)HDrealloc(table->attrs, table->size * sizeof(match_attr_t));
- if(new_attrs)
+ new_attrs = (match_attr_t *)HDrealloc(table->attrs, table->size * sizeof(match_attr_t));
+ if (new_attrs)
table->attrs = new_attrs;
} /* end if */
- if(table->nattrs < table->size) {
+ if (table->nattrs < table->size) {
size_t curr_val;
- curr_val = table->nattrs;
+ curr_val = table->nattrs;
table->attrs[curr_val].exist[0] = exist[0];
table->attrs[curr_val].exist[1] = exist[1];
- if(name)
+ if (name)
table->attrs[curr_val].name = (char *)HDstrdup(name);
table->nattrs++;
}
@@ -137,14 +139,15 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta
* Parameter:
* table_out [OUT] : return the list
*------------------------------------------------------------------------*/
-static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts)
+static herr_t
+build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t **table_out, diff_opt_t *opts)
{
table_attrs_t *table_lp = NULL;
- H5O_info_t oinfo1, oinfo2; /* Object info */
- hid_t attr1_id = H5I_INVALID_HID; /* attr ID */
- hid_t attr2_id = H5I_INVALID_HID; /* attr ID */
- size_t curr1 = 0;
- size_t curr2 = 0;
+ H5O_info_t oinfo1, oinfo2; /* Object info */
+ hid_t attr1_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr2_id = H5I_INVALID_HID; /* attr ID */
+ size_t curr1 = 0;
+ size_t curr2 = 0;
unsigned infile[2];
char name1[ATTR_NAME_MAX];
char name2[ATTR_NAME_MAX];
@@ -154,11 +157,11 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
- if(H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) {
+ if (H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) {
H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info first object failed");
}
H5TOOLS_DEBUG("H5Oget_info3 loc1id=%d", oinfo1.num_attrs);
- if(H5Oget_info2(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) {
+ if (H5Oget_info2(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) {
H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info second object failed");
}
H5TOOLS_DEBUG("H5Oget_info3 loc2id=%d", oinfo2.num_attrs);
@@ -170,37 +173,39 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/*--------------------------------------------------
* build the list
*/
- while(curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) {
+ while (curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) {
H5TOOLS_DEBUG("list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs);
H5TOOLS_DEBUG("list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs);
/*------------------
- * open attribute1 */
- if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ * open attribute1 */
+ if ((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx first attribute failed");
/* get name */
- if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
+ if (H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed");
/*------------------
- * open attribute2 */
- if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ * open attribute2 */
+ if ((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx second attribute failed");
/* get name */
- if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
+ if (H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed");
/* criteria is string compare */
cmp = HDstrcmp(name1, name2);
- if(cmp == 0) {
+ if (cmp == 0) {
infile[0] = 1;
infile[1] = 1;
table_attr_mark_exist(infile, name1, table_lp);
curr1++;
curr2++;
}
- else if(cmp < 0) {
+ else if (cmp < 0) {
infile[0] = 1;
infile[1] = 0;
table_attr_mark_exist(infile, name1, table_lp);
@@ -225,15 +230,16 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* list1 did not end */
infile[0] = 1;
infile[1] = 0;
- while(curr1 < oinfo1.num_attrs) {
+ while (curr1 < oinfo1.num_attrs) {
H5TOOLS_DEBUG("list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs);
/*------------------
- * open attribute1 */
- if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ * open attribute1 */
+ if ((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx first attribute failed");
/* get name */
- if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
+ if (H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed");
H5TOOLS_DEBUG("list_attrs 1 name - %s", name1);
@@ -249,14 +255,15 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* list2 did not end */
infile[0] = 0;
infile[1] = 1;
- while(curr2 < oinfo2.num_attrs) {
+ while (curr2 < oinfo2.num_attrs) {
H5TOOLS_DEBUG("list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs);
/*------------------
- * open attribute2 */
- if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ * open attribute2 */
+ if ((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx second attribute failed");
/* get name */
- if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
+ if (H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed");
H5TOOLS_DEBUG("list_attrs 2 name - %s", name2);
@@ -272,11 +279,11 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/*------------------------------------------------------
* print the list
*/
- if(opts->mode_verbose_level == 2) {
+ if (opts->mode_verbose_level == 2) {
/* if '-v2' is detected */
parallel_print(" obj1 obj2\n");
parallel_print(" --------------------------------------\n");
- for(i = 0; i < (unsigned int) table_lp->nattrs; i++) {
+ for (i = 0; i < (unsigned int)table_lp->nattrs; i++) {
int c1, c2;
c1 = (table_lp->attrs[i].exist[0]) ? 'x' : ' ';
c2 = (table_lp->attrs[i].exist[1]) ? 'x' : ' ';
@@ -284,19 +291,21 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
} /* end for */
}
- if(opts->mode_verbose_level >= 1)
+ if (opts->mode_verbose_level >= 1)
parallel_print("Attributes status: %d common, %d only in obj1, %d only in obj2\n",
- table_lp->nattrs - table_lp->nattrs_only1 - table_lp->nattrs_only2,
- table_lp->nattrs_only1, table_lp->nattrs_only2);
+ table_lp->nattrs - table_lp->nattrs_only1 - table_lp->nattrs_only2,
+ table_lp->nattrs_only1, table_lp->nattrs_only2);
done:
*table_out = table_lp;
/* disable error reporting */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(attr1_id);
H5Aclose(attr2_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
@@ -313,61 +322,62 @@ done:
*-------------------------------------------------------------------------
*/
-hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
- const char *name1, const char *name2, const char *path1, const char *path2, diff_opt_t *opts)
+hsize_t
+diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2, const char *path1,
+ const char *path2, diff_opt_t *opts)
{
- hid_t space1_id = H5I_INVALID_HID; /* space ID */
- hid_t space2_id = H5I_INVALID_HID; /* space ID */
- hid_t ftype1_id = H5I_INVALID_HID; /* file data type ID */
- hid_t ftype2_id = H5I_INVALID_HID; /* file data type ID */
- hid_t mtype1_id = H5I_INVALID_HID; /* memory data type ID */
- hid_t mtype2_id = H5I_INVALID_HID; /* memory data type ID */
- size_t msize1; /* memory size of memory type */
- size_t msize2; /* memory size of memory type */
- void *buf1 = NULL; /* data buffer */
- void *buf2 = NULL; /* data buffer */
- hbool_t buf1hasdata = FALSE; /* buffer has data */
- hbool_t buf2hasdata = FALSE; /* buffer has data */
- int rank1; /* rank of dataset */
- int rank2; /* rank of dataset */
- hsize_t dims1[H5S_MAX_RANK]; /* dimensions of dataset */
- hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */
+ hid_t space1_id = H5I_INVALID_HID; /* space ID */
+ hid_t space2_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype1_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t ftype2_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype1_id = H5I_INVALID_HID; /* memory data type ID */
+ hid_t mtype2_id = H5I_INVALID_HID; /* memory data type ID */
+ size_t msize1; /* memory size of memory type */
+ size_t msize2; /* memory size of memory type */
+ void * buf1 = NULL; /* data buffer */
+ void * buf2 = NULL; /* data buffer */
+ hbool_t buf1hasdata = FALSE; /* buffer has data */
+ hbool_t buf2hasdata = FALSE; /* buffer has data */
+ int rank1; /* rank of dataset */
+ int rank2; /* rank of dataset */
+ hsize_t dims1[H5S_MAX_RANK]; /* dimensions of dataset */
+ hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */
hsize_t nfound = 0;
size_t sz;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/* get the datatypes */
- if((ftype1_id = H5Aget_type(attr1_id)) < 0)
+ if ((ftype1_id = H5Aget_type(attr1_id)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed");
- if((ftype2_id = H5Aget_type(attr2_id)) < 0)
+ if ((ftype2_id = H5Aget_type(attr2_id)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed");
- if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0)
+ if ((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type first attribute ftype failed");
- if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0)
+ if ((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type second attribute ftype failed");
- if((msize1 = H5Tget_size(mtype1_id)) == 0)
+ if ((msize1 = H5Tget_size(mtype1_id)) == 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_size first attribute mtype failed");
- if((msize2 = H5Tget_size(mtype2_id)) == 0)
+ if ((msize2 = H5Tget_size(mtype2_id)) == 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_size second attribute mtype failed");
/* get the dataspace */
- if((space1_id = H5Aget_space(attr1_id)) < 0)
+ if ((space1_id = H5Aget_space(attr1_id)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_space first attribute failed");
- if((space2_id = H5Aget_space(attr2_id)) < 0)
+ if ((space2_id = H5Aget_space(attr2_id)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_space second attribute failed");
/* get dimensions */
- if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0)
+ if ((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims first attribute failed");
- if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0)
+ if ((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims second attribute failed");
/*----------------------------------------------------------------------
- * check for comparable TYPE and SPACE
- *----------------------------------------------------------------------
- */
+ * check for comparable TYPE and SPACE
+ *----------------------------------------------------------------------
+ */
H5TOOLS_DEBUG("Check for comparable TYPE and SPACE");
H5TOOLS_DEBUG("attr_names: %s - %s", name1, name2);
@@ -390,25 +400,25 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
H5TOOLS_DEBUG("attr_names: %s - %s", opts->obj_name[0], opts->obj_name[1]);
/* pass dims1 and dims2 for maxdims as well since attribute's maxdims
- * are always same */
- if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, dims1, dims2, opts, 0) == 1) {
+ * are always same */
+ if (diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, dims1, dims2, opts, 0) == 1) {
int j;
/*-----------------------------------------------------------------
- * "upgrade" the smaller memory size
- *------------------------------------------------------------------
- */
- if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2))
+ * "upgrade" the smaller memory size
+ *------------------------------------------------------------------
+ */
+ if (FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed");
H5TOOLS_DEBUG("initialize read");
/*---------------------------------------------------------------------
- * initialize diff_opt_t structure for dimensions
- *----------------------------------------------------------------------
- */
+ * initialize diff_opt_t structure for dimensions
+ *----------------------------------------------------------------------
+ */
opts->nelmts = 1;
- for(j = 0; j < rank1; j++) {
+ for (j = 0; j < rank1; j++) {
opts->dims[j] = dims1[j];
opts->nelmts *= dims1[j];
}
@@ -416,17 +426,17 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx);
/*---------------------------------------------------------------------
- * read
- *----------------------------------------------------------------------
- */
+ * read
+ *----------------------------------------------------------------------
+ */
buf1 = (void *)HDcalloc((size_t)(opts->nelmts), msize1);
buf2 = (void *)HDcalloc((size_t)(opts->nelmts), msize2);
H5TOOLS_DEBUG("attr buffer size %ld * %ld", opts->nelmts, msize1);
- if(buf1 == NULL || buf2 == NULL) {
+ if (buf1 == NULL || buf2 == NULL) {
parallel_print("cannot read into memory\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "buffer allocation failed");
}
- if(H5Aread(attr1_id, mtype1_id, buf1) < 0) {
+ if (H5Aread(attr1_id, mtype1_id, buf1) < 0) {
parallel_print("Failed reading attribute1 %s\n", name1);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed");
}
@@ -434,7 +444,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
buf1hasdata = TRUE;
H5TOOLS_DEBUG("attr H5Aread 1");
- if(H5Aread(attr2_id, mtype2_id, buf2) < 0) {
+ if (H5Aread(attr2_id, mtype2_id, buf2) < 0) {
parallel_print("Failed reading attribute2 %s\n", name2);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed");
}
@@ -444,10 +454,10 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
/* format output string */
if (opts->obj_name[0] != NULL)
- HDfree(opts->obj_name[0]);
+ HDfree(opts->obj_name[0]);
opts->obj_name[0] = NULL;
if (opts->obj_name[1] != NULL)
- HDfree(opts->obj_name[1]);
+ HDfree(opts->obj_name[1]);
opts->obj_name[1] = NULL;
H5TOOLS_DEBUG("attr_names: %s - %s : %s - %s", name1, name2, path1, path2);
@@ -467,13 +477,13 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
}
/*---------------------------------------------------------------------
- * array compare
- *----------------------------------------------------------------------
- */
+ * array compare
+ *----------------------------------------------------------------------
+ */
H5TOOLS_DEBUG("array compare %s - %s", opts->obj_name[0], opts->obj_name[1]);
opts->hs_nelmts = opts->nelmts;
- opts->m_tid = mtype1_id;
+ opts->m_tid = mtype1_id;
/* initialize the current stripmine position; this is necessary to print the array indices */
for (j = 0; j < opts->rank; j++)
@@ -481,14 +491,14 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
/* always print name */
/* verbose (-v) and report (-r) mode */
- if(opts->mode_verbose || opts->mode_report) {
+ if (opts->mode_verbose || opts->mode_report) {
do_print_attrname("attribute", opts->obj_name[0], opts->obj_name[1]);
nfound = diff_array(buf1, buf2, opts, attr1_id, attr2_id);
print_found(nfound);
}
/* quiet mode (-q), just count differences */
- else if(opts->mode_quiet) {
+ else if (opts->mode_quiet) {
nfound = diff_array(buf1, buf2, opts, attr1_id, attr2_id);
}
/* the rest (-c, none, ...) */
@@ -500,57 +510,59 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
do_print_attrname("attribute", opts->obj_name[0], opts->obj_name[1]);
print_found(nfound);
} /* end if */
- } /* end else */
+ } /* end else */
}
- H5TOOLS_DEBUG("check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_DEBUG("check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound,
+ opts->err_stat);
/*----------------------------------------------------------------------
- * close
- *----------------------------------------------------------------------
- */
- if (opts->obj_name[0] != NULL)
+ * close
+ *----------------------------------------------------------------------
+ */
+ if (opts->obj_name[0] != NULL)
HDfree(opts->obj_name[0]);
- opts->obj_name[0] = NULL;
- if (opts->obj_name[1] != NULL)
+ opts->obj_name[0] = NULL;
+ if (opts->obj_name[1] != NULL)
HDfree(opts->obj_name[1]);
- opts->obj_name[1] = NULL;
+ opts->obj_name[1] = NULL;
/* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any
- * VLEN memory first */
- if(TRUE == h5tools_detect_vlen(mtype1_id))
+ * VLEN memory first */
+ if (TRUE == h5tools_detect_vlen(mtype1_id))
H5Dvlen_reclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
HDfree(buf1);
buf1 = NULL;
- if(TRUE == h5tools_detect_vlen(mtype2_id))
+ if (TRUE == h5tools_detect_vlen(mtype2_id))
H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
HDfree(buf2);
buf2 = NULL;
- if(H5Tclose(ftype1_id) < 0)
+ if (H5Tclose(ftype1_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed");
- if(H5Tclose(ftype2_id) < 0)
+ if (H5Tclose(ftype2_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed");
- if(H5Sclose(space1_id) < 0)
+ if (H5Sclose(space1_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed");
- if(H5Sclose(space2_id) < 0)
+ if (H5Sclose(space2_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed");
- if(H5Tclose(mtype1_id) < 0)
+ if (H5Tclose(mtype1_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose first attribute mtype failed");
- if(H5Tclose(mtype2_id) < 0)
+ if (H5Tclose(mtype2_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose second attribute mtype failed");
done:
opts->err_stat = opts->err_stat | ret_value;
- H5E_BEGIN_TRY {
- if(buf1) {
- if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id))
+ H5E_BEGIN_TRY
+ {
+ if (buf1) {
+ if (buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id))
H5Dvlen_reclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
HDfree(buf1);
} /* end if */
- if(buf2) {
- if(buf2hasdata && TRUE == h5tools_detect_vlen(mtype2_id))
+ if (buf2) {
+ if (buf2hasdata && TRUE == h5tools_detect_vlen(mtype2_id))
H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
HDfree(buf2);
} /* end if */
@@ -561,7 +573,8 @@ done:
H5Tclose(mtype2_id);
H5Sclose(space1_id);
H5Sclose(space2_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
@@ -581,58 +594,60 @@ done:
*-------------------------------------------------------------------------
*/
-hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *path2, diff_opt_t *opts)
+hsize_t
+diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *path2, diff_opt_t *opts)
{
table_attrs_t *match_list_attrs = NULL;
- hid_t attr1_id = H5I_INVALID_HID; /* attr ID */
- hid_t attr2_id = H5I_INVALID_HID; /* attr ID */
- char *name1 = NULL;
- char *name2 = NULL;
- unsigned u; /* Local index variable */
- hsize_t nfound = 0;
+ hid_t attr1_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr2_id = H5I_INVALID_HID; /* attr ID */
+ char * name1 = NULL;
+ char * name2 = NULL;
+ unsigned u; /* Local index variable */
+ hsize_t nfound = 0;
hsize_t nfound_total = 0;
- diff_opt_t attr_opts;
+ diff_opt_t attr_opts;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
- attr_opts = *opts;
+ attr_opts = *opts;
attr_opts.obj_name[0] = NULL;
attr_opts.obj_name[1] = NULL;
- if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, &attr_opts) < 0) {
+ if (build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, &attr_opts) < 0) {
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "build_match_list_attrs failed");
}
- H5TOOLS_DEBUG("check match_list_attrs - opts->contents:%d - errstat:%d", attr_opts.contents, attr_opts.err_stat);
+ H5TOOLS_DEBUG("check match_list_attrs - opts->contents:%d - errstat:%d", attr_opts.contents,
+ attr_opts.err_stat);
/* if detect any unique extra attr */
- if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) {
+ if (match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) {
H5TOOLS_DEBUG("attributes only in one file");
/* exit will be 1 */
attr_opts.contents = 0;
}
H5TOOLS_DEBUG("match_list_attrs info - opts->contents:%d", attr_opts.contents);
- for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) {
+ for (u = 0; u < (unsigned)match_list_attrs->nattrs; u++) {
H5TOOLS_DEBUG("match_list_attrs loop[%d] - errstat:%d", u, attr_opts.err_stat);
- if((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) {
+ if ((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) {
name1 = name2 = match_list_attrs->attrs[u].name;
H5TOOLS_DEBUG("name - %s", name1);
/*--------------
- * attribute 1 */
- if((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0)
+ * attribute 1 */
+ if ((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aopen first attribute failed");
/*--------------
- * attribute 2 */
- if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0)
+ * attribute 2 */
+ if ((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aopen second attribute failed");
H5TOOLS_DEBUG("got attributes");
nfound = diff_attr_data(attr1_id, attr2_id, name1, name2, path1, path2, &attr_opts);
- if(H5Aclose(attr1_id) < 0)
+ if (H5Aclose(attr1_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed");
- if(H5Aclose(attr2_id) < 0)
+ if (H5Aclose(attr2_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed");
nfound_total += nfound;
@@ -641,18 +656,19 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p
done:
opts->print_header = attr_opts.print_header;
- opts->contents = attr_opts.contents;
- opts->not_cmp = attr_opts.not_cmp;
- opts->err_stat = attr_opts.err_stat | ret_value;
+ opts->contents = attr_opts.contents;
+ opts->not_cmp = attr_opts.not_cmp;
+ opts->err_stat = attr_opts.err_stat | ret_value;
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
table_attrs_free(match_list_attrs);
H5Aclose(attr1_id);
H5Aclose(attr2_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
return nfound_total;
}
-
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 8fb24e1..0e276fc 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,7 +17,6 @@
#include "h5diff.h"
#include "ph5diff.h"
-
/*-------------------------------------------------------------------------
* Function: diff_dataset
*
@@ -31,16 +30,16 @@ hsize_t
diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
{
int status = -1;
- hid_t did1 = H5I_INVALID_HID;
- hid_t did2 = H5I_INVALID_HID;
- hid_t dcpl1 = H5I_INVALID_HID;
- hid_t dcpl2 = H5I_INVALID_HID;
+ hid_t did1 = H5I_INVALID_HID;
+ hid_t did2 = H5I_INVALID_HID;
+ hid_t dcpl1 = H5I_INVALID_HID;
+ hid_t dcpl2 = H5I_INVALID_HID;
hsize_t nfound = 0;
diff_opt_t diff_opts;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
- diff_opts = *opts;
+ diff_opts = *opts;
diff_opts.obj_name[0] = NULL;
diff_opts.obj_name[1] = NULL;
@@ -50,18 +49,18 @@ diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *
*-------------------------------------------------------------------------
*/
/* Open the datasets */
- if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) {
+ if ((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) {
parallel_print("Cannot open dataset <%s>\n", obj1_name);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 first dataset failed");
}
- if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) {
+ if ((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) {
parallel_print("Cannot open dataset <%s>\n", obj2_name);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 second dataset failed");
}
- if((dcpl1 = H5Dget_create_plist(did1)) < 0)
+ if ((dcpl1 = H5Dget_create_plist(did1)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist first dataset failed");
- if((dcpl2 = H5Dget_create_plist(did2)) < 0)
+ if ((dcpl2 = H5Dget_create_plist(did2)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist second dataset failed");
/*-------------------------------------------------------------------------
@@ -73,29 +72,31 @@ diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *
*/
H5TOOLS_DEBUG("h5tools_canreadf then diff_datasetid");
if ((status = h5tools_canreadf((opts->mode_verbose ? obj1_name : NULL), dcpl1) == 1) &&
- (status = h5tools_canreadf((opts->mode_verbose ? obj2_name : NULL), dcpl2) == 1))
+ (status = h5tools_canreadf((opts->mode_verbose ? obj2_name : NULL), dcpl2) == 1))
nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, &diff_opts);
else if (status < 0) {
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "h5tools_canreadf failed");
}
else {
- ret_value = 1;
+ ret_value = 1;
diff_opts.not_cmp = 1;
}
done:
opts->print_header = diff_opts.print_header;
- opts->not_cmp = diff_opts.not_cmp;
- opts->err_stat = diff_opts.err_stat | ret_value;
+ opts->not_cmp = diff_opts.not_cmp;
+ opts->err_stat = diff_opts.err_stat | ret_value;
/* disable error reporting */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl1);
H5Pclose(dcpl2);
H5Dclose(did1);
H5Dclose(did2);
/* enable error reporting */
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
return nfound;
@@ -155,67 +156,67 @@ done:
hsize_t
diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
{
- hid_t sid1 = H5I_INVALID_HID;
- hid_t sid2 = H5I_INVALID_HID;
- hid_t f_tid1 = H5I_INVALID_HID;
- hid_t f_tid2 = H5I_INVALID_HID;
- hid_t m_tid1 = H5I_INVALID_HID;
- hid_t m_tid2 = H5I_INVALID_HID;
- hid_t dcpl1 = H5I_INVALID_HID;
- hid_t dcpl2 = H5I_INVALID_HID;
- H5D_layout_t stl1 = -1;
- H5D_layout_t stl2 = -1;
- size_t m_size1;
- size_t m_size2;
- H5T_sign_t sign1;
- H5T_sign_t sign2;
- int rank1;
- int rank2;
- hsize_t nelmts1;
- hsize_t nelmts2;
- hsize_t dims1[H5S_MAX_RANK];
- hsize_t dims2[H5S_MAX_RANK];
- hsize_t maxdim1[H5S_MAX_RANK];
- hsize_t maxdim2[H5S_MAX_RANK];
- hsize_t storage_size1;
- hsize_t storage_size2;
- hsize_t nfound = 0; /* number of differences found */
- int can_compare = 1; /* do diff or not */
- void *buf1 = NULL;
- void *buf2 = NULL;
- void *sm_buf1 = NULL;
- void *sm_buf2 = NULL;
- hid_t sm_space1 = H5I_INVALID_HID; /*stripmine data space */
- hid_t sm_space2 = H5I_INVALID_HID; /*stripmine data space */
- size_t need; /* bytes needed for malloc */
- int i, j;
- unsigned int vl_data1 = 0; /*contains VL datatypes */
- unsigned int vl_data2 = 0; /*contains VL datatypes */
- diff_err_t ret_value = opts->err_stat;
+ hid_t sid1 = H5I_INVALID_HID;
+ hid_t sid2 = H5I_INVALID_HID;
+ hid_t f_tid1 = H5I_INVALID_HID;
+ hid_t f_tid2 = H5I_INVALID_HID;
+ hid_t m_tid1 = H5I_INVALID_HID;
+ hid_t m_tid2 = H5I_INVALID_HID;
+ hid_t dcpl1 = H5I_INVALID_HID;
+ hid_t dcpl2 = H5I_INVALID_HID;
+ H5D_layout_t stl1 = -1;
+ H5D_layout_t stl2 = -1;
+ size_t m_size1;
+ size_t m_size2;
+ H5T_sign_t sign1;
+ H5T_sign_t sign2;
+ int rank1;
+ int rank2;
+ hsize_t nelmts1;
+ hsize_t nelmts2;
+ hsize_t dims1[H5S_MAX_RANK];
+ hsize_t dims2[H5S_MAX_RANK];
+ hsize_t maxdim1[H5S_MAX_RANK];
+ hsize_t maxdim2[H5S_MAX_RANK];
+ hsize_t storage_size1;
+ hsize_t storage_size2;
+ hsize_t nfound = 0; /* number of differences found */
+ int can_compare = 1; /* do diff or not */
+ void * buf1 = NULL;
+ void * buf2 = NULL;
+ void * sm_buf1 = NULL;
+ void * sm_buf2 = NULL;
+ hid_t sm_space1 = H5I_INVALID_HID; /*stripmine data space */
+ hid_t sm_space2 = H5I_INVALID_HID; /*stripmine data space */
+ size_t need; /* bytes needed for malloc */
+ int i, j;
+ unsigned int vl_data1 = 0; /*contains VL datatypes */
+ unsigned int vl_data2 = 0; /*contains VL datatypes */
+ diff_err_t ret_value = opts->err_stat;
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/* Get the dataspace handle */
- if((sid1 = H5Dget_space(did1)) < 0)
+ if ((sid1 = H5Dget_space(did1)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_space failed");
/* Get rank */
- if((rank1 = H5Sget_simple_extent_ndims(sid1)) < 0)
+ if ((rank1 = H5Sget_simple_extent_ndims(sid1)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_ndims failed");
/* Get the dataspace handle */
- if((sid2 = H5Dget_space(did2)) < 0 )
+ if ((sid2 = H5Dget_space(did2)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_space failed");
/* Get rank */
- if((rank2 = H5Sget_simple_extent_ndims(sid2)) < 0)
+ if ((rank2 = H5Sget_simple_extent_ndims(sid2)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_ndims failed");
/* Get dimensions */
- if(H5Sget_simple_extent_dims(sid1, dims1, maxdim1) < 0)
+ if (H5Sget_simple_extent_dims(sid1, dims1, maxdim1) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims failed");
/* Get dimensions */
- if(H5Sget_simple_extent_dims(sid2, dims2, maxdim2) < 0)
+ if (H5Sget_simple_extent_dims(sid2, dims2, maxdim2) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims failed");
H5TOOLS_DEBUG("rank: %ld - %ld", rank1, rank2);
@@ -225,26 +226,26 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
*/
/* Get the data type */
- if((f_tid1 = H5Dget_type(did1)) < 0)
+ if ((f_tid1 = H5Dget_type(did1)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_type failed");
/* Get the data type */
- if((f_tid2 = H5Dget_type(did2)) < 0)
+ if ((f_tid2 = H5Dget_type(did2)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_type failed");
/*-------------------------------------------------------------------------
* get the storage layout type
*-------------------------------------------------------------------------
*/
- if((dcpl1 = H5Dget_create_plist(did1)) < 0)
+ if ((dcpl1 = H5Dget_create_plist(did1)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist failed");
- if((stl1 = H5Pget_layout(dcpl1)) < 0)
+ if ((stl1 = H5Pget_layout(dcpl1)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Pget_layout failed");
H5Pclose(dcpl1);
- if((dcpl2 = H5Dget_create_plist(did2)) < 0)
+ if ((dcpl2 = H5Dget_create_plist(did2)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist failed");
- if((stl2 = H5Pget_layout(dcpl2)) < 0)
+ if ((stl2 = H5Pget_layout(dcpl2)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Pget_layout failed");
H5Pclose(dcpl2);
@@ -258,15 +259,15 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
storage_size2 = H5Dget_storage_size(did2);
H5TOOLS_DEBUG("storage size: %ld - %ld", storage_size1, storage_size2);
- if(storage_size1 == 0 || storage_size2 == 0) {
- if(stl1 == H5D_VIRTUAL || stl2 == H5D_VIRTUAL) {
- if((opts->mode_verbose||opts->mode_list_not_cmp) && obj1_name && obj2_name)
+ if (storage_size1 == 0 || storage_size2 == 0) {
+ if (stl1 == H5D_VIRTUAL || stl2 == H5D_VIRTUAL) {
+ if ((opts->mode_verbose || opts->mode_list_not_cmp) && obj1_name && obj2_name)
parallel_print("Warning: <%s> or <%s> is a virtual dataset\n", obj1_name, obj2_name);
}
else {
- if((opts->mode_verbose || opts->mode_list_not_cmp) && obj1_name && obj2_name)
+ if ((opts->mode_verbose || opts->mode_list_not_cmp) && obj1_name && obj2_name)
parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name);
- can_compare = 0;
+ can_compare = 0;
opts->not_cmp = 1;
}
}
@@ -282,7 +283,6 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
}
}
-
opts->obj_name[1] = NULL;
if (obj2_name) {
j = (int)HDstrlen(obj2_name);
@@ -306,10 +306,10 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
*-------------------------------------------------------------------------
*/
H5TOOLS_DEBUG("check for memory type and sizes");
- if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0)
+ if ((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type first ftype failed");
- if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0)
+ if ((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type second ftype failed");
m_size1 = H5Tget_size(m_tid1);
@@ -320,18 +320,18 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
* check for different signed/unsigned types
*-------------------------------------------------------------------------
*/
- if(can_compare) {
+ if (can_compare) {
H5TOOLS_DEBUG("can_compare for sign");
sign1 = H5Tget_sign(m_tid1);
sign2 = H5Tget_sign(m_tid2);
- if(sign1 != sign2) {
+ if (sign1 != sign2) {
H5TOOLS_DEBUG("sign1 != sign2");
- if((opts->mode_verbose || opts->mode_list_not_cmp) && obj1_name && obj2_name) {
+ if ((opts->mode_verbose || opts->mode_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1));
parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
}
- can_compare = 0;
+ can_compare = 0;
opts->not_cmp = 1;
}
H5TOOLS_DEBUG("can_compare for sign - can_compare=%d opts->not_cmp=%d", can_compare, opts->not_cmp);
@@ -340,9 +340,9 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
/* Check if type is either VLEN-data or VLEN-string to reclaim any
* VLEN memory buffer later
*/
- if(TRUE == h5tools_detect_vlen(m_tid1))
+ if (TRUE == h5tools_detect_vlen(m_tid1))
vl_data1 = TRUE;
- if(TRUE == h5tools_detect_vlen(m_tid2))
+ if (TRUE == h5tools_detect_vlen(m_tid2))
vl_data2 = TRUE;
H5TOOLS_DEBUG("h5tools_detect_vlen %d:%d - errstat:%d", vl_data1, vl_data2, opts->err_stat);
@@ -350,61 +350,61 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
* only attempt to compare if possible
*-------------------------------------------------------------------------
*/
- if(can_compare) { /* it is possible to compare */
- H5T_class_t tclass = H5Tget_class(f_tid1);
+ if (can_compare) { /* it is possible to compare */
+ H5T_class_t tclass = H5Tget_class(f_tid1);
H5TOOLS_DEBUG("can_compare attempt");
/*-----------------------------------------------------------------
- * get number of elements
- *------------------------------------------------------------------
- */
+ * get number of elements
+ *------------------------------------------------------------------
+ */
nelmts1 = 1;
- for(i = 0; i < rank1; i++)
+ for (i = 0; i < rank1; i++)
nelmts1 *= dims1[i];
nelmts2 = 1;
- for(i = 0; i < rank2; i++)
+ for (i = 0; i < rank2; i++)
nelmts2 *= dims2[i];
H5TOOLS_DEBUG("nelmts: %ld - %ld", nelmts1, nelmts2);
- if(tclass != H5T_ARRAY) {
+ if (tclass != H5T_ARRAY) {
/*-----------------------------------------------------------------
* "upgrade" the smaller memory size
*------------------------------------------------------------------
*/
H5TOOLS_DEBUG("NOT H5T_ARRAY, upgrade the smaller memory size?");
- if (FAIL == match_up_memsize (f_tid1, f_tid2, &m_tid1, &m_tid2, &m_size1, &m_size2))
+ if (FAIL == match_up_memsize(f_tid1, f_tid2, &m_tid1, &m_tid2, &m_size1, &m_size2))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed");
H5TOOLS_DEBUG("m_size: %ld - %ld", m_size1, m_size2);
opts->rank = rank1;
- for(i = 0; i < rank1; i++)
+ for (i = 0; i < rank1; i++)
opts->dims[i] = dims1[i];
opts->m_size = m_size1;
- opts->m_tid = m_tid1;
+ opts->m_tid = m_tid1;
opts->nelmts = nelmts1;
- need = (size_t)(nelmts1 * m_size1); /* bytes needed */
+ need = (size_t)(nelmts1 * m_size1); /* bytes needed */
}
else {
H5TOOLS_DEBUG("Array dims: %d - %d", dims1[0], dims2[0]);
/* Compare the smallest array, but create the largest buffer */
- if(m_size1 <= m_size2) {
+ if (m_size1 <= m_size2) {
opts->rank = rank1;
- for(i = 0; i < rank1; i++)
+ for (i = 0; i < rank1; i++)
opts->dims[i] = dims1[i];
opts->m_size = m_size1;
- opts->m_tid = m_tid1;
+ opts->m_tid = m_tid1;
opts->nelmts = nelmts1;
- need = (size_t)(nelmts2 * m_size2); /* bytes needed */
+ need = (size_t)(nelmts2 * m_size2); /* bytes needed */
}
else {
opts->rank = rank2;
- for(i = 0; i < rank2; i++)
+ for (i = 0; i < rank2; i++)
opts->dims[i] = dims2[i];
opts->m_size = m_size2;
- opts->m_tid = m_tid2;
+ opts->m_tid = m_tid2;
opts->nelmts = nelmts2;
- need = (size_t)(nelmts1 * m_size1); /* bytes needed */
+ need = (size_t)(nelmts1 * m_size1); /* bytes needed */
}
}
opts->hs_nelmts = opts->nelmts;
@@ -413,25 +413,24 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
H5TOOLS_DEBUG("obj_names: %s - %s", obj1_name, obj2_name);
if (opts->obj_name[0] != NULL)
- HDfree(opts->obj_name[0]);
+ HDfree(opts->obj_name[0]);
opts->obj_name[0] = NULL;
if (opts->obj_name[1] != NULL)
- HDfree(opts->obj_name[1]);
+ HDfree(opts->obj_name[1]);
opts->obj_name[1] = NULL;
- if(obj1_name)
+ if (obj1_name)
opts->obj_name[0] = HDstrdup(diff_basename(obj1_name));
- if(obj2_name)
+ if (obj2_name)
opts->obj_name[1] = HDstrdup(diff_basename(obj2_name));
H5TOOLS_DEBUG("obj_names: %s - %s", opts->obj_name[0], opts->obj_name[1]);
-
H5TOOLS_DEBUG("read/compare");
/*----------------------------------------------------------------
* read/compare
*-----------------------------------------------------------------
*/
- if(need < H5TOOLS_MALLOCSIZE) {
+ if (need < H5TOOLS_MALLOCSIZE) {
buf1 = HDmalloc(need);
buf2 = HDmalloc(need);
} /* end if */
@@ -439,17 +438,17 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
/* Assume entire data space to be printed */
init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx);
- for(i = 0; i < opts->rank; i++) {
+ for (i = 0; i < opts->rank; i++) {
opts->p_max_idx[i] = opts->dims[i];
}
- if(buf1 != NULL && buf2 != NULL && opts->sset[0] == NULL && opts->sset[1] == NULL) {
+ if (buf1 != NULL && buf2 != NULL && opts->sset[0] == NULL && opts->sset[1] == NULL) {
H5TOOLS_DEBUG("buf1 != NULL && buf2 != NULL");
H5TOOLS_DEBUG("H5Dread did1");
- if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0)
+ if (H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed");
H5TOOLS_DEBUG("H5Dread did2");
- if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0)
+ if (H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed");
/* initialize the current stripmine position; this is necessary to print the array indices */
@@ -462,60 +461,60 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
/* reclaim any VL memory, if necessary */
H5TOOLS_DEBUG("check vl_data1:%d", vl_data1);
- if(vl_data1)
+ if (vl_data1)
H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
H5TOOLS_DEBUG("check vl_data2:%d", vl_data2);
- if(vl_data2)
+ if (vl_data2)
H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
- if(buf1 != NULL) {
+ if (buf1 != NULL) {
HDfree(buf1);
buf1 = NULL;
}
- if(buf2 != NULL) {
+ if (buf2 != NULL) {
HDfree(buf2);
buf2 = NULL;
}
- } /* end if */
- else { /* possibly not enough memory, read/compare by hyperslabs */
- hsize_t elmtno; /* counter */
- int carry; /* counter carry value */
+ } /* end if */
+ else { /* possibly not enough memory, read/compare by hyperslabs */
+ hsize_t elmtno; /* counter */
+ int carry; /* counter carry value */
/* stripmine info */
- hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
- hsize_t sm_block[H5S_MAX_RANK]; /* stripmine block size */
- hsize_t sm_nbytes; /* bytes per stripmine */
- hsize_t sm_nelmts1; /* elements per stripmine */
- hsize_t sm_nelmts2; /* elements per stripmine */
- hssize_t ssm_nelmts; /* elements temp */
+ hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
+ hsize_t sm_block[H5S_MAX_RANK]; /* stripmine block size */
+ hsize_t sm_nbytes; /* bytes per stripmine */
+ hsize_t sm_nelmts1; /* elements per stripmine */
+ hsize_t sm_nelmts2; /* elements per stripmine */
+ hssize_t ssm_nelmts; /* elements temp */
/* hyperslab info */
- hsize_t hs_offset1[H5S_MAX_RANK]; /* starting offset */
- hsize_t hs_count1[H5S_MAX_RANK]; /* number of blocks */
- hsize_t hs_block1[H5S_MAX_RANK]; /* size of blocks */
- hsize_t hs_stride1[H5S_MAX_RANK]; /* stride */
- hsize_t hs_size1[H5S_MAX_RANK]; /* size this pass */
- hsize_t hs_offset2[H5S_MAX_RANK]; /* starting offset */
- hsize_t hs_count2[H5S_MAX_RANK]; /* number of blocks */
- hsize_t hs_block2[H5S_MAX_RANK]; /* size of blocks */
- hsize_t hs_stride2[H5S_MAX_RANK]; /* stride */
- hsize_t hs_size2[H5S_MAX_RANK]; /* size this pass */
- hsize_t hs_nelmts1 = 0; /* elements in request */
- hsize_t hs_nelmts2 = 0; /* elements in request */
- hsize_t zero[8]; /* vector of zeros */
- hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */
- hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */
+ hsize_t hs_offset1[H5S_MAX_RANK]; /* starting offset */
+ hsize_t hs_count1[H5S_MAX_RANK]; /* number of blocks */
+ hsize_t hs_block1[H5S_MAX_RANK]; /* size of blocks */
+ hsize_t hs_stride1[H5S_MAX_RANK]; /* stride */
+ hsize_t hs_size1[H5S_MAX_RANK]; /* size this pass */
+ hsize_t hs_offset2[H5S_MAX_RANK]; /* starting offset */
+ hsize_t hs_count2[H5S_MAX_RANK]; /* number of blocks */
+ hsize_t hs_block2[H5S_MAX_RANK]; /* size of blocks */
+ hsize_t hs_stride2[H5S_MAX_RANK]; /* stride */
+ hsize_t hs_size2[H5S_MAX_RANK]; /* size this pass */
+ hsize_t hs_nelmts1 = 0; /* elements in request */
+ hsize_t hs_nelmts2 = 0; /* elements in request */
+ hsize_t zero[8]; /* vector of zeros */
+ hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */
+ hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */
H5TOOLS_DEBUG("reclaim any VL memory and free unused buffers");
- if(buf1 != NULL) {
+ if (buf1 != NULL) {
/* reclaim any VL memory, if necessary */
- if(vl_data1)
+ if (vl_data1)
H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
HDfree(buf1);
buf1 = NULL;
}
- if(buf2 != NULL) {
+ if (buf2 != NULL) {
/* reclaim any VL memory, if necessary */
- if(vl_data2)
+ if (vl_data2)
H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
HDfree(buf2);
buf2 = NULL;
@@ -535,37 +534,39 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
HDmemset(zero, 0, sizeof zero);
/* if subsetting was requested - initialize the subsetting variables */
- H5TOOLS_DEBUG("compare by hyperslabs: opts->nelmts=%ld - opts->m_size=%ld", opts->nelmts, opts->m_size);
+ H5TOOLS_DEBUG("compare by hyperslabs: opts->nelmts=%ld - opts->m_size=%ld", opts->nelmts,
+ opts->m_size);
if (opts->sset[0] != NULL) {
H5TOOLS_DEBUG("opts->sset[0] != NULL");
/* Check for valid settings - default if not specified */
- if(!opts->sset[0]->start.data || !opts->sset[0]->stride.data || !opts->sset[0]->count.data || !opts->sset[0]->block.data) {
+ if (!opts->sset[0]->start.data || !opts->sset[0]->stride.data || !opts->sset[0]->count.data ||
+ !opts->sset[0]->block.data) {
/* they didn't specify a ``stride'' or ``block''. default to 1 in all
* dimensions */
- if(!opts->sset[0]->start.data) {
+ if (!opts->sset[0]->start.data) {
/* default to (0, 0, ...) for the start coord */
opts->sset[0]->start.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
- opts->sset[0]->start.len = (unsigned)rank1;
+ opts->sset[0]->start.len = (unsigned)rank1;
}
- if(!opts->sset[0]->stride.data) {
+ if (!opts->sset[0]->stride.data) {
opts->sset[0]->stride.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
- opts->sset[0]->stride.len = (unsigned)rank1;
+ opts->sset[0]->stride.len = (unsigned)rank1;
for (i = 0; i < rank1; i++)
opts->sset[0]->stride.data[i] = 1;
}
- if(!opts->sset[0]->count.data) {
+ if (!opts->sset[0]->count.data) {
opts->sset[0]->count.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
- opts->sset[0]->count.len = (unsigned)rank1;
+ opts->sset[0]->count.len = (unsigned)rank1;
for (i = 0; i < rank1; i++)
opts->sset[0]->count.data[i] = 1;
}
- if(!opts->sset[0]->block.data) {
+ if (!opts->sset[0]->block.data) {
opts->sset[0]->block.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
- opts->sset[0]->block.len = (unsigned)rank1;
+ opts->sset[0]->block.len = (unsigned)rank1;
for (i = 0; i < rank1; i++)
opts->sset[0]->block.data[i] = 1;
}
@@ -574,13 +575,13 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
* check for block overlap
*-------------------------------------------------------------------------
*/
- for(i = 0; i < rank1; i++) {
- if(opts->sset[0]->count.data[i] > 1) {
- if(opts->sset[0]->stride.data[i] < opts->sset[0]->block.data[i]) {
+ for (i = 0; i < rank1; i++) {
+ if (opts->sset[0]->count.data[i] > 1) {
+ if (opts->sset[0]->stride.data[i] < opts->sset[0]->block.data[i]) {
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "wrong subset selection[0]; blocks overlap");
} /* end if */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
}
/* Reset the total number of elements to the subset from the command */
@@ -588,43 +589,45 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
for (i = 0; i < rank1; i++) {
hs_offset1[i] = opts->sset[0]->start.data[i];
hs_stride1[i] = opts->sset[0]->stride.data[i];
- hs_count1[i] = opts->sset[0]->count.data[i];
- hs_block1[i] = opts->sset[0]->block.data[i];
+ hs_count1[i] = opts->sset[0]->count.data[i];
+ hs_block1[i] = opts->sset[0]->block.data[i];
opts->nelmts *= hs_count1[i] * hs_block1[i];
hs_size1[i] = 0;
- H5TOOLS_DEBUG("[%d]hs_offset1:%ld, hs_stride1:%ld, hs_count1:%ld, hs_block1:%ld", i, hs_offset1[i], hs_stride1[i], hs_count1[i], hs_block1[i]);
+ H5TOOLS_DEBUG("[%d]hs_offset1:%ld, hs_stride1:%ld, hs_count1:%ld, hs_block1:%ld", i,
+ hs_offset1[i], hs_stride1[i], hs_count1[i], hs_block1[i]);
}
}
if (opts->sset[1] != NULL) {
H5TOOLS_DEBUG("opts->sset[1] != NULL");
/* Check for valid settings - default if not specified */
- if(!opts->sset[1]->start.data || !opts->sset[1]->stride.data || !opts->sset[1]->count.data || !opts->sset[1]->block.data) {
+ if (!opts->sset[1]->start.data || !opts->sset[1]->stride.data || !opts->sset[1]->count.data ||
+ !opts->sset[1]->block.data) {
/* they didn't specify a ``stride'' or ``block''. default to 1 in all
* dimensions */
- if(!opts->sset[1]->start.data) {
+ if (!opts->sset[1]->start.data) {
/* default to (0, 0, ...) for the start coord */
opts->sset[1]->start.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
- opts->sset[1]->start.len = (unsigned)rank2;
+ opts->sset[1]->start.len = (unsigned)rank2;
}
- if(!opts->sset[1]->stride.data) {
+ if (!opts->sset[1]->stride.data) {
opts->sset[1]->stride.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
- opts->sset[1]->stride.len = (unsigned)rank2;
+ opts->sset[1]->stride.len = (unsigned)rank2;
for (i = 0; i < rank2; i++)
opts->sset[1]->stride.data[i] = 1;
}
- if(!opts->sset[1]->count.data) {
+ if (!opts->sset[1]->count.data) {
opts->sset[1]->count.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
- opts->sset[1]->count.len = (unsigned)rank2;
+ opts->sset[1]->count.len = (unsigned)rank2;
for (i = 0; i < rank2; i++)
opts->sset[1]->count.data[i] = 1;
}
- if(!opts->sset[1]->block.data) {
+ if (!opts->sset[1]->block.data) {
opts->sset[1]->block.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
- opts->sset[1]->block.len = (unsigned)rank2;
+ opts->sset[1]->block.len = (unsigned)rank2;
for (i = 0; i < rank2; i++)
opts->sset[1]->block.data[i] = 1;
}
@@ -633,22 +636,23 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
* check for block overlap
*-------------------------------------------------------------------------
*/
- for(i = 0; i < rank2; i++) {
- if(opts->sset[1]->count.data[i] > 1) {
- if(opts->sset[1]->stride.data[i] < opts->sset[1]->block.data[i]) {
+ for (i = 0; i < rank2; i++) {
+ if (opts->sset[1]->count.data[i] > 1) {
+ if (opts->sset[1]->stride.data[i] < opts->sset[1]->block.data[i]) {
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "wrong subset selection[1]; blocks overlap");
} /* end if */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
}
for (i = 0; i < rank2; i++) {
hs_offset2[i] = opts->sset[1]->start.data[i];
hs_stride2[i] = opts->sset[1]->stride.data[i];
- hs_count2[i] = opts->sset[1]->count.data[i];
- hs_block2[i] = opts->sset[1]->block.data[i];
- hs_size2[i] = 0;
- H5TOOLS_DEBUG("[%d]hs_offset2:%ld, hs_stride2:%ld, hs_count2:%ld, hs_block2:%ld", i, hs_offset2[i], hs_stride2[i], hs_count2[i], hs_block2[i]);
+ hs_count2[i] = opts->sset[1]->count.data[i];
+ hs_block2[i] = opts->sset[1]->block.data[i];
+ hs_size2[i] = 0;
+ H5TOOLS_DEBUG("[%d]hs_offset2:%ld, hs_stride2:%ld, hs_count2:%ld, hs_block2:%ld", i,
+ hs_offset2[i], hs_stride2[i], hs_count2[i], hs_block2[i]);
}
}
@@ -657,18 +661,18 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
* a hyperslab whose size is manageable.
*/
sm_nbytes = opts->m_size;
- if(opts->rank > 0) {
+ if (opts->rank > 0) {
for (i = opts->rank; i > 0; --i) {
hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
if (size == 0) /* datum size > H5TOOLS_BUFSIZE */
size = 1;
H5TOOLS_DEBUG("opts->dims[%d]: %ld - size: %ld", i - 1, opts->dims[i - 1], size);
if (opts->sset[1] != NULL) {
- sm_size[i - 1] = MIN(hs_block1[i - 1] * hs_count1[i - 1], size);
+ sm_size[i - 1] = MIN(hs_block1[i - 1] * hs_count1[i - 1], size);
sm_block[i - 1] = MIN(hs_block1[i - 1], sm_size[i - 1]);
}
else {
- sm_size[i - 1] = MIN(opts->dims[i - 1], size);
+ sm_size[i - 1] = MIN(opts->dims[i - 1], size);
sm_block[i - 1] = sm_size[i - 1];
}
H5TOOLS_DEBUG("sm_size[%d]: %ld - sm_block:%ld", i - 1, sm_size[i - 1], sm_block[i - 1]);
@@ -678,84 +682,90 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
}
H5TOOLS_DEBUG("opts->nelmts: %ld", opts->nelmts);
- for(elmtno = 0; elmtno < opts->nelmts; elmtno += opts->hs_nelmts) {
+ for (elmtno = 0; elmtno < opts->nelmts; elmtno += opts->hs_nelmts) {
H5TOOLS_DEBUG("elmtno: %ld - hs_nelmts1: %ld", elmtno, hs_nelmts1);
- if(NULL == (sm_buf1 = (unsigned char *)HDmalloc((size_t) sm_nbytes)))
+ if (NULL == (sm_buf1 = (unsigned char *)HDmalloc((size_t)sm_nbytes)))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not allocate buffer for strip-mine");
- if(NULL == (sm_buf2 = (unsigned char *)HDmalloc((size_t) sm_nbytes)))
+ if (NULL == (sm_buf2 = (unsigned char *)HDmalloc((size_t)sm_nbytes)))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not allocate buffer for strip-mine");
/* calculate the hyperslab size */
/* initialize subset */
- if(opts->rank > 0) {
+ if (opts->rank > 0) {
if (opts->sset[0] != NULL) {
H5TOOLS_DEBUG("sset1 has data");
/* calculate the potential number of elements */
- for(i = 0; i < rank1; i++) {
- H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset1: %ld - sm_block: %ld", i, opts->dims[i], hs_offset1[i], sm_block[i]);
+ for (i = 0; i < rank1; i++) {
+ H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset1: %ld - sm_block: %ld", i,
+ opts->dims[i], hs_offset1[i], sm_block[i]);
hs_size1[i] = MIN(opts->dims[i] - hs_offset1[i], sm_block[i]);
H5TOOLS_DEBUG("hs_size1[%d]: %ld", i, hs_size1[i]);
}
- if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset1, hs_stride1, hs_count1, hs_size1) < 0)
+ if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset1, hs_stride1, hs_count1,
+ hs_size1) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid1 failed");
}
else {
- for(i = 0, hs_nelmts1 = 1; i < rank1; i++) {
- H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset1: %ld - sm_block: %ld", i, opts->dims[i], hs_offset1[i], sm_block[i]);
+ for (i = 0, hs_nelmts1 = 1; i < rank1; i++) {
+ H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset1: %ld - sm_block: %ld", i,
+ opts->dims[i], hs_offset1[i], sm_block[i]);
hs_size1[i] = MIN(opts->dims[i] - hs_offset1[i], sm_block[i]);
H5TOOLS_DEBUG("hs_size1[%d]: %ld", i, hs_size1[i]);
hs_nelmts1 *= hs_size1[i];
H5TOOLS_DEBUG("hs_nelmts1:%ld *= hs_size1[%d]: %ld", hs_nelmts1, i, hs_size1[i]);
}
- if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset1, NULL, hs_size1, NULL) < 0)
+ if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset1, NULL, hs_size1, NULL) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid1 failed");
}
- if((ssm_nelmts = H5Sget_select_npoints(sid1)) < 0)
+ if ((ssm_nelmts = H5Sget_select_npoints(sid1)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_select_npoints failed");
sm_nelmts1 = (hsize_t)ssm_nelmts;
H5TOOLS_DEBUG("sm_nelmts1: %ld", sm_nelmts1);
hs_nelmts1 = sm_nelmts1;
- if((sm_space1 = H5Screate_simple(1, &sm_nelmts1, NULL)) < 0)
+ if ((sm_space1 = H5Screate_simple(1, &sm_nelmts1, NULL)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Screate_simple failed");
- if(H5Sselect_hyperslab(sm_space1, H5S_SELECT_SET, zero, NULL, &sm_nelmts1, NULL) < 0)
+ if (H5Sselect_hyperslab(sm_space1, H5S_SELECT_SET, zero, NULL, &sm_nelmts1, NULL) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed");
if (opts->sset[1] != NULL) {
H5TOOLS_DEBUG("sset2 has data");
- for(i = 0; i < rank2; i++) {
- H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset2: %ld - sm_block: %ld", i, opts->dims[i], hs_offset2[i], sm_block[i]);
+ for (i = 0; i < rank2; i++) {
+ H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset2: %ld - sm_block: %ld", i,
+ opts->dims[i], hs_offset2[i], sm_block[i]);
hs_size2[i] = MIN(opts->dims[i] - hs_offset2[i], sm_block[i]);
H5TOOLS_DEBUG("hs_size2[%d]: %ld", i, hs_size2[i]);
}
- if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, hs_stride2, hs_count2, hs_size2) < 0)
+ if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, hs_stride2, hs_count2,
+ hs_size2) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid2 failed");
}
else {
- for(i = 0, hs_nelmts2 = 1; i < rank2; i++) {
- H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset2: %ld - sm_block: %ld", i, opts->dims[i], hs_offset2[i], sm_block[i]);
+ for (i = 0, hs_nelmts2 = 1; i < rank2; i++) {
+ H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset2: %ld - sm_block: %ld", i,
+ opts->dims[i], hs_offset2[i], sm_block[i]);
hs_size2[i] = MIN(opts->dims[i] - hs_offset2[i], sm_block[i]);
H5TOOLS_DEBUG("hs_size2[%d]: %ld", i, hs_size2[i]);
hs_nelmts2 *= hs_size2[i];
H5TOOLS_DEBUG("hs_nelmts2:%ld *= hs_size2[%d]: %ld", hs_nelmts2, i, hs_size2[i]);
}
- if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, NULL, hs_size2, NULL) < 0)
+ if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, NULL, hs_size2, NULL) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid2 failed");
}
- if((ssm_nelmts = H5Sget_select_npoints(sid2)) < 0)
+ if ((ssm_nelmts = H5Sget_select_npoints(sid2)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_select_npoints failed");
sm_nelmts2 = (hsize_t)ssm_nelmts;
H5TOOLS_DEBUG("sm_nelmts2: %ld", sm_nelmts2);
hs_nelmts2 = sm_nelmts2;
- if((sm_space2 = H5Screate_simple(1, &sm_nelmts2, NULL)) < 0)
+ if ((sm_space2 = H5Screate_simple(1, &sm_nelmts2, NULL)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Screate_simple failed");
- if(H5Sselect_hyperslab(sm_space2, H5S_SELECT_SET, zero, NULL, &sm_nelmts2, NULL) < 0)
+ if (H5Sselect_hyperslab(sm_space2, H5S_SELECT_SET, zero, NULL, &sm_nelmts2, NULL) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed");
}
else
@@ -764,14 +774,14 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
H5TOOLS_DEBUG("hs_nelmts: %ld", opts->hs_nelmts);
/* read the data */
- if(H5Dread(did1, m_tid1, sm_space1, sid1, H5P_DEFAULT, sm_buf1) < 0)
+ if (H5Dread(did1, m_tid1, sm_space1, sid1, H5P_DEFAULT, sm_buf1) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed");
- if(H5Dread(did2, m_tid2, sm_space2, sid2, H5P_DEFAULT, sm_buf2) < 0)
+ if (H5Dread(did2, m_tid2, sm_space2, sid2, H5P_DEFAULT, sm_buf2) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed");
/* print array indices. get the lower bound of the hyperslab and calculate
the element position at the start of hyperslab */
- if(H5Sget_select_bounds(sid1, low, high) < 0)
+ if (H5Sget_select_bounds(sid1, low, high) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_select_bounds failed");
/* initialize the current stripmine position; this is necessary to print the array indices */
for (j = 0; j < opts->rank; j++)
@@ -784,16 +794,16 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
found in each hyperslab and pass the position at the beginning for printing */
nfound += diff_array(sm_buf1, sm_buf2, opts, did1, did2);
- if(sm_buf1 != NULL) {
+ if (sm_buf1 != NULL) {
/* reclaim any VL memory, if necessary */
- if(vl_data1)
+ if (vl_data1)
H5Dvlen_reclaim(m_tid1, sm_space1, H5P_DEFAULT, sm_buf1);
HDfree(sm_buf1);
sm_buf1 = NULL;
}
- if(sm_buf2 != NULL) {
+ if (sm_buf2 != NULL) {
/* reclaim any VL memory, if necessary */
- if(vl_data2)
+ if (vl_data2)
H5Dvlen_reclaim(m_tid2, sm_space2, H5P_DEFAULT, sm_buf2);
HDfree(sm_buf2);
sm_buf2 = NULL;
@@ -803,10 +813,11 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
H5Sclose(sm_space2);
/* calculate the next hyperslab offset */
- for(i = opts->rank, carry = 1; i > 0 && carry; --i) {
+ for (i = opts->rank, carry = 1; i > 0 && carry; --i) {
if (opts->sset[0] != NULL) {
- H5TOOLS_DEBUG("[%d]hs_size1:%ld - hs_block1:%ld - hs_stride1:%ld", i-1, hs_size1[i-1], hs_block1[i - 1], hs_stride1[i - 1]);
- if(hs_size1[i - 1] >= hs_block1[i - 1]) {
+ H5TOOLS_DEBUG("[%d]hs_size1:%ld - hs_block1:%ld - hs_stride1:%ld", i - 1,
+ hs_size1[i - 1], hs_block1[i - 1], hs_stride1[i - 1]);
+ if (hs_size1[i - 1] >= hs_block1[i - 1]) {
hs_offset1[i - 1] += hs_size1[i - 1];
}
else {
@@ -815,15 +826,17 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
}
else
hs_offset1[i - 1] += hs_size1[i - 1];
- H5TOOLS_DEBUG("[%d]hs_offset1:%ld - opts->dims:%ld", i-1, hs_offset1[i-1], opts->dims[i - 1]);
- if(hs_offset1[i - 1] >= opts->dims[i - 1])
+ H5TOOLS_DEBUG("[%d]hs_offset1:%ld - opts->dims:%ld", i - 1, hs_offset1[i - 1],
+ opts->dims[i - 1]);
+ if (hs_offset1[i - 1] >= opts->dims[i - 1])
hs_offset1[i - 1] = 0;
else
carry = 0;
- H5TOOLS_DEBUG("[%d]hs_offset1:%ld", i-1, hs_offset1[i-1]);
+ H5TOOLS_DEBUG("[%d]hs_offset1:%ld", i - 1, hs_offset1[i - 1]);
if (opts->sset[1] != NULL) {
- H5TOOLS_DEBUG("[%d]hs_size2:%ld - hs_block2:%ld - hs_stride2:%ld", i-1, hs_size2[i-1], hs_block2[i - 1], hs_stride2[i - 1]);
- if(hs_size2[i - 1] >= hs_block2[i - 1]) {
+ H5TOOLS_DEBUG("[%d]hs_size2:%ld - hs_block2:%ld - hs_stride2:%ld", i - 1,
+ hs_size2[i - 1], hs_block2[i - 1], hs_stride2[i - 1]);
+ if (hs_size2[i - 1] >= hs_block2[i - 1]) {
hs_offset2[i - 1] += hs_size2[i - 1];
}
else {
@@ -832,17 +845,17 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
}
else
hs_offset2[i - 1] += hs_size2[i - 1];
- H5TOOLS_DEBUG("[%d]hs_offset2:%ld - opts->dims:%ld", i-1, hs_offset2[i-1], opts->dims[i - 1]);
- if(hs_offset2[i - 1] >= opts->dims[i - 1])
+ H5TOOLS_DEBUG("[%d]hs_offset2:%ld - opts->dims:%ld", i - 1, hs_offset2[i - 1],
+ opts->dims[i - 1]);
+ if (hs_offset2[i - 1] >= opts->dims[i - 1])
hs_offset2[i - 1] = 0;
- H5TOOLS_DEBUG("[%d]hs_offset2:%ld", i-1, hs_offset2[i-1]);
+ H5TOOLS_DEBUG("[%d]hs_offset2:%ld", i - 1, hs_offset2[i - 1]);
}
} /* elmtno for loop */
- } /* hyperslab read */
+ } /* hyperslab read */
H5TOOLS_DEBUG("can compare complete");
} /*can_compare*/
-
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -854,38 +867,38 @@ done:
H5TOOLS_DEBUG("free names - errstat:%d", opts->err_stat);
/* free */
if (opts->obj_name[0] != NULL)
- HDfree(opts->obj_name[0]);
+ HDfree(opts->obj_name[0]);
opts->obj_name[0] = NULL;
if (opts->obj_name[1] != NULL)
- HDfree(opts->obj_name[1]);
+ HDfree(opts->obj_name[1]);
opts->obj_name[1] = NULL;
H5TOOLS_DEBUG("reclaim any VL memory");
- if(buf1 != NULL) {
+ if (buf1 != NULL) {
/* reclaim any VL memory, if necessary */
- if(vl_data1)
+ if (vl_data1)
H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
HDfree(buf1);
buf1 = NULL;
}
- if(buf2 != NULL) {
+ if (buf2 != NULL) {
/* reclaim any VL memory, if necessary */
- if(vl_data2)
+ if (vl_data2)
H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
HDfree(buf2);
buf2 = NULL;
}
H5TOOLS_DEBUG("reclaim any stripmine VL memory");
- if(sm_buf1 != NULL) {
+ if (sm_buf1 != NULL) {
/* reclaim any VL memory, if necessary */
- if(vl_data1)
+ if (vl_data1)
H5Dvlen_reclaim(m_tid1, sm_space1, H5P_DEFAULT, sm_buf1);
HDfree(sm_buf1);
sm_buf1 = NULL;
}
- if(sm_buf2 != NULL) {
+ if (sm_buf2 != NULL) {
/* reclaim any VL memory, if necessary */
- if(vl_data2)
+ if (vl_data2)
H5Dvlen_reclaim(m_tid2, sm_space2, H5P_DEFAULT, sm_buf2);
HDfree(sm_buf2);
sm_buf2 = NULL;
@@ -893,7 +906,8 @@ done:
H5TOOLS_DEBUG("close ids");
/* disable error reporting */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid1);
H5Sclose(sid2);
H5Sclose(sm_space1);
@@ -905,7 +919,8 @@ done:
H5Tclose(m_tid1);
H5Tclose(m_tid2);
/* enable error reporting */
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
H5TOOLS_ENDDEBUG(": %d with nfound:%d", ret_value, nfound);
return nfound;
@@ -925,37 +940,35 @@ done:
int
diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1, hsize_t *dims2,
- hsize_t *maxdim1, hsize_t *maxdim2, diff_opt_t *opts, int is_compound)
+ hsize_t *maxdim1, hsize_t *maxdim2, diff_opt_t *opts, int is_compound)
{
- H5T_class_t tclass1;
- H5T_class_t tclass2;
- int maxdim_diff = 0; /* maximum dimensions are different */
- int dim_diff = 0; /* current dimensions are different */
- int i;
- int ret_value = 1;
-
- H5TOOLS_START_DEBUG("");
+ H5T_class_t tclass1;
+ H5T_class_t tclass2;
+ int maxdim_diff = 0; /* maximum dimensions are different */
+ int dim_diff = 0; /* current dimensions are different */
+ int i;
+ int ret_value = 1;
+
+ H5TOOLS_START_DEBUG(" ");
/*-------------------------------------------------------------------------
* check for the same class
*-------------------------------------------------------------------------
*/
- if((tclass1 = H5Tget_class(f_tid1)) < 0)
+ if ((tclass1 = H5Tget_class(f_tid1)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_class first object failed");
- if((tclass2 = H5Tget_class(f_tid2)) < 0)
+ if ((tclass2 = H5Tget_class(f_tid2)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_class second object failed");
H5TOOLS_DEBUG("obj_names: %s - %s", opts->obj_name[0], opts->obj_name[1]);
- if(tclass1 != tclass2) {
- if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
- if(is_compound) {
+ if (tclass1 != tclass2) {
+ if ((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
+ if (is_compound) {
parallel_print("Not comparable: <%s> has a class %s and <%s> has a class %s\n",
- opts->obj_name[0], get_class(tclass1),
- opts->obj_name[1], get_class(tclass2));
+ opts->obj_name[0], get_class(tclass1), opts->obj_name[1], get_class(tclass2));
}
else {
parallel_print("Not comparable: <%s> is of class %s and <%s> is of class %s\n",
- opts->obj_name[0], get_class(tclass1),
- opts->obj_name[1], get_class(tclass2));
+ opts->obj_name[0], get_class(tclass1), opts->obj_name[1], get_class(tclass2));
}
}
@@ -969,9 +982,9 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
*/
switch (tclass1) {
case H5T_TIME:
- if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
- parallel_print("Not comparable: <%s> and <%s> are of class %s\n",
- opts->obj_name[0], opts->obj_name[1], get_class(tclass2));
+ if ((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
+ parallel_print("Not comparable: <%s> and <%s> are of class %s\n", opts->obj_name[0],
+ opts->obj_name[1], get_class(tclass2));
} /* end if */
opts->not_cmp = 1;
@@ -999,11 +1012,11 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
* check for equal file datatype; warning only
*-------------------------------------------------------------------------
*/
- if((H5Tequal(f_tid1, f_tid2) == 0) && (opts->mode_verbose) && opts->obj_name[0] && opts->obj_name[1]) {
+ if ((H5Tequal(f_tid1, f_tid2) == 0) && (opts->mode_verbose) && opts->obj_name[0] && opts->obj_name[1]) {
H5T_class_t cl = H5Tget_class(f_tid1);
parallel_print("Warning: different storage datatype\n");
- if(cl == H5T_INTEGER || cl == H5T_FLOAT) {
+ if (cl == H5T_INTEGER || cl == H5T_FLOAT) {
parallel_print("<%s> has file datatype ", opts->obj_name[0]);
print_type(f_tid1);
parallel_print("\n");
@@ -1017,13 +1030,13 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
* check for the same rank
*-------------------------------------------------------------------------
*/
- if(rank1 != rank2) {
- if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
+ if (rank1 != rank2) {
+ if ((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
parallel_print("Not comparable: <%s> has rank %d, dimensions ", opts->obj_name[0], rank1);
print_dimensions(rank1, dims1);
parallel_print(", max dimensions ");
print_dimensions(rank1, maxdim1);
- parallel_print("\n" );
+ parallel_print("\n");
parallel_print("and <%s> has rank %d, dimensions ", opts->obj_name[1], rank2);
print_dimensions(rank2, dims2);
parallel_print(", max dimensions ");
@@ -1039,12 +1052,12 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
* check for different dimensions
*-------------------------------------------------------------------------
*/
- for(i = 0; i<rank1; i++) {
- if(maxdim1 && maxdim2) {
- if(maxdim1[i] != maxdim2[i])
+ for (i = 0; i < rank1; i++) {
+ if (maxdim1 && maxdim2) {
+ if (maxdim1[i] != maxdim2[i])
maxdim_diff = 1;
}
- if(dims1[i] != dims2[i])
+ if (dims1[i] != dims2[i])
dim_diff = 1;
}
@@ -1052,14 +1065,14 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
* current dimensions
*-------------------------------------------------------------------------
*/
- if(dim_diff == 1) {
- if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
+ if (dim_diff == 1) {
+ if ((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
parallel_print("Not comparable: <%s> has rank %d, dimensions ", opts->obj_name[0], rank1);
print_dimensions(rank1, dims1);
- if(maxdim1 && maxdim2) {
+ if (maxdim1 && maxdim2) {
parallel_print(", max dimensions ");
print_dimensions(rank1, maxdim1);
- parallel_print("\n" );
+ parallel_print("\n");
parallel_print("and <%s> has rank %d, dimensions ", opts->obj_name[1], rank2);
print_dimensions(rank2, dims2);
parallel_print(", max dimensions ");
@@ -1076,9 +1089,9 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
* maximum dimensions; just give a warning
*-------------------------------------------------------------------------
*/
- if(maxdim1 && maxdim2 && maxdim_diff == 1 && opts->obj_name[0]) {
- if(opts->mode_verbose) {
- parallel_print( "Warning: different maximum dimensions\n");
+ if (maxdim1 && maxdim2 && maxdim_diff == 1 && opts->obj_name[0]) {
+ if (opts->mode_verbose) {
+ parallel_print("Warning: different maximum dimensions\n");
parallel_print("<%s> has max dimensions ", opts->obj_name[0]);
print_dimensions(rank1, maxdim1);
parallel_print("\n");
@@ -1088,7 +1101,7 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
}
}
- if(tclass1 == H5T_STRING) {
+ if (tclass1 == H5T_STRING) {
htri_t vstrtype1 = -1;
htri_t vstrtype2 = -1;
H5TOOLS_DEBUG(" - H5T_STRING");
@@ -1098,16 +1111,16 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
/* no compare if either one but not both are variable string type */
if (vstrtype1 != vstrtype2) {
- if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1])
- parallel_print("Not comparable: <%s> or <%s> is of mixed string type\n",
- opts->obj_name[0], opts->obj_name[1]);
+ if ((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1])
+ parallel_print("Not comparable: <%s> or <%s> is of mixed string type\n", opts->obj_name[0],
+ opts->obj_name[1]);
opts->not_cmp = 1;
H5TOOLS_GOTO_DONE(0);
}
}
- if(tclass1 == H5T_COMPOUND) {
+ if (tclass1 == H5T_COMPOUND) {
int nmembs1;
int nmembs2;
int j;
@@ -1118,8 +1131,8 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
nmembs1 = H5Tget_nmembers(f_tid1);
nmembs2 = H5Tget_nmembers(f_tid2);
- if(nmembs1 != nmembs2) {
- if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
+ if (nmembs1 != nmembs2) {
+ if ((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
parallel_print("Not comparable: <%s> has %d members ", opts->obj_name[0], nmembs1);
parallel_print("<%s> has %d members ", opts->obj_name[1], nmembs2);
parallel_print("\n");
@@ -1133,7 +1146,8 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
memb_type1 = H5Tget_member_type(f_tid1, (unsigned)j);
memb_type2 = H5Tget_member_type(f_tid2, (unsigned)j);
- if (diff_can_type(memb_type1, memb_type2, rank1, rank2, dims1, dims2, maxdim1, maxdim2, opts, 1) != 1) {
+ if (diff_can_type(memb_type1, memb_type2, rank1, rank2, dims1, dims2, maxdim1, maxdim2, opts,
+ 1) != 1) {
opts->not_cmp = 1;
H5Tclose(memb_type1);
H5Tclose(memb_type2);
@@ -1151,8 +1165,7 @@ done:
return ret_value;
}
-
-#if defined (H5DIFF_DEBUG_UNUSED)
+#if defined(H5DIFF_DEBUG_UNUSED)
/* this function is not currently used, but could be useful */
/*-------------------------------------------------------------------------
* Function: print_sizes
@@ -1160,45 +1173,46 @@ done:
* Purpose: Print datatype sizes
*-------------------------------------------------------------------------
*/
-void print_sizes( const char *obj1, const char *obj2, hid_t f_tid1, hid_t f_tid2, hid_t m_tid1, hid_t m_tid2);
+void print_sizes(const char *obj1, const char *obj2, hid_t f_tid1, hid_t f_tid2, hid_t m_tid1, hid_t m_tid2);
-void print_sizes( const char *obj1, const char *obj2, hid_t f_tid1, hid_t f_tid2, hid_t m_tid1, hid_t m_tid2)
+void
+print_sizes(const char *obj1, const char *obj2, hid_t f_tid1, hid_t f_tid2, hid_t m_tid1, hid_t m_tid2)
{
- size_t f_size1, f_size2; /* size of type in file */
- size_t m_size1, m_size2; /* size of type in memory */
+ size_t f_size1, f_size2; /* size of type in file */
+ size_t m_size1, m_size2; /* size of type in memory */
- f_size1 = H5Tget_size( f_tid1 );
- f_size2 = H5Tget_size( f_tid2 );
- m_size1 = H5Tget_size( m_tid1 );
- m_size2 = H5Tget_size( m_tid2 );
+ f_size1 = H5Tget_size(f_tid1);
+ f_size2 = H5Tget_size(f_tid2);
+ m_size1 = H5Tget_size(m_tid1);
+ m_size2 = H5Tget_size(m_tid2);
parallel_print("\n");
parallel_print("------------------\n");
- parallel_print("sizeof(char) %u\n", sizeof(char) );
- parallel_print("sizeof(short) %u\n", sizeof(short) );
- parallel_print("sizeof(int) %u\n", sizeof(int) );
- parallel_print("sizeof(long) %u\n", sizeof(long) );
+ parallel_print("sizeof(char) %u\n", sizeof(char));
+ parallel_print("sizeof(short) %u\n", sizeof(short));
+ parallel_print("sizeof(int) %u\n", sizeof(int));
+ parallel_print("sizeof(long) %u\n", sizeof(long));
parallel_print("<%s> ------------------\n", obj1);
parallel_print("type on file ");
print_type(f_tid1);
parallel_print("\n");
- parallel_print("size on file %u\n", f_size1 );
+ parallel_print("size on file %u\n", f_size1);
parallel_print("type on memory ");
print_type(m_tid1);
parallel_print("\n");
- parallel_print("size on memory %u\n", m_size1 );
+ parallel_print("size on memory %u\n", m_size1);
parallel_print("<%s> ------------------\n", obj2);
parallel_print("type on file ");
print_type(f_tid2);
parallel_print("\n");
- parallel_print("size on file %u\n", f_size2 );
+ parallel_print("size on file %u\n", f_size2);
parallel_print("type on memory ");
print_type(m_tid2);
parallel_print("\n");
- parallel_print("size on memory %u\n", m_size2 );
+ parallel_print("size on memory %u\n", m_size2);
parallel_print("\n");
}
#endif /* H5DIFF_DEBUG */
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 59b11d6..e487a12 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,9 +17,8 @@
#include "h5diff.h"
#include "ph5diff.h"
-
/* global variables */
-int g_nTasks = 1;
+int g_nTasks = 1;
/*-------------------------------------------------------------------------
* Function: print_dimensions
@@ -28,29 +27,28 @@ int g_nTasks = 1;
*-------------------------------------------------------------------------
*/
void
-print_dimensions (int rank, hsize_t *dims)
+print_dimensions(int rank, hsize_t *dims)
{
- int i;
+ int i;
- if(rank <= 0)
- parallel_print("H5S_SCALAR" );
+ if (rank <= 0)
+ parallel_print("H5S_SCALAR");
else {
if (!dims)
parallel_print("dimension is NULL");
else {
parallel_print("[");
- for (i = 0; i < rank-1; i++) {
+ for (i = 0; i < rank - 1; i++) {
parallel_print(HSIZE_T_FORMAT, dims[i]);
parallel_print("x");
}
- parallel_print(HSIZE_T_FORMAT, dims[rank-1]);
- parallel_print("]" );
+ parallel_print(HSIZE_T_FORMAT, dims[rank - 1]);
+ parallel_print("]");
}
}
}
-
/*-------------------------------------------------------------------------
* Function: print_type
*
@@ -61,120 +59,121 @@ print_dimensions (int rank, hsize_t *dims)
* Comments: Adapted from h5dump for H5T_INTEGER and H5T_FLOAT classes only
*-------------------------------------------------------------------------
*/
-void print_type(hid_t type)
+void
+print_type(hid_t type)
{
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- if(H5Tequal(type, H5T_STD_I8BE))
- parallel_print("H5T_STD_I8BE");
- else if(H5Tequal(type, H5T_STD_I8LE))
- parallel_print("H5T_STD_I8LE");
- else if(H5Tequal(type, H5T_STD_I16BE))
- parallel_print("H5T_STD_I16BE");
- else if(H5Tequal(type, H5T_STD_I16LE))
- parallel_print("H5T_STD_I16LE");
- else if(H5Tequal(type, H5T_STD_I32BE))
- parallel_print("H5T_STD_I32BE");
- else if(H5Tequal(type, H5T_STD_I32LE))
- parallel_print("H5T_STD_I32LE");
- else if(H5Tequal(type, H5T_STD_I64BE))
- parallel_print("H5T_STD_I64BE");
- else if(H5Tequal(type, H5T_STD_I64LE))
- parallel_print("H5T_STD_I64LE");
- else if(H5Tequal(type, H5T_STD_U8BE))
- parallel_print("H5T_STD_U8BE");
- else if(H5Tequal(type, H5T_STD_U8LE))
- parallel_print("H5T_STD_U8LE");
- else if(H5Tequal(type, H5T_STD_U16BE))
- parallel_print("H5T_STD_U16BE");
- else if(H5Tequal(type, H5T_STD_U16LE))
- parallel_print("H5T_STD_U16LE");
- else if(H5Tequal(type, H5T_STD_U32BE))
- parallel_print("H5T_STD_U32BE");
- else if(H5Tequal(type, H5T_STD_U32LE))
- parallel_print("H5T_STD_U32LE");
- else if(H5Tequal(type, H5T_STD_U64BE))
- parallel_print("H5T_STD_U64BE");
- else if(H5Tequal(type, H5T_STD_U64LE))
- parallel_print("H5T_STD_U64LE");
- else if(H5Tequal(type, H5T_NATIVE_SCHAR))
- parallel_print("H5T_NATIVE_SCHAR");
- else if(H5Tequal(type, H5T_NATIVE_UCHAR))
- parallel_print("H5T_NATIVE_UCHAR");
- else if(H5Tequal(type, H5T_NATIVE_SHORT))
- parallel_print("H5T_NATIVE_SHORT");
- else if(H5Tequal(type, H5T_NATIVE_USHORT))
- parallel_print("H5T_NATIVE_USHORT");
- else if(H5Tequal(type, H5T_NATIVE_INT))
- parallel_print("H5T_NATIVE_INT");
- else if(H5Tequal(type, H5T_NATIVE_UINT))
- parallel_print("H5T_NATIVE_UINT");
- else if(H5Tequal(type, H5T_NATIVE_LONG))
- parallel_print("H5T_NATIVE_LONG");
- else if(H5Tequal(type, H5T_NATIVE_ULONG))
- parallel_print("H5T_NATIVE_ULONG");
- else if(H5Tequal(type, H5T_NATIVE_LLONG))
- parallel_print("H5T_NATIVE_LLONG");
- else if(H5Tequal(type, H5T_NATIVE_ULLONG))
- parallel_print("H5T_NATIVE_ULLONG");
- else
- parallel_print("undefined integer");
- break;
-
- case H5T_FLOAT:
- if(H5Tequal(type, H5T_IEEE_F32BE))
- parallel_print("H5T_IEEE_F32BE");
- else if(H5Tequal(type, H5T_IEEE_F32LE))
- parallel_print("H5T_IEEE_F32LE");
- else if(H5Tequal(type, H5T_IEEE_F64BE))
- parallel_print("H5T_IEEE_F64BE");
- else if(H5Tequal(type, H5T_IEEE_F64LE))
- parallel_print("H5T_IEEE_F64LE");
- else if(H5Tequal(type, H5T_NATIVE_FLOAT))
- parallel_print("H5T_NATIVE_FLOAT");
- else if(H5Tequal(type, H5T_NATIVE_DOUBLE))
- parallel_print("H5T_NATIVE_DOUBLE");
-#if H5_SIZEOF_LONG_DOUBLE !=0
- else if(H5Tequal(type, H5T_NATIVE_LDOUBLE))
- parallel_print("H5T_NATIVE_LDOUBLE");
+ case H5T_INTEGER:
+ if (H5Tequal(type, H5T_STD_I8BE))
+ parallel_print("H5T_STD_I8BE");
+ else if (H5Tequal(type, H5T_STD_I8LE))
+ parallel_print("H5T_STD_I8LE");
+ else if (H5Tequal(type, H5T_STD_I16BE))
+ parallel_print("H5T_STD_I16BE");
+ else if (H5Tequal(type, H5T_STD_I16LE))
+ parallel_print("H5T_STD_I16LE");
+ else if (H5Tequal(type, H5T_STD_I32BE))
+ parallel_print("H5T_STD_I32BE");
+ else if (H5Tequal(type, H5T_STD_I32LE))
+ parallel_print("H5T_STD_I32LE");
+ else if (H5Tequal(type, H5T_STD_I64BE))
+ parallel_print("H5T_STD_I64BE");
+ else if (H5Tequal(type, H5T_STD_I64LE))
+ parallel_print("H5T_STD_I64LE");
+ else if (H5Tequal(type, H5T_STD_U8BE))
+ parallel_print("H5T_STD_U8BE");
+ else if (H5Tequal(type, H5T_STD_U8LE))
+ parallel_print("H5T_STD_U8LE");
+ else if (H5Tequal(type, H5T_STD_U16BE))
+ parallel_print("H5T_STD_U16BE");
+ else if (H5Tequal(type, H5T_STD_U16LE))
+ parallel_print("H5T_STD_U16LE");
+ else if (H5Tequal(type, H5T_STD_U32BE))
+ parallel_print("H5T_STD_U32BE");
+ else if (H5Tequal(type, H5T_STD_U32LE))
+ parallel_print("H5T_STD_U32LE");
+ else if (H5Tequal(type, H5T_STD_U64BE))
+ parallel_print("H5T_STD_U64BE");
+ else if (H5Tequal(type, H5T_STD_U64LE))
+ parallel_print("H5T_STD_U64LE");
+ else if (H5Tequal(type, H5T_NATIVE_SCHAR))
+ parallel_print("H5T_NATIVE_SCHAR");
+ else if (H5Tequal(type, H5T_NATIVE_UCHAR))
+ parallel_print("H5T_NATIVE_UCHAR");
+ else if (H5Tequal(type, H5T_NATIVE_SHORT))
+ parallel_print("H5T_NATIVE_SHORT");
+ else if (H5Tequal(type, H5T_NATIVE_USHORT))
+ parallel_print("H5T_NATIVE_USHORT");
+ else if (H5Tequal(type, H5T_NATIVE_INT))
+ parallel_print("H5T_NATIVE_INT");
+ else if (H5Tequal(type, H5T_NATIVE_UINT))
+ parallel_print("H5T_NATIVE_UINT");
+ else if (H5Tequal(type, H5T_NATIVE_LONG))
+ parallel_print("H5T_NATIVE_LONG");
+ else if (H5Tequal(type, H5T_NATIVE_ULONG))
+ parallel_print("H5T_NATIVE_ULONG");
+ else if (H5Tequal(type, H5T_NATIVE_LLONG))
+ parallel_print("H5T_NATIVE_LLONG");
+ else if (H5Tequal(type, H5T_NATIVE_ULLONG))
+ parallel_print("H5T_NATIVE_ULLONG");
+ else
+ parallel_print("undefined integer");
+ break;
+
+ case H5T_FLOAT:
+ if (H5Tequal(type, H5T_IEEE_F32BE))
+ parallel_print("H5T_IEEE_F32BE");
+ else if (H5Tequal(type, H5T_IEEE_F32LE))
+ parallel_print("H5T_IEEE_F32LE");
+ else if (H5Tequal(type, H5T_IEEE_F64BE))
+ parallel_print("H5T_IEEE_F64BE");
+ else if (H5Tequal(type, H5T_IEEE_F64LE))
+ parallel_print("H5T_IEEE_F64LE");
+ else if (H5Tequal(type, H5T_NATIVE_FLOAT))
+ parallel_print("H5T_NATIVE_FLOAT");
+ else if (H5Tequal(type, H5T_NATIVE_DOUBLE))
+ parallel_print("H5T_NATIVE_DOUBLE");
+#if H5_SIZEOF_LONG_DOUBLE != 0
+ else if (H5Tequal(type, H5T_NATIVE_LDOUBLE))
+ parallel_print("H5T_NATIVE_LDOUBLE");
#endif
- else
- parallel_print("undefined float");
- break;
-
- case H5T_BITFIELD:
- if(H5Tequal(type, H5T_STD_B8BE))
- parallel_print("H5T_STD_B8BE");
- else if(H5Tequal(type, H5T_STD_B8LE))
- parallel_print("H5T_STD_B8LE");
- else if(H5Tequal(type, H5T_STD_B16BE))
- parallel_print("H5T_STD_B16BE");
- else if(H5Tequal(type, H5T_STD_B16LE))
- parallel_print("H5T_STD_B16LE");
- else if(H5Tequal(type, H5T_STD_B32BE))
- parallel_print("H5T_STD_B32BE");
- else if(H5Tequal(type, H5T_STD_B32LE))
- parallel_print("H5T_STD_B32LE");
- else if(H5Tequal(type, H5T_STD_B64BE))
- parallel_print("H5T_STD_B64BE");
- else if(H5Tequal(type, H5T_STD_B64LE))
- parallel_print("H5T_STD_B64LE");
- else
- parallel_print("undefined bitfield");
- break;
-
- case H5T_TIME:
- case H5T_STRING:
- case H5T_OPAQUE:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- default:
- return;
+ else
+ parallel_print("undefined float");
+ break;
+
+ case H5T_BITFIELD:
+ if (H5Tequal(type, H5T_STD_B8BE))
+ parallel_print("H5T_STD_B8BE");
+ else if (H5Tequal(type, H5T_STD_B8LE))
+ parallel_print("H5T_STD_B8LE");
+ else if (H5Tequal(type, H5T_STD_B16BE))
+ parallel_print("H5T_STD_B16BE");
+ else if (H5Tequal(type, H5T_STD_B16LE))
+ parallel_print("H5T_STD_B16LE");
+ else if (H5Tequal(type, H5T_STD_B32BE))
+ parallel_print("H5T_STD_B32BE");
+ else if (H5Tequal(type, H5T_STD_B32LE))
+ parallel_print("H5T_STD_B32LE");
+ else if (H5Tequal(type, H5T_STD_B64BE))
+ parallel_print("H5T_STD_B64BE");
+ else if (H5Tequal(type, H5T_STD_B64LE))
+ parallel_print("H5T_STD_B64LE");
+ else
+ parallel_print("undefined bitfield");
+ break;
+
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
+ return;
} /* end switch */
}
@@ -185,24 +184,24 @@ void print_type(hid_t type)
* Purpose: Returns a pointer to the last component absolute name
*-------------------------------------------------------------------------
*/
-H5_ATTR_PURE const char*
+H5_ATTR_PURE const char *
diff_basename(const char *name)
{
size_t i;
- if(name == NULL)
+ if (name == NULL)
return NULL;
/* Find the end of the base name */
i = HDstrlen(name);
- while(i > 0 && '/' == name[i - 1])
+ while (i > 0 && '/' == name[i - 1])
--i;
/* Skip backward over base name */
- while(i > 0 && '/' != name[i - 1])
+ while (i > 0 && '/' != name[i - 1])
--i;
- return(name+i);
+ return (name + i);
}
/*-------------------------------------------------------------------------
@@ -211,28 +210,28 @@ diff_basename(const char *name)
* Purpose: Returns the type as a string
*-------------------------------------------------------------------------
*/
-H5_ATTR_CONST const char*
+H5_ATTR_CONST const char *
get_type(h5trav_type_t type)
{
- switch(type) {
+ switch (type) {
case H5TRAV_TYPE_DATASET:
- return("H5G_DATASET");
+ return ("H5G_DATASET");
case H5TRAV_TYPE_GROUP:
- return("H5G_GROUP");
+ return ("H5G_GROUP");
case H5TRAV_TYPE_NAMED_DATATYPE:
- return("H5G_TYPE");
+ return ("H5G_TYPE");
case H5TRAV_TYPE_LINK:
- return("H5G_LINK");
+ return ("H5G_LINK");
case H5TRAV_TYPE_UDLINK:
- return("H5G_UDLINK");
+ return ("H5G_UDLINK");
case H5TRAV_TYPE_UNKNOWN:
default:
- return("unknown type");
+ return ("unknown type");
}
}
@@ -242,10 +241,10 @@ get_type(h5trav_type_t type)
* Purpose: Returns the sign as a string
*-------------------------------------------------------------------------
*/
-H5_ATTR_CONST const char*
+H5_ATTR_CONST const char *
get_sign(H5T_sign_t sign)
{
- switch(sign) {
+ switch (sign) {
case H5T_SGN_NONE:
return "H5T_SGN_NONE";
@@ -263,54 +262,53 @@ get_sign(H5T_sign_t sign)
} /* end switch */
}
-
/*-------------------------------------------------------------------------
* Function: get_class
*
* Purpose: Returns the class as a string
*-------------------------------------------------------------------------
*/
-H5_ATTR_CONST const char*
+H5_ATTR_CONST const char *
get_class(H5T_class_t tclass)
{
- switch(tclass) {
+ switch (tclass) {
case H5T_TIME:
- return("H5T_TIME");
+ return ("H5T_TIME");
case H5T_INTEGER:
- return("H5T_INTEGER");
+ return ("H5T_INTEGER");
case H5T_FLOAT:
- return("H5T_FLOAT");
+ return ("H5T_FLOAT");
case H5T_STRING:
- return("H5T_STRING");
+ return ("H5T_STRING");
case H5T_BITFIELD:
- return("H5T_BITFIELD");
+ return ("H5T_BITFIELD");
case H5T_OPAQUE:
- return("H5T_OPAQUE");
+ return ("H5T_OPAQUE");
case H5T_COMPOUND:
- return("H5T_COMPOUND");
+ return ("H5T_COMPOUND");
case H5T_REFERENCE:
- return("H5T_REFERENCE");
+ return ("H5T_REFERENCE");
case H5T_ENUM:
- return("H5T_ENUM");
+ return ("H5T_ENUM");
case H5T_VLEN:
- return("H5T_VLEN");
+ return ("H5T_VLEN");
case H5T_ARRAY:
- return("H5T_ARRAY");
+ return ("H5T_ARRAY");
case H5T_NO_CLASS:
case H5T_NCLASSES:
default:
- return("Invalid class");
+ return ("Invalid class");
} /* end switch */
} /* end get_class() */
@@ -320,33 +318,33 @@ get_class(H5T_class_t tclass)
* Purpose: print number of differences found
*-------------------------------------------------------------------------
*/
-void print_found(hsize_t nfound)
+void
+print_found(hsize_t nfound)
{
- if(g_Parallel)
- parallel_print("%"H5_PRINTF_LL_WIDTH"u differences found\n", (unsigned long long)nfound);
+ if (g_Parallel)
+ parallel_print("%" PRIuHSIZE " differences found\n", nfound);
else
- HDfprintf(stdout,"%Hu differences found\n",nfound);
+ HDfprintf(stdout, "%" PRIuHSIZE " differences found\n", nfound);
}
-
/*-----------------------------------------------------------------
* Function: match_up_memsize
*
* Purpose: match smaller memory size up to bigger memory size
*------------------------------------------------------------------
*/
-herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
- hid_t *m_tid1, hid_t *m_tid2,
- size_t *m_size1, size_t *m_size2)
+herr_t
+match_up_memsize(hid_t f_tid1_id, hid_t f_tid2_id, hid_t *m_tid1, hid_t *m_tid2, size_t *m_size1,
+ size_t *m_size2)
{
herr_t ret_value = SUCCEED;
- H5TOOLS_START_DEBUG("");
- if((*m_size1) != (*m_size2)) {
- if((*m_size1) < (*m_size2)) {
+ H5TOOLS_START_DEBUG(" ");
+ if ((*m_size1) != (*m_size2)) {
+ if ((*m_size1) < (*m_size2)) {
H5Tclose(*m_tid1);
- if(((*m_tid1) = H5Tget_native_type(f_tid2_id, H5T_DIR_DEFAULT)) < 0)
+ if (((*m_tid1) = H5Tget_native_type(f_tid2_id, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_native_type failed");
*m_size1 = H5Tget_size(*m_tid1);
@@ -354,17 +352,16 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
else {
H5Tclose(*m_tid2);
- if(((*m_tid2) = H5Tget_native_type(f_tid1_id, H5T_DIR_DEFAULT)) < 0)
+ if (((*m_tid2) = H5Tget_native_type(f_tid1_id, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_native_type failed");
*m_size2 = H5Tget_size(*m_tid2);
} /* end else */
- } /* end if */
- if((*m_size1) != (*m_size2))
+ } /* end if */
+ if ((*m_size1) != (*m_size2))
H5TOOLS_GOTO_ERROR(FAIL, "native type sizes do not compare");
done:
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
-
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 8a926f6..bc4ac36 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,50 +24,49 @@
#ifdef H5_TOOLS_DEBUG
/* global debug variables */
-int H5tools_INDENT_g = 0;
+int H5tools_INDENT_g = 0;
#endif
-
/* global variables */
H5E_auto2_t lib_func;
H5E_auto2_t tools_func;
-void *lib_edata;
-void *tools_edata;
-
-hid_t H5tools_ERR_STACK_g = H5I_INVALID_HID;
-hid_t H5tools_ERR_CLS_g = H5I_INVALID_HID;
-hid_t H5E_tools_g = H5I_INVALID_HID;
-hid_t H5E_tools_min_id_g = H5I_INVALID_HID;
-hid_t H5E_tools_min_info_id_g = H5I_INVALID_HID;
-hid_t H5E_tools_min_dbg_id_g = H5I_INVALID_HID;
-
-FILE *rawattrstream = NULL; /* should initialize to stdout but gcc moans about it */
-FILE *rawdatastream = NULL; /* should initialize to stdout but gcc moans about it */
-FILE *rawinstream = NULL; /* should initialize to stdin but gcc moans about it */
-FILE *rawoutstream = NULL; /* should initialize to stdout but gcc moans about it */
-FILE *rawerrorstream = NULL; /* should initialize to stderr but gcc moans about it */
-
-int bin_output; /* binary output */
-int bin_form = 0; /* binary form, default NATIVE */
-int region_output; /* region output */
-int oid_output; /* oid output */
-int data_output; /* data output */
-int attr_data_output; /* attribute data output */
-int compound_data;
-
-unsigned packed_bits_num; /* number of packed bits to display */
-unsigned packed_data_offset; /* offset of packed bits to display */
-unsigned packed_data_length; /* length of packed bits to display */
-unsigned long long packed_data_mask; /* mask in which packed bits to display */
-
-int enable_error_stack = 0; /* re-enable error stack; disable=0 enable=1 */
+void * lib_edata;
+void * tools_edata;
+
+hid_t H5tools_ERR_STACK_g = H5I_INVALID_HID;
+hid_t H5tools_ERR_CLS_g = H5I_INVALID_HID;
+hid_t H5E_tools_g = H5I_INVALID_HID;
+hid_t H5E_tools_min_id_g = H5I_INVALID_HID;
+hid_t H5E_tools_min_info_id_g = H5I_INVALID_HID;
+hid_t H5E_tools_min_dbg_id_g = H5I_INVALID_HID;
+
+FILE *rawattrstream = NULL; /* should initialize to stdout but gcc moans about it */
+FILE *rawdatastream = NULL; /* should initialize to stdout but gcc moans about it */
+FILE *rawinstream = NULL; /* should initialize to stdin but gcc moans about it */
+FILE *rawoutstream = NULL; /* should initialize to stdout but gcc moans about it */
+FILE *rawerrorstream = NULL; /* should initialize to stderr but gcc moans about it */
+
+int bin_output; /* binary output */
+int bin_form = 0; /* binary form, default NATIVE */
+int region_output; /* region output */
+int oid_output; /* oid output */
+int data_output; /* data output */
+int attr_data_output; /* attribute data output */
+int compound_data;
+
+unsigned packed_bits_num; /* number of packed bits to display */
+unsigned packed_data_offset; /* offset of packed bits to display */
+unsigned packed_data_length; /* length of packed bits to display */
+unsigned long long packed_data_mask; /* mask in which packed bits to display */
+
+int enable_error_stack = 0; /* re-enable error stack; disable=0 enable=1 */
/* sort parameters */
-H5_index_t sort_by = H5_INDEX_NAME; /* sort_by [creation_order | name] */
-H5_iter_order_t sort_order = H5_ITER_INC; /* sort_order [ascending | descending] */
+H5_index_t sort_by = H5_INDEX_NAME; /* sort_by [creation_order | name] */
+H5_iter_order_t sort_order = H5_ITER_INC; /* sort_order [ascending | descending] */
/* module-scoped variables */
-static int h5tools_init_g; /* if h5tools lib has been initialized */
+static int h5tools_init_g; /* if h5tools lib has been initialized */
/* Names of VFDs. These names are always available so that
* the tools can emit special messages when a VFD is asked
@@ -76,21 +75,10 @@ static int h5tools_init_g; /* if h5tools lib has been initialized */
*
*/
const char *drivernames[] = {
- "sec2",
- "direct",
- "log",
- "windows",
- "stdio",
- "core",
- "family",
- "split",
- "multi",
- "mpio",
- "ros3",
- "hdfs",
+ "sec2", "direct", "log", "windows", "stdio", "core", "family", "split", "multi", "mpio", "ros3", "hdfs",
};
-#define NUM_DRIVERS (sizeof(drivernames) / sizeof(drivernames[0]))
+#define NUM_DRIVERS (sizeof(drivernames) / sizeof(drivernames[0]))
/*-------------------------------------------------------------------------
* Function: h5tools_init
@@ -234,9 +222,9 @@ h5tools_close(void)
int
h5tools_set_data_output_file(const char *fname, int is_bin)
{
- int retvalue = FAIL;
- FILE *f; /* temporary holding place for the stream pointer
- * so that rawdatastream is changed only when succeeded */
+ int retvalue = FAIL;
+ FILE *f; /* temporary holding place for the stream pointer
+ * so that rawdatastream is changed only when succeeded */
if (rawdatastream && rawdatastream != stdout) {
if (HDfclose(rawdatastream))
@@ -251,19 +239,19 @@ h5tools_set_data_output_file(const char *fname, int is_bin)
if (is_bin) {
if ((f = HDfopen(fname, "wb")) != NULL) {
rawdatastream = f;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
}
else {
if ((f = HDfopen(fname, "w")) != NULL) {
rawdatastream = f;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
}
}
else {
rawdatastream = NULL;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
return retvalue;
@@ -282,9 +270,9 @@ h5tools_set_data_output_file(const char *fname, int is_bin)
int
h5tools_set_attr_output_file(const char *fname, int is_bin)
{
- int retvalue = FAIL;
- FILE *f; /* temporary holding place for the stream pointer
- * so that rawattrstream is changed only when succeeded */
+ int retvalue = FAIL;
+ FILE *f; /* temporary holding place for the stream pointer
+ * so that rawattrstream is changed only when succeeded */
if (rawattrstream && rawattrstream != stdout) {
if (HDfclose(rawattrstream))
@@ -299,19 +287,19 @@ h5tools_set_attr_output_file(const char *fname, int is_bin)
if (is_bin) {
if ((f = HDfopen(fname, "wb")) != NULL) {
rawattrstream = f;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
}
else {
if ((f = HDfopen(fname, "w")) != NULL) {
rawattrstream = f;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
}
}
else {
rawattrstream = NULL;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
return retvalue;
@@ -331,9 +319,9 @@ h5tools_set_attr_output_file(const char *fname, int is_bin)
int
h5tools_set_input_file(const char *fname, int is_bin)
{
- int retvalue = FAIL;
- FILE *f; /* temporary holding place for the stream pointer
- * so that rawinstream is changed only when succeeded */
+ int retvalue = FAIL;
+ FILE *f; /* temporary holding place for the stream pointer
+ * so that rawinstream is changed only when succeeded */
if (rawinstream && rawinstream != stdin) {
if (HDfclose(rawinstream))
@@ -347,19 +335,19 @@ h5tools_set_input_file(const char *fname, int is_bin)
if (is_bin) {
if ((f = HDfopen(fname, "rb")) != NULL) {
rawinstream = f;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
}
else {
if ((f = HDfopen(fname, "r")) != NULL) {
rawinstream = f;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
}
}
else {
rawinstream = NULL;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
return retvalue;
@@ -379,9 +367,9 @@ h5tools_set_input_file(const char *fname, int is_bin)
int
h5tools_set_output_file(const char *fname, int is_bin)
{
- int retvalue = FAIL;
- FILE *f; /* temporary holding place for the stream pointer
- * so that rawoutstream is changed only when succeeded */
+ int retvalue = FAIL;
+ FILE *f; /* temporary holding place for the stream pointer
+ * so that rawoutstream is changed only when succeeded */
if (rawoutstream && rawoutstream != stdout) {
if (HDfclose(rawoutstream))
@@ -395,19 +383,19 @@ h5tools_set_output_file(const char *fname, int is_bin)
if (is_bin) {
if ((f = HDfopen(fname, "wb")) != NULL) {
rawoutstream = f;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
}
else {
if ((f = HDfopen(fname, "w")) != NULL) {
rawoutstream = f;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
}
}
else {
rawoutstream = NULL;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
return retvalue;
@@ -426,9 +414,9 @@ h5tools_set_output_file(const char *fname, int is_bin)
int
h5tools_set_error_file(const char *fname, int is_bin)
{
- int retvalue = FAIL;
- FILE *f; /* temporary holding place for the stream pointer
- * so that rawerrorstream is changed only when succeeded */
+ int retvalue = FAIL;
+ FILE *f; /* temporary holding place for the stream pointer
+ * so that rawerrorstream is changed only when succeeded */
if (rawerrorstream && rawerrorstream != stderr) {
if (HDfclose(rawerrorstream))
@@ -439,23 +427,23 @@ h5tools_set_error_file(const char *fname, int is_bin)
/* First check if filename is string "NULL" */
if (fname != NULL) {
- /* binary output */
+ /* binary output */
if (is_bin) {
if ((f = HDfopen(fname, "wb")) != NULL) {
rawerrorstream = f;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
}
else {
if ((f = HDfopen(fname, "w")) != NULL) {
rawerrorstream = f;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
}
}
else {
rawerrorstream = NULL;
- retvalue = SUCCEED;
+ retvalue = SUCCEED;
}
return retvalue;
@@ -495,7 +483,7 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info)
unsigned long long log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC;
/* Log Driver */
- if (H5Pset_fapl_log(fapl_id, NULL, log_flags, (size_t) 0) < 0)
+ if (H5Pset_fapl_log(fapl_id, NULL, log_flags, (size_t)0) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_log failed");
}
else if (!HDstrcmp(vfd_info->name, drivernames[WINDOWS_VFD_IDX])) {
@@ -514,7 +502,7 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info)
}
else if (!HDstrcmp(vfd_info->name, drivernames[CORE_VFD_IDX])) {
/* Core Driver */
- if (H5Pset_fapl_core(fapl_id, (size_t) H5_MB, TRUE) < 0)
+ if (H5Pset_fapl_core(fapl_id, (size_t)H5_MB, TRUE) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_core failed");
}
else if (!HDstrcmp(vfd_info->name, drivernames[FAMILY_VFD_IDX])) {
@@ -522,7 +510,7 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info)
/* Set member size to be 0 to indicate the current first member size
* is the member size.
*/
- if (H5Pset_fapl_family(fapl_id, (hsize_t) 0, H5P_DEFAULT) < 0)
+ if (H5Pset_fapl_family(fapl_id, (hsize_t)0, H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_family failed");
}
else if (!HDstrcmp(vfd_info->name, drivernames[SPLIT_VFD_IDX])) {
@@ -595,7 +583,7 @@ hid_t
h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vfd_info_t *vfd_info)
{
hid_t new_fapl_id = H5I_INVALID_HID;
- hid_t ret_value = H5I_INVALID_HID;
+ hid_t ret_value = H5I_INVALID_HID;
if (prev_fapl_id < 0)
H5TOOLS_GOTO_ERROR(FAIL, "invalid FAPL");
@@ -743,11 +731,11 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, hbool_t use_specific_driver,
- char *drivername, size_t drivername_size)
+h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, hbool_t use_specific_driver, char *drivername,
+ size_t drivername_size)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t tmp_fapl_id = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t tmp_fapl_id = H5I_INVALID_HID;
hid_t used_fapl_id = H5I_INVALID_HID;
unsigned drivernum;
hid_t ret_value = H5I_INVALID_HID;
@@ -761,9 +749,11 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, hbool_t use_spec
fid = H5Fopen(fname, flags, fapl_id);
}
else {
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
fid = H5Fopen(fname, flags, fapl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
}
/* If we succeeded in opening the file, we're done. */
@@ -784,13 +774,13 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, hbool_t use_spec
h5tools_vfd_info_t vfd_info;
/* Skip the log VFD as it prints out to standard out
- * and is fundamentally SEC2 anyway.
- */
+ * and is fundamentally SEC2 anyway.
+ */
if (drivernum == LOG_VFD_IDX)
continue;
- vfd_info.info = NULL;
- vfd_info.name = drivernames[drivernum];
+ vfd_info.info = NULL;
+ vfd_info.name = drivernames[drivernum];
/* Get a fapl reflecting the selected VFD */
if ((tmp_fapl_id = h5tools_get_fapl(fapl_id, &vfd_info)) < 0)
@@ -862,12 +852,12 @@ h5tools_detect_vlen(hid_t tid)
/* recursive detect any vlen data values in type (compound, array ...) */
ret = H5Tdetect_class(tid, H5T_VLEN);
- if((ret == TRUE) || (ret < 0))
+ if ((ret == TRUE) || (ret < 0))
goto done;
/* recursive detect any vlen string in type (compound, array ...) */
ret = h5tools_detect_vlen_str(tid);
- if((ret == TRUE) || (ret < 0))
+ if ((ret == TRUE) || (ret < 0))
goto done;
done:
@@ -888,42 +878,42 @@ htri_t
h5tools_detect_vlen_str(hid_t tid)
{
H5T_class_t tclass = -1;
- htri_t ret = FALSE;
+ htri_t ret = FALSE;
ret = H5Tis_variable_str(tid);
- if((ret == TRUE) || (ret < 0))
+ if ((ret == TRUE) || (ret < 0))
goto done;
tclass = H5Tget_class(tid);
- if(tclass == H5T_ARRAY || tclass == H5T_VLEN) {
+ if (tclass == H5T_ARRAY || tclass == H5T_VLEN) {
hid_t btid = H5Tget_super(tid);
- if(btid < 0) {
+ if (btid < 0) {
ret = (htri_t)btid;
goto done;
}
ret = h5tools_detect_vlen_str(btid);
- if((ret == TRUE) || (ret < 0)) {
+ if ((ret == TRUE) || (ret < 0)) {
H5Tclose(btid);
goto done;
}
}
- else if(tclass == H5T_COMPOUND) {
+ else if (tclass == H5T_COMPOUND) {
unsigned nmembs;
- int snmembs = H5Tget_nmembers(tid);
+ int snmembs = H5Tget_nmembers(tid);
unsigned u;
- if(snmembs < 0) {
+ if (snmembs < 0) {
ret = FAIL;
goto done;
}
nmembs = (unsigned)snmembs;
- for(u = 0; u < nmembs; u++) {
+ for (u = 0; u < nmembs; u++) {
hid_t mtid = H5Tget_member_type(tid, u);
ret = h5tools_detect_vlen_str(mtid);
- if((ret == TRUE) || (ret < 0)) {
+ if ((ret == TRUE) || (ret < 0)) {
H5Tclose(mtid);
goto done;
}
@@ -946,13 +936,13 @@ done:
*-------------------------------------------------------------------------
*/
void
-h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hsize_t elmtno, int secnum)
+h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hsize_t elmtno,
+ int secnum)
{
h5tools_str_t prefix;
- h5tools_str_t str; /*temporary for indentation */
- size_t templength = 0;
- unsigned u, indentlevel = 0;
+ h5tools_str_t str; /*temporary for indentation */
+ size_t templength = 0;
+ unsigned u, indentlevel = 0;
if (stream == NULL)
return;
@@ -960,13 +950,14 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context
if (!ctx->need_prefix)
return;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
HDmemset(&prefix, 0, sizeof(h5tools_str_t));
HDmemset(&str, 0, sizeof(h5tools_str_t));
/* Terminate previous line, if any */
- H5TOOLS_DEBUG("before CR elmtno=%ld, ctx->cur_column=%d, info->idx_fmt=%s, info->line_suf=%s", elmtno, ctx->cur_column, info->idx_fmt, info->line_suf);
+ H5TOOLS_DEBUG("before CR elmtno=%ld, ctx->cur_column=%d, info->idx_fmt=%s, info->line_suf=%s", elmtno,
+ ctx->cur_column, info->idx_fmt, info->line_suf);
if (ctx->cur_column) {
PUTSTREAM(OPT(info->line_suf, ""), stream);
HDputc('\n', stream);
@@ -1020,15 +1011,15 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context
H5TOOLS_DEBUG("prefix=%s - templength=%d", prefix.s, templength);
ctx->cur_column = ctx->prev_prefix_len = templength;
- ctx->cur_elmt = 0;
- ctx->need_prefix = 0;
+ ctx->cur_elmt = 0;
+ ctx->need_prefix = 0;
H5TOOLS_DEBUG("prefix=%s - str=%s", prefix.s, str.s);
/* Free string */
h5tools_str_close(&prefix);
h5tools_str_close(&str);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
}
/*-------------------------------------------------------------------------
@@ -1043,12 +1034,12 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context
*/
void
h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hsize_t elmtno, hsize_t *ptdata, int secnum)
+ hsize_t elmtno, hsize_t *ptdata, int secnum)
{
h5tools_str_t prefix;
- h5tools_str_t str; /*temporary for indentation */
- size_t templength = 0;
- unsigned u, indentlevel = 0;
+ h5tools_str_t str; /*temporary for indentation */
+ size_t templength = 0;
+ unsigned u, indentlevel = 0;
if (stream == NULL)
return;
@@ -1108,8 +1099,8 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_
}
ctx->cur_column = ctx->prev_prefix_len = templength;
- ctx->cur_elmt = 0;
- ctx->need_prefix = 0;
+ ctx->cur_elmt = 0;
+ ctx->need_prefix = 0;
/* Free string */
h5tools_str_close(&prefix);
@@ -1141,13 +1132,14 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_
*/
hbool_t
h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter)
+ h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t local_elmt_counter,
+ hsize_t elmt_counter)
{
- hbool_t dimension_break = TRUE;
- char *s = NULL;
- char *section = NULL; /* a section of output */
- int secnum; /* section sequence number */
- int multiline; /* datum was multiline */
+ hbool_t dimension_break = TRUE;
+ char * s = NULL;
+ char * section = NULL; /* a section of output */
+ int secnum; /* section sequence number */
+ int multiline; /* datum was multiline */
if (stream == NULL)
return dimension_break;
@@ -1163,9 +1155,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex
* current location...
*/
if (info->line_multi_new == 1 &&
- (ctx->cur_column + h5tools_count_ncols(s) +
- HDstrlen(OPT(info->elmt_suf2, " ")) +
- HDstrlen(OPT(info->line_suf, ""))) > ncols) {
+ (ctx->cur_column + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols) {
if (ctx->prev_multiline) {
/*
* ... and the previous element also occupied more than one
@@ -1173,9 +1164,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex
*/
ctx->need_prefix = TRUE;
}
- else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) +
- HDstrlen(OPT(info->elmt_suf2, " ")) +
- HDstrlen(OPT(info->line_suf, ""))) <= ncols) {
+ else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) <= ncols) {
/*
* ...but *could* fit on one line otherwise, then we
* should end the current line and start this element on its
@@ -1197,23 +1187,21 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex
if (elmt_counter == ctx->size_last_dim) {
ctx->need_prefix = TRUE;
- dimension_break = FALSE;
+ dimension_break = FALSE;
}
H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix);
}
- H5TOOLS_DEBUG("elmt_counter=%ld - ctx->size_last_dim=%ld info->line_suf=%s", elmt_counter, ctx->size_last_dim, info->line_suf);
+ H5TOOLS_DEBUG("elmt_counter=%ld - ctx->size_last_dim=%ld info->line_suf=%s", elmt_counter,
+ ctx->size_last_dim, info->line_suf);
/*
* If the previous element occupied multiple lines and this element
* is too long to fit on a line then start this element at the
* beginning of the line.
*/
- if (info->line_multi_new == 1 &&
- ctx->prev_multiline &&
- (ctx->cur_column +
- h5tools_count_ncols(s) +
- HDstrlen(OPT(info->elmt_suf2, " ")) +
- HDstrlen(OPT(info->line_suf, ""))) > ncols)
+ if (info->line_multi_new == 1 && ctx->prev_multiline &&
+ (ctx->cur_column + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = TRUE;
H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix);
@@ -1231,9 +1219,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex
* one-at a time.
*/
multiline = 0;
- for (secnum = 0, multiline = 0;
- (section = HDstrtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK));
- secnum++) {
+ for (secnum = 0, multiline = 0; (section = HDstrtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); secnum++) {
/*
* If the current section plus possible suffix and end-of-line
* information would cause the output to wrap then we need to
@@ -1243,9 +1229,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex
/*
* check for displaying prefix for each section
*/
- if ( (ctx->cur_column + HDstrlen(section) +
- HDstrlen(OPT(info->elmt_suf2, " ")) +
- HDstrlen(OPT(info->line_suf, ""))) > ncols)
+ if ((ctx->cur_column + HDstrlen(section) + HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = 1;
/*
@@ -1262,7 +1247,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex
* this is necessary to print the array indices
*/
*curr_pos = ctx->sm_pos + local_elmt_counter;
- H5TOOLS_DEBUG("curr_pos=%ld - ctx->sm_pos=%ld - ctx->ndims=%ld", *curr_pos, ctx->sm_pos, ctx->ndims);
+ H5TOOLS_DEBUG("curr_pos=%ld - ctx->sm_pos=%ld - ctx->ndims=%ld", *curr_pos, ctx->sm_pos,
+ ctx->ndims);
h5tools_simple_prefix(stream, info, ctx, *curr_pos, secnum);
}
@@ -1279,7 +1265,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex
ctx->prev_multiline = multiline;
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return dimension_break;
}
@@ -1311,15 +1297,16 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_contex
*/
hbool_t
h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter)
+ h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t *ptdata,
+ hsize_t local_elmt_counter, hsize_t elmt_counter)
{
- hbool_t dimension_break = TRUE;
- char *s = NULL;
- char *section = NULL; /* a section of output */
- int secnum; /* section sequence number */
- int multiline; /* datum was multiline */
+ hbool_t dimension_break = TRUE;
+ char * s = NULL;
+ char * section = NULL; /* a section of output */
+ int secnum; /* section sequence number */
+ int multiline; /* datum was multiline */
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
H5TOOLS_DEBUG("elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter);
s = h5tools_str_fmt(buffer, (size_t)0, "%s");
@@ -1329,9 +1316,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools
* current location...
*/
if (info->line_multi_new == 1 &&
- (ctx->cur_column + h5tools_count_ncols(s) +
- HDstrlen(OPT(info->elmt_suf2, " ")) +
- HDstrlen(OPT(info->line_suf, ""))) > ncols) {
+ (ctx->cur_column + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols) {
if (ctx->prev_multiline) {
/*
* ... and the previous element also occupied more than one
@@ -1339,9 +1325,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools
*/
ctx->need_prefix = TRUE;
}
- else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) +
- HDstrlen(OPT(info->elmt_suf2, " ")) +
- HDstrlen(OPT(info->line_suf, ""))) <= ncols) {
+ else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) <= ncols) {
/*
* ...but *could* fit on one line otherwise, then we
* should end the current line and start this element on its
@@ -1362,7 +1347,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools
if (elmt_counter == ctx->size_last_dim) {
ctx->need_prefix = TRUE;
- dimension_break = FALSE;
+ dimension_break = FALSE;
}
}
@@ -1372,9 +1357,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools
* beginning of the line.
*/
if (info->line_multi_new == 1 && ctx->prev_multiline &&
- (ctx->cur_column + h5tools_count_ncols(s) +
- HDstrlen(OPT(info->elmt_suf2, " ")) +
- HDstrlen(OPT(info->line_suf, ""))) > ncols)
+ (ctx->cur_column + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = TRUE;
/*
@@ -1402,9 +1386,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools
* this check to happen for the first line
*/
if ((!info->skip_first || local_elmt_counter) &&
- (ctx->cur_column + HDstrlen(section) +
- HDstrlen(OPT(info->elmt_suf2, " ")) +
- HDstrlen(OPT(info->line_suf, ""))) > ncols)
+ (ctx->cur_column + HDstrlen(section) + HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = 1;
/*
@@ -1436,7 +1419,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools
ctx->prev_multiline = multiline;
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return dimension_break;
}
@@ -1450,17 +1433,17 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools
*-------------------------------------------------------------------------
*/
void
-init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *p_min_idx)
+init_acc_pos(unsigned ndims, const hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *p_min_idx)
{
- int i;
+ int i;
unsigned j;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
for (i = 0; (unsigned)i < ndims; i++)
p_min_idx[i] = 0;
- if(ndims > 0) {
+ if (ndims > 0) {
acc[ndims - 1] = 1;
for (i = ((int)ndims - 2); i >= 0; i--) {
acc[i] = acc[i + 1] * dims[i + 1];
@@ -1470,7 +1453,7 @@ init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t
pos[j] = 0;
}
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
}
/*-------------------------------------------------------------------------
@@ -1483,16 +1466,16 @@ init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t
*-------------------------------------------------------------------------
*/
hsize_t
-calc_acc_pos(unsigned ndims, hsize_t elmtno, hsize_t *acc, hsize_t *pos)
+calc_acc_pos(unsigned ndims, hsize_t elmtno, const hsize_t *acc, hsize_t *pos)
{
- int i;
- hsize_t curr_pos = elmtno;
+ int i;
+ hsize_t curr_pos = elmtno;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
- if(ndims > 0) {
- for(i = 0; i < (int)ndims; i++) {
- if(curr_pos > 0) {
+ if (ndims > 0) {
+ for (i = 0; i < (int)ndims; i++) {
+ if (curr_pos > 0) {
H5TOOLS_DEBUG("curr_pos=%ld - ctx->acc[%d]=%ld", curr_pos, i, acc[i]);
pos[i] = curr_pos / acc[i];
curr_pos -= acc[i] * pos[i];
@@ -1503,7 +1486,7 @@ calc_acc_pos(unsigned ndims, hsize_t elmtno, hsize_t *acc, hsize_t *pos)
}
}
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return curr_pos;
}
@@ -1518,20 +1501,20 @@ calc_acc_pos(unsigned ndims, hsize_t elmtno, hsize_t *acc, hsize_t *pos)
*-------------------------------------------------------------------------
*/
int
-render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts)
+render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts)
{
- unsigned char *mem = (unsigned char*)_mem;
- size_t size; /* datum size */
+ unsigned char *mem = (unsigned char *)_mem;
+ size_t size; /* datum size */
hsize_t block_index;
H5T_class_t type_class;
hbool_t past_catch = FALSE;
- int ret_value = 0;
+ int ret_value = 0;
- H5TOOLS_START_DEBUG("");
- if((size = H5Tget_size(tid)) == 0)
+ H5TOOLS_START_DEBUG(" ");
+ if ((size = H5Tget_size(tid)) == 0)
H5TOOLS_THROW((-1), "H5Tget_size failed");
- if((type_class = H5Tget_class(tid)) < 0)
+ if ((type_class = H5Tget_class(tid)) < 0)
H5TOOLS_THROW((-1), "H5Tget_class failed");
switch (type_class) {
@@ -1541,191 +1524,185 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
case H5T_BITFIELD:
H5TOOLS_DEBUG("numbers");
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 */
+ while (block_index > 0) {
+ size_t bytes_in = 0; /* # of bytes to write */
+ size_t bytes_wrote = 0; /* # of bytes written */
- if(block_index > sizeof(size_t))
+ if (block_index > sizeof(size_t))
bytes_in = sizeof(size_t);
else
bytes_in = (size_t)block_index;
bytes_wrote = HDfwrite(mem, 1, bytes_in, stream);
- if(bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream)))
+ if (bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream)))
H5TOOLS_THROW((-1), "fwrite failed");
block_index -= (hsize_t)bytes_wrote;
mem = mem + bytes_wrote;
}
break;
- case H5T_STRING:
- {
- unsigned int i;
- H5T_str_t pad;
- char *s = NULL;
- unsigned char tempuchar;
-
- H5TOOLS_DEBUG("H5T_STRING");
- 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 **)((void *)mem);
- if (s != NULL)
- size = HDstrlen(s);
- else
- H5TOOLS_THROW((-1), "NULL string");
- }
- 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, sizeof(unsigned char), 1, stream))
- H5TOOLS_THROW((-1), "fwrite failed");
- } /* i */
- } /* for (block_index = 0; block_index < block_nelmts; block_index++) */
- }
- break;
- case H5T_COMPOUND:
- {
- int snmembs;
- unsigned nmembs;
-
- H5TOOLS_DEBUG("H5T_COMPOUND");
- if((snmembs = H5Tget_nmembers(tid)) < 0)
- H5TOOLS_THROW((-1), "H5Tget_nmembers of compound failed");
- nmembs = (unsigned)snmembs;
-
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- unsigned j;
-
- mem = ((unsigned char*)_mem) + block_index * size;
- for (j = 0; j < nmembs; j++) {
- hid_t memb = H5I_INVALID_HID;
- size_t offset;
-
- offset = H5Tget_member_offset(tid, j);
- memb = H5Tget_member_type(tid, j);
-
- if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) {
- H5Tclose(memb);
- H5TOOLS_THROW((-1), "render_bin_output of compound member failed");
- }
+ case H5T_STRING: {
+ unsigned int i;
+ H5T_str_t pad;
+ char * s = NULL;
+ unsigned char tempuchar;
- H5Tclose(memb);
- }
- }
- }
- break;
- case H5T_ARRAY:
- {
- int k, ndims;
- hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts;
- hid_t memb = H5I_INVALID_HID;
-
- H5TOOLS_DEBUG("H5T_ARRAY");
- /* get the array's base datatype for each element */
- memb = H5Tget_super(tid);
- ndims = H5Tget_array_ndims(tid);
- H5Tget_array_dims2(tid, dims);
- if(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;
- }
+ H5TOOLS_DEBUG("H5T_STRING");
+ 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 **)((void *)mem);
+ if (s != NULL)
+ size = HDstrlen(s);
+ else
+ H5TOOLS_THROW((-1), "NULL string");
}
else {
- H5Tclose(memb);
- H5TOOLS_THROW((-1), "calculate the number of array elements failed");
+ 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, sizeof(unsigned char), 1, stream))
+ H5TOOLS_THROW((-1), "fwrite failed");
+ } /* i */
+ } /* for (block_index = 0; block_index < block_nelmts; block_index++) */
+ } break;
+ case H5T_COMPOUND: {
+ int snmembs;
+ unsigned nmembs;
+
+ H5TOOLS_DEBUG("H5T_COMPOUND");
+ if ((snmembs = H5Tget_nmembers(tid)) < 0)
+ H5TOOLS_THROW((-1), "H5Tget_nmembers of compound failed");
+ nmembs = (unsigned)snmembs;
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ unsigned j;
+
+ mem = ((unsigned char *)_mem) + block_index * size;
+ for (j = 0; j < nmembs; j++) {
+ hid_t memb = H5I_INVALID_HID;
+ size_t offset;
- 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) {
+ offset = H5Tget_member_offset(tid, j);
+ memb = H5Tget_member_type(tid, j);
+
+ if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) {
H5Tclose(memb);
- H5TOOLS_THROW((-1), "render_bin_output failed");
+ H5TOOLS_THROW((-1), "render_bin_output of compound member failed");
}
+
+ H5Tclose(memb);
}
- H5Tclose(memb);
}
- break;
- case H5T_VLEN:
- {
- hsize_t nelmts;
- hid_t memb = H5I_INVALID_HID;
-
- H5TOOLS_DEBUG("H5T_VLEN");
- /* 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 *)((void *)mem))->len;
-
- /* dump the array element */
- if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *)((void *)mem))->p)), nelmts) < 0) {
- H5Tclose(memb);
- H5TOOLS_THROW((-1), "render_bin_output failed");
- }
+ } break;
+ case H5T_ARRAY: {
+ int k, ndims;
+ hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts = 0;
+ hid_t memb = H5I_INVALID_HID;
+
+ H5TOOLS_DEBUG("H5T_ARRAY");
+ /* get the array's base datatype for each element */
+ memb = H5Tget_super(tid);
+ ndims = H5Tget_array_ndims(tid);
+ H5Tget_array_dims2(tid, dims);
+ if (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;
}
+ }
+ else {
H5Tclose(memb);
+ H5TOOLS_THROW((-1), "calculate the number of array elements failed");
}
- break;
- case H5T_REFERENCE:
- {
- H5TOOLS_DEBUG("reference class type");
- if (size == H5R_DSET_REG_REF_BUF_SIZE) {
- /* if (H5Tequal(tid, H5T_STD_REF_DSETREG)) */
- H5TOOLS_DEBUG("H5T_STD_REF_DSETREG");
- if (region_output) {
- /* region data */
- hid_t region_id = H5I_INVALID_HID;
- hid_t region_space = H5I_INVALID_HID;
- H5S_sel_type region_type;
-
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- if((region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem)) < 0)
- H5TOOLS_INFO("H5Ropen_object H5T_STD_REF failed");
- else {
- if((region_space = H5Rget_region(container, H5R_DATASET_REGION, mem)) >= 0) {
- if (!h5tools_is_zero(mem, H5R_DSET_REG_REF_BUF_SIZE)) {
- 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);
- }
- else {
- H5TOOLS_INFO("H5Ropen_object H5T_STD_REF NULL");
- }
- H5Sclose(region_space);
- } /* end if (region_space >= 0) */
- H5Dclose(region_id);
- }
- }
- } /* end if (region_output... */
+
+ 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) {
+ H5Tclose(memb);
+ H5TOOLS_THROW((-1), "render_bin_output failed");
}
- else if (size == H5R_OBJ_REF_BUF_SIZE) {
- /* if (H5Tequal(tid, H5T_STD_REF_OBJ)) */
- H5TOOLS_DEBUG("H5T_STD_REF_OBJ");
+ }
+ H5Tclose(memb);
+ } break;
+ case H5T_VLEN: {
+ hsize_t nelmts;
+ hid_t memb = H5I_INVALID_HID;
+
+ H5TOOLS_DEBUG("H5T_VLEN");
+ /* 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 *)((void *)mem))->len;
+
+ /* dump the array element */
+ if (render_bin_output(stream, container, memb, ((char *)(((hvl_t *)((void *)mem))->p)),
+ nelmts) < 0) {
+ H5Tclose(memb);
+ H5TOOLS_THROW((-1), "render_bin_output failed");
}
}
- break;
+ H5Tclose(memb);
+ } break;
+ case H5T_REFERENCE: {
+ H5TOOLS_DEBUG("reference class type");
+ if (size == H5R_DSET_REG_REF_BUF_SIZE) {
+ /* if (H5Tequal(tid, H5T_STD_REF_DSETREG)) */
+ H5TOOLS_DEBUG("H5T_STD_REF_DSETREG");
+ if (region_output) {
+ /* region data */
+ hid_t region_id = H5I_INVALID_HID;
+ hid_t region_space = H5I_INVALID_HID;
+ H5S_sel_type region_type;
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char *)_mem) + block_index * size;
+ if ((region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem)) <
+ 0)
+ H5TOOLS_INFO("H5Ropen_object H5T_STD_REF failed");
+ else {
+ if ((region_space = H5Rget_region(container, H5R_DATASET_REGION, mem)) >= 0) {
+ if (!h5tools_is_zero(mem, H5R_DSET_REG_REF_BUF_SIZE)) {
+ 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);
+ }
+ else {
+ H5TOOLS_INFO("H5Ropen_object H5T_STD_REF NULL");
+ }
+ H5Sclose(region_space);
+ } /* end if (region_space >= 0) */
+ H5Dclose(region_id);
+ }
+ }
+ } /* end if (region_output... */
+ }
+ else if (size == H5R_OBJ_REF_BUF_SIZE) {
+ /* if (H5Tequal(tid, H5T_STD_REF_OBJ)) */
+ H5TOOLS_DEBUG("H5T_STD_REF_OBJ");
+ }
+ } break;
case H5T_TIME:
case H5T_OPAQUE:
H5TOOLS_DEBUG("H5T_OPAQUE");
for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
+ mem = ((unsigned char *)_mem) + block_index * size;
if (size != HDfwrite(mem, sizeof(char), size, stream))
H5TOOLS_THROW((-1), "fwrite failed");
} /* end for */
@@ -1739,8 +1716,8 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
break;
} /* end switch */
-CATCH
- H5TOOLS_ENDDEBUG("");
+ CATCH
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1756,55 +1733,55 @@ CATCH
*-------------------------------------------------------------------------
*/
int
-render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
- hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata)
+render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t container, unsigned ndims,
+ hid_t type_id, hsize_t nblocks, const hsize_t *ptdata)
{
- hsize_t *dims1 = NULL;
- hsize_t *start = NULL;
- hsize_t *count = NULL;
- hsize_t numelem;
- hsize_t total_size[H5S_MAX_RANK];
- unsigned jndx;
- size_t type_size;
- hid_t mem_space = H5I_INVALID_HID;
- void *region_buf = NULL;
- hbool_t past_catch = FALSE;
- hsize_t blkndx;
- hid_t sid1 = H5I_INVALID_HID;
- int ret_value = -1;
-
- H5TOOLS_START_DEBUG("");
+ hsize_t *dims1 = NULL;
+ hsize_t *start = NULL;
+ hsize_t *count = NULL;
+ hsize_t numelem;
+ hsize_t total_size[H5S_MAX_RANK];
+ unsigned jndx;
+ size_t type_size;
+ hid_t mem_space = H5I_INVALID_HID;
+ void * region_buf = NULL;
+ hbool_t past_catch = FALSE;
+ hsize_t blkndx;
+ hid_t sid1 = H5I_INVALID_HID;
+ int ret_value = -1;
+
+ H5TOOLS_START_DEBUG(" ");
/* Get the dataspace of the dataset */
- if((sid1 = H5Dget_space(region_id)) < 0)
+ if ((sid1 = H5Dget_space(region_id)) < 0)
H5TOOLS_THROW((-1), "H5Dget_space failed");
/* Allocate space for the dimension array */
- if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate buffer for dims");
/* find the dimensions of each data space from the block coordinates */
numelem = 1;
for (jndx = 0; jndx < ndims; jndx++) {
dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1;
- numelem = dims1[jndx] * numelem;
+ numelem = dims1[jndx] * numelem;
}
/* Create dataspace for reading buffer */
- if((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0)
+ if ((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0)
H5TOOLS_THROW((-1), "H5Screate_simple failed");
- if((type_size = H5Tget_size(type_id)) == 0)
+ if ((type_size = H5Tget_size(type_id)) == 0)
H5TOOLS_THROW((-1), "H5Tget_size failed");
- if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL)
+ if ((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate region buffer");
/* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
/* 1 2 n 1 2 n */
- if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate buffer for start");
- if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate buffer for count");
for (blkndx = 0; blkndx < nblocks; blkndx++) {
@@ -1813,34 +1790,33 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
count[jndx] = dims1[jndx];
}
- if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed");
- if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0)
+ if (H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
- if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
+ if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed");
- if(render_bin_output(stream, container, type_id, (char*)region_buf, numelem) < 0)
+ if (render_bin_output(stream, container, type_id, (char *)region_buf, numelem) < 0)
H5TOOLS_GOTO_ERROR((-1), "render_bin_output of data region failed");
/* Render the region data element end */
-done:
- ;
+done:;
} /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
-CATCH
+ CATCH
HDfree(start);
HDfree(count);
HDfree(region_buf);
HDfree(dims1);
- if(H5Sclose(mem_space) < 0)
+ if (H5Sclose(mem_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
- if(H5Sclose(sid1) < 0)
+ if (H5Sclose(sid1) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1855,40 +1831,39 @@ CATCH
*-------------------------------------------------------------------------
*/
hbool_t
-render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
- FILE *stream, hid_t container)
+render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container)
{
- hssize_t snblocks;
- hsize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata = NULL;
- int sndims;
- unsigned ndims;
- hid_t dtype = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- hbool_t past_catch = FALSE;
- hbool_t ret_value = TRUE;
-
- H5TOOLS_START_DEBUG("");
- if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
+ hssize_t snblocks;
+ hsize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ int sndims;
+ unsigned ndims;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ hbool_t past_catch = FALSE;
+ hbool_t ret_value = TRUE;
+
+ H5TOOLS_START_DEBUG(" ");
+ if ((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
H5TOOLS_THROW(FALSE, "H5Sget_select_hyper_nblocks failed");
nblocks = (hsize_t)snblocks;
/* Print block information */
- if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ if ((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
H5TOOLS_THROW(FALSE, "H5Sget_simple_extent_ndims failed");
ndims = (unsigned)sndims;
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
- if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL)
+ if ((ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL)
H5TOOLS_GOTO_ERROR(FALSE, "Could not allocate buffer for ptdata");
- if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, nblocks, ptdata) < 0)
+ if (H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, nblocks, ptdata) < 0)
H5TOOLS_GOTO_ERROR(FALSE, "H5Rget_select_hyper_blocklist failed");
- if((dtype = H5Dget_type(region_id)) < 0)
+ if ((dtype = H5Dget_type(region_id)) < 0)
H5TOOLS_GOTO_ERROR(FALSE, "H5Dget_type failed");
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FALSE, "H5Tget_native_type failed");
render_bin_output_region_data_blocks(region_id, stream, container, ndims, type_id, nblocks, ptdata);
@@ -1896,16 +1871,16 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
done:
HDfree(ptdata);
- if(type_id > 0 && H5Tclose(type_id) < 0)
+ if (type_id > 0 && H5Tclose(type_id) < 0)
H5TOOLS_ERROR(FALSE, "H5Tclose failed");
- if(dtype > 0 && H5Tclose(dtype) < 0)
+ if (dtype > 0 && H5Tclose(dtype) < 0)
H5TOOLS_ERROR(FALSE, "H5Tclose failed");
H5_LEAVE(TRUE)
-CATCH
- H5TOOLS_ENDDEBUG("");
+ CATCH
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1927,47 +1902,46 @@ CATCH
*-------------------------------------------------------------------------
*/
int
-render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
- FILE *stream, hid_t container,
- unsigned ndims, hid_t type_id, hsize_t npoints)
+render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container,
+ unsigned ndims, hid_t type_id, hsize_t npoints)
{
hsize_t *dims1 = NULL;
size_t type_size;
- hid_t mem_space = H5I_INVALID_HID;
- void *region_buf = NULL;
- int ret_value = 0;
+ hid_t mem_space = H5I_INVALID_HID;
+ void * region_buf = NULL;
+ int ret_value = 0;
- H5TOOLS_START_DEBUG("");
- if((type_size = H5Tget_size(type_id)) == 0)
+ H5TOOLS_START_DEBUG(" ");
+ if ((type_size = H5Tget_size(type_id)) == 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
- if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL)
+ if ((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL)
H5TOOLS_GOTO_ERROR((-1), "Could not allocate buffer for region");
/* Allocate space for the dimension array */
- if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_GOTO_ERROR((-1), "Could not allocate buffer for dims");
dims1[0] = npoints;
- if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(1, dims1, NULL)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Screate_simple failed");
- if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0)
+ if (H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
- if(H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0)
+ if (H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed");
- if(render_bin_output(stream, container, type_id, (char*)region_buf, npoints) < 0)
+ if (render_bin_output(stream, container, type_id, (char *)region_buf, npoints) < 0)
H5TOOLS_GOTO_ERROR((-1), "render_bin_output of data points failed");
done:
HDfree(region_buf);
HDfree(dims1);
- if(H5Sclose(mem_space) < 0)
+ if (H5Sclose(mem_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1982,46 +1956,45 @@ done:
*-------------------------------------------------------------------------
*/
hbool_t
-render_bin_output_region_points(hid_t region_space, hid_t region_id,
- FILE *stream, hid_t container)
+render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container)
{
hssize_t snpoints;
hsize_t npoints;
int sndims;
unsigned ndims;
- hid_t dtype = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
hbool_t past_catch = FALSE;
- hbool_t ret_value = TRUE;
+ hbool_t ret_value = TRUE;
- H5TOOLS_START_DEBUG("");
- if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
+ H5TOOLS_START_DEBUG(" ");
+ if ((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
H5TOOLS_THROW(FALSE, "H5Sget_select_elem_npoints failed");
npoints = (hsize_t)snpoints;
/* Allocate space for the dimension array */
- if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ if ((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
H5TOOLS_THROW(FALSE, "H5Sget_simple_extent_ndims failed");
ndims = (unsigned)sndims;
- if((dtype = H5Dget_type(region_id)) < 0)
+ if ((dtype = H5Dget_type(region_id)) < 0)
H5TOOLS_GOTO_ERROR(FALSE, "H5Dget_type failed");
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FALSE, "H5Tget_native_type failed");
render_bin_output_region_data_points(region_space, region_id, stream, container, ndims, type_id, npoints);
done:
- if(type_id > 0 && H5Tclose(type_id) < 0)
+ if (type_id > 0 && H5Tclose(type_id) < 0)
H5TOOLS_ERROR(FALSE, "H5Tclose failed");
- if(dtype > 0 && H5Tclose(dtype) < 0)
+ if (dtype > 0 && H5Tclose(dtype) < 0)
H5TOOLS_ERROR(FALSE, "H5Tclose failed");
H5_LEAVE(ret_value)
-CATCH
- H5TOOLS_ENDDEBUG("");
+ CATCH
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -2037,7 +2010,7 @@ CATCH
H5_ATTR_PURE hbool_t
h5tools_is_zero(const void *_mem, size_t size)
{
- const unsigned char *mem = (const unsigned char *) _mem;
+ const unsigned char *mem = (const unsigned char *)_mem;
while (size-- > 0)
if (mem[size])
@@ -2064,25 +2037,23 @@ h5tools_is_zero(const void *_mem, size_t size)
*-------------------------------------------------------------------------
*/
hbool_t
-h5tools_is_obj_same(hid_t loc_id1, const char *name1,
- hid_t loc_id2, const char *name2)
+h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2)
{
- H5O_info_t oinfo1, oinfo2;
- hbool_t ret_val = FALSE;
+ H5O_info_t oinfo1, oinfo2;
+ hbool_t ret_val = FALSE;
- if ( name1 && HDstrcmp(name1, "."))
- H5Oget_info_by_name2(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
+ if (name1 && HDstrcmp(name1, ".") != 0)
+ H5Oget_info_by_name2(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
else
- H5Oget_info2(loc_id1, &oinfo1, H5O_INFO_BASIC);
+ H5Oget_info2(loc_id1, &oinfo1, H5O_INFO_BASIC);
- if ( name2 && HDstrcmp(name2, "."))
- H5Oget_info_by_name2(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
+ if (name2 && HDstrcmp(name2, ".") != 0)
+ H5Oget_info_by_name2(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
else
- H5Oget_info2(loc_id2, &oinfo2, H5O_INFO_BASIC);
+ H5Oget_info2(loc_id2, &oinfo2, H5O_INFO_BASIC);
- if (oinfo1.fileno == oinfo2.fileno && oinfo1.addr==oinfo2.addr)
- ret_val = 1;
+ if (oinfo1.fileno == oinfo2.fileno && oinfo1.addr == oinfo2.addr)
+ ret_val = 1;
return ret_val;
}
-
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index cde8670..d75506d 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,94 +17,104 @@
*
* Purpose: Support functions for the various tools.
*/
-#ifndef H5TOOLS_H__
-#define H5TOOLS_H__
+#ifndef H5TOOLS_H
+#define H5TOOLS_H
#include "hdf5.h"
#include "h5tools_error.h"
-#define ESCAPE_HTML 1
-#define OPT(X,S) ((X) ? (X) : (S))
-#define OPTIONAL_LINE_BREAK "\001" /* Special strings embedded in the output */
+#define ESCAPE_HTML 1
+#define OPT(X, S) ((X) ? (X) : (S))
+#define OPTIONAL_LINE_BREAK "\001" /* Special strings embedded in the output */
#define START_OF_DATA 0x0001
-#define END_OF_DATA 0x0002
+#define END_OF_DATA 0x0002
/* format for hsize_t */
-#define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u"
+#define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u"
-#define H5TOOLS_DUMP_MAX_RANK H5S_MAX_RANK
+#define H5TOOLS_DUMP_MAX_RANK H5S_MAX_RANK
/* Stream macros */
-#define FLUSHSTREAM(S) if(S != NULL) HDfflush(S)
-#define PRINTSTREAM(S, F, ...) if(S != NULL) HDfprintf(S, F, __VA_ARGS__)
-#define PRINTVALSTREAM(S, V) if(S != NULL) HDfprintf(S, V)
-#define PUTSTREAM(X,S) do { if(S != NULL) HDfputs(X, S); } while(0)
+#define FLUSHSTREAM(S) \
+ if (S != NULL) \
+ HDfflush(S)
+#define PRINTSTREAM(S, F, ...) \
+ if (S != NULL) \
+ HDfprintf(S, F, __VA_ARGS__)
+#define PRINTVALSTREAM(S, V) \
+ if (S != NULL) \
+ HDfprintf(S, V)
+#define PUTSTREAM(X, S) \
+ do { \
+ if (S != NULL) \
+ HDfputs(X, S); \
+ } while (0)
/*
* Strings for output - these were duplicated from the h5dump.h
* file in order to support region reference data display
*/
-#define ATTRIBUTE "ATTRIBUTE"
-#define BLOCK "BLOCK"
-#define SUPER_BLOCK "SUPER_BLOCK"
-#define COMPRESSION "COMPRESSION"
-#define CONCATENATOR "//"
-#define COMPLEX "COMPLEX"
-#define COUNT "COUNT"
-#define CSET "CSET"
-#define CTYPE "CTYPE"
-#define DATA "DATA"
-#define DATASPACE "DATASPACE"
-#define EXTERNAL "EXTERNAL"
-#define FILENO "FILENO"
-#define HARDLINK "HARDLINK"
-#define NLINK "NLINK"
-#define OBJID "OBJECTID"
-#define OBJNO "OBJNO"
-#define S_SCALAR "SCALAR"
-#define S_SIMPLE "SIMPLE"
-#define S_NULL "NULL"
-#define SOFTLINK "SOFTLINK"
-#define EXTLINK "EXTERNAL_LINK"
-#define UDLINK "USERDEFINED_LINK"
-#define START "START"
-#define STRIDE "STRIDE"
-#define STRSIZE "STRSIZE"
-#define STRPAD "STRPAD"
-#define SUBSET "SUBSET"
-#define FILTERS "FILTERS"
-#define DEFLATE "COMPRESSION DEFLATE"
-#define DEFLATE_LEVEL "LEVEL"
-#define SHUFFLE "PREPROCESSING SHUFFLE"
-#define FLETCHER32 "CHECKSUM FLETCHER32"
-#define SZIP "COMPRESSION SZIP"
-#define NBIT "COMPRESSION NBIT"
-#define SCALEOFFSET "COMPRESSION SCALEOFFSET"
-#define SCALEOFFSET_MINBIT "MIN BITS"
-#define STORAGE_LAYOUT "STORAGE_LAYOUT"
-#define CONTIGUOUS "CONTIGUOUS"
-#define COMPACT "COMPACT"
-#define CHUNKED "CHUNKED"
-#define EXTERNAL_FILE "EXTERNAL_FILE"
-#define FILLVALUE "FILLVALUE"
-#define FILE_CONTENTS "FILE_CONTENTS"
-#define PACKED_BITS "PACKED_BITS"
-#define PACKED_OFFSET "OFFSET"
-#define PACKED_LENGTH "LENGTH"
-#define REGION "REGION"
-#define VDS_VIRTUAL "VIRTUAL"
-#define VDS_MAPPING "MAPPING"
-#define VDS_SOURCE "SOURCE"
-#define VDS_REG_HYPERSLAB "SELECTION REGULAR_HYPERSLAB"
-#define VDS_IRR_HYPERSLAB "SELECTION IRREGULAR_HYPERSLAB"
-#define VDS_POINT "POINT"
-#define VDS_SRC_FILE "FILE"
-#define VDS_SRC_DATASET "DATASET"
-#define VDS_NONE "SELECTION NONE"
-#define VDS_ALL "SELECTION ALL"
-
-#define BEGIN "{"
-#define END "}"
+#define ATTRIBUTE "ATTRIBUTE"
+#define BLOCK "BLOCK"
+#define SUPER_BLOCK "SUPER_BLOCK"
+#define COMPRESSION "COMPRESSION"
+#define CONCATENATOR "//"
+#define COMPLEX "COMPLEX"
+#define COUNT "COUNT"
+#define CSET "CSET"
+#define CTYPE "CTYPE"
+#define DATA "DATA"
+#define DATASPACE "DATASPACE"
+#define EXTERNAL "EXTERNAL"
+#define FILENO "FILENO"
+#define HARDLINK "HARDLINK"
+#define NLINK "NLINK"
+#define OBJID "OBJECTID"
+#define OBJNO "OBJNO"
+#define S_SCALAR "SCALAR"
+#define S_SIMPLE "SIMPLE"
+#define S_NULL "NULL"
+#define SOFTLINK "SOFTLINK"
+#define EXTLINK "EXTERNAL_LINK"
+#define UDLINK "USERDEFINED_LINK"
+#define START "START"
+#define STRIDE "STRIDE"
+#define STRSIZE "STRSIZE"
+#define STRPAD "STRPAD"
+#define SUBSET "SUBSET"
+#define FILTERS "FILTERS"
+#define DEFLATE "COMPRESSION DEFLATE"
+#define DEFLATE_LEVEL "LEVEL"
+#define SHUFFLE "PREPROCESSING SHUFFLE"
+#define FLETCHER32 "CHECKSUM FLETCHER32"
+#define SZIP "COMPRESSION SZIP"
+#define NBIT "COMPRESSION NBIT"
+#define SCALEOFFSET "COMPRESSION SCALEOFFSET"
+#define SCALEOFFSET_MINBIT "MIN BITS"
+#define STORAGE_LAYOUT "STORAGE_LAYOUT"
+#define CONTIGUOUS "CONTIGUOUS"
+#define COMPACT "COMPACT"
+#define CHUNKED "CHUNKED"
+#define EXTERNAL_FILE "EXTERNAL_FILE"
+#define FILLVALUE "FILLVALUE"
+#define FILE_CONTENTS "FILE_CONTENTS"
+#define PACKED_BITS "PACKED_BITS"
+#define PACKED_OFFSET "OFFSET"
+#define PACKED_LENGTH "LENGTH"
+#define REGION "REGION"
+#define VDS_VIRTUAL "VIRTUAL"
+#define VDS_MAPPING "MAPPING"
+#define VDS_SOURCE "SOURCE"
+#define VDS_REG_HYPERSLAB "SELECTION REGULAR_HYPERSLAB"
+#define VDS_IRR_HYPERSLAB "SELECTION IRREGULAR_HYPERSLAB"
+#define VDS_POINT "POINT"
+#define VDS_SRC_FILE "FILE"
+#define VDS_SRC_DATASET "DATASET"
+#define VDS_NONE "SELECTION NONE"
+#define VDS_ALL "SELECTION ALL"
+
+#define BEGIN "{"
+#define END "}"
/*
* dump structure for output - this was duplicated from the h5dump.h
@@ -205,7 +215,6 @@ typedef struct h5tools_dump_header_t {
/* Forward declaration (see declaration in h5tools_str.c) */
struct H5LD_memb_t;
-
/*
* Information about how to format output.
*/
@@ -282,19 +291,19 @@ typedef struct h5tool_format_t {
* Numeric data is also subject to the formats for individual elements.
*/
hbool_t raw;
- const char *fmt_raw;
- const char *fmt_int;
- const char *fmt_uint;
- const char *fmt_schar;
- const char *fmt_uchar;
- const char *fmt_short;
- const char *fmt_ushort;
- const char *fmt_long;
- const char *fmt_ulong;
- const char *fmt_llong;
- const char *fmt_ullong;
- const char *fmt_double;
- const char *fmt_float;
+ const char *fmt_raw;
+ const char *fmt_int;
+ const char *fmt_uint;
+ const char *fmt_schar;
+ const char *fmt_uchar;
+ const char *fmt_short;
+ const char *fmt_ushort;
+ const char *fmt_long;
+ const char *fmt_ulong;
+ const char *fmt_llong;
+ const char *fmt_ullong;
+ const char *fmt_double;
+ const char *fmt_float;
int ascii;
int str_locale;
unsigned str_repeat;
@@ -315,9 +324,9 @@ typedef struct h5tool_format_t {
* linebreaks: a boolean value to determine if we want to break the line
* after each row of an array.
*/
- const char *arr_pre;
- const char *arr_sep;
- const char *arr_suf;
+ const char *arr_pre;
+ const char *arr_sep;
+ const char *arr_suf;
int arr_linebreak;
/*
@@ -344,13 +353,12 @@ typedef struct h5tool_format_t {
*
* listv: h5watch: vector containing info about the list of compound fields to be printed.
*/
- const char *cmpd_name;
- const char *cmpd_sep;
- const char *cmpd_pre;
- const char *cmpd_suf;
- const char *cmpd_end;
- const struct H5LD_memb_t * const *cmpd_listv;
-
+ const char * cmpd_name;
+ const char * cmpd_sep;
+ const char * cmpd_pre;
+ const char * cmpd_suf;
+ const char * cmpd_end;
+ const struct H5LD_memb_t *const *cmpd_listv;
/*
* Fields associated with vlen data types.
@@ -369,10 +377,10 @@ typedef struct h5tool_format_t {
* end: a string to print after we reach the last element of
* each compound type. prints out before the suf.
*/
- const char *vlen_sep;
- const char *vlen_pre;
- const char *vlen_suf;
- const char *vlen_end;
+ const char *vlen_sep;
+ const char *vlen_pre;
+ const char *vlen_suf;
+ const char *vlen_end;
/*
* Fields associated with the individual elements.
@@ -388,9 +396,9 @@ typedef struct h5tool_format_t {
* are followed on the same line by another element. The
* default is a single space.
*/
- const char *elmt_fmt;
- const char *elmt_suf1;
- const char *elmt_suf2;
+ const char *elmt_fmt;
+ const char *elmt_suf1;
+ const char *elmt_suf2;
/*
* Fields associated with the index values printed at the left edge of
@@ -409,9 +417,9 @@ typedef struct h5tool_format_t {
* printf(3c) format which should include a format for a
* character string. The default is "%s".
*/
- const char *idx_n_fmt; /*index number format */
- const char *idx_sep; /*separator between numbers */
- const char *idx_fmt; /*entire index format */
+ const char *idx_n_fmt; /*index number format */
+ const char *idx_sep; /*separator between numbers */
+ const char *idx_fmt; /*entire index format */
/*
* Fields associated with entire lines.
@@ -467,15 +475,15 @@ typedef struct h5tool_format_t {
* indentlevel: a string that shows how far to indent if extra spacing
* is needed. dumper uses it.
*/
- unsigned line_ncols; /*columns of output */
- size_t line_per_line; /*max elements per line */
- const char *line_pre; /*prefix at front of each line */
- const char *line_1st; /*alternate pre. on first line */
- const char *line_cont; /*alternate pre. on continuation*/
- const char *line_suf; /*string to append to each line */
- const char *line_sep; /*separates lines */
- int line_multi_new; /*split multi-line outputs? */
- const char *line_indent; /*for extra identation if we need it*/
+ unsigned line_ncols; /*columns of output */
+ size_t line_per_line; /*max elements per line */
+ const char *line_pre; /*prefix at front of each line */
+ const char *line_1st; /*alternate pre. on first line */
+ const char *line_cont; /*alternate pre. on continuation*/
+ const char *line_suf; /*string to append to each line */
+ const char *line_sep; /*separates lines */
+ int line_multi_new; /*split multi-line outputs? */
+ const char *line_indent; /*for extra identation if we need it*/
/*used to skip the first set of checks for line length*/
int skip_first;
@@ -505,7 +513,7 @@ typedef struct h5tool_format_t {
} h5tool_format_t;
typedef struct subset_d {
- hsize_t *data;
+ hsize_t * data;
unsigned int len;
} subset_d;
@@ -518,25 +526,26 @@ struct subset_t {
};
typedef struct h5tools_context_t {
- size_t cur_column; /* current column for output */
- size_t cur_elmt; /* current element/output line */
- int need_prefix; /* is line prefix needed? */
+ size_t cur_column; /* current column for output */
+ size_t cur_elmt; /* current element/output line */
+ int need_prefix; /* is line prefix needed? */
unsigned ndims; /* dimensionality */
- hsize_t p_min_idx[H5S_MAX_RANK]; /* min selected index */
- hsize_t p_max_idx[H5S_MAX_RANK]; /* max selected index */
- int prev_multiline; /* was prev datum multiline? */
- size_t prev_prefix_len; /* length of previous prefix */
- int continuation; /* continuation of previous data?*/
- hsize_t size_last_dim; /* the size of the last dimension, needed so we can break after each row */
- unsigned indent_level; /* the number of times we need some extra indentation */
- unsigned default_indent_level; /* this is used when the indent level gets changed */
- hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
- hsize_t pos[H5S_MAX_RANK]; /* matrix position */
- hsize_t sm_pos; /* current stripmine element position */
- const struct H5LD_memb_t * const *cmpd_listv; /* h5watch: vector containing info about the list of compound fields to be printed */
- struct subset_t *sset; /* subsetting parameters */
- int display_index; /* */
- int display_char; /* */
+ hsize_t p_min_idx[H5S_MAX_RANK]; /* min selected index */
+ hsize_t p_max_idx[H5S_MAX_RANK]; /* max selected index */
+ int prev_multiline; /* was prev datum multiline? */
+ size_t prev_prefix_len; /* length of previous prefix */
+ int continuation; /* continuation of previous data?*/
+ hsize_t size_last_dim; /* the size of the last dimension, needed so we can break after each row */
+ unsigned indent_level; /* the number of times we need some extra indentation */
+ unsigned default_indent_level; /* this is used when the indent level gets changed */
+ hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
+ hsize_t pos[H5S_MAX_RANK]; /* matrix position */
+ hsize_t sm_pos; /* current stripmine element position */
+ const struct H5LD_memb_t *const
+ *cmpd_listv; /* h5watch: vector containing info about the list of compound fields to be printed */
+ struct subset_t *sset; /* subsetting parameters */
+ int display_index; /* */
+ int display_char; /* */
} h5tools_context_t;
/* VFD info structs used to set the file access property
@@ -575,99 +584,105 @@ typedef enum {
#include "h5tools_str.h"
-
#ifdef __cplusplus
extern "C" {
#endif
H5TOOLS_DLLVAR const char *drivernames[];
-H5TOOLS_DLLVAR h5tool_format_t h5tools_dataformat;
+H5TOOLS_DLLVAR h5tool_format_t h5tools_dataformat;
H5TOOLS_DLLVAR const h5tools_dump_header_t h5tools_standardformat;
-H5TOOLS_DLLVAR const h5tools_dump_header_t* h5tools_dump_header_format;
-H5TOOLS_DLLVAR H5E_auto2_t lib_func;
-H5TOOLS_DLLVAR H5E_auto2_t tools_func;
-H5TOOLS_DLLVAR void *lib_edata;
-H5TOOLS_DLLVAR void *tools_edata;
-
-H5TOOLS_DLLVAR unsigned packed_bits_num; /* number of packed bits to display */
-H5TOOLS_DLLVAR unsigned packed_data_offset; /* offset of packed bits to display */
-H5TOOLS_DLLVAR unsigned packed_data_length; /* length of packed bits to display */
-H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */
-H5TOOLS_DLLVAR FILE *rawattrstream; /* output stream for raw attribute data */
-H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */
-H5TOOLS_DLLVAR FILE *rawinstream; /* input stream for raw input */
-H5TOOLS_DLLVAR FILE *rawoutstream; /* output stream for raw output */
-H5TOOLS_DLLVAR FILE *rawerrorstream; /* output stream for raw error */
-H5TOOLS_DLLVAR int bin_output; /* binary output */
-H5TOOLS_DLLVAR int bin_form; /* binary form */
-H5TOOLS_DLLVAR int region_output; /* region output */
-H5TOOLS_DLLVAR int oid_output; /* oid output */
-H5TOOLS_DLLVAR int data_output; /* data output */
-H5TOOLS_DLLVAR int attr_data_output; /* attribute data output */
+H5TOOLS_DLLVAR const h5tools_dump_header_t *h5tools_dump_header_format;
+H5TOOLS_DLLVAR H5E_auto2_t lib_func;
+H5TOOLS_DLLVAR H5E_auto2_t tools_func;
+H5TOOLS_DLLVAR void * lib_edata;
+H5TOOLS_DLLVAR void * tools_edata;
+
+H5TOOLS_DLLVAR unsigned packed_bits_num; /* number of packed bits to display */
+H5TOOLS_DLLVAR unsigned packed_data_offset; /* offset of packed bits to display */
+H5TOOLS_DLLVAR unsigned packed_data_length; /* length of packed bits to display */
+H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */
+H5TOOLS_DLLVAR FILE *rawattrstream; /* output stream for raw attribute data */
+H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */
+H5TOOLS_DLLVAR FILE *rawinstream; /* input stream for raw input */
+H5TOOLS_DLLVAR FILE *rawoutstream; /* output stream for raw output */
+H5TOOLS_DLLVAR FILE *rawerrorstream; /* output stream for raw error */
+H5TOOLS_DLLVAR int bin_output; /* binary output */
+H5TOOLS_DLLVAR int bin_form; /* binary form */
+H5TOOLS_DLLVAR int region_output; /* region output */
+H5TOOLS_DLLVAR int oid_output; /* oid output */
+H5TOOLS_DLLVAR int data_output; /* data output */
+H5TOOLS_DLLVAR int attr_data_output; /* attribute data output */
/* sort parameters */
-H5TOOLS_DLLVAR H5_index_t sort_by; /* sort_by [creation_order | name] */
-H5TOOLS_DLLVAR H5_iter_order_t sort_order; /* sort_order [ascending | descending] */
+H5TOOLS_DLLVAR H5_index_t sort_by; /* sort_by [creation_order | name] */
+H5TOOLS_DLLVAR H5_iter_order_t sort_order; /* sort_order [ascending | descending] */
/* things to display or which are set via command line parameters */
-H5TOOLS_DLLVAR int enable_error_stack; /* re-enable error stack; disable=0 enable=1 */
+H5TOOLS_DLLVAR int enable_error_stack; /* re-enable error stack; disable=0 enable=1 */
/* Strings for output */
-#define H5_TOOLS_GROUP "GROUP"
-#define H5_TOOLS_DATASET "DATASET"
-#define H5_TOOLS_DATATYPE "DATATYPE"
-#define H5_TOOLS_ATTRIBUTE "ATTRIBUTE"
-#define H5_TOOLS_UNKNOWN "UNKNOWN"
+#define H5_TOOLS_GROUP "GROUP"
+#define H5_TOOLS_DATASET "DATASET"
+#define H5_TOOLS_DATATYPE "DATATYPE"
+#define H5_TOOLS_ATTRIBUTE "ATTRIBUTE"
+#define H5_TOOLS_UNKNOWN "UNKNOWN"
/* Definitions of useful routines */
-H5TOOLS_DLL void h5tools_init(void);
-H5TOOLS_DLL void h5tools_close(void);
+H5TOOLS_DLL void h5tools_init(void);
+H5TOOLS_DLL void h5tools_close(void);
-H5TOOLS_DLL void h5tools_error_report(void);
-H5TOOLS_DLL int h5tools_set_data_output_file(const char *fname, int is_bin);
-H5TOOLS_DLL int h5tools_set_attr_output_file(const char *fname, int is_bin);
-H5TOOLS_DLL int h5tools_set_input_file(const char *fname, int is_bin);
-H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin);
-H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin);
+H5TOOLS_DLL void h5tools_error_report(void);
+H5TOOLS_DLL int h5tools_set_data_output_file(const char *fname, int is_bin);
+H5TOOLS_DLL int h5tools_set_attr_output_file(const char *fname, int is_bin);
+H5TOOLS_DLL int h5tools_set_input_file(const char *fname, int is_bin);
+H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin);
+H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin);
H5TOOLS_DLL hid_t h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vfd_info_t *vfd_info);
-H5TOOLS_DLL herr_t h5tools_get_vfd_name(hid_t fapl_id,
- char *drivername, size_t drivername_size);
-H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl,
- hbool_t use_specific_driver, char *drivername, size_t drivername_size);
+H5TOOLS_DLL herr_t h5tools_get_vfd_name(hid_t fapl_id, char *drivername, size_t drivername_size);
+H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, hbool_t use_specific_driver,
+ char *drivername, size_t drivername_size);
H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type);
H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type);
H5TOOLS_DLL htri_t h5tools_detect_vlen(hid_t tid);
H5TOOLS_DLL htri_t h5tools_detect_vlen_str(hid_t tid);
H5TOOLS_DLL hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2);
-H5TOOLS_DLL void init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *p_min_idx);
-H5TOOLS_DLL hsize_t calc_acc_pos(unsigned ndims, hsize_t elemtno, hsize_t *acc, hsize_t *pos);
+H5TOOLS_DLL void init_acc_pos(unsigned ndims, const hsize_t *dims, hsize_t *acc, hsize_t *pos,
+ hsize_t *p_min_idx);
+H5TOOLS_DLL hsize_t calc_acc_pos(unsigned ndims, hsize_t elemtno, const hsize_t *acc, hsize_t *pos);
H5TOOLS_DLL hbool_t h5tools_is_zero(const void *_mem, size_t size);
-H5TOOLS_DLL int h5tools_canreadf(const char* name, hid_t dcpl_id);
+H5TOOLS_DLL int h5tools_canreadf(const char *name, hid_t dcpl_id);
H5TOOLS_DLL int h5tools_can_encode(H5Z_filter_t filtn);
-H5TOOLS_DLL void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hsize_t elmtno, int secnum);
-H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hsize_t elmtno, hsize_t *ptdata, int secnum);
+H5TOOLS_DLL void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ hsize_t elmtno, int secnum);
+H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata,
+ int secnum);
H5TOOLS_DLL int 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,
- unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata);
-H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container);
-H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE* stream, hid_t container,
- unsigned ndims, hid_t type_id, hsize_t npoints);
-H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container);
-
-H5TOOLS_DLL hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer,
- hsize_t *curr_pos, size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter);
-H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer,
- hsize_t *curr_pos, size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter);
+ unsigned ndims, hid_t type_id, hsize_t nblocks,
+ const hsize_t *ptdata);
+H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream,
+ hid_t container);
+H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *stream,
+ hid_t container, unsigned ndims, hid_t type_id,
+ hsize_t npoints);
+H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream,
+ hid_t container);
+
+H5TOOLS_DLL hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols,
+ hsize_t local_elmt_counter, hsize_t elmt_counter);
+H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx, h5tools_str_t *buffer,
+ hsize_t *curr_pos, size_t ncols, hsize_t *ptdata,
+ hsize_t local_elmt_counter, hsize_t elmt_counter);
#ifdef __cplusplus
}
#endif
-#endif /* H5TOOLS_H__ */
-
+#endif /* H5TOOLS_H */
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index a2c73d0..fb0353f 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -23,192 +23,193 @@
#include "H5private.h"
h5tool_format_t h5tools_dataformat = {
- 0, /*raw */
-
- "", /*fmt_raw */
- "%d", /*fmt_int */
- "%u", /*fmt_uint */
- "%hhd", /*fmt_schar */
- "%u", /*fmt_uchar */
- "%d", /*fmt_short */
- "%u", /*fmt_ushort */
- "%ld", /*fmt_long */
- "%lu", /*fmt_ulong */
- NULL, /*fmt_llong */
- NULL, /*fmt_ullong */
- "%g", /*fmt_double */
- "%g", /*fmt_float */
-
- 0, /*ascii */
- 0, /*str_locale */
- 0, /*str_repeat */
-
- "[ ", /*arr_pre */
- ",", /*arr_sep */
- " ]", /*arr_suf */
- 1, /*arr_linebreak */
-
- "", /*cmpd_name */
- ",\n", /*cmpd_sep */
- "{", /*cmpd_pre */
- "}", /*cmpd_suf */
- "\n", /*cmpd_end */
- NULL, /* cmpd_listv */
-
- ", ", /*vlen_sep */
- "(", /*vlen_pre */
- ")", /*vlen_suf */
- "", /*vlen_end */
-
- "%s", /*elmt_fmt */
- ",", /*elmt_suf1 */
- " ", /*elmt_suf2 */
-
- "", /*idx_n_fmt */
- "", /*idx_sep */
- "", /*idx_fmt */
-
- 80, /*line_ncols *//*standard default columns */
- 0, /*line_per_line */
- "", /*line_pre */
- "%s", /*line_1st */
- "%s", /*line_cont */
- "", /*line_suf */
- "", /*line_sep */
- 1, /*line_multi_new */
- " ", /*line_indent */
-
- 1, /*skip_first */
-
- 1, /*obj_hidefileno */
- " "H5_PRINTF_HADDR_FMT, /*obj_format */
-
- 1, /*dset_hidefileno */
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%hhd", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ "[ ", /*arr_pre */
+ ",", /*arr_sep */
+ " ]", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ ",\n", /*cmpd_sep */
+ "{", /*cmpd_pre */
+ "}", /*cmpd_suf */
+ "\n", /*cmpd_end */
+ NULL, /* cmpd_listv */
+
+ ", ", /*vlen_sep */
+ "(", /*vlen_pre */
+ ")", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ ",", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ "", /*idx_n_fmt */
+ "", /*idx_sep */
+ "", /*idx_fmt */
+
+ 80,
+ /*line_ncols */ /*standard default columns */
+ 0, /*line_per_line */
+ "", /*line_pre */
+ "%s", /*line_1st */
+ "%s", /*line_cont */
+ "", /*line_suf */
+ "", /*line_sep */
+ 1, /*line_multi_new */
+ " ", /*line_indent */
+
+ 1, /*skip_first */
+
+ 1, /*obj_hidefileno */
+ " %" PRIuHADDR, /*obj_format */
+
+ 1, /*dset_hidefileno */
"DATASET %s ", /*dset_format */
- "%s", /*dset_blockformat_pre */
- "%s", /*dset_ptformat_pre */
- "%s", /*dset_ptformat */
- 1, /*array indices */
- 1 /*escape non printable characters */
+ "%s", /*dset_blockformat_pre */
+ "%s", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
+ 1, /*array indices */
+ 1 /*escape non printable characters */
};
const h5tools_dump_header_t h5tools_standardformat = {
-"standardformat", /*name */
-"HDF5", /*filebegin */
-"", /*fileend */
-SUPER_BLOCK, /*bootblockbegin */
-"", /*bootblockend */
-H5_TOOLS_GROUP, /*groupbegin */
-"", /*groupend */
-H5_TOOLS_DATASET, /*datasetbegin */
-"", /*datasetend */
-ATTRIBUTE, /*attributebegin */
-"", /*attributeend */
-H5_TOOLS_DATATYPE, /*datatypebegin */
-"", /*datatypeend */
-DATASPACE, /*dataspacebegin */
-"", /*dataspaceend */
-DATA, /*databegin */
-"", /*dataend */
-SOFTLINK, /*softlinkbegin */
-"", /*softlinkend */
-EXTLINK, /*extlinkbegin */
-"", /*extlinkend */
-UDLINK, /*udlinkbegin */
-"", /*udlinkend */
-SUBSET, /*subsettingbegin */
-"", /*subsettingend */
-START, /*startbegin */
-"", /*startend */
-STRIDE, /*stridebegin */
-"", /*strideend */
-COUNT, /*countbegin */
-"", /*countend */
-BLOCK, /*blockbegin */
-"", /*blockend */
-
-"{", /*fileblockbegin */
-"}", /*fileblockend */
-"{", /*bootblockblockbegin */
-"}", /*bootblockblockend */
-"{", /*groupblockbegin */
-"}", /*groupblockend */
-"{", /*datasetblockbegin */
-"}", /*datasetblockend */
-"{", /*attributeblockbegin */
-"}", /*attributeblockend */
-"", /*datatypeblockbegin */
-"", /*datatypeblockend */
-"", /*dataspaceblockbegin */
-"", /*dataspaceblockend */
-"{", /*datablockbegin */
-"}", /*datablockend */
-"{", /*softlinkblockbegin */
-"}", /*softlinkblockend */
-"{", /*extlinkblockbegin */
-"}", /*extlinkblockend */
-"{", /*udlinkblockbegin */
-"}", /*udlinkblockend */
-"{", /*strblockbegin */
-"}", /*strblockend */
-"{", /*enumblockbegin */
-"}", /*enumblockend */
-"{", /*structblockbegin */
-"}", /*structblockend */
-"{", /*vlenblockbegin */
-"}", /*vlenblockend */
-"{", /*subsettingblockbegin */
-"}", /*subsettingblockend */
-"(", /*startblockbegin */
-");", /*startblockend */
-"(", /*strideblockbegin */
-");", /*strideblockend */
-"(", /*countblockbegin */
-");", /*countblockend */
-"(", /*blockblockbegin */
-");", /*blockblockend */
-
-"", /*dataspacedescriptionbegin */
-"", /*dataspacedescriptionend */
-"(", /*dataspacedimbegin */
-")", /*dataspacedimend */
-
-"", /*virtualselectionbegin */
-"", /*virtualselectionend */
-"{", /*virtualselectionblockbegin */
-"}", /*virtualselectionblockend */
-"\"", /*virtualfilenamebeginbegin */
-"\"", /*virtualfilenamebeginend */
-"\"", /*virtualdatasetnamebegin */
-"\"", /*virtualdtatasetnameend */
+ "standardformat", /*name */
+ "HDF5", /*filebegin */
+ "", /*fileend */
+ SUPER_BLOCK, /*bootblockbegin */
+ "", /*bootblockend */
+ H5_TOOLS_GROUP, /*groupbegin */
+ "", /*groupend */
+ H5_TOOLS_DATASET, /*datasetbegin */
+ "", /*datasetend */
+ ATTRIBUTE, /*attributebegin */
+ "", /*attributeend */
+ H5_TOOLS_DATATYPE, /*datatypebegin */
+ "", /*datatypeend */
+ DATASPACE, /*dataspacebegin */
+ "", /*dataspaceend */
+ DATA, /*databegin */
+ "", /*dataend */
+ SOFTLINK, /*softlinkbegin */
+ "", /*softlinkend */
+ EXTLINK, /*extlinkbegin */
+ "", /*extlinkend */
+ UDLINK, /*udlinkbegin */
+ "", /*udlinkend */
+ SUBSET, /*subsettingbegin */
+ "", /*subsettingend */
+ START, /*startbegin */
+ "", /*startend */
+ STRIDE, /*stridebegin */
+ "", /*strideend */
+ COUNT, /*countbegin */
+ "", /*countend */
+ BLOCK, /*blockbegin */
+ "", /*blockend */
+
+ "{", /*fileblockbegin */
+ "}", /*fileblockend */
+ "{", /*bootblockblockbegin */
+ "}", /*bootblockblockend */
+ "{", /*groupblockbegin */
+ "}", /*groupblockend */
+ "{", /*datasetblockbegin */
+ "}", /*datasetblockend */
+ "{", /*attributeblockbegin */
+ "}", /*attributeblockend */
+ "", /*datatypeblockbegin */
+ "", /*datatypeblockend */
+ "", /*dataspaceblockbegin */
+ "", /*dataspaceblockend */
+ "{", /*datablockbegin */
+ "}", /*datablockend */
+ "{", /*softlinkblockbegin */
+ "}", /*softlinkblockend */
+ "{", /*extlinkblockbegin */
+ "}", /*extlinkblockend */
+ "{", /*udlinkblockbegin */
+ "}", /*udlinkblockend */
+ "{", /*strblockbegin */
+ "}", /*strblockend */
+ "{", /*enumblockbegin */
+ "}", /*enumblockend */
+ "{", /*structblockbegin */
+ "}", /*structblockend */
+ "{", /*vlenblockbegin */
+ "}", /*vlenblockend */
+ "{", /*subsettingblockbegin */
+ "}", /*subsettingblockend */
+ "(", /*startblockbegin */
+ ");", /*startblockend */
+ "(", /*strideblockbegin */
+ ");", /*strideblockend */
+ "(", /*countblockbegin */
+ ");", /*countblockend */
+ "(", /*blockblockbegin */
+ ");", /*blockblockend */
+
+ "", /*dataspacedescriptionbegin */
+ "", /*dataspacedescriptionend */
+ "(", /*dataspacedimbegin */
+ ")", /*dataspacedimend */
+
+ "", /*virtualselectionbegin */
+ "", /*virtualselectionend */
+ "{", /*virtualselectionblockbegin */
+ "}", /*virtualselectionblockend */
+ "\"", /*virtualfilenamebeginbegin */
+ "\"", /*virtualfilenamebeginend */
+ "\"", /*virtualdatasetnamebegin */
+ "\"", /*virtualdtatasetnameend */
};
-const h5tools_dump_header_t* h5tools_dump_header_format;
-table_t *h5dump_type_table = NULL; /* type table reference for datatype dump */
+const h5tools_dump_header_t *h5tools_dump_header_format;
+table_t * h5dump_type_table = NULL; /* type table reference for datatype dump */
/* local prototypes */
-static int h5tools_print_region_data_blocks(hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx,
- h5tools_str_t *buffer, /* string into which to render */
- size_t ncols, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata);
+static int h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *cur_ctx,
+ h5tools_str_t * buffer, /* string into which to render */
+ size_t ncols, unsigned ndims, hid_t type_id, hsize_t nblocks,
+ hsize_t *ptdata);
-static int h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx,
- h5tools_str_t *buffer, size_t ncols,
- unsigned ndims, hid_t type_id, hsize_t npoints, hsize_t *ptdata);
+static int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stream,
+ const h5tool_format_t *info, h5tools_context_t *cur_ctx,
+ h5tools_str_t *buffer, size_t ncols, unsigned ndims,
+ hid_t type_id, hsize_t npoints, hsize_t *ptdata);
void h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims);
-void h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, int dims);
+void h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ int dims);
-static void h5tools_print_virtual_selection(hid_t vspace,
- FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, /* in,out */
- h5tools_str_t *buffer, /* string into which to render */
- hsize_t *curr_pos, /* total data element position */
- size_t ncols);
+static void h5tools_print_virtual_selection(hid_t vspace, FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx, /* in,out */
+ h5tools_str_t * buffer, /* string into which to render */
+ hsize_t * curr_pos, /* total data element position */
+ size_t ncols);
void
h5tools_dump_init(void)
@@ -253,27 +254,27 @@ h5tools_dump_init(void)
*-------------------------------------------------------------------------
*/
int
-h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, /* in,out */
+h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, /* in,out */
hid_t container, unsigned flags, hsize_t nelmts, hid_t type, void *_mem)
{
- unsigned char *mem = (unsigned char*) _mem;
- hsize_t i; /* element counter */
- size_t size; /* size of each datum */
+ unsigned char *mem = (unsigned char *)_mem;
+ hsize_t i; /* element counter */
+ size_t size; /* size of each datum */
hbool_t dimension_break = TRUE;
- size_t ncols = 80; /* available output width */
- h5tools_str_t buffer; /* string into which to render */
- hsize_t curr_pos = 0; /* total data element position */
- hsize_t elmt_counter = 0;/* counts the # elements printed.
- * I (ptl?) needed something that
- * isn't going to get reset when a new
- * line is formed. I'm going to use
- * this var to count elements and
- * break after we see a number equal
- * to the ctx->size_last_dim. */
- int ret_value = 0;
-
- H5TOOLS_START_DEBUG(" file=%p", (void*)stream);
- H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream);
+ size_t ncols = 80; /* available output width */
+ h5tools_str_t buffer; /* string into which to render */
+ hsize_t curr_pos = 0; /* total data element position */
+ hsize_t elmt_counter = 0; /* counts the # elements printed.
+ * I (ptl?) needed something that
+ * isn't going to get reset when a new
+ * line is formed. I'm going to use
+ * this var to count elements and
+ * break after we see a number equal
+ * to the ctx->size_last_dim. */
+ int ret_value = 0;
+
+ H5TOOLS_START_DEBUG(" file=%p", (void *)stream);
+ H5TOOLS_DEBUG("rawdata file=%p", (void *)rawdatastream);
/* binary dump */
if (bin_output && (rawdatastream != NULL)) {
H5TOOLS_DEBUG("render_bin_output");
@@ -298,7 +299,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_cont
H5TOOLS_DEBUG("data render start:%ld", nelmts);
for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) {
- void* memref = mem + i * size;
+ void *memref = mem + i * size;
/* Render the data element begin*/
h5tools_str_reset(&buffer);
@@ -307,16 +308,16 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_cont
if (i + 1 < nelmts || (flags & END_OF_DATA) == 0)
h5tools_str_append(&buffer, "%s", OPT(info->elmt_suf1, ","));
- dimension_break = h5tools_render_element(stream, info, ctx, &buffer,
- &curr_pos, ncols, i, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, i, elmt_counter);
/* Render the data element end*/
- if(FALSE == dimension_break)
+ if (FALSE == dimension_break)
elmt_counter = 0;
} /* end for (i = 0; i < nelmts... */
H5TOOLS_DEBUG("data render finish");
h5tools_str_close(&buffer);
- }/* else bin */
+ } /* else bin */
H5TOOLS_ENDDEBUG("exit");
return ret_value;
@@ -328,7 +329,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_cont
* Purpose: Print some values from an attribute referenced by object reference.
*
* Description:
- * This is a special case subfunction to dump aa attribute references.
+ * This is a special case subfunction to dump an attribute reference.
*
* Return:
* The function returns False if the last dimension has been reached, otherwise True
@@ -346,47 +347,47 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_cont
*-------------------------------------------------------------------------
*/
hbool_t
-h5tools_dump_region_attribute(hid_t region_id,
- FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, /* in,out */
- h5tools_str_t *buffer, /* string into which to render */
- hsize_t *curr_pos, /* total data element position */
- size_t ncols, hsize_t region_elmt_counter, /* element counter */
- hsize_t elmt_counter)
+h5tools_dump_region_attribute(hid_t region_id, FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx, /* in,out */
+ h5tools_str_t * buffer, /* string into which to render */
+ hsize_t * curr_pos, /* total data element position */
+ size_t ncols, hsize_t region_elmt_counter, /* element counter */
+ hsize_t elmt_counter)
{
hbool_t dimension_break = TRUE;
- hid_t atype = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- hid_t region_space = H5I_INVALID_HID;
+ hid_t atype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t region_space = H5I_INVALID_HID;
h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */
hbool_t past_catch = FALSE;
- hbool_t ret_value = TRUE;
+ hbool_t ret_value = TRUE;
HDassert(info);
HDassert(ctx);
HDassert(buffer);
- outputformat = *info;
+ outputformat = *info;
outputformat.idx_fmt = "";
outputformat.idx_n_fmt = "";
outputformat.idx_sep = "";
outputformat.line_pre = "";
- H5TOOLS_DEBUG("enter file=%p", (void*)stream);
- H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream);
+ H5TOOLS_DEBUG("enter file=%p", (void *)stream);
+ H5TOOLS_DEBUG("rawdata file=%p", (void *)rawdatastream);
/* Render the region { element begin */
h5tools_str_reset(buffer);
h5tools_str_append(buffer, " {");
- dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos, ncols,
+ region_elmt_counter, elmt_counter);
/* Render the region { element end */
- if((region_space = H5Aget_space(region_id)) < 0)
+ if ((region_space = H5Aget_space(region_id)) < 0)
H5TOOLS_GOTO_ERROR(dimension_break, "H5Aget_space failed");
- if((atype = H5Aget_type(region_id)) < 0)
+ if ((atype = H5Aget_type(region_id)) < 0)
H5TOOLS_GOTO_ERROR(dimension_break, "H5Aget_type failed");
- if((type_id = H5Tget_native_type(atype, H5T_DIR_DEFAULT)) < 0)
+ if ((type_id = H5Tget_native_type(atype, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(dimension_break, "H5Tget_native_type failed");
ctx->indent_level++;
@@ -394,9 +395,8 @@ h5tools_dump_region_attribute(hid_t region_id,
/* Render the datatype element begin */
h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s %s ",
- h5tools_dump_header_format->datatypebegin,
- h5tools_dump_header_format->datatypeblockbegin);
+ h5tools_str_append(buffer, "%s %s ", h5tools_dump_header_format->datatypebegin,
+ h5tools_dump_header_format->datatypeblockbegin);
ctx->need_prefix = TRUE;
ctx->indent_level++;
@@ -411,7 +411,8 @@ h5tools_dump_region_attribute(hid_t region_id,
if (HDstrlen(h5tools_dump_header_format->datatypeend))
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend);
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the datatype element end */
ctx->need_prefix = TRUE;
@@ -430,7 +431,8 @@ h5tools_dump_region_attribute(hid_t region_id,
if (HDstrlen(h5tools_dump_header_format->dataspaceend))
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the dataspace element end */
if (region_output) {
@@ -440,26 +442,30 @@ h5tools_dump_region_attribute(hid_t region_id,
}
done:
- if(H5Tclose(type_id) < 0)
+ if (H5Tclose(type_id) < 0)
H5TOOLS_ERROR(dimension_break, "H5Tclose failed");
- if(H5Tclose(atype) < 0)
+ if (H5Tclose(atype) < 0)
H5TOOLS_ERROR(dimension_break, "H5Tclose failed");
+ if (H5Sclose(region_space) < 0)
+ H5TOOLS_ERROR(dimension_break, "H5Sclose failed");
+
ctx->indent_level--;
ctx->need_prefix = TRUE;
/* Render the region } element begin */
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "}");
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the region } element end */
H5_LEAVE(dimension_break)
-CATCH
+ CATCH
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -482,30 +488,32 @@ CATCH
*-------------------------------------------------------------------------
*/
static int
-h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx,
- h5tools_str_t *buffer, /* string into which to render */
- size_t ncols, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata)
+h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *cur_ctx,
+ h5tools_str_t * buffer, /* string into which to render */
+ size_t ncols, unsigned ndims, hid_t type_id, hsize_t nblocks,
+ hsize_t *ptdata)
{
- hbool_t dimension_break = TRUE;
- hsize_t *dims1 = NULL;
- hsize_t *start = NULL;
- hsize_t *count = NULL;
- hsize_t blkndx;
- hsize_t total_size[H5S_MAX_RANK];
- hsize_t elmtno; /* elemnt index */
- hsize_t curr_pos = 0;
- unsigned int region_flags; /* buffer extent flags */
- hsize_t numelem;
- hsize_t numindex;
- unsigned indx;
- unsigned jndx;
- hbool_t past_catch = FALSE;
- size_t type_size;
- hid_t mem_space = H5I_INVALID_HID;
- hid_t sid1 = H5I_INVALID_HID;
+ hbool_t dimension_break = TRUE;
+ hsize_t * dims1 = NULL;
+ hsize_t * start = NULL;
+ hsize_t * count = NULL;
+ hsize_t blkndx;
+ hsize_t total_size[H5S_MAX_RANK];
+ hsize_t elmtno; /* elemnt index */
+ hsize_t curr_pos = 0;
+ unsigned int region_flags; /* buffer extent flags */
+ hsize_t numelem;
+ hsize_t numindex;
+ unsigned indx;
+ unsigned jndx;
+ hbool_t past_catch = FALSE;
+ size_t type_size;
+ hid_t mem_space = H5I_INVALID_HID;
+ hid_t sid1 = H5I_INVALID_HID;
h5tools_context_t ctx;
- void *region_buf = NULL;
- int ret_value = 0;
+ void * region_buf = NULL;
+ int ret_value = 0;
HDassert(info);
HDassert(cur_ctx);
@@ -514,58 +522,58 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for
HDmemset(&ctx, 0, sizeof(ctx));
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
- if((type_size = H5Tget_size(type_id)) == 0)
+ if ((type_size = H5Tget_size(type_id)) == 0)
H5TOOLS_THROW(FAIL, "H5Tget_size failed");
/* Get the dataspace of the dataset */
- if((sid1 = H5Dget_space(region_id)) < 0)
+ if ((sid1 = H5Dget_space(region_id)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed");
/* Allocate space for the dimension array */
- if((dims1 = (hsize_t *) HDmalloc((size_t)(sizeof(hsize_t) * ndims))) == NULL)
+ if ((dims1 = (hsize_t *)HDmalloc((size_t)(sizeof(hsize_t) * ndims))) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for dims");
/* find the dimensions of each data space from the block coordinates */
numelem = 1;
for (jndx = 0; jndx < ndims; jndx++) {
dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1;
- numelem = dims1[jndx] * numelem;
+ numelem = dims1[jndx] * numelem;
}
/* Create dataspace for reading buffer */
- if((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0)
+ if ((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Screate_simple failed");
- if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL)
+ if ((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate region buffer");
/* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
/* 1 2 n 1 2 n */
- if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for start");
- if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for count");
- curr_pos = 0;
- ctx.indent_level = cur_ctx->indent_level;
- ctx.cur_column = cur_ctx->cur_column;
+ curr_pos = 0;
+ ctx.indent_level = cur_ctx->indent_level;
+ ctx.cur_column = cur_ctx->cur_column;
ctx.prev_multiline = cur_ctx->prev_multiline;
- ctx.ndims = ndims;
+ ctx.ndims = ndims;
for (blkndx = 0; blkndx < nblocks; blkndx++) {
ctx.need_prefix = TRUE;
- ctx.cur_elmt = 0;
+ ctx.cur_elmt = 0;
for (indx = 0; indx < ndims; indx++) {
start[indx] = ptdata[indx + blkndx * ndims * 2];
count[indx] = dims1[indx];
}
- if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) {
- if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) {
+ if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) {
+ if (H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) {
ctx.indent_level++;
- if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
+ if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
/* assume entire data space to be printed */
init_acc_pos(ctx.ndims, total_size, ctx.acc, ctx.pos, ctx.p_min_idx);
@@ -581,9 +589,9 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for
for (indx = 0; indx < (unsigned)ctx.ndims; indx++)
ctx.p_max_idx[indx] = dims1[indx];
- curr_pos = 0;
- ctx.sm_pos = blkndx * 2 * ndims;
- ctx.size_last_dim = dims1[ndims-1];
+ curr_pos = 0;
+ ctx.sm_pos = blkndx * 2 * ndims;
+ ctx.size_last_dim = dims1[ndims - 1];
h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0);
@@ -595,16 +603,16 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for
h5tools_str_append(buffer, "%s", numindex ? OPTIONAL_LINE_BREAK "" : "");
h5tools_str_sprint(buffer, info, region_id, type_id,
- ((char*)region_buf + numindex * type_size), &ctx);
+ ((char *)region_buf + numindex * type_size), &ctx);
if (numindex + 1 < numelem || (region_flags & END_OF_DATA) == 0)
h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ","));
dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos,
- ncols, ptdata, numindex, elmtno);
+ ncols, ptdata, numindex, elmtno);
/* Render the region data element end */
- if(FALSE == dimension_break)
+ if (FALSE == dimension_break)
elmtno = 0;
} /* end for (numindex = 0; numindex < numelem; numindex++, elmtno++, ctx.cur_elmt++) */
}
@@ -629,12 +637,12 @@ done:
HDfree(region_buf);
HDfree(dims1);
- if(H5Sclose(mem_space) < 0)
+ if (H5Sclose(mem_space) < 0)
H5TOOLS_ERROR(FAIL, "H5Sclose failed");
- if(H5Sclose(sid1) < 0)
+ if (H5Sclose(sid1) < 0)
H5TOOLS_ERROR(FAIL, "H5Sclose failed");
-CATCH
- H5TOOLS_ENDDEBUG("");
+ CATCH
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -663,45 +671,44 @@ CATCH
*-------------------------------------------------------------------------
*/
hbool_t
-h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, /* in,out */
- h5tools_str_t *buffer, /* string into which to render */
- hsize_t *curr_pos, /* total data element position */
- size_t ncols, hsize_t region_elmt_counter, /* element counter */
- hsize_t elmt_counter)
+h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *stream,
+ const h5tool_format_t *info, h5tools_context_t *ctx, /* in,out */
+ h5tools_str_t *buffer, /* string into which to render */
+ hsize_t * curr_pos, /* total data element position */
+ size_t ncols, hsize_t region_elmt_counter, /* element counter */
+ hsize_t elmt_counter)
{
- hbool_t dimension_break = TRUE;
- hssize_t snblocks;
- hsize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata = NULL;
- int sndims;
- unsigned ndims;
- hsize_t indx;
- hid_t dtype = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */
- hbool_t past_catch = FALSE;
- hbool_t ret_value = TRUE;
+ hbool_t dimension_break = TRUE;
+ hssize_t snblocks;
+ hsize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t * ptdata = NULL;
+ int sndims;
+ unsigned ndims;
+ hsize_t indx;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */
+ hbool_t past_catch = FALSE;
+ hbool_t ret_value = TRUE;
HDassert(info);
HDassert(ctx);
HDassert(buffer);
- H5TOOLS_START_DEBUG("");
- outputformat = *info;
+ H5TOOLS_START_DEBUG(" ");
+ outputformat = *info;
outputformat.idx_fmt = "";
outputformat.idx_n_fmt = "";
outputformat.idx_sep = "";
outputformat.line_pre = "";
- if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
+ if ((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
H5TOOLS_THROW(dimension_break, "H5Sget_select_hyper_nblocks failed");
nblocks = (hsize_t)snblocks;
/* Print block information */
- if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ if ((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
H5TOOLS_THROW(dimension_break, "H5Sget_simple_extent_ndims failed");
ndims = (unsigned)sndims;
@@ -711,7 +718,8 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
h5tools_str_reset(buffer);
h5tools_str_append(buffer, " {");
- dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos, ncols,
+ region_elmt_counter, elmt_counter);
/* Render the region { element end */
ctx->indent_level++;
@@ -722,46 +730,46 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
h5tools_str_append(buffer, "REGION_TYPE BLOCK ");
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
- HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL)
+ HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
+ if ((ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL)
H5TOOLS_GOTO_ERROR(dimension_break, "Could not allocate buffer for ptdata");
- if(H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, nblocks, ptdata) < 0)
+ if (H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, nblocks, ptdata) < 0)
H5TOOLS_GOTO_ERROR(dimension_break, "H5Rget_select_hyper_blocklist failed");
- for(indx = 0; indx < nblocks; indx++) {
+ for (indx = 0; indx < nblocks; indx++) {
unsigned loop_indx;
- h5tools_str_append(buffer, outputformat.dset_blockformat_pre,
- indx ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)indx);
+ h5tools_str_append(buffer, outputformat.dset_blockformat_pre, indx ? "," OPTIONAL_LINE_BREAK " " : "",
+ (unsigned long)indx);
/* Start coordinates and opposite corner */
for (loop_indx = 0; loop_indx < ndims; loop_indx++)
h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, loop_indx ? "," : "(",
- ptdata[indx * 2 * ndims + loop_indx]);
+ ptdata[indx * 2 * ndims + loop_indx]);
for (loop_indx = 0; loop_indx < ndims; loop_indx++)
h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, loop_indx ? "," : ")-(",
- ptdata[indx * 2 * ndims + loop_indx + ndims]);
+ ptdata[indx * 2 * ndims + loop_indx + ndims]);
h5tools_str_append(buffer, ")");
} /* end for (indx = 0; indx < nblocks; indx++) */
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the region datatype info and indices element end */
ctx->need_prefix = TRUE;
- if((dtype = H5Dget_type(region_id)) < 0)
+ if ((dtype = H5Dget_type(region_id)) < 0)
H5TOOLS_GOTO_ERROR(dimension_break, "H5Dget_type failed");
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(dimension_break, "H5Tget_native_type failed");
/* Render the datatype element begin */
h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s %s ",
- h5tools_dump_header_format->datatypebegin,
- h5tools_dump_header_format->datatypeblockbegin);
+ h5tools_str_append(buffer, "%s %s ", h5tools_dump_header_format->datatypebegin,
+ h5tools_dump_header_format->datatypeblockbegin);
ctx->indent_level++;
h5tools_print_datatype(stream, buffer, info, ctx, dtype, TRUE);
@@ -775,7 +783,8 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
if (HDstrlen(h5tools_dump_header_format->datatypeend))
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend);
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the datatype element end */
ctx->need_prefix = TRUE;
@@ -794,7 +803,8 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
if (HDstrlen(h5tools_dump_header_format->dataspaceend))
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the dataspace element end */
if (region_output) {
@@ -802,24 +812,25 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
/* Render the databegin element begin */
h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s %s",
- h5tools_dump_header_format->databegin,
- h5tools_dump_header_format->datablockbegin);
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->databegin,
+ h5tools_dump_header_format->datablockbegin);
+ dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols,
+ region_elmt_counter, elmt_counter);
/* Render the databegin element end */
ctx->need_prefix = TRUE;
- h5tools_print_region_data_blocks(region_id, rawdatastream, info, ctx, buffer, ncols, ndims, type_id, nblocks, ptdata);
+ h5tools_print_region_data_blocks(region_id, rawdatastream, info, ctx, buffer, ncols, ndims, type_id,
+ nblocks, ptdata);
}
done:
HDfree(ptdata);
- if(type_id > 0 && H5Tclose(type_id) < 0)
+ if (type_id > 0 && H5Tclose(type_id) < 0)
H5TOOLS_ERROR(dimension_break, "H5Tclose failed");
- if(dtype > 0 && H5Tclose(dtype) < 0)
+ if (dtype > 0 && H5Tclose(dtype) < 0)
H5TOOLS_ERROR(dimension_break, "H5Tclose failed");
if (region_output) {
@@ -827,16 +838,16 @@ done:
/* Render the dataend element begin */
h5tools_str_reset(buffer);
- if(HDstrlen(h5tools_dump_header_format->datablockend)) {
+ if (HDstrlen(h5tools_dump_header_format->datablockend)) {
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datablockend);
- if(HDstrlen(h5tools_dump_header_format->dataend))
+ if (HDstrlen(h5tools_dump_header_format->dataend))
h5tools_str_append(buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->dataend))
+ if (HDstrlen(h5tools_dump_header_format->dataend))
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataend);
- dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos,
- ncols, region_elmt_counter, elmt_counter);
+ dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos, ncols,
+ region_elmt_counter, elmt_counter);
/* Render the dataend element end */
}
@@ -846,14 +857,15 @@ done:
/* Render the region } element begin */
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "}");
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the region } element end */
H5_LEAVE(dimension_break)
-CATCH
+ CATCH
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -877,25 +889,25 @@ CATCH
*-------------------------------------------------------------------------
*/
static int
-h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx,
- h5tools_str_t *buffer, size_t ncols,
- unsigned ndims, hid_t type_id, hsize_t npoints, hsize_t *ptdata)
+h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stream,
+ const h5tool_format_t *info, h5tools_context_t *cur_ctx,
+ h5tools_str_t *buffer, size_t ncols, unsigned ndims, hid_t type_id,
+ hsize_t npoints, hsize_t *ptdata)
{
- hbool_t dimension_break = TRUE;
- hsize_t *dims1 = NULL;
- hsize_t elmtno; /* elemnt index */
- hsize_t curr_pos = 0;
- hsize_t total_size[H5S_MAX_RANK];
- hsize_t jndx;
- unsigned indx;
- size_t type_size;
- unsigned int region_flags; /* buffer extent flags */
- hid_t mem_space = H5I_INVALID_HID;
- void *region_buf = NULL;
+ hbool_t dimension_break = TRUE;
+ hsize_t * dims1 = NULL;
+ hsize_t elmtno; /* elemnt index */
+ hsize_t curr_pos = 0;
+ hsize_t total_size[H5S_MAX_RANK];
+ hsize_t jndx;
+ unsigned indx;
+ size_t type_size;
+ unsigned int region_flags; /* buffer extent flags */
+ hid_t mem_space = H5I_INVALID_HID;
+ void * region_buf = NULL;
h5tools_context_t ctx;
- hbool_t past_catch = FALSE;
- int ret_value = 0;
+ hbool_t past_catch = FALSE;
+ int ret_value = 0;
HDassert(info);
HDassert(cur_ctx);
@@ -903,42 +915,42 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
HDassert(ptdata);
HDassert(ndims > 0);
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
HDmemset(&ctx, 0, sizeof(ctx));
/* Allocate space for the dimension array */
- if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate buffer for dims");
dims1[0] = npoints;
/* Create dataspace for reading buffer */
- if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(1, dims1, NULL)) < 0)
H5TOOLS_THROW((-1), "H5Screate_simple failed");
- if((type_size = H5Tget_size(type_id)) == 0)
+ if ((type_size = H5Tget_size(type_id)) == 0)
H5TOOLS_THROW((-1), "H5Tget_size failed");
- if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL)
+ if ((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate buffer for region");
- curr_pos = 0;
- ctx.indent_level = cur_ctx->indent_level;
- ctx.cur_column = cur_ctx->cur_column;
+ curr_pos = 0;
+ ctx.indent_level = cur_ctx->indent_level;
+ ctx.cur_column = cur_ctx->cur_column;
ctx.prev_multiline = cur_ctx->prev_multiline;
- ctx.ndims = ndims;
+ ctx.ndims = ndims;
- if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0)
+ if (H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
H5TOOLS_DEBUG("data render start:%ld", npoints);
elmtno = 0;
for (jndx = 0; jndx < npoints; jndx++, elmtno++) {
ctx.need_prefix = TRUE;
- ctx.cur_elmt = 0; /* points are always 0 */
+ ctx.cur_elmt = 0; /* points are always 0 */
ctx.indent_level++;
- if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
+ if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
/* assume entire data space to be printed */
init_acc_pos(ctx.ndims, total_size, ctx.acc, ctx.pos, ctx.p_min_idx);
@@ -956,23 +968,23 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
else
ctx.size_last_dim = 0;
- curr_pos = 0; /* points requires constant 0 */
+ curr_pos = 0; /* points requires constant 0 */
h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0);
/* Render the point element begin */
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : "");
- h5tools_str_sprint(buffer, info, region_id, type_id,
- ((char*)region_buf + jndx * type_size), &ctx);
+ h5tools_str_sprint(buffer, info, region_id, type_id, ((char *)region_buf + jndx * type_size),
+ &ctx);
if (jndx + 1 < npoints || (region_flags & END_OF_DATA) == 0)
h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ","));
- dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos,
- ncols, ptdata, (hsize_t)0, elmtno);
+ dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, ncols,
+ ptdata, (hsize_t)0, elmtno);
/* Render the point element end */
- if(FALSE == dimension_break)
+ if (FALSE == dimension_break)
elmtno = 0;
}
else {
@@ -983,13 +995,13 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
done:
HDfree(region_buf);
-CATCH
+ CATCH
HDfree(dims1);
- if(H5Sclose(mem_space) < 0)
+ if (H5Sclose(mem_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1018,42 +1030,42 @@ CATCH
*-------------------------------------------------------------------------
*/
hbool_t
-h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter,
- hsize_t elmt_counter)
+h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, FILE *stream,
+ const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer,
+ hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter,
+ hsize_t elmt_counter)
{
- hbool_t dimension_break = TRUE;
- hssize_t snpoints;
- hsize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata;
- int sndims;
- unsigned ndims;
- hsize_t indx;
- hid_t dtype = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */
- hbool_t past_catch = FALSE;
- hbool_t ret_value = TRUE;
+ hbool_t dimension_break = TRUE;
+ hssize_t snpoints;
+ hsize_t npoints;
+ hsize_t alloc_size;
+ hsize_t * ptdata;
+ int sndims;
+ unsigned ndims;
+ hsize_t indx;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */
+ hbool_t past_catch = FALSE;
+ hbool_t ret_value = TRUE;
HDassert(info);
HDassert(ctx);
HDassert(buffer);
- H5TOOLS_START_DEBUG("");
- outputformat = *info;
+ H5TOOLS_START_DEBUG(" ");
+ outputformat = *info;
outputformat.idx_fmt = "";
outputformat.idx_n_fmt = "";
outputformat.idx_sep = "";
outputformat.line_pre = "";
- if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
+ if ((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
H5TOOLS_THROW(dimension_break, "H5Sget_select_elem_npoints failed");
npoints = (hsize_t)snpoints;
/* Allocate space for the dimension array */
- if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ if ((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
H5TOOLS_THROW(dimension_break, "H5Sget_simple_extent_ndims failed");
ndims = (unsigned)sndims;
@@ -1063,7 +1075,8 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "{");
- dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos, ncols,
+ region_elmt_counter, elmt_counter);
/* Render the region { element end */
ctx->indent_level++;
@@ -1074,41 +1087,41 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
h5tools_str_append(buffer, "REGION_TYPE POINT ");
alloc_size = npoints * ndims * sizeof(ptdata[0]);
- HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size)))
+ HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
+ if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)))
H5TOOLS_GOTO_ERROR(dimension_break, "Could not allocate buffer for ptdata");
- if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, npoints, ptdata) < 0)
+ if (H5Sget_select_elem_pointlist(region_space, (hsize_t)0, npoints, ptdata) < 0)
H5TOOLS_GOTO_ERROR(dimension_break, "H5Sget_select_elem_pointlist failed");
for (indx = 0; indx < npoints; indx++) {
unsigned loop_indx;
- h5tools_str_append(buffer, outputformat.dset_ptformat_pre,
- indx ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) indx);
+ h5tools_str_append(buffer, outputformat.dset_ptformat_pre, indx ? "," OPTIONAL_LINE_BREAK " " : "",
+ (unsigned long)indx);
for (loop_indx = 0; loop_indx < ndims; loop_indx++)
h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, loop_indx ? "," : "(",
- ptdata[indx * ndims + loop_indx]);
+ ptdata[indx * ndims + loop_indx]);
h5tools_str_append(buffer, ")");
} /* end for (indx = 0; indx < npoints; indx++) */
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the region datatype info and indices element end */
ctx->need_prefix = TRUE;
- if((dtype = H5Dget_type(region_id)) < 0)
+ if ((dtype = H5Dget_type(region_id)) < 0)
H5TOOLS_GOTO_ERROR(dimension_break, "H5Dget_type failed");
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(dimension_break, "H5Tget_native_type failed");
/* Render the datatype element begin */
h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s %s ",
- h5tools_dump_header_format->datatypebegin,
- h5tools_dump_header_format->datatypeblockbegin);
+ h5tools_str_append(buffer, "%s %s ", h5tools_dump_header_format->datatypebegin,
+ h5tools_dump_header_format->datatypeblockbegin);
ctx->indent_level++;
h5tools_print_datatype(stream, buffer, info, ctx, dtype, TRUE);
@@ -1122,7 +1135,8 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
if (HDstrlen(h5tools_dump_header_format->datatypeend))
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend);
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the datatype element end */
ctx->need_prefix = TRUE;
@@ -1141,7 +1155,8 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
if (HDstrlen(h5tools_dump_header_format->dataspaceend))
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the dataspace element end */
if (region_output) {
@@ -1150,24 +1165,25 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
/* Render the databegin element begin */
h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s %s",
- h5tools_dump_header_format->databegin,
- h5tools_dump_header_format->datablockbegin);
+ h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->databegin,
+ h5tools_dump_header_format->datablockbegin);
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
+ dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols,
+ region_elmt_counter, elmt_counter);
ctx->need_prefix = TRUE;
- h5tools_print_region_data_points(region_space, region_id, rawdatastream, info, ctx, buffer, ncols, ndims, type_id, npoints, ptdata);
+ h5tools_print_region_data_points(region_space, region_id, rawdatastream, info, ctx, buffer, ncols,
+ ndims, type_id, npoints, ptdata);
}
done:
HDfree(ptdata);
- if(type_id > 0 && H5Tclose(type_id) < 0)
+ if (type_id > 0 && H5Tclose(type_id) < 0)
H5TOOLS_ERROR(dimension_break, "H5Tclose failed");
- if(dtype > 0 && H5Tclose(dtype) < 0)
+ if (dtype > 0 && H5Tclose(dtype) < 0)
H5TOOLS_ERROR(dimension_break, "H5Tclose failed");
if (region_output) {
@@ -1175,16 +1191,16 @@ done:
/* Render the dataend element begin */
h5tools_str_reset(buffer);
- if(HDstrlen(h5tools_dump_header_format->datablockend)) {
+ if (HDstrlen(h5tools_dump_header_format->datablockend)) {
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datablockend);
- if(HDstrlen(h5tools_dump_header_format->dataend))
+ if (HDstrlen(h5tools_dump_header_format->dataend))
h5tools_str_append(buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->dataend))
+ if (HDstrlen(h5tools_dump_header_format->dataend))
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataend);
- dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos,
- ncols, region_elmt_counter, elmt_counter);
+ dimension_break = h5tools_render_element(stream, &outputformat, ctx, buffer, curr_pos, ncols,
+ region_elmt_counter, elmt_counter);
/* Render the dataend element end*/
}
@@ -1194,14 +1210,14 @@ done:
/* Render the region } element begin */
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "}");
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos,
- ncols, region_elmt_counter, elmt_counter);
+ dimension_break =
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter);
/* Render the region } element end */
H5_LEAVE(dimension_break)
-CATCH
+ CATCH
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1239,37 +1255,37 @@ CATCH
*-------------------------------------------------------------------------
*/
static herr_t
-h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hid_t dset, hid_t p_type, hid_t f_space, hsize_t hyperslab_count,
- hsize_t *temp_start, /* start inside offset count loop */
- hsize_t *temp_count, /* count inside offset count loop */
- hsize_t *temp_block, /* block size used in loop */
- hsize_t *temp_stride, /* stride size used in loop */
- hsize_t *total_size, /* total size of dataset */
- unsigned int row_dim) /* index of row_counter dimension */
+h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset,
+ hid_t p_type, hid_t f_space, hsize_t hyperslab_count,
+ hsize_t * temp_start, /* start inside offset count loop */
+ hsize_t * temp_count, /* count inside offset count loop */
+ hsize_t * temp_block, /* block size used in loop */
+ hsize_t * temp_stride, /* stride size used in loop */
+ const hsize_t *total_size, /* total size of dataset */
+ unsigned int row_dim) /* index of row_counter dimension */
{
- size_t i; /* counters */
- size_t j; /* counters */
- hsize_t zero[1] = {0}; /* vector of zeros */
- unsigned int flags; /* buffer extent flags */
- hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */
- hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */
- size_t p_type_nbytes; /* size of memory type */
- hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
- hsize_t sm_nbytes; /* bytes per stripmine */
- hssize_t ssm_nelmts; /* elements per stripmine*/
- hsize_t sm_nelmts; /* elements per stripmine*/
- unsigned char *sm_buf = NULL; /* buffer for raw data */
- hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */
- hsize_t size_row_block; /* size for blocks along rows */
- hsize_t row_counter = 0;
- hbool_t past_catch = FALSE;
+ size_t i; /* counters */
+ size_t j; /* counters */
+ hsize_t zero[1] = {0}; /* vector of zeros */
+ unsigned int flags; /* buffer extent flags */
+ hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */
+ hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */
+ size_t p_type_nbytes; /* size of memory type */
+ hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
+ hsize_t sm_nbytes; /* bytes per stripmine */
+ hssize_t ssm_nelmts; /* elements per stripmine*/
+ hsize_t sm_nelmts; /* elements per stripmine*/
+ unsigned char *sm_buf = NULL; /* buffer for raw data */
+ hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */
+ hsize_t size_row_block; /* size for blocks along rows */
+ hsize_t row_counter = 0;
+ hbool_t past_catch = FALSE;
/* VL data special information */
- unsigned int vl_data = 0; /* contains VL datatypes */
- herr_t ret_value = SUCCEED;
+ unsigned int vl_data = 0; /* contains VL datatypes */
+ herr_t ret_value = SUCCEED;
- H5TOOLS_START_DEBUG("");
- if ((size_t) ctx->ndims > NELMTS(sm_size))
+ H5TOOLS_START_DEBUG(" ");
+ if ((size_t)ctx->ndims > NELMTS(sm_size))
H5TOOLS_THROW(FAIL, "ndims and sm_size comparision failed");
size_row_block = ctx->sset->block.data[row_dim];
@@ -1282,9 +1298,8 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) {
/* jump rows if size of block exceeded
cases where block > 1 only and stride > block */
- if (size_row_block > 1
- && row_counter == size_row_block
- && ctx->sset->stride.data[row_dim] > ctx->sset->block.data[row_dim]) {
+ if (size_row_block > 1 && row_counter == size_row_block &&
+ ctx->sset->stride.data[row_dim] > ctx->sset->block.data[row_dim]) {
hsize_t increase_rows = ctx->sset->stride.data[row_dim] - ctx->sset->block.data[row_dim];
temp_start[row_dim] += increase_rows;
@@ -1294,10 +1309,10 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
row_counter++;
/* calculate the potential number of elements we're going to print */
- if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0)
+ if (H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0)
H5TOOLS_THROW(FAIL, "H5Sselect_hyperslab failed");
- if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0)
+ if ((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0)
H5TOOLS_THROW(FAIL, "H5Sget_select_npoints failed");
sm_nelmts = (hsize_t)ssm_nelmts;
@@ -1306,7 +1321,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
* determine the strip mine size and allocate a buffer. the strip mine is
* a hyperslab whose size is manageable.
*/
- if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0)
+ if ((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0)
H5TOOLS_THROW(FAIL, "H5Tget_size failed");
if (ctx->ndims > 0)
@@ -1319,18 +1334,18 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
HDassert(sm_nbytes > 0);
}
- HDassert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/
- if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes)))
+ HDassert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/
+ if (NULL == (sm_buf = (unsigned char *)HDmalloc((size_t)sm_nelmts * p_type_nbytes)))
H5TOOLS_THROW(FAIL, "Could not allocate buffer for strip-mine");
- if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0)
+ if ((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0)
H5TOOLS_THROW(FAIL, "H5Screate_simple failed");
- if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0)
+ if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0)
H5TOOLS_THROW(FAIL, "H5Sselect_hyperslab failed");
/* read the data */
- if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0)
+ if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0)
H5TOOLS_THROW(FAIL, "H5Dread failed");
/* print the data */
@@ -1344,32 +1359,31 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
/* print array indices. get the lower bound of the hyperslab and calculate
the element position at the start of hyperslab */
- if(H5Sget_select_bounds(f_space, low, high) < 0)
+ if (H5Sget_select_bounds(f_space, low, high) < 0)
H5TOOLS_THROW(FAIL, "H5Sget_select_bounds failed");
/* initialize the current stripmine position; this is necessary to print the array indices */
ctx->sm_pos = 0;
- for (i = 0; i < (size_t) ctx->ndims - 1; i++) {
+ for (i = 0; i < (size_t)ctx->ndims - 1; i++) {
hsize_t offset = 1; /* accumulation of the previous dimensions */
- for (j = i + 1; j < (size_t) ctx->ndims; j++)
+ for (j = i + 1; j < (size_t)ctx->ndims; j++)
offset *= total_size[j];
ctx->sm_pos += low[i] * offset;
}
ctx->sm_pos += low[ctx->ndims - 1];
-
ctx->need_prefix = TRUE;
- if(h5tools_dump_simple_data(stream, info, ctx, dset, flags, sm_nelmts, p_type, sm_buf) < 0)
+ if (h5tools_dump_simple_data(stream, info, ctx, dset, flags, sm_nelmts, p_type, sm_buf) < 0)
H5TOOLS_THROW(FAIL, "h5tools_dump_simple_data failed");
/* Reclaim any VL memory, if necessary */
if (vl_data)
H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf);
- if(H5Sclose(sm_space) < 0)
+ if (H5Sclose(sm_space) < 0)
H5TOOLS_THROW(FAIL, "H5Sclose failed");
- if(sm_buf)
+ if (sm_buf)
HDfree(sm_buf);
sm_buf = NULL;
}
@@ -1380,11 +1394,11 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
} /* hyperslab_count loop */
-CATCH
- if(sm_buf)
+ CATCH
+ if (sm_buf)
HDfree(sm_buf);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1421,22 +1435,22 @@ CATCH
*-------------------------------------------------------------------------
*/
static herr_t
-h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hid_t dset, hid_t p_type, hid_t f_space, hsize_t *total_size)
+h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset,
+ hid_t p_type, hid_t f_space, hsize_t *total_size)
{
- size_t i; /* counters */
- hsize_t n; /* counters */
- hsize_t count; /* hyperslab count */
- hsize_t outer_count; /* offset count */
- unsigned int row_dim; /* index of row_counter dimension */
- int current_outer_dim; /* dimension for start */
- hsize_t temp_start[H5S_MAX_RANK];/* temporary start inside offset count loop */
- hsize_t max_start[H5S_MAX_RANK]; /* maximum start inside offset count loop */
- hsize_t temp_count[H5S_MAX_RANK];/* temporary count inside offset count loop */
- hsize_t temp_block[H5S_MAX_RANK];/* temporary block size used in loop */
- hsize_t temp_stride[H5S_MAX_RANK];/* temporary stride size used in loop */
- int reset_dim;
- herr_t ret_value = SUCCEED;
+ size_t i; /* counters */
+ hsize_t n; /* counters */
+ hsize_t count; /* hyperslab count */
+ hsize_t outer_count; /* offset count */
+ unsigned int row_dim; /* index of row_counter dimension */
+ int current_outer_dim; /* dimension for start */
+ hsize_t temp_start[H5S_MAX_RANK]; /* temporary start inside offset count loop */
+ hsize_t max_start[H5S_MAX_RANK]; /* maximum start inside offset count loop */
+ hsize_t temp_count[H5S_MAX_RANK]; /* temporary count inside offset count loop */
+ hsize_t temp_block[H5S_MAX_RANK]; /* temporary block size used in loop */
+ hsize_t temp_stride[H5S_MAX_RANK]; /* temporary stride size used in loop */
+ int reset_dim;
+ herr_t ret_value = SUCCEED;
if (ctx->ndims == 1)
row_dim = 0;
@@ -1446,23 +1460,23 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
/* get the offset count */
outer_count = 1;
if (ctx->ndims > 2)
- for (i = 0; i < (size_t) ctx->ndims - 2; i++) {
+ for (i = 0; i < (size_t)ctx->ndims - 2; i++) {
/* block size is handled by containing h5tools_print_simple_subset call */
outer_count = outer_count * ctx->sset->count.data[i];
}
/* initialize temporary start, count and maximum start */
for (i = 0; i < ctx->ndims; i++) {
- temp_start[i] = ctx->sset->start.data[i];
- temp_count[i] = ctx->sset->count.data[i];
- temp_block[i] = ctx->sset->block.data[i];
+ temp_start[i] = ctx->sset->start.data[i];
+ temp_count[i] = ctx->sset->count.data[i];
+ temp_block[i] = ctx->sset->block.data[i];
temp_stride[i] = ctx->sset->stride.data[i];
- max_start[i] = 0;
+ max_start[i] = 0;
}
if (ctx->ndims > 2) {
- for (i = 0; i < (size_t) ctx->ndims - 2; i++) {
- max_start[i] = temp_start[i] + ctx->sset->count.data[i] * ctx->sset->stride.data[i];
+ for (i = 0; i < (size_t)ctx->ndims - 2; i++) {
+ max_start[i] = temp_start[i] + ctx->sset->count.data[i] * ctx->sset->stride.data[i];
temp_count[i] = 1;
}
}
@@ -1488,9 +1502,8 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
count = 1;
}
- h5tools_print_simple_subset(stream, info, ctx, dset, p_type,
- f_space, count, temp_start, temp_count,
- temp_block, temp_stride, total_size, row_dim);
+ h5tools_print_simple_subset(stream, info, ctx, dset, p_type, f_space, count, temp_start, temp_count,
+ temp_block, temp_stride, total_size, row_dim);
if (ctx->ndims > 2) {
/* dimension for start */
@@ -1561,24 +1574,25 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
*-------------------------------------------------------------------------
*/
static herr_t
-h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type)
+h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset,
+ hid_t p_type)
{
int sndims;
- hid_t f_space = H5I_INVALID_HID; /* file data space */
- hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
+ hid_t f_space = H5I_INVALID_HID; /* file data space */
+ hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
hbool_t past_catch = FALSE;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
- H5TOOLS_START_DEBUG("");
- if((f_space = H5Dget_space(dset)) < 0)
+ H5TOOLS_START_DEBUG(" ");
+ if ((f_space = H5Dget_space(dset)) < 0)
H5TOOLS_THROW(FAIL, "H5Dget_space failed");
- if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0)
+ if ((sndims = H5Sget_simple_extent_ndims(f_space)) < 0)
H5TOOLS_THROW(FAIL, "H5Sget_simple_extent_ndims failed");
ctx->ndims = (unsigned)sndims;
/* assume entire data space to be printed */
- if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0)
+ if (H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0)
H5TOOLS_THROW(FAIL, "H5Sget_simple_extent_dims failed");
init_acc_pos(ctx->ndims, total_size, ctx->acc, ctx->pos, ctx->p_min_idx);
@@ -1589,11 +1603,11 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
h5tools_display_simple_subset(stream, info, ctx, dset, p_type, f_space, total_size);
-CATCH
- if(f_space >= 0 && H5Sclose(f_space) < 0)
+ CATCH
+ if (f_space >= 0 && H5Sclose(f_space) < 0)
H5TOOLS_THROW(FAIL, "H5Sclose failed");
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1613,44 +1627,45 @@ CATCH
*-------------------------------------------------------------------------
*/
static int
-h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type)
+h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset,
+ hid_t p_type)
{
- hid_t f_space = H5I_INVALID_HID; /* file data space */
- hsize_t elmtno; /* counter */
- size_t i = 0; /* counter */
- int sndims; /* rank of dataspace */
- int carry; /* counter carry value */
- hsize_t zero[8]; /* vector of zeros */
- unsigned int flags; /* buffer extent flags */
- hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
- hbool_t past_catch = FALSE;
+ hid_t f_space = H5I_INVALID_HID; /* file data space */
+ hsize_t elmtno; /* counter */
+ size_t i = 0; /* counter */
+ int sndims; /* rank of dataspace */
+ int carry; /* counter carry value */
+ hsize_t zero[8]; /* vector of zeros */
+ unsigned int flags; /* buffer extent flags */
+ hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
+ hbool_t past_catch = FALSE;
/* Print info */
- size_t p_type_nbytes; /* size of memory type */
- hsize_t p_nelmts; /* total selected elmts */
+ size_t p_type_nbytes; /* size of memory type */
+ hsize_t p_nelmts; /* total selected elmts */
/* Stripmine info */
- hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
- hsize_t sm_nbytes; /* bytes per stripmine */
- hsize_t sm_nelmts; /* elements per stripmine*/
- unsigned char *sm_buf = NULL; /* buffer for raw data */
- hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */
+ hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
+ hsize_t sm_nbytes; /* bytes per stripmine */
+ hsize_t sm_nelmts; /* elements per stripmine*/
+ unsigned char *sm_buf = NULL; /* buffer for raw data */
+ hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */
/* Hyperslab info */
- hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */
- hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */
- hsize_t hs_nelmts; /* elements in request */
+ hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */
+ hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */
+ hsize_t hs_nelmts; /* elements in request */
/* VL data special information */
- unsigned int vl_data = 0; /* contains VL datatypes */
- int ret_value = 0;
+ unsigned int vl_data = 0; /* contains VL datatypes */
+ int ret_value = 0;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
if (H5I_INVALID_HID == (f_space = H5Dget_space(dset)))
H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
sndims = H5Sget_simple_extent_ndims(f_space);
- if(sndims < 0)
+ if (sndims < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_simple_extent_ndims failed");
ctx->ndims = (unsigned)sndims;
H5TOOLS_DEBUG("sndims:%d", sndims);
@@ -1695,7 +1710,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
sm_nbytes *= sm_size[i - 1];
}
}
- if(!sm_nbytes)
+ if (!sm_nbytes)
goto done;
HDassert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/
@@ -1703,7 +1718,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
H5TOOLS_DEBUG("stripmine size:%ld", sm_nbytes);
sm_nelmts = sm_nbytes / p_type_nbytes;
- sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
+ sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
H5TOOLS_DEBUG("sm_nelmts size:%ld", sm_nelmts);
H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims);
@@ -1717,7 +1732,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
/* Calculate the hyperslab size */
if (ctx->ndims > 0) {
for (i = 0, hs_nelmts = 1; i < ctx->ndims; i++) {
- hs_size[i] = MIN(total_size[i] - hs_offset[i], sm_size[i]);
+ hs_size[i] = MIN(total_size[i] - hs_offset[i], sm_size[i]);
ctx->p_max_idx[i] = ctx->p_min_idx[i] + hs_size[i];
hs_nelmts *= hs_size[i];
}
@@ -1746,7 +1761,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
indices */
ctx->sm_pos = elmtno;
- if(h5tools_dump_simple_data(stream, info, ctx, dset, flags, hs_nelmts, p_type, sm_buf) < 0)
+ if (h5tools_dump_simple_data(stream, info, ctx, dset, flags, hs_nelmts, p_type, sm_buf) < 0)
H5TOOLS_ERROR((-1), "h5tools_dump_simple_data failed");
/* Reclaim any VL memory, if necessary */
@@ -1775,12 +1790,12 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
} /* if (NULL != (sm_buf...)) */
done:
- if(sm_space >= 0 && H5Sclose(sm_space) < 0)
+ if (sm_space >= 0 && H5Sclose(sm_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
- if(f_space >= 0 && H5Sclose(f_space) < 0)
+ if (f_space >= 0 && H5Sclose(f_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
-CATCH
- H5TOOLS_ENDDEBUG("");
+ CATCH
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1795,33 +1810,33 @@ CATCH
*-------------------------------------------------------------------------
*/
static int
-h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hid_t attr_id, hid_t p_type)
+h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t attr_id,
+ hid_t p_type)
{
- hid_t f_space = H5I_INVALID_HID; /* file data space */
+ hid_t f_space = H5I_INVALID_HID; /* file data space */
hsize_t alloc_size;
- int sndims; /* rank of dataspace */
- unsigned i; /* counters */
- hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
- hsize_t p_nelmts; /* total selected elmts */
+ int sndims; /* rank of dataspace */
+ unsigned i; /* counters */
+ hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
+ hsize_t p_nelmts; /* total selected elmts */
hbool_t past_catch = FALSE;
- unsigned char *buf = NULL; /* buffer for raw data */
- int ret_value = 0;
+ unsigned char *buf = NULL; /* buffer for raw data */
+ int ret_value = 0;
/* VL data special information */
- unsigned int vl_data = 0; /* contains VL datatypes */
+ unsigned int vl_data = 0; /* contains VL datatypes */
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
if (H5I_INVALID_HID == (f_space = H5Aget_space(attr_id)))
H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
sndims = H5Sget_simple_extent_ndims(f_space);
- if(sndims < 0)
+ if (sndims < 0)
H5TOOLS_THROW((-1), "H5Dget_simple_extent_ndims failed");
ctx->ndims = (unsigned)sndims;
H5TOOLS_DEBUG("sndims:%d", sndims);
- if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx))
+ if ((size_t)ctx->ndims > NELMTS(ctx->p_min_idx))
H5TOOLS_THROW((-1), "ctx->ndims > NELMTS(ctx->p_min_idx) failed");
/* Assume entire data space to be printed */
@@ -1854,7 +1869,8 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
H5TOOLS_DEBUG("Read the data");
/* Read the data */
if (H5Aread(attr_id, p_type, buf) >= 0) {
- if(h5tools_dump_simple_data(stream, info, ctx, attr_id, START_OF_DATA | END_OF_DATA, p_nelmts, p_type, buf) < 0)
+ if (h5tools_dump_simple_data(stream, info, ctx, attr_id, START_OF_DATA | END_OF_DATA, p_nelmts,
+ p_type, buf) < 0)
H5TOOLS_ERROR((-1), "h5tools_dump_simple_data failed");
/* Reclaim any VL memory, if necessary */
@@ -1866,10 +1882,10 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
HDfree(buf);
} /* if (NULL != (buf...)) */
done:
- if(f_space >= 0 && H5Sclose(f_space) < 0)
+ if (f_space >= 0 && H5Sclose(f_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
-CATCH
- H5TOOLS_ENDDEBUG("");
+ CATCH
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1894,14 +1910,14 @@ CATCH
int
h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset)
{
- hid_t f_space = H5I_INVALID_HID;
- hid_t p_type = H5I_INVALID_HID;
- hid_t f_type = H5I_INVALID_HID;
- H5S_class_t space_type;
+ hid_t f_space = H5I_INVALID_HID;
+ hid_t p_type = H5I_INVALID_HID;
+ hid_t f_type = H5I_INVALID_HID;
+ H5S_class_t space_type;
h5tool_format_t info_dflt;
- int ret_value = 0;
+ int ret_value = 0;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
/* Use default values */
if (!stream)
stream = rawoutstream;
@@ -1936,7 +1952,7 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
/* Print the data */
if (space_type == H5S_SIMPLE || space_type == H5S_SCALAR) {
- if(!ctx->sset)
+ if (!ctx->sset)
ret_value = h5tools_dump_simple_dset(rawdatastream, info, ctx, dset, p_type);
else
ret_value = h5tools_dump_simple_subset(rawdatastream, info, ctx, dset, p_type);
@@ -1953,7 +1969,7 @@ done:
if (f_space > 0)
H5Sclose(f_space);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -1971,13 +1987,13 @@ done:
int
h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t attr_id)
{
- hid_t f_space = H5I_INVALID_HID;
- hid_t p_type = H5I_INVALID_HID;
- hid_t f_type = H5I_INVALID_HID;
- h5tool_format_t info_dflt;
- int ret_value = 0;
+ hid_t f_space = H5I_INVALID_HID;
+ hid_t p_type = H5I_INVALID_HID;
+ hid_t f_type = H5I_INVALID_HID;
+ h5tool_format_t info_dflt;
+ int ret_value = 0;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
/* Use default values */
if (!stream)
stream = rawoutstream;
@@ -2023,7 +2039,7 @@ done:
if (f_space > 0)
H5Sclose(f_space);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -2040,45 +2056,45 @@ done:
*/
int
h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info,
- h5tools_context_t *ctx, hid_t type, int object_search)
+ h5tools_context_t *ctx, hid_t type, int object_search)
{
- char *mname;
- hid_t mtype = H5I_INVALID_HID;
- hid_t str_type = H5I_INVALID_HID;
- hid_t super = H5I_INVALID_HID;
- hid_t tmp_type = H5I_INVALID_HID;
- int snmembers;
- int sndims;
- unsigned nmembers;
- unsigned i;
- size_t size = 0;
- size_t ncols = 80; /*available output width */
- hsize_t dims[H5TOOLS_DUMP_MAX_RANK];
- hsize_t curr_pos = 0; /* total data element position */
- H5T_str_t str_pad;
- H5T_cset_t cset;
- H5T_order_t order;
- H5T_class_t type_class;
- H5T_sign_t sign; /* sign scheme value */
- htri_t is_vlstr = FALSE;
- hbool_t past_catch = FALSE;
- const char *sign_s = NULL; /* sign scheme string */
- const char *order_s = NULL; /* byte order string */
- int ret_value = 0;
+ char * mname;
+ hid_t mtype = H5I_INVALID_HID;
+ hid_t str_type = H5I_INVALID_HID;
+ hid_t super = H5I_INVALID_HID;
+ hid_t tmp_type = H5I_INVALID_HID;
+ int snmembers;
+ int sndims;
+ unsigned nmembers;
+ unsigned i;
+ size_t size = 0;
+ size_t ncols = 80; /*available output width */
+ hsize_t dims[H5TOOLS_DUMP_MAX_RANK];
+ hsize_t curr_pos = 0; /* total data element position */
+ H5T_str_t str_pad;
+ H5T_cset_t cset;
+ H5T_order_t order;
+ H5T_class_t type_class;
+ H5T_sign_t sign; /* sign scheme value */
+ htri_t is_vlstr = FALSE;
+ hbool_t past_catch = FALSE;
+ const char *sign_s = NULL; /* sign scheme string */
+ const char *order_s = NULL; /* byte order string */
+ int ret_value = 0;
- H5TOOLS_START_DEBUG("");
- if((type_class = H5Tget_class(type)) < 0)
+ H5TOOLS_START_DEBUG(" ");
+ if ((type_class = H5Tget_class(type)) < 0)
H5TOOLS_THROW((-1), "H5Tget_class failed");
if (object_search && H5Tcommitted(type) > 0) {
- H5O_info_t oinfo;
- obj_t *obj = NULL; /* Found object */
+ H5O_info_t oinfo;
+ obj_t * obj = NULL; /* Found object */
H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
obj = search_obj(h5dump_type_table, oinfo.addr);
- if(obj) {
- if(!obj->recorded)
- h5tools_str_append(buffer,"\"/#"H5_PRINTF_HADDR_FMT"\"", obj->objno);
+ if (obj) {
+ if (!obj->recorded)
+ h5tools_str_append(buffer, "\"/#" H5_PRINTF_HADDR_FMT "\"", obj->objno);
else
h5tools_str_append(buffer, "\"%s\"", obj->objname);
}
@@ -2094,522 +2110,530 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
ncols = info->line_ncols;
switch (type_class) {
- case H5T_INTEGER:
- if (H5Tequal(type, H5T_STD_I8BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_I8BE");
- else if (H5Tequal(type, H5T_STD_I8LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_I8LE");
- else if (H5Tequal(type, H5T_STD_I16BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_I16BE");
- else if (H5Tequal(type, H5T_STD_I16LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_I16LE");
- else if (H5Tequal(type, H5T_STD_I32BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_I32BE");
- else if (H5Tequal(type, H5T_STD_I32LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_I32LE");
- else if (H5Tequal(type, H5T_STD_I64BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_I64BE");
- else if (H5Tequal(type, H5T_STD_I64LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_I64LE");
- else if (H5Tequal(type, H5T_STD_U8BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_U8BE");
- else if (H5Tequal(type, H5T_STD_U8LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_U8LE");
- else if (H5Tequal(type, H5T_STD_U16BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_U16BE");
- else if (H5Tequal(type, H5T_STD_U16LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_U16LE");
- else if (H5Tequal(type, H5T_STD_U32BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_U32BE");
- else if (H5Tequal(type, H5T_STD_U32LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_U32LE");
- else if (H5Tequal(type, H5T_STD_U64BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_U64BE");
- else if (H5Tequal(type, H5T_STD_U64LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_U64LE");
- else if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_SCHAR");
- else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_UCHAR");
- else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_SHORT");
- else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_USHORT");
- else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_INT");
- else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_UINT");
- else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_LONG");
- else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_ULONG");
- else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_LLONG");
- else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_ULLONG");
- else {
+ case H5T_INTEGER:
+ if (H5Tequal(type, H5T_STD_I8BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_I8BE");
+ else if (H5Tequal(type, H5T_STD_I8LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_I8LE");
+ else if (H5Tequal(type, H5T_STD_I16BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_I16BE");
+ else if (H5Tequal(type, H5T_STD_I16LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_I16LE");
+ else if (H5Tequal(type, H5T_STD_I32BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_I32BE");
+ else if (H5Tequal(type, H5T_STD_I32LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_I32LE");
+ else if (H5Tequal(type, H5T_STD_I64BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_I64BE");
+ else if (H5Tequal(type, H5T_STD_I64LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_I64LE");
+ else if (H5Tequal(type, H5T_STD_U8BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_U8BE");
+ else if (H5Tequal(type, H5T_STD_U8LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_U8LE");
+ else if (H5Tequal(type, H5T_STD_U16BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_U16BE");
+ else if (H5Tequal(type, H5T_STD_U16LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_U16LE");
+ else if (H5Tequal(type, H5T_STD_U32BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_U32BE");
+ else if (H5Tequal(type, H5T_STD_U32LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_U32LE");
+ else if (H5Tequal(type, H5T_STD_U64BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_U64BE");
+ else if (H5Tequal(type, H5T_STD_U64LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_U64LE");
+ else if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_SCHAR");
+ else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_UCHAR");
+ else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_SHORT");
+ else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_USHORT");
+ else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_INT");
+ else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_UINT");
+ else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_LONG");
+ else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_ULONG");
+ else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_LLONG");
+ else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_ULLONG");
+ else {
- /* byte order */
- if (H5Tget_size(type) > 1) {
- order = H5Tget_order(type);
- if (H5T_ORDER_LE == order)
- order_s = " little-endian";
- else if (H5T_ORDER_BE == order)
- order_s = " big-endian";
- else if (H5T_ORDER_VAX == order)
- order_s = " mixed-endian";
+ /* byte order */
+ if (H5Tget_size(type) > 1) {
+ order = H5Tget_order(type);
+ if (H5T_ORDER_LE == order)
+ order_s = " little-endian";
+ else if (H5T_ORDER_BE == order)
+ order_s = " big-endian";
+ else if (H5T_ORDER_VAX == order)
+ order_s = " mixed-endian";
+ else
+ order_s = " unknown-byte-order";
+ }
else
- order_s = " unknown-byte-order";
- }
- else
- order_s = "";
-
- /* sign */
- if ((sign = H5Tget_sign(type)) >= 0) {
- if (H5T_SGN_NONE == sign)
- sign_s = " unsigned";
- else if (H5T_SGN_2 == sign)
- sign_s = "";
+ order_s = "";
+
+ /* sign */
+ if ((sign = H5Tget_sign(type)) >= 0) {
+ if (H5T_SGN_NONE == sign)
+ sign_s = " unsigned";
+ else if (H5T_SGN_2 == sign)
+ sign_s = "";
+ else
+ sign_s = " unknown-sign";
+ }
else
sign_s = " unknown-sign";
- }
- else
- sign_s = " unknown-sign";
- /* print size, order, and sign */
- h5tools_str_append(buffer, "%lu-bit%s%s integer",
- (unsigned long) (8 * H5Tget_size(type)), order_s, sign_s);
- }
- break;
-
- case H5T_FLOAT:
- if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE)
- h5tools_str_append(buffer, "H5T_IEEE_F32BE");
- else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE)
- h5tools_str_append(buffer, "H5T_IEEE_F32LE");
- else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE)
- h5tools_str_append(buffer, "H5T_IEEE_F64BE");
- else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE)
- h5tools_str_append(buffer, "H5T_IEEE_F64LE");
- else if (H5Tequal(type, H5T_VAX_F32) == TRUE)
- h5tools_str_append(buffer, "H5T_VAX_F32");
- else if (H5Tequal(type, H5T_VAX_F64) == TRUE)
- h5tools_str_append(buffer, "H5T_VAX_F64");
- else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_FLOAT");
- else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_DOUBLE");
-#if H5_SIZEOF_LONG_DOUBLE !=0
- else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE)
- h5tools_str_append(buffer, "H5T_NATIVE_LDOUBLE");
-#endif
- else {
-
- /* byte order */
- if (H5Tget_size(type) > 1) {
- order = H5Tget_order(type);
- if (H5T_ORDER_LE == order)
- order_s = " little-endian";
- else if (H5T_ORDER_BE == order)
- order_s = " big-endian";
- else if (H5T_ORDER_VAX == order)
- order_s = " mixed-endian";
- else
- order_s = " unknown-byte-order";
+ /* print size, order, sign, and precision */
+ h5tools_str_append(buffer, "%lu-bit%s%s integer %lu-bit precision",
+ (unsigned long)(8 * H5Tget_size(type)), order_s, sign_s,
+ H5Tget_precision(type));
}
- else
- order_s = "";
+ break;
- /* print size and byte order */
- h5tools_str_append(buffer, "%lu-bit%s floating-point",
- (unsigned long) (8 * H5Tget_size(type)), order_s);
+ case H5T_FLOAT:
+ if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_IEEE_F32BE");
+ else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_IEEE_F32LE");
+ else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_IEEE_F64BE");
+ else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_IEEE_F64LE");
+ else if (H5Tequal(type, H5T_VAX_F32) == TRUE)
+ h5tools_str_append(buffer, "H5T_VAX_F32");
+ else if (H5Tequal(type, H5T_VAX_F64) == TRUE)
+ h5tools_str_append(buffer, "H5T_VAX_F64");
+ else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_FLOAT");
+ else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE)
+ h5tools_str_append(buffer, "H5T_NATIVE_DOUBLE");
+ else {
+ /* print what the library knows */
+ /* byte order */
+ if (H5Tget_size(type) > 1) {
+ order = H5Tget_order(type);
+ if (H5T_ORDER_LE == order)
+ order_s = " little-endian";
+ else if (H5T_ORDER_BE == order)
+ order_s = " big-endian";
+ else if (H5T_ORDER_VAX == order)
+ order_s = " mixed-endian";
+ else
+ order_s = " unknown-byte-order";
+ }
+ else
+ order_s = "";
- }
- break;
-
- case H5T_TIME:
- h5tools_str_append(buffer, "H5T_TIME: not yet implemented");
- break;
-
- case H5T_STRING:
- /* Make a copy of type in memory in case when TYPE is on disk, the size
- * will be bigger than in memory. This makes it easier to compare
- * types in memory. */
- tmp_type = H5Tcopy(type);
- size = H5Tget_size(tmp_type);
- str_pad = H5Tget_strpad(tmp_type);
- cset = H5Tget_cset(tmp_type);
- is_vlstr = H5Tis_variable_str(tmp_type);
-
- curr_pos = ctx->cur_column;
- h5tools_str_append(buffer, "H5T_STRING %s", h5tools_dump_header_format->strblockbegin);
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ /* print size. byte order, and precision */
+ h5tools_str_append(buffer, "%lu-bit%s floating-point %lu-bit precision",
+ (unsigned long)(8 * H5Tget_size(type)), order_s, H5Tget_precision(type));
+ }
+ break;
- ctx->indent_level++;
+ case H5T_TIME:
+ h5tools_str_append(buffer, "H5T_TIME: not yet implemented");
+ break;
- ctx->need_prefix = TRUE;
+ case H5T_STRING:
+ /* Make a copy of type in memory in case when TYPE is on disk, the size
+ * will be bigger than in memory. This makes it easier to compare
+ * types in memory. */
+ tmp_type = H5Tcopy(type);
+ size = H5Tget_size(tmp_type);
+ str_pad = H5Tget_strpad(tmp_type);
+ cset = H5Tget_cset(tmp_type);
+ is_vlstr = H5Tis_variable_str(tmp_type);
+
+ curr_pos = ctx->cur_column;
+ h5tools_str_append(buffer, "H5T_STRING %s", h5tools_dump_header_format->strblockbegin);
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- h5tools_str_reset(buffer);
+ ctx->indent_level++;
- if (is_vlstr)
- h5tools_str_append(buffer, "%s H5T_VARIABLE;", STRSIZE);
- else
- h5tools_str_append(buffer, "%s %d;", STRSIZE, (int) size);
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ ctx->need_prefix = TRUE;
- ctx->need_prefix = TRUE;
+ h5tools_str_reset(buffer);
- h5tools_str_reset(buffer);
+ if (is_vlstr)
+ h5tools_str_append(buffer, "%s H5T_VARIABLE;", STRSIZE);
+ else
+ h5tools_str_append(buffer, "%s %d;", STRSIZE, (int)size);
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- h5tools_str_append(buffer, "%s ", STRPAD);
- switch (str_pad) {
- case H5T_STR_NULLTERM:
- h5tools_str_append(buffer, "H5T_STR_NULLTERM;");
- break;
- case H5T_STR_NULLPAD:
- h5tools_str_append(buffer, "H5T_STR_NULLPAD;");
- break;
- case H5T_STR_SPACEPAD:
- h5tools_str_append(buffer, "H5T_STR_SPACEPAD;");
- break;
- case H5T_STR_RESERVED_3:
- case H5T_STR_RESERVED_4:
- case H5T_STR_RESERVED_5:
- case H5T_STR_RESERVED_6:
- case H5T_STR_RESERVED_7:
- case H5T_STR_RESERVED_8:
- case H5T_STR_RESERVED_9:
- case H5T_STR_RESERVED_10:
- case H5T_STR_RESERVED_11:
- case H5T_STR_RESERVED_12:
- case H5T_STR_RESERVED_13:
- case H5T_STR_RESERVED_14:
- case H5T_STR_RESERVED_15:
- h5tools_str_append(buffer, "H5T_STR_UNKNOWN;");
- break;
- case H5T_STR_ERROR:
- h5tools_str_append(buffer, "H5T_STR_ERROR;");
- break;
- default:
- h5tools_str_append(buffer, "ERROR;");
- break;
- }
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ ctx->need_prefix = TRUE;
- ctx->need_prefix = TRUE;
+ h5tools_str_reset(buffer);
- h5tools_str_reset(buffer);
+ h5tools_str_append(buffer, "%s ", STRPAD);
+ switch (str_pad) {
+ case H5T_STR_NULLTERM:
+ h5tools_str_append(buffer, "H5T_STR_NULLTERM;");
+ break;
+ case H5T_STR_NULLPAD:
+ h5tools_str_append(buffer, "H5T_STR_NULLPAD;");
+ break;
+ case H5T_STR_SPACEPAD:
+ h5tools_str_append(buffer, "H5T_STR_SPACEPAD;");
+ break;
+ case H5T_STR_RESERVED_3:
+ case H5T_STR_RESERVED_4:
+ case H5T_STR_RESERVED_5:
+ case H5T_STR_RESERVED_6:
+ case H5T_STR_RESERVED_7:
+ case H5T_STR_RESERVED_8:
+ case H5T_STR_RESERVED_9:
+ case H5T_STR_RESERVED_10:
+ case H5T_STR_RESERVED_11:
+ case H5T_STR_RESERVED_12:
+ case H5T_STR_RESERVED_13:
+ case H5T_STR_RESERVED_14:
+ case H5T_STR_RESERVED_15:
+ h5tools_str_append(buffer, "H5T_STR_UNKNOWN;");
+ break;
+ case H5T_STR_ERROR:
+ h5tools_str_append(buffer, "H5T_STR_ERROR;");
+ break;
+ default:
+ h5tools_str_append(buffer, "ERROR;");
+ break;
+ }
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- h5tools_str_append(buffer, "%s ", CSET);
+ ctx->need_prefix = TRUE;
- switch (cset) {
- case H5T_CSET_ASCII:
- h5tools_str_append(buffer, "H5T_CSET_ASCII;");
- break;
- case H5T_CSET_UTF8:
- h5tools_str_append(buffer, "H5T_CSET_UTF8;");
- break;
- case H5T_CSET_RESERVED_2:
- case H5T_CSET_RESERVED_3:
- case H5T_CSET_RESERVED_4:
- case H5T_CSET_RESERVED_5:
- case H5T_CSET_RESERVED_6:
- case H5T_CSET_RESERVED_7:
- case H5T_CSET_RESERVED_8:
- case H5T_CSET_RESERVED_9:
- case H5T_CSET_RESERVED_10:
- case H5T_CSET_RESERVED_11:
- case H5T_CSET_RESERVED_12:
- case H5T_CSET_RESERVED_13:
- case H5T_CSET_RESERVED_14:
- case H5T_CSET_RESERVED_15:
- h5tools_str_append(buffer, "H5T_CSET_UNKNOWN;");
- break;
- case H5T_CSET_ERROR:
- h5tools_str_append(buffer, "H5T_CSET_ERROR;");
- break;
- default:
- h5tools_str_append(buffer, "ERROR;");
- break;
- }
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_reset(buffer);
- ctx->need_prefix = TRUE;
+ h5tools_str_append(buffer, "%s ", CSET);
+
+ switch (cset) {
+ case H5T_CSET_ASCII:
+ h5tools_str_append(buffer, "H5T_CSET_ASCII;");
+ break;
+ case H5T_CSET_UTF8:
+ h5tools_str_append(buffer, "H5T_CSET_UTF8;");
+ break;
+ case H5T_CSET_RESERVED_2:
+ case H5T_CSET_RESERVED_3:
+ case H5T_CSET_RESERVED_4:
+ case H5T_CSET_RESERVED_5:
+ case H5T_CSET_RESERVED_6:
+ case H5T_CSET_RESERVED_7:
+ case H5T_CSET_RESERVED_8:
+ case H5T_CSET_RESERVED_9:
+ case H5T_CSET_RESERVED_10:
+ case H5T_CSET_RESERVED_11:
+ case H5T_CSET_RESERVED_12:
+ case H5T_CSET_RESERVED_13:
+ case H5T_CSET_RESERVED_14:
+ case H5T_CSET_RESERVED_15:
+ h5tools_str_append(buffer, "H5T_CSET_UNKNOWN;");
+ break;
+ case H5T_CSET_ERROR:
+ h5tools_str_append(buffer, "H5T_CSET_ERROR;");
+ break;
+ default:
+ h5tools_str_append(buffer, "ERROR;");
+ break;
+ }
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- h5tools_str_reset(buffer);
+ ctx->need_prefix = TRUE;
- str_type = H5Tcopy(H5T_C_S1);
- if (is_vlstr)
- H5Tset_size(str_type, H5T_VARIABLE);
- else
- H5Tset_size(str_type, size);
- H5Tset_cset(str_type, cset);
- H5Tset_strpad(str_type, str_pad);
+ h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s ", CTYPE);
+ str_type = H5Tcopy(H5T_C_S1);
+ if (is_vlstr)
+ H5Tset_size(str_type, H5T_VARIABLE);
+ else
+ H5Tset_size(str_type, size);
+ H5Tset_cset(str_type, cset);
+ H5Tset_strpad(str_type, str_pad);
- /* Check C variable-length string first. Are the two types equal? */
- if (H5Tequal(tmp_type, str_type)) {
- h5tools_str_append(buffer, "H5T_C_S1;");
- goto found_string_type;
- }
+ h5tools_str_append(buffer, "%s ", CTYPE);
- /* Change the endianness and see if they're equal. */
- order = H5Tget_order(tmp_type);
- if(order == H5T_ORDER_LE) {
- if(H5Tset_order(str_type, H5T_ORDER_LE) < 0)
- H5TOOLS_ERROR((-1), "H5Tset_order failed");
- } /* end if */
- else if(order == H5T_ORDER_BE) {
- if(H5Tset_order(str_type, H5T_ORDER_BE) < 0)
- H5TOOLS_ERROR((-1), "H5Tset_order failed");
- } /* end if */
-
- if(H5Tequal(tmp_type, str_type)) {
- h5tools_str_append(buffer, "H5T_C_S1;");
- goto found_string_type;
- }
+ /* Check C variable-length string first. Are the two types equal? */
+ if (H5Tequal(tmp_type, str_type)) {
+ h5tools_str_append(buffer, "H5T_C_S1;");
+ goto found_string_type;
+ }
- /* If not equal to C variable-length string, check Fortran type. */
- if(H5Tclose(str_type) < 0)
- H5TOOLS_ERROR((-1), "H5Tclose failed");
- str_type = H5Tcopy(H5T_FORTRAN_S1);
+ /* Change the endianness and see if they're equal. */
+ order = H5Tget_order(tmp_type);
+ if (order == H5T_ORDER_LE) {
+ if (H5Tset_order(str_type, H5T_ORDER_LE) < 0)
+ H5TOOLS_ERROR((-1), "H5Tset_order failed");
+ } /* end if */
+ else if (order == H5T_ORDER_BE) {
+ if (H5Tset_order(str_type, H5T_ORDER_BE) < 0)
+ H5TOOLS_ERROR((-1), "H5Tset_order failed");
+ } /* end if */
+
+ if (H5Tequal(tmp_type, str_type)) {
+ h5tools_str_append(buffer, "H5T_C_S1;");
+ goto found_string_type;
+ }
- H5Tset_cset(str_type, cset);
- H5Tset_size(str_type, size);
- H5Tset_strpad(str_type, str_pad);
+ /* If not equal to C variable-length string, check Fortran type. */
+ if (H5Tclose(str_type) < 0)
+ H5TOOLS_ERROR((-1), "H5Tclose failed");
+ str_type = H5Tcopy(H5T_FORTRAN_S1);
- /* Are the two types equal? */
- if (H5Tequal(tmp_type, str_type)) {
- h5tools_str_append(buffer, "H5T_FORTRAN_S1;");
- goto found_string_type;
- }
+ H5Tset_cset(str_type, cset);
+ H5Tset_size(str_type, size);
+ H5Tset_strpad(str_type, str_pad);
- /* Change the endianness and see if they're equal. */
- order = H5Tget_order(tmp_type);
- if(order == H5T_ORDER_LE) {
- if(H5Tset_order(str_type, H5T_ORDER_LE) < 0)
- H5TOOLS_ERROR((-1), "H5Tset_order failed");
- } /* end if */
- else if(order == H5T_ORDER_BE) {
- if(H5Tset_order(str_type, H5T_ORDER_BE) < 0)
- H5TOOLS_ERROR((-1), "H5Tset_order failed");
- } /* end if */
-
- if(H5Tequal(tmp_type, str_type)) {
- h5tools_str_append(buffer, "H5T_FORTRAN_S1;");
- goto found_string_type;
- }
+ /* Are the two types equal? */
+ if (H5Tequal(tmp_type, str_type)) {
+ h5tools_str_append(buffer, "H5T_FORTRAN_S1;");
+ goto found_string_type;
+ }
- /* Type doesn't match any of above. */
- h5tools_str_append(buffer, "unknown_one_character_type;");
+ /* Change the endianness and see if they're equal. */
+ order = H5Tget_order(tmp_type);
+ if (order == H5T_ORDER_LE) {
+ if (H5Tset_order(str_type, H5T_ORDER_LE) < 0)
+ H5TOOLS_ERROR((-1), "H5Tset_order failed");
+ } /* end if */
+ else if (order == H5T_ORDER_BE) {
+ if (H5Tset_order(str_type, H5T_ORDER_BE) < 0)
+ H5TOOLS_ERROR((-1), "H5Tset_order failed");
+ } /* end if */
+
+ if (H5Tequal(tmp_type, str_type)) {
+ h5tools_str_append(buffer, "H5T_FORTRAN_S1;");
+ goto found_string_type;
+ }
- found_string_type:
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- ctx->indent_level--;
+ /* Type doesn't match any of above. */
+ h5tools_str_append(buffer, "unknown_one_character_type;");
- ctx->need_prefix = TRUE;
+found_string_type:
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
+ ctx->indent_level--;
- h5tools_str_reset(buffer);
- if(H5Tclose(str_type) < 0)
- H5TOOLS_ERROR((-1), "H5Tclose failed");
- if(H5Tclose(tmp_type) < 0)
- H5TOOLS_ERROR((-1), "H5Tclose failed");
-
- h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend);
- break;
-
- case H5T_BITFIELD:
- if (H5Tequal(type, H5T_STD_B8BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_B8BE");
- else if (H5Tequal(type, H5T_STD_B8LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_B8LE");
- else if (H5Tequal(type, H5T_STD_B16BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_B16BE");
- else if (H5Tequal(type, H5T_STD_B16LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_B16LE");
- else if (H5Tequal(type, H5T_STD_B32BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_B32BE");
- else if (H5Tequal(type, H5T_STD_B32LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_B32LE");
- else if (H5Tequal(type, H5T_STD_B64BE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_B64BE");
- else if (H5Tequal(type, H5T_STD_B64LE) == TRUE)
- h5tools_str_append(buffer, "H5T_STD_B64LE");
- else
- h5tools_str_append(buffer, "undefined bitfield");
- break;
+ ctx->need_prefix = TRUE;
- case H5T_OPAQUE:
- h5tools_str_append(buffer, "H5T_OPAQUE %s", h5tools_dump_header_format->structblockbegin);
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- ctx->indent_level++;
- {
- char *ttag;
+ h5tools_str_reset(buffer);
+ if (H5Tclose(str_type) < 0)
+ H5TOOLS_ERROR((-1), "H5Tclose failed");
+ if (H5Tclose(tmp_type) < 0)
+ H5TOOLS_ERROR((-1), "H5Tclose failed");
- if(NULL == (ttag = H5Tget_tag(type)))
- H5TOOLS_THROW((-1), "H5Tget_tag failed");
+ h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend);
+ break;
- ctx->need_prefix = TRUE;
+ case H5T_BITFIELD:
+ if (H5Tequal(type, H5T_STD_B8BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_B8BE");
+ else if (H5Tequal(type, H5T_STD_B8LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_B8LE");
+ else if (H5Tequal(type, H5T_STD_B16BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_B16BE");
+ else if (H5Tequal(type, H5T_STD_B16LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_B16LE");
+ else if (H5Tequal(type, H5T_STD_B32BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_B32BE");
+ else if (H5Tequal(type, H5T_STD_B32LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_B32LE");
+ else if (H5Tequal(type, H5T_STD_B64BE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_B64BE");
+ else if (H5Tequal(type, H5T_STD_B64LE) == TRUE)
+ h5tools_str_append(buffer, "H5T_STD_B64LE");
+ else
+ h5tools_str_append(buffer, "undefined bitfield");
+ break;
- h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag);
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ case H5T_OPAQUE:
+ h5tools_str_append(buffer, "H5T_OPAQUE %s", h5tools_dump_header_format->structblockbegin);
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
+ ctx->indent_level++;
+ {
+ char *ttag;
- H5free_memory(ttag);
+ if (NULL == (ttag = H5Tget_tag(type)))
+ H5TOOLS_THROW((-1), "H5Tget_tag failed");
- if((size = H5Tget_size(type)) <= 0) {
ctx->need_prefix = TRUE;
h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "OPAQUE_SIZE \"%s\";", size);
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag);
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
+
+ H5free_memory(ttag);
+
+ if ((size = H5Tget_size(type)) <= 0) {
+ ctx->need_prefix = TRUE;
+
+ h5tools_str_reset(buffer);
+ h5tools_str_append(buffer, "OPAQUE_SIZE \"%s\";", size);
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
+ }
}
- }
- ctx->indent_level--;
+ ctx->indent_level--;
- ctx->need_prefix = TRUE;
+ ctx->need_prefix = TRUE;
- h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend);
- break;
+ h5tools_str_reset(buffer);
+ h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend);
+ break;
- case H5T_COMPOUND:
- if((snmembers = H5Tget_nmembers(type)) < 0)
- H5TOOLS_THROW((-1), "H5Tget_nmembers failed");
- nmembers = (unsigned)snmembers;
+ case H5T_COMPOUND:
+ if ((snmembers = H5Tget_nmembers(type)) < 0)
+ H5TOOLS_THROW((-1), "H5Tget_nmembers failed");
+ nmembers = (unsigned)snmembers;
- h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin);
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin);
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- ctx->indent_level++;
- for (i = 0; i < nmembers; i++) {
- mname = H5Tget_member_name(type, i);
- if((mtype = H5Tget_member_type(type, i)) >= 0) {
- ctx->need_prefix = TRUE;
+ ctx->indent_level++;
+ for (i = 0; i < nmembers; i++) {
+ mname = H5Tget_member_name(type, i);
+ if ((mtype = H5Tget_member_type(type, i)) >= 0) {
+ ctx->need_prefix = TRUE;
- h5tools_str_reset(buffer);
- h5tools_print_datatype(stream, buffer, info, ctx, mtype, TRUE);
+ h5tools_str_reset(buffer);
+ h5tools_print_datatype(stream, buffer, info, ctx, mtype, TRUE);
- h5tools_str_append(buffer, " \"%s\";", mname);
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- if(H5Tclose(mtype) < 0)
- H5TOOLS_ERROR((-1), "H5Tclose failed");
+ h5tools_str_append(buffer, " \"%s\";", mname);
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
+ if (H5Tclose(mtype) < 0)
+ H5TOOLS_ERROR((-1), "H5Tclose failed");
+ }
+ else
+ H5TOOLS_ERROR((-1), "H5Tget_member_type failed");
+ H5free_memory(mname);
}
- else
- H5TOOLS_ERROR((-1), "H5Tget_member_type failed");
- H5free_memory(mname);
- }
- ctx->indent_level--;
+ ctx->indent_level--;
- ctx->need_prefix = TRUE;
+ ctx->need_prefix = TRUE;
- h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend);
- break;
+ h5tools_str_reset(buffer);
+ h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend);
+ break;
- case H5T_REFERENCE:
- h5tools_str_append(buffer, "H5T_REFERENCE");
- if (H5Tequal(type, H5T_STD_REF_DSETREG) == TRUE) {
- h5tools_str_append(buffer, " { H5T_STD_REF_DSETREG }");
- }
- else if (H5Tequal(type, H5T_STD_REF_OBJ) == TRUE) {
- h5tools_str_append(buffer, " { H5T_STD_REF_OBJECT }");
- }
- else {
- h5tools_str_append(buffer, " { UNDEFINED }");
- }
- break;
+ case H5T_REFERENCE:
+ h5tools_str_append(buffer, "H5T_REFERENCE");
+ if (H5Tequal(type, H5T_STD_REF_DSETREG) == TRUE) {
+ h5tools_str_append(buffer, " { H5T_STD_REF_DSETREG }");
+ }
+ else if (H5Tequal(type, H5T_STD_REF_OBJ) == TRUE) {
+ h5tools_str_append(buffer, " { H5T_STD_REF_OBJECT }");
+ }
+ else {
+ h5tools_str_append(buffer, " { UNDEFINED }");
+ }
+ break;
- case H5T_ENUM:
- if((super = H5Tget_super(type)) < 0)
- H5TOOLS_THROW((-1), "H5Tget_super failed");
+ case H5T_ENUM:
+ if ((super = H5Tget_super(type)) < 0)
+ H5TOOLS_THROW((-1), "H5Tget_super failed");
- h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin);
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- ctx->indent_level++;
+ h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin);
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
+ ctx->indent_level++;
- ctx->need_prefix = TRUE;
+ ctx->need_prefix = TRUE;
- h5tools_str_reset(buffer);
- h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE);
+ h5tools_str_reset(buffer);
+ h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE);
- if(H5Tclose(super) < 0)
- H5TOOLS_ERROR((-1), "H5Tclose failed");
+ if (H5Tclose(super) < 0)
+ H5TOOLS_ERROR((-1), "H5Tclose failed");
- h5tools_str_append(buffer, ";");
- h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(buffer, ";");
+ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- h5tools_print_enum(stream, buffer, info, ctx, type);
+ h5tools_print_enum(stream, buffer, info, ctx, type);
- ctx->indent_level--;
+ ctx->indent_level--;
- ctx->need_prefix = TRUE;
+ ctx->need_prefix = TRUE;
- h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend);
+ h5tools_str_reset(buffer);
+ h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend);
- break;
+ break;
- case H5T_VLEN:
- if((super = H5Tget_super(type)) < 0)
- H5TOOLS_THROW((-1), "H5Tget_super failed");
+ case H5T_VLEN:
+ if ((super = H5Tget_super(type)) < 0)
+ H5TOOLS_THROW((-1), "H5Tget_super failed");
- h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin);
+ h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin);
- h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE);
+ h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE);
- if(H5Tclose(super) < 0)
- H5TOOLS_ERROR((-1), "H5Tclose failed");
+ if (H5Tclose(super) < 0)
+ H5TOOLS_ERROR((-1), "H5Tclose failed");
- h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend);
+ h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend);
- break;
+ break;
- case H5T_ARRAY:
- h5tools_str_append(buffer, "H5T_ARRAY { ");
+ case H5T_ARRAY:
+ h5tools_str_append(buffer, "H5T_ARRAY { ");
- /* Get array information */
- if((sndims = H5Tget_array_ndims(type)) >= 0) {
- unsigned ndims = (unsigned)sndims;
+ /* Get array information */
+ if ((sndims = H5Tget_array_ndims(type)) >= 0) {
+ unsigned ndims = (unsigned)sndims;
- if(H5Tget_array_dims2(type, dims) >= 0) {
- /* Print array dimensions */
- for (i = 0; i < ndims; i++)
- h5tools_str_append(buffer, "[" HSIZE_T_FORMAT "]", dims[i]);
+ if (H5Tget_array_dims2(type, dims) >= 0) {
+ /* Print array dimensions */
+ for (i = 0; i < ndims; i++)
+ h5tools_str_append(buffer, "[" HSIZE_T_FORMAT "]", dims[i]);
- h5tools_str_append(buffer, " ");
+ h5tools_str_append(buffer, " ");
+ }
+ else
+ H5TOOLS_ERROR((-1), "H5Tget_array_dims2 failed");
}
else
- H5TOOLS_ERROR((-1), "H5Tget_array_dims2 failed");
- }
- else
- H5TOOLS_ERROR((-1), "H5Tget_array_ndims failed");
-
- /* Get array base type */
- if((super = H5Tget_super(type)) >= 0) {
- /* Print base type */
- h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE);
- /* Close array base type */
- if(H5Tclose(super) < 0)
- H5TOOLS_ERROR((-1), "H5Tclose failed");
- }
- else
- H5TOOLS_ERROR((-1), "H5Tget_super failed");
+ H5TOOLS_ERROR((-1), "H5Tget_array_ndims failed");
+
+ /* Get array base type */
+ if ((super = H5Tget_super(type)) >= 0) {
+ /* Print base type */
+ h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE);
+ /* Close array base type */
+ if (H5Tclose(super) < 0)
+ H5TOOLS_ERROR((-1), "H5Tclose failed");
+ }
+ else
+ H5TOOLS_ERROR((-1), "H5Tget_super failed");
- h5tools_str_append(buffer, " }");
+ h5tools_str_append(buffer, " }");
- break;
+ break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- default:
- h5tools_str_append(buffer, "unknown datatype");
- break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
+ h5tools_str_append(buffer, "unknown datatype");
+ break;
}
-CATCH
- H5TOOLS_ENDDEBUG("");
+ CATCH
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -2629,69 +2653,70 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
{
hsize_t size[H5TOOLS_DUMP_MAX_RANK];
hsize_t maxsize[H5TOOLS_DUMP_MAX_RANK];
- int ndims = -1;
+ int ndims = -1;
H5S_class_t space_type = -1;
hbool_t past_catch = FALSE;
int i;
int ret_value = 0;
- H5TOOLS_START_DEBUG("");
- if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0)
+ H5TOOLS_START_DEBUG(" ");
+ if ((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0)
H5TOOLS_THROW((-1), "H5Sget_simple_extent_dims failed");
- if((space_type = H5Sget_simple_extent_type(space)) < 0)
+ if ((space_type = H5Sget_simple_extent_type(space)) < 0)
H5TOOLS_THROW((-1), "H5Sget_simple_extent_type failed");
- switch(space_type) {
- case H5S_SCALAR:
- /* scalar dataspace */
- h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin, S_SCALAR);
- break;
-
- case H5S_SIMPLE:
- /* simple dataspace */
- h5tools_str_append(buffer, "%s %s { %s " HSIZE_T_FORMAT,
- h5tools_dump_header_format->dataspacedescriptionbegin, S_SIMPLE,
- h5tools_dump_header_format->dataspacedimbegin, size[0]);
+ switch (space_type) {
+ case H5S_SCALAR:
+ /* scalar dataspace */
+ h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin,
+ S_SCALAR);
+ break;
- for(i = 1; i < ndims; i++)
- h5tools_str_append(buffer, ", " HSIZE_T_FORMAT, size[i]);
+ case H5S_SIMPLE:
+ /* simple dataspace */
+ h5tools_str_append(buffer, "%s %s { %s " HSIZE_T_FORMAT,
+ h5tools_dump_header_format->dataspacedescriptionbegin, S_SIMPLE,
+ h5tools_dump_header_format->dataspacedimbegin, size[0]);
- h5tools_str_append(buffer, " %s / ", h5tools_dump_header_format->dataspacedimend);
+ for (i = 1; i < ndims; i++)
+ h5tools_str_append(buffer, ", " HSIZE_T_FORMAT, size[i]);
- if(maxsize[0] == H5S_UNLIMITED)
- h5tools_str_append(buffer, "%s %s",
- h5tools_dump_header_format->dataspacedimbegin, "H5S_UNLIMITED");
- else
- h5tools_str_append(buffer, "%s " HSIZE_T_FORMAT,
- h5tools_dump_header_format->dataspacedimbegin, maxsize[0]);
+ h5tools_str_append(buffer, " %s / ", h5tools_dump_header_format->dataspacedimend);
- for(i = 1; i < ndims; i++)
- if(maxsize[i] == H5S_UNLIMITED)
- h5tools_str_append(buffer, ", %s", "H5S_UNLIMITED");
+ if (maxsize[0] == H5S_UNLIMITED)
+ h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedimbegin,
+ "H5S_UNLIMITED");
else
- h5tools_str_append(buffer, ", " HSIZE_T_FORMAT, maxsize[i]);
+ h5tools_str_append(buffer, "%s " HSIZE_T_FORMAT,
+ h5tools_dump_header_format->dataspacedimbegin, maxsize[0]);
- h5tools_str_append(buffer, " %s }", h5tools_dump_header_format->dataspacedimend);
- break;
+ for (i = 1; i < ndims; i++)
+ if (maxsize[i] == H5S_UNLIMITED)
+ h5tools_str_append(buffer, ", %s", "H5S_UNLIMITED");
+ else
+ h5tools_str_append(buffer, ", " HSIZE_T_FORMAT, maxsize[i]);
- case H5S_NULL:
- /* null dataspace */
- h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin, S_NULL);
- break;
+ h5tools_str_append(buffer, " %s }", h5tools_dump_header_format->dataspacedimend);
+ break;
- case H5S_NO_CLASS:
- default:
- h5tools_str_append(buffer, "%s unknown dataspace %s\n", BEGIN, END);
- break;
+ case H5S_NULL:
+ /* null dataspace */
+ h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin,
+ S_NULL);
+ break;
+
+ case H5S_NO_CLASS:
+ default:
+ h5tools_str_append(buffer, "%s unknown dataspace %s\n", BEGIN, END);
+ break;
} /* end switch */
-CATCH
- H5TOOLS_ENDDEBUG("");
+ CATCH
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: print_enum
*
@@ -2704,37 +2729,38 @@ CATCH
*
*-----------------------------------------------------------------------*/
int
-h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t type)
+h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, h5tools_context_t *ctx,
+ hid_t type)
{
- char **name = NULL; /*member names */
+ char ** name = NULL; /*member names */
unsigned char *value = NULL; /*value array */
- unsigned char *copy = NULL; /*a pointer to value array */
+ unsigned char *copy = NULL; /*a pointer to value array */
unsigned i;
- unsigned nmembs = 0; /*number of members */
+ unsigned nmembs = 0; /*number of members */
int snmembs;
- hid_t super = H5I_INVALID_HID; /*enum base integer type */
- hid_t native = H5I_INVALID_HID; /*native integer datatype */
- H5T_sign_t sign_type; /*sign of value type */
- size_t type_size; /*value type size */
- size_t dst_size; /*destination value type size */
- size_t ncols = 80; /*available output width */
- hsize_t curr_pos = 0; /* total data element position */
+ hid_t super = H5I_INVALID_HID; /*enum base integer type */
+ hid_t native = H5I_INVALID_HID; /*native integer datatype */
+ H5T_sign_t sign_type; /*sign of value type */
+ size_t type_size; /*value type size */
+ size_t dst_size; /*destination value type size */
+ size_t ncols = 80; /*available output width */
+ hsize_t curr_pos = 0; /* total data element position */
hbool_t past_catch = FALSE;
- int ret_value = 0;
+ int ret_value = 0;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
if (info->line_ncols > 0)
ncols = info->line_ncols;
- if((snmembs = H5Tget_nmembers(type)) < 0)
+ if ((snmembs = H5Tget_nmembers(type)) < 0)
H5TOOLS_THROW((-1), "H5Tget_nmembers failed");
nmembs = (unsigned)snmembs;
HDassert(nmembs > 0);
- if((super = H5Tget_super(type)) < 0)
+ if ((super = H5Tget_super(type)) < 0)
H5TOOLS_THROW((-1), "H5Tget_super failed");
- if((type_size = H5Tget_size(type)) <= 0)
+ if ((type_size = H5Tget_size(type)) <= 0)
H5TOOLS_THROW((-1), "H5Tget_size(type) failed");
/*
@@ -2744,12 +2770,12 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
* 2. unsigned long long -- the largest native unsigned integer
* 3. raw format
*/
- if(type_size <= sizeof(long long)) {
+ if (type_size <= sizeof(long long)) {
dst_size = sizeof(long long);
- if((sign_type = H5Tget_sign(type))<0)
+ if ((sign_type = H5Tget_sign(type)) < 0)
H5TOOLS_THROW((-1), "H5Tget_sign failed");
- if(H5T_SGN_NONE == sign_type)
+ if (H5T_SGN_NONE == sign_type)
native = H5T_NATIVE_ULLONG;
else
native = H5T_NATIVE_LLONG;
@@ -2758,20 +2784,20 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
dst_size = type_size;
/* Get the names and raw values of all members */
- if(NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *))))
+ if (NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *))))
H5TOOLS_THROW((-1), "Could not allocate buffer for member name");
- if(NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size))))
+ if (NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size))))
H5TOOLS_THROW((-1), "Could not allocate buffer for member value");
for (i = 0; i < nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
- if(H5Tget_member_value(type, i, value + i * type_size) < 0)
+ if (H5Tget_member_value(type, i, value + i * type_size) < 0)
H5TOOLS_THROW((-1), "H5Tget_member_value failed");
}
/* Convert values to native datatype */
if (native > 0)
- if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0)
+ if (H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0)
H5TOOLS_THROW((-1), "H5Tconvert failed");
/*
@@ -2781,7 +2807,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
/* Print members */
for (i = 0; i < nmembs; i++) {
- int nchars; /*number of output characters */
+ int nchars; /*number of output characters */
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0);
@@ -2803,38 +2829,38 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
/*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
*strangely, unless use another pointer "copy".*/
copy = value + i * dst_size;
- h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long *) ((void *) copy)));
+ h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long *)((void *)copy)));
}
else {
/*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
*strangely, unless use another pointer "copy".*/
copy = value + i * dst_size;
- h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "d", *((long long *) ((void *) copy)));
+ h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "d", *((long long *)((void *)copy)));
}
h5tools_str_append(buffer, ";");
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
}
-CATCH
- if(name) {
+ CATCH
+ if (name) {
/* Release resources */
- for(i = 0; i < nmembs; i++)
- if(name[i])
+ for (i = 0; i < nmembs; i++)
+ if (name[i])
H5free_memory(name[i]);
HDfree(name);
} /* end if */
- if(value)
+ if (value)
HDfree(value);
- if(super >= 0 && H5Tclose(super) < 0)
+ if (super >= 0 && H5Tclose(super) < 0)
H5TOOLS_THROW((-1), "Could not close datatype's super class");
- if(0 == nmembs)
+ if (0 == nmembs)
h5tools_str_append(buffer, "\n<empty>");
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -2852,13 +2878,13 @@ CATCH
void
h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t type)
{
- h5tools_str_t buffer; /* string into which to render */
- size_t ncols = 80; /* available output width */
- hsize_t curr_pos = ctx->sm_pos; /* total data element position */
- /* pass to the prefix in h5tools_simple_prefix the total position
- * instead of the current stripmine position i; this is necessary
- * to print the array indices
- */
+ h5tools_str_t buffer; /* string into which to render */
+ size_t ncols = 80; /* available output width */
+ hsize_t curr_pos = ctx->sm_pos; /* total data element position */
+ /* pass to the prefix in h5tools_simple_prefix the total position
+ * instead of the current stripmine position i; this is necessary
+ * to print the array indices
+ */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2869,9 +2895,8 @@ h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, h5tools_context
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s ",
- h5tools_dump_header_format->datatypebegin,
- h5tools_dump_header_format->datatypeblockbegin);
+ h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->datatypebegin,
+ h5tools_dump_header_format->datatypeblockbegin);
h5tools_print_datatype(stream, &buffer, info, ctx, type, TRUE);
if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend);
@@ -2899,13 +2924,13 @@ h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, h5tools_context
void
h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t type)
{
- h5tools_str_t buffer; /* string into which to render */
- size_t ncols = 80; /* available output width */
- hsize_t curr_pos = ctx->sm_pos; /* total data element position */
- /* pass to the prefix in h5tools_simple_prefix the total position
- * instead of the current stripmine position i; this is necessary
- * to print the array indices
- */
+ h5tools_str_t buffer; /* string into which to render */
+ size_t ncols = 80; /* available output width */
+ hsize_t curr_pos = ctx->sm_pos; /* total data element position */
+ /* pass to the prefix in h5tools_simple_prefix the total position
+ * instead of the current stripmine position i; this is necessary
+ * to print the array indices
+ */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2916,8 +2941,7 @@ h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, h5tools_contex
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s ",
- h5tools_dump_header_format->dataspacebegin);
+ h5tools_str_append(&buffer, "%s ", h5tools_dump_header_format->dataspacebegin);
h5tools_print_dataspace(&buffer, type);
@@ -2947,13 +2971,13 @@ h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, h5tools_contex
void
h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t oid)
{
- h5tools_str_t buffer; /* string into which to render */
- size_t ncols = 80; /* available output width */
- hsize_t curr_pos = ctx->sm_pos; /* total data element position */
- /* pass to the prefix in h5tools_simple_prefix the total position
- * instead of the current stripmine position i; this is necessary
- * to print the array indices
- */
+ h5tools_str_t buffer; /* string into which to render */
+ size_t ncols = 80; /* available output width */
+ hsize_t curr_pos = ctx->sm_pos; /* total data element position */
+ /* pass to the prefix in h5tools_simple_prefix the total position
+ * instead of the current stripmine position i; this is necessary
+ * to print the array indices
+ */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2980,38 +3004,43 @@ h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c
*/
static void
h5tools_print_virtual_selection(hid_t vspace, FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, /* in,out*/
- h5tools_str_t *buffer, /* string into which to render */
- hsize_t *curr_pos, /* total data element position */
- size_t ncols)
+ h5tools_context_t *ctx, /* in,out*/
+ h5tools_str_t * buffer, /* string into which to render */
+ hsize_t * curr_pos, /* total data element position */
+ size_t ncols)
{
- switch(H5Sget_select_type(vspace)) {
- case H5S_SEL_NONE: /* Nothing selected */
+ switch (H5Sget_select_type(vspace)) {
+ case H5S_SEL_NONE: /* Nothing selected */
ctx->need_prefix = TRUE;
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s", VDS_NONE);
break;
- case H5S_SEL_POINTS: /* Sequence of points selected */
+ case H5S_SEL_POINTS: /* Sequence of points selected */
h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "%s %s ", VDS_POINT, h5tools_dump_header_format->virtualselectionblockbegin);
+ h5tools_str_append(buffer, "%s %s ", VDS_POINT,
+ h5tools_dump_header_format->virtualselectionblockbegin);
h5tools_str_dump_space_points(buffer, vspace, info);
h5tools_str_append(buffer, " %s", h5tools_dump_header_format->virtualselectionblockend);
break;
- case H5S_SEL_HYPERSLABS: /* "New-style" hyperslab selection defined */
+ case H5S_SEL_HYPERSLABS: /* "New-style" hyperslab selection defined */
ctx->need_prefix = TRUE;
h5tools_str_reset(buffer);
if (H5Sis_regular_hyperslab(vspace)) {
- h5tools_str_append(buffer, "%s %s ", VDS_REG_HYPERSLAB, h5tools_dump_header_format->virtualselectionblockbegin);
- h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_str_append(buffer, "%s %s ", VDS_REG_HYPERSLAB,
+ h5tools_dump_header_format->virtualselectionblockbegin);
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
h5tools_str_reset(buffer);
h5tools_str_dump_space_slabs(buffer, vspace, info, ctx);
}
else {
- h5tools_str_append(buffer, "%s %s ", VDS_IRR_HYPERSLAB, h5tools_dump_header_format->virtualselectionblockbegin);
- h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_str_append(buffer, "%s %s ", VDS_IRR_HYPERSLAB,
+ h5tools_dump_header_format->virtualselectionblockbegin);
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
ctx->indent_level++;
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, *curr_pos, 0);
@@ -3020,13 +3049,14 @@ h5tools_print_virtual_selection(hid_t vspace, FILE *stream, const h5tool_format_
h5tools_str_dump_space_blocks(buffer, vspace, info);
ctx->indent_level--;
}
- h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
ctx->need_prefix = TRUE;
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->virtualselectionblockend);
break;
- case H5S_SEL_ALL: /* Entire extent selected */
+ case H5S_SEL_ALL: /* Entire extent selected */
ctx->need_prefix = TRUE;
h5tools_str_reset(buffer);
@@ -3037,7 +3067,7 @@ h5tools_print_virtual_selection(hid_t vspace, FILE *stream, const h5tool_format_
default:
h5tools_str_append(buffer, "Unknown Selection");
}
- h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_render_element(stream, info, ctx, buffer, curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
}
/*-------------------------------------------------------------------------
@@ -3049,17 +3079,17 @@ h5tools_print_virtual_selection(hid_t vspace, FILE *stream, const h5tool_format_
*-------------------------------------------------------------------------
*/
void
-h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id)
+h5tools_print_fill_value(h5tools_str_t *buffer /*in,out*/, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id)
{
- size_t size;
- hid_t n_type = H5I_INVALID_HID;
- void *buf = NULL;
+ size_t size;
+ hid_t n_type = H5I_INVALID_HID;
+ void * buf = NULL;
n_type = H5Tget_native_type(type_id, H5T_DIR_DEFAULT);
size = H5Tget_size(n_type);
- buf = HDmalloc(size);
+ buf = HDmalloc(size);
H5Pget_fill_value(dcpl, n_type, buf);
@@ -3068,7 +3098,7 @@ h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t
H5Tclose(n_type);
if (buf)
- HDfree (buf);
+ HDfree(buf);
}
/*-------------------------------------------------------------------------
@@ -3080,32 +3110,32 @@ h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t
*-------------------------------------------------------------------------
*/
void
-h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, hid_t dcpl_id, hid_t type_id, hid_t dset_id)
+h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dcpl_id,
+ hid_t type_id, hid_t dset_id)
{
- int nfilters; /* number of filters */
- int rank; /* rank */
+ int nfilters; /* number of filters */
+ int rank; /* rank */
int i;
unsigned j;
- unsigned filt_flags; /* filter flags */
- unsigned cd_values[20]; /* filter client data values */
+ unsigned filt_flags; /* filter flags */
+ unsigned cd_values[20]; /* filter client data values */
unsigned szip_options_mask;
unsigned szip_pixels_per_block;
- H5Z_filter_t filtn; /* filter identification number */
+ H5Z_filter_t filtn; /* filter identification number */
H5D_fill_value_t fvstatus;
H5D_alloc_time_t at;
H5D_fill_time_t ft;
H5D_layout_t stl;
- size_t ncols = 80; /* available output width */
- size_t cd_nelmts; /* filter client number of values */
- off_t offset; /* offset of external file */
- char f_name[256]; /* filter name */
- char name[256]; /* external or virtual file name */
- hsize_t chsize[64]; /* chunk size in elements */
- hsize_t size; /* size of external file */
+ size_t ncols = 80; /* available output width */
+ size_t cd_nelmts; /* filter client number of values */
+ off_t offset; /* offset of external file */
+ char f_name[256]; /* filter name */
+ char name[256]; /* external or virtual file name */
+ hsize_t chsize[64]; /* chunk size in elements */
+ hsize_t size; /* size of external file */
hsize_t storage_size;
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -3113,13 +3143,13 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
ncols = info->line_ncols;
storage_size = H5Dget_storage_size(dset_id);
- nfilters = H5Pget_nfilters(dcpl_id);
- HDstrcpy(f_name,"\0");
+ nfilters = H5Pget_nfilters(dcpl_id);
+ HDstrcpy(f_name, "\0");
/*-------------------------------------------------------------------------
- * STORAGE_LAYOUT
- *-------------------------------------------------------------------------
- */
+ * STORAGE_LAYOUT
+ *-------------------------------------------------------------------------
+ */
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
@@ -3135,12 +3165,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s ", CHUNKED);
- rank = H5Pget_chunk(dcpl_id, (int) NELMTS(chsize), chsize);
- h5tools_str_append(&buffer, "%s " HSIZE_T_FORMAT, h5tools_dump_header_format->dataspacedimbegin, chsize[0]);
- for(i = 1; i < rank; i++)
+ rank = H5Pget_chunk(dcpl_id, (int)NELMTS(chsize), chsize);
+ h5tools_str_append(&buffer, "%s " HSIZE_T_FORMAT, h5tools_dump_header_format->dataspacedimbegin,
+ chsize[0]);
+ for (i = 1; i < rank; i++)
h5tools_str_append(&buffer, ", " HSIZE_T_FORMAT, chsize[i]);
h5tools_str_append(&buffer, " %s", h5tools_dump_header_format->dataspacedimend);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
ctx->need_prefix = TRUE;
@@ -3150,49 +3182,49 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
if (nfilters) {
hsize_t dims[H5S_MAX_RANK];
hsize_t nelmts = 1;
- double ratio = 0;
- int ok = 0;
+ double ratio = 0;
+ int ok = 0;
- hid_t tid = H5Dget_type(dset_id);
- hid_t sid = H5Dget_space(dset_id);
+ hid_t tid = H5Dget_type(dset_id);
+ hid_t sid = H5Dget_space(dset_id);
size_t datum_size = H5Tget_size(tid);
- int ndims = H5Sget_simple_extent_dims(sid, dims, NULL);
+ int ndims = H5Sget_simple_extent_dims(sid, dims, NULL);
/* only print the compression ratio for these filters */
for (i = 0; i < nfilters && !ok; i++) {
cd_nelmts = NELMTS(cd_values);
- filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name),
- f_name, NULL);
- ok = (filtn >= 0);
+ filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, cd_values,
+ sizeof(f_name), f_name, NULL);
+ ok = (filtn >= 0);
}
- if(ndims && ok) {
+ if (ndims && ok) {
hsize_t uncomp_size;
- for(i = 0; i < ndims; i++) {
+ for (i = 0; i < ndims; i++) {
nelmts *= dims[i];
}
uncomp_size = nelmts * datum_size;
/* compression ratio = uncompressed size / compressed size */
- if(storage_size != 0)
- ratio = (double) uncomp_size / (double) storage_size;
-
- h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT" (%.3f:1 COMPRESSION)", storage_size, ratio);
+ if (storage_size != 0)
+ ratio = (double)uncomp_size / (double)storage_size;
+ h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT " (%.3f:1 COMPRESSION)", storage_size,
+ ratio);
}
else
h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size);
H5Sclose(sid);
H5Tclose(tid);
-
}
else {
h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size);
}
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
ctx->indent_level--;
break;
case H5D_COMPACT:
@@ -3201,190 +3233,208 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s", COMPACT);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
ctx->indent_level--;
break;
- case H5D_CONTIGUOUS:
- {
- int n_external;
-
- n_external = H5Pget_external_count(dcpl_id);
-
- ctx->indent_level++;
- if (n_external) {
+ case H5D_CONTIGUOUS: {
+ int n_external;
- /* EXTERNAL FILE */
+ n_external = H5Pget_external_count(dcpl_id);
- ctx->need_prefix = TRUE;
+ ctx->indent_level++;
+ if (n_external) {
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s", CONTIGUOUS);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ /* EXTERNAL FILE */
- ctx->need_prefix = TRUE;
+ ctx->need_prefix = TRUE;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s", EXTERNAL, BEGIN);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s", CONTIGUOUS);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- ctx->indent_level++;
- for (j = 0; j < (unsigned) n_external; j++) {
- H5Pget_external(dcpl_id, j, sizeof(name), name, &offset, &size);
+ ctx->need_prefix = TRUE;
- ctx->need_prefix = TRUE;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s %s", EXTERNAL, BEGIN);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "FILENAME %s SIZE " HSIZE_T_FORMAT, name, size);
- h5tools_str_append(&buffer, " OFFSET %ld", offset);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
- }
- ctx->indent_level--;
+ ctx->indent_level++;
+ for (j = 0; j < (unsigned)n_external; j++) {
+ H5Pget_external(dcpl_id, j, sizeof(name), name, &offset, &size);
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s", END);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_str_append(&buffer, "FILENAME %s SIZE " HSIZE_T_FORMAT, name, size);
+ h5tools_str_append(&buffer, " OFFSET %ld", offset);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
}
- else {
- haddr_t ioffset;
+ ctx->indent_level--;
- /* NORMAL FILE */
+ ctx->need_prefix = TRUE;
- ctx->need_prefix = TRUE;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s", END);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
+ }
+ else {
+ haddr_t ioffset;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s", CONTIGUOUS);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ /* NORMAL FILE */
- ctx->need_prefix = TRUE;
+ ctx->need_prefix = TRUE;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer,"SIZE " HSIZE_T_FORMAT, storage_size);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s", CONTIGUOUS);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- ctx->need_prefix = TRUE;
+ ctx->need_prefix = TRUE;
- h5tools_str_reset(&buffer);
- ioffset = H5Dget_offset(dset_id);
- h5tools_str_append(&buffer, "OFFSET "H5_PRINTF_HADDR_FMT, ioffset);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
- }
- ctx->indent_level--;
- }
- break;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- case H5D_VIRTUAL:
- {
- char dsetname[256]; /* virtual datset name */
- size_t n_vmaps;
+ ctx->need_prefix = TRUE;
- H5Pget_virtual_count(dcpl_id, &n_vmaps);
+ h5tools_str_reset(&buffer);
+ ioffset = H5Dget_offset(dset_id);
+ h5tools_str_append(&buffer, "OFFSET " H5_PRINTF_HADDR_FMT, ioffset);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
+ }
+ ctx->indent_level--;
+ } break;
- if (n_vmaps) {
- size_t curr_vmap;
- ssize_t H5_ATTR_NDEBUG_UNUSED ssize_out;
+ case H5D_VIRTUAL: {
+ char dsetname[256]; /* virtual datset name */
+ size_t n_vmaps;
- ctx->indent_level++;
- for (curr_vmap = 0; curr_vmap < n_vmaps; curr_vmap++) {
- hid_t virtual_vspace = H5Pget_virtual_vspace(dcpl_id, curr_vmap);
- hid_t virtual_srcspace = H5Pget_virtual_srcspace(dcpl_id, curr_vmap);
+ H5Pget_virtual_count(dcpl_id, &n_vmaps);
- ctx->need_prefix = TRUE;
+ if (n_vmaps) {
+ size_t curr_vmap;
+ ssize_t H5_ATTR_NDEBUG_UNUSED ssize_out;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %ld %s ", VDS_MAPPING, curr_vmap, BEGIN);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ ctx->indent_level++;
+ for (curr_vmap = 0; curr_vmap < n_vmaps; curr_vmap++) {
+ hid_t virtual_vspace = H5Pget_virtual_vspace(dcpl_id, curr_vmap);
+ hid_t virtual_srcspace = H5Pget_virtual_srcspace(dcpl_id, curr_vmap);
- ctx->indent_level++;
+ ctx->need_prefix = TRUE;
- ctx->need_prefix = TRUE;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s %ld %s ", VDS_MAPPING, curr_vmap, BEGIN);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s", VDS_VIRTUAL, BEGIN);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ ctx->indent_level++;
- ctx->indent_level++;
+ ctx->need_prefix = TRUE;
- h5tools_print_virtual_selection(virtual_vspace, stream, info, ctx, &buffer, &curr_pos, (size_t) ncols);
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s %s", VDS_VIRTUAL, BEGIN);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- ctx->indent_level--;
+ ctx->indent_level++;
- ctx->need_prefix = TRUE;
+ h5tools_print_virtual_selection(virtual_vspace, stream, info, ctx, &buffer, &curr_pos,
+ (size_t)ncols);
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s", END);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ ctx->indent_level--;
- ctx->need_prefix = TRUE;
+ ctx->need_prefix = TRUE;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s", VDS_SOURCE, BEGIN);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s", END);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- ctx->indent_level++;
+ ctx->need_prefix = TRUE;
- ssize_out = H5Pget_virtual_filename(dcpl_id, curr_vmap, NULL, 0);
- HDassert(ssize_out > 0);
- HDassert((size_t)ssize_out < sizeof(name));
- H5Pget_virtual_filename(dcpl_id, curr_vmap, name, sizeof(name));
- ssize_out = H5Pget_virtual_dsetname(dcpl_id, curr_vmap, NULL, 0);
- HDassert(ssize_out > 0);
- HDassert((size_t)ssize_out < sizeof(name));
- H5Pget_virtual_dsetname(dcpl_id, curr_vmap, dsetname, sizeof(dsetname));
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s %s", VDS_SOURCE, BEGIN);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- ctx->need_prefix = TRUE;
+ ctx->indent_level++;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s", VDS_SRC_FILE, h5tools_dump_header_format->virtualfilenamebegin);
- h5tools_str_append(&buffer, "%s", name);
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->virtualfilenameend);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ ssize_out = H5Pget_virtual_filename(dcpl_id, curr_vmap, NULL, 0);
+ HDassert(ssize_out > 0);
+ HDassert((size_t)ssize_out < sizeof(name));
+ H5Pget_virtual_filename(dcpl_id, curr_vmap, name, sizeof(name));
+ ssize_out = H5Pget_virtual_dsetname(dcpl_id, curr_vmap, NULL, 0);
+ HDassert(ssize_out > 0);
+ HDassert((size_t)ssize_out < sizeof(name));
+ H5Pget_virtual_dsetname(dcpl_id, curr_vmap, dsetname, sizeof(dsetname));
- ctx->need_prefix = TRUE;
+ ctx->need_prefix = TRUE;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s", VDS_SRC_DATASET, h5tools_dump_header_format->virtualdatasetnamebegin);
- h5tools_str_append(&buffer, "%s", dsetname);
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->virtualdatasetnameend);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s %s", VDS_SRC_FILE,
+ h5tools_dump_header_format->virtualfilenamebegin);
+ h5tools_str_append(&buffer, "%s", name);
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->virtualfilenameend);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- h5tools_print_virtual_selection(virtual_srcspace, stream, info, ctx, &buffer, &curr_pos, (size_t) ncols);
+ ctx->need_prefix = TRUE;
- ctx->indent_level--;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s %s", VDS_SRC_DATASET,
+ h5tools_dump_header_format->virtualdatasetnamebegin);
+ h5tools_str_append(&buffer, "%s", dsetname);
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->virtualdatasetnameend);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- ctx->need_prefix = TRUE;
+ h5tools_print_virtual_selection(virtual_srcspace, stream, info, ctx, &buffer, &curr_pos,
+ (size_t)ncols);
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s", END);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
+ ctx->indent_level--;
- ctx->indent_level--;
+ ctx->need_prefix = TRUE;
- ctx->need_prefix = TRUE;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s", END);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s", END);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
- }
ctx->indent_level--;
+
+ ctx->need_prefix = TRUE;
+
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s", END);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
}
+ ctx->indent_level--;
}
- break;
+ } break;
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s", "Unknown layout");
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
- }/*switch*/
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
+ } /*switch*/
ctx->need_prefix = TRUE;
@@ -3393,9 +3443,9 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
/*-------------------------------------------------------------------------
- * FILTERS
- *-------------------------------------------------------------------------
- */
+ * FILTERS
+ *-------------------------------------------------------------------------
+ */
if (H5D_VIRTUAL != stl) {
ctx->need_prefix = TRUE;
@@ -3405,37 +3455,43 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
ctx->indent_level++;
- if(nfilters) {
- for(i = 0; i < nfilters; i++) {
+ if (nfilters) {
+ for (i = 0; i < nfilters; i++) {
cd_nelmts = NELMTS(cd_values);
- filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_name), f_name, NULL);
+ filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, cd_values,
+ sizeof(f_name), f_name, NULL);
- if(filtn < 0)
+ if (filtn < 0)
continue; /* nothing to print for invalid filter */
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- switch(filtn) {
+ switch (filtn) {
case H5Z_FILTER_DEFLATE:
- h5tools_str_append(&buffer, "%s %s %s %d %s", DEFLATE, BEGIN, DEFLATE_LEVEL, cd_values[0], END);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s %s %s %d %s", DEFLATE, BEGIN, DEFLATE_LEVEL,
+ cd_values[0], END);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5Z_FILTER_SHUFFLE:
h5tools_str_append(&buffer, "%s", SHUFFLE);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5Z_FILTER_FLETCHER32:
h5tools_str_append(&buffer, "%s", FLETCHER32);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5Z_FILTER_SZIP:
- szip_options_mask = cd_values[0];;
+ szip_options_mask = cd_values[0];
+ ;
szip_pixels_per_block = cd_values[1];
h5tools_str_append(&buffer, "%s %s", SZIP, BEGIN);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
ctx->indent_level++;
@@ -3443,41 +3499,46 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "PIXELS_PER_BLOCK %d", szip_pixels_per_block);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- if(szip_options_mask & H5_SZIP_CHIP_OPTION_MASK)
+ if (szip_options_mask & H5_SZIP_CHIP_OPTION_MASK)
h5tools_str_append(&buffer, "MODE %s", "HARDWARE");
- else if(szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK)
+ else if (szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK)
h5tools_str_append(&buffer, "MODE %s", "K13");
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- if(szip_options_mask & H5_SZIP_EC_OPTION_MASK)
+ if (szip_options_mask & H5_SZIP_EC_OPTION_MASK)
h5tools_str_append(&buffer, "CODING %s", "ENTROPY");
- else if(szip_options_mask & H5_SZIP_NN_OPTION_MASK)
+ else if (szip_options_mask & H5_SZIP_NN_OPTION_MASK)
h5tools_str_append(&buffer, "CODING %s", "NEAREST NEIGHBOUR");
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- if(szip_options_mask & H5_SZIP_LSB_OPTION_MASK)
+ if (szip_options_mask & H5_SZIP_LSB_OPTION_MASK)
h5tools_str_append(&buffer, "BYTE_ORDER %s", "LSB");
- else if(szip_options_mask & H5_SZIP_MSB_OPTION_MASK)
+ else if (szip_options_mask & H5_SZIP_MSB_OPTION_MASK)
h5tools_str_append(&buffer, "BYTE_ORDER %s", "MSB");
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
- if(szip_options_mask & H5_SZIP_RAW_OPTION_MASK) {
+ if (szip_options_mask & H5_SZIP_RAW_OPTION_MASK) {
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "HEADER %s", "RAW");
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
}
ctx->indent_level--;
@@ -3486,19 +3547,24 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s", END);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5Z_FILTER_NBIT:
h5tools_str_append(&buffer, "%s", NBIT);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5Z_FILTER_SCALEOFFSET:
- h5tools_str_append(&buffer, "%s %s %s %d %s", SCALEOFFSET, BEGIN, SCALEOFFSET_MINBIT, cd_values[0], END);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s %s %s %d %s", SCALEOFFSET, BEGIN, SCALEOFFSET_MINBIT,
+ cd_values[0], END);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
break;
default:
h5tools_str_append(&buffer, "%s %s", "USER_DEFINED_FILTER", BEGIN);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
ctx->indent_level++;
@@ -3506,56 +3572,61 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "FILTER_ID %d", filtn);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
- if(f_name[0] != '\0') {
+ if (f_name[0] != '\0') {
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "COMMENT %s", f_name);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
}
if (cd_nelmts) {
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s ","PARAMS", BEGIN);
- for (j=0; j<cd_nelmts; j++)
+ h5tools_str_append(&buffer, "%s %s ", "PARAMS", BEGIN);
+ for (j = 0; j < cd_nelmts; j++)
h5tools_str_append(&buffer, "%d ", cd_values[j]);
h5tools_str_append(&buffer, "%s", END);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
}
ctx->indent_level--;
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s",END);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s", END);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
break;
- }/*switch*/
- } /*i*/
- }/*nfilters*/
+ } /*switch*/
+ } /*i*/
+ } /*nfilters*/
else {
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "NONE");
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
}
ctx->indent_level--;
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s",END);
+ h5tools_str_append(&buffer, "%s", END);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
} /* end if (H5D_VIRTUAL != stl) */
/*-------------------------------------------------------------------------
- * FILLVALUE
- *-------------------------------------------------------------------------
- */
+ * FILLVALUE
+ *-------------------------------------------------------------------------
+ */
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
@@ -3570,7 +3641,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_append(&buffer, "FILL_TIME ");
H5Pget_fill_time(dcpl_id, &ft);
- switch(ft) {
+ switch (ft) {
case H5D_FILL_TIME_ALLOC:
h5tools_str_append(&buffer, "%s", "H5D_FILL_TIME_ALLOC");
break;
@@ -3619,9 +3690,9 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
/*-------------------------------------------------------------------------
- * ALLOCATION_TIME
- *-------------------------------------------------------------------------
- */
+ * ALLOCATION_TIME
+ *-------------------------------------------------------------------------
+ */
if (H5D_VIRTUAL != stl) {
ctx->need_prefix = TRUE;
@@ -3635,7 +3706,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_reset(&buffer);
H5Pget_alloc_time(dcpl_id, &at);
- switch(at) {
+ switch (at) {
case H5D_ALLOC_TIME_EARLY:
h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_EARLY");
break;
@@ -3676,16 +3747,16 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
void
h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t obj_id)
{
- char *comment = NULL;
+ char * comment = NULL;
ssize_t cmt_bufsize = -1;
- size_t buf_size = 0;
- size_t ncols = 80; /* available output width */
- h5tools_str_t buffer; /* string into which to render */
- hsize_t curr_pos = ctx->sm_pos; /* total data element position */
- /* pass to the prefix in h5tools_simple_prefix the total position
- * instead of the current stripmine position i; this is necessary
- * to print the array indices
- */
+ size_t buf_size = 0;
+ size_t ncols = 80; /* available output width */
+ h5tools_str_t buffer; /* string into which to render */
+ hsize_t curr_pos = ctx->sm_pos; /* total data element position */
+ /* pass to the prefix in h5tools_simple_prefix the total position
+ * instead of the current stripmine position i; this is necessary
+ * to print the array indices
+ */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -3697,17 +3768,18 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_
/* call H5Oget_comment again with the correct value */
if (cmt_bufsize > 0) {
- comment = (char *)HDmalloc((size_t)(cmt_bufsize+1)); /* new_size including null terminator */
- if(comment) {
+ comment = (char *)HDmalloc((size_t)(cmt_bufsize + 1)); /* new_size including null terminator */
+ if (comment) {
cmt_bufsize = H5Oget_comment(obj_id, comment, (size_t)cmt_bufsize);
- if(cmt_bufsize > 0) {
+ if (cmt_bufsize > 0) {
comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "COMMENT \"%s\"", comment);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -3727,15 +3799,16 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_
*-------------------------------------------------------------------------
*/
void
-h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, const char *attr_name, hid_t attr_id)
+h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ const char *attr_name, hid_t attr_id)
{
- h5tools_str_t buffer; /* string into which to render */
- size_t ncols = 80; /* available output width */
- hsize_t curr_pos = ctx->sm_pos; /* total data element position */
- /* pass to the prefix in h5tools_simple_prefix the total position
- * instead of the current stripmine position i; this is necessary
- * to print the array indices
- */
+ h5tools_str_t buffer; /* string into which to render */
+ size_t ncols = 80; /* available output width */
+ hsize_t curr_pos = ctx->sm_pos; /* total data element position */
+ /* pass to the prefix in h5tools_simple_prefix the total position
+ * instead of the current stripmine position i; this is necessary
+ * to print the array indices
+ */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -3746,16 +3819,15 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_contex
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->attributebegin, attr_name,
- h5tools_dump_header_format->attributeblockbegin);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->attributebegin, attr_name,
+ h5tools_dump_header_format->attributeblockbegin);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- if(attr_id < 0) {
+ if (attr_id < 0) {
error_msg("unable to open attribute \"%s\"\n", attr_name);
}
else {
- hid_t type = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
ctx->indent_level++;
@@ -3766,10 +3838,10 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_contex
space = H5Aget_space(attr_id);
h5tools_dump_dataspace(stream, info, ctx, space);
- if(oid_output)
+ if (oid_output)
h5tools_dump_oid(stream, info, ctx, attr_id);
- if(data_output || attr_data_output)
+ if (data_output || attr_data_output)
h5tools_dump_data(stream, info, ctx, attr_id, FALSE);
ctx->indent_level--;
@@ -3829,38 +3901,40 @@ void
h5tools_print_packed_bits(h5tools_str_t *buffer, hid_t type)
{
unsigned packed_bits_size = 0;
- hid_t n_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
+ hid_t n_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
- if(H5Tget_class(n_type) == H5T_INTEGER) {
- if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE)
+ if (H5Tget_class(n_type) == H5T_INTEGER) {
+ if (H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE)
packed_bits_size = 8 * sizeof(char);
- else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE)
+ else if (H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE)
packed_bits_size = 8 * sizeof(unsigned char);
- else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE)
+ else if (H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE)
packed_bits_size = 8 * sizeof(short);
- else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE)
+ else if (H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE)
packed_bits_size = 8 * sizeof(unsigned short);
- else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE)
+ else if (H5Tequal(n_type, H5T_NATIVE_INT) == TRUE)
packed_bits_size = 8 * sizeof(int);
- else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE)
+ else if (H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE)
packed_bits_size = 8 * sizeof(unsigned int);
- else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE)
+ else if (H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE)
packed_bits_size = 8 * sizeof(long);
- else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE)
+ else if (H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE)
packed_bits_size = 8 * sizeof(unsigned long);
- else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE)
+ else if (H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE)
packed_bits_size = 8 * sizeof(long long);
- else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE)
+ else if (H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE)
packed_bits_size = 8 * sizeof(unsigned long long);
else
error_msg("Packed Bit not valid for this datatype");
}
- if((packed_bits_size > 0) && (packed_data_offset + packed_data_length) > packed_bits_size) {
- error_msg("Packed Bit offset+length value(%u) too large. Max is %d\n", packed_data_offset + packed_data_length, packed_bits_size);
+ if ((packed_bits_size > 0) && (packed_data_offset + packed_data_length) > packed_bits_size) {
+ error_msg("Packed Bit offset+length value(%u) too large. Max is %d\n",
+ packed_data_offset + packed_data_length, packed_bits_size);
packed_data_mask = 0;
};
- h5tools_str_append(buffer, "%s %s=%u %s=%u", PACKED_BITS, PACKED_OFFSET, packed_data_offset, PACKED_LENGTH, packed_data_length);
+ h5tools_str_append(buffer, "%s %s=%u %s=%u", PACKED_BITS, PACKED_OFFSET, packed_data_offset,
+ PACKED_LENGTH, packed_data_length);
}
/*-------------------------------------------------------------------------
@@ -3874,9 +3948,9 @@ h5tools_print_packed_bits(h5tools_str_t *buffer, hid_t type)
void
h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, int dims)
{
- h5tools_str_t buffer; /* string into which to render */
- hsize_t curr_pos = 0; /* total data element position */
- size_t ncols = 80; /* available output width */
+ h5tools_str_t buffer; /* string into which to render */
+ hsize_t curr_pos = 0; /* total data element position */
+ size_t ncols = 80; /* available output width */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -3886,7 +3960,8 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tool
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->subsettingbegin, h5tools_dump_header_format->subsettingblockbegin);
+ h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->subsettingbegin,
+ h5tools_dump_header_format->subsettingblockbegin);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
ctx->indent_level++;
@@ -3894,43 +3969,51 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tool
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->startbegin, h5tools_dump_header_format->startblockbegin);
+ h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->startbegin,
+ h5tools_dump_header_format->startblockbegin);
h5tools_print_dims(&buffer, ctx->sset->start.data, dims);
- h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->startend, h5tools_dump_header_format->startblockend);
+ h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->startend,
+ h5tools_dump_header_format->startblockend);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->stridebegin, h5tools_dump_header_format->strideblockbegin);
+ h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->stridebegin,
+ h5tools_dump_header_format->strideblockbegin);
h5tools_print_dims(&buffer, ctx->sset->stride.data, dims);
- h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->strideend, h5tools_dump_header_format->strideblockend);
+ h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->strideend,
+ h5tools_dump_header_format->strideblockend);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->countbegin, h5tools_dump_header_format->countblockbegin);
+ h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->countbegin,
+ h5tools_dump_header_format->countblockbegin);
- if(ctx->sset->count.data)
+ if (ctx->sset->count.data)
h5tools_print_dims(&buffer, ctx->sset->count.data, dims);
else
h5tools_str_append(&buffer, "DEFAULT");
- h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->countend, h5tools_dump_header_format->countblockend);
+ h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->countend,
+ h5tools_dump_header_format->countblockend);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->blockbegin, h5tools_dump_header_format->blockblockbegin);
+ h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->blockbegin,
+ h5tools_dump_header_format->blockblockbegin);
- if(ctx->sset->block.data)
+ if (ctx->sset->block.data)
h5tools_print_dims(&buffer, ctx->sset->block.data, dims);
else
h5tools_str_append(&buffer, "DEFAULT");
- h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->blockend, h5tools_dump_header_format->blockblockend);
+ h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->blockend,
+ h5tools_dump_header_format->blockblockend);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
ctx->indent_level--;
@@ -3947,21 +4030,22 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tool
*-------------------------------------------------------------------------
*/
void
-h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t container, hid_t f_type, unsigned char *region_buf, int ndims)
+h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t container,
+ hid_t f_type, unsigned char *region_buf, int ndims)
{
- hid_t region_id = H5I_INVALID_HID;
- hid_t region_sid = H5I_INVALID_HID;
- hsize_t elmt_counter = 0; /*counts the # elements printed. */
- size_t ncols = 80; /* available output width */
- int i;
- size_t nsize;
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t datactx; /* print context */
-
- H5TOOLS_START_DEBUG("");
-
- datactx = *ctx; /* print context */
+ hid_t region_id = H5I_INVALID_HID;
+ hid_t region_sid = H5I_INVALID_HID;
+ hsize_t elmt_counter = 0; /*counts the # elements printed. */
+ size_t ncols = 80; /* available output width */
+ int i;
+ size_t nsize;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t datactx; /* print context */
+
+ H5TOOLS_START_DEBUG(" ");
+
+ datactx = *ctx; /* print context */
/* Assume entire data space to be printed */
datactx.need_prefix = TRUE;
@@ -3977,7 +4061,8 @@ h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_contex
h5tools_str_reset(&buffer);
H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF_DSETREG:%d", i);
h5tools_str_sprint(&buffer, info, container, f_type, memref, &datactx);
- h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims);
+ h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i,
+ (hsize_t)ndims);
if (!h5tools_is_zero(memref, H5Tget_size(f_type))) {
if (nsize == H5R_OBJ_REF_BUF_SIZE) {
@@ -3993,43 +4078,44 @@ h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_contex
H5S_sel_type region_type;
region_type = H5Sget_select_type(region_sid);
- if(region_type == H5S_SEL_POINTS) {
+ if (region_type == H5S_SEL_POINTS) {
/* Print point information */
H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION");
- h5tools_dump_region_data_points(
- region_sid, region_id, stream, info, &datactx,
- &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter);
+ h5tools_dump_region_data_points(region_sid, region_id, stream, info, &datactx,
+ &buffer, &curr_pos, ncols, (hsize_t)i,
+ elmt_counter);
}
- else if(region_type == H5S_SEL_HYPERSLABS) {
+ else if (region_type == H5S_SEL_HYPERSLABS) {
/* Print block information */
H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION");
- h5tools_dump_region_data_blocks(
- region_sid, region_id, stream, info, &datactx,
- &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter);
+ h5tools_dump_region_data_blocks(region_sid, region_id, stream, info, &datactx,
+ &buffer, &curr_pos, ncols, (hsize_t)i,
+ elmt_counter);
}
else
H5TOOLS_INFO("invalid region type");
- if(H5Sclose(region_sid) < 0)
+ if (H5Sclose(region_sid) < 0)
H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION failed");
} /* end if (region_space >= 0) */
else
H5TOOLS_INFO("H5Rget_region H5R_DATASET_REGION failed");
- if(H5Dclose(region_id) < 0)
+ if (H5Dclose(region_id) < 0)
H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION failed");
} /* if (region_id >= 0) */
else {
/* if (region_id < 0) - could mean that no reference was written do not throw failure */
- H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed");
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g,
+ H5E_tools_min_id_g, "H5Rdereference failed");
}
}
} /* end else to if (h5tools_is_zero(... */
- H5TOOLS_DEBUG("finished reference loop:%d",i);
+ H5TOOLS_DEBUG("finished reference loop:%d", i);
} /* end for(i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) */
h5tools_str_close(&buffer);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
}
/*-------------------------------------------------------------------------
@@ -4041,44 +4127,45 @@ h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_contex
*-------------------------------------------------------------------------
*/
void
-h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t obj_id, int obj_data)
+h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t obj_id,
+ int obj_data)
{
- H5S_class_t space_type;
- int ndims;
- size_t nsize;
- hid_t space = H5I_INVALID_HID;
- hid_t f_type = H5I_INVALID_HID;
- hsize_t total_size[H5S_MAX_RANK];
- int status = -1;
- h5tools_context_t datactx; /* print context */
- h5tools_str_t buffer; /* string into which to render */
- hsize_t curr_pos = 0; /* total data element position */
- size_t ncols = 80; /* available output width */
- h5tool_format_t string_dataformat;
- h5tool_format_t outputformat;
- unsigned char *region_buf = NULL;
-
- H5TOOLS_START_DEBUG(" file=%p", (void*)stream);
- H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream);
+ H5S_class_t space_type;
+ int ndims;
+ size_t nsize;
+ hid_t space = H5I_INVALID_HID;
+ hid_t f_type = H5I_INVALID_HID;
+ hsize_t total_size[H5S_MAX_RANK];
+ int status = -1;
+ h5tools_context_t datactx; /* print context */
+ h5tools_str_t buffer; /* string into which to render */
+ hsize_t curr_pos = 0; /* total data element position */
+ size_t ncols = 80; /* available output width */
+ h5tool_format_t string_dataformat;
+ h5tool_format_t outputformat;
+ unsigned char * region_buf = NULL;
+
+ H5TOOLS_START_DEBUG(" file=%p", (void *)stream);
+ H5TOOLS_DEBUG("rawdata file=%p", (void *)rawdatastream);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
if (info->line_ncols > 0)
ncols = info->line_ncols;
- outputformat = *info;
+ outputformat = *info;
string_dataformat = *info;
/* print the matrix indices */
string_dataformat.pindex = ctx->display_index;
- if(obj_data) {
+ if (obj_data) {
H5TOOLS_DEBUG("dataset");
f_type = H5Dget_type(obj_id);
- space = H5Dget_space(obj_id);
+ space = H5Dget_space(obj_id);
}
else {
H5TOOLS_DEBUG("attribute");
f_type = H5Aget_type(obj_id);
- space = H5Aget_space(obj_id);
+ space = H5Aget_space(obj_id);
}
nsize = H5Tget_size(f_type);
@@ -4099,8 +4186,10 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->databegin, h5tools_dump_header_format->datablockbegin);
- h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->databegin,
+ h5tools_dump_header_format->datablockbegin);
+ h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
if (H5Tget_class(f_type) == H5T_REFERENCE) {
ctx->indent_level++;
@@ -4141,43 +4230,43 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
}
else {
H5TOOLS_DEBUG("Print all the values");
- datactx = *ctx;
+ datactx = *ctx;
string_dataformat = *info;
- if((datactx.display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) {
+ if ((datactx.display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) {
H5TOOLS_DEBUG("Print 1-byte integer data as an ASCII character string");
/*
- * Print 1-byte integer data as an ASCII character string
- * instead of integers if the `-r' or `--string' command-line
- * option was given.
- *
- * We don't want to modify the global dataformat, so make a
- * copy of it instead.
- */
+ * Print 1-byte integer data as an ASCII character string
+ * instead of integers if the `-r' or `--string' command-line
+ * option was given.
+ *
+ * We don't want to modify the global dataformat, so make a
+ * copy of it instead.
+ */
string_dataformat.idx_fmt = "\"";
datactx.indent_level++;
datactx.need_prefix = TRUE;
h5tools_simple_prefix(stream, &string_dataformat, &datactx, (hsize_t)0, 0);
string_dataformat.line_multi_new = 1;
- string_dataformat.str_repeat = 8;
- string_dataformat.ascii = TRUE;
- string_dataformat.elmt_suf1 = "";
- string_dataformat.elmt_suf2 = "";
- string_dataformat.line_suf = "\"";
+ string_dataformat.str_repeat = 8;
+ string_dataformat.ascii = TRUE;
+ string_dataformat.elmt_suf1 = "";
+ string_dataformat.elmt_suf2 = "";
+ string_dataformat.line_suf = "\"";
}
else {
datactx.need_prefix = TRUE;
}
/* Print all the values. */
- if(obj_data) {
+ if (obj_data) {
H5TOOLS_DEBUG("h5tools_dump_dset");
status = h5tools_dump_dset(stream, &string_dataformat, &datactx, obj_id);
}
else {
/* need to call h5tools_dump_mem for the attribute data */
space_type = H5Sget_simple_extent_type(space);
- if(space_type == H5S_NULL || space_type == H5S_NO_CLASS) {
+ if (space_type == H5S_NULL || space_type == H5S_NO_CLASS) {
status = SUCCEED;
}
else {
@@ -4186,15 +4275,17 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
}
}
if (datactx.display_char && H5Tget_size(f_type) == 1 && H5Tget_class(f_type) == H5T_INTEGER) {
- H5TOOLS_DEBUG("Print 1-byte integer data as an ASCII character string eol=%s",string_dataformat.line_suf);
- datactx.need_prefix = FALSE;
- string_dataformat.arr_linebreak = 0;
- string_dataformat.idx_fmt = "";
+ H5TOOLS_DEBUG("Print 1-byte integer data as an ASCII character string eol=%s",
+ string_dataformat.line_suf);
+ datactx.need_prefix = FALSE;
+ string_dataformat.arr_linebreak = 0;
+ string_dataformat.idx_fmt = "";
string_dataformat.line_multi_new = 0;
- string_dataformat.line_suf = "";
+ string_dataformat.line_suf = "";
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"");
- h5tools_render_element(stream, &string_dataformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, &string_dataformat, &datactx, &buffer, &curr_pos, (size_t)ncols,
+ (hsize_t)0, (hsize_t)0);
}
H5TOOLS_DEBUG("Print all the values Complete");
@@ -4211,15 +4302,16 @@ done:
h5tools_simple_prefix(stream, &outputformat, ctx, (hsize_t)0, 0);
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datablockend)) {
+ if (HDstrlen(h5tools_dump_header_format->datablockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datablockend);
- if(HDstrlen(h5tools_dump_header_format->dataend))
+ if (HDstrlen(h5tools_dump_header_format->dataend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->dataend))
+ if (HDstrlen(h5tools_dump_header_format->dataend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataend);
- h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
if (ctx->sset && obj_data) {
ctx->indent_level--;
@@ -4228,17 +4320,17 @@ done:
h5tools_simple_prefix(stream, &outputformat, ctx, (hsize_t)0, 0);
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->subsettingblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->subsettingblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->subsettingblockend);
- if(HDstrlen(h5tools_dump_header_format->subsettingend))
+ if (HDstrlen(h5tools_dump_header_format->subsettingend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->subsettingend))
+ if (HDstrlen(h5tools_dump_header_format->subsettingend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->subsettingend);
- h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
+ (hsize_t)0);
}
h5tools_str_close(&buffer);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
}
-
diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h
index 67c3e5f..9b47789 100644
--- a/tools/lib/h5tools_dump.h
+++ b/tools/lib/h5tools_dump.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,8 +14,8 @@
/*
* Purpose: Support h5dump functions for the various tools.
*/
-#ifndef H5TOOLS_DUMP_H__
-#define H5TOOLS_DUMP_H__
+#ifndef H5TOOLS_DUMP_H
+#define H5TOOLS_DUMP_H
#include "h5tools_utils.h"
@@ -23,69 +23,75 @@
Note: these are defined in H5Zprivate, they are
duplicated here.
*/
-#define H5_SZIP_LSB_OPTION_MASK 8
-#define H5_SZIP_MSB_OPTION_MASK 16
-#define H5_SZIP_RAW_OPTION_MASK 128
+#define H5_SZIP_LSB_OPTION_MASK 8
+#define H5_SZIP_MSB_OPTION_MASK 16
+#define H5_SZIP_RAW_OPTION_MASK 128
#ifdef __cplusplus
extern "C" {
#endif
-H5TOOLS_DLLVAR table_t *h5dump_type_table; /*type table reference for datatype dump */
+H5TOOLS_DLLVAR table_t *h5dump_type_table; /*type table reference for datatype dump */
/* Definitions of useful routines */
-H5TOOLS_DLL void h5tools_dump_init(void);
+H5TOOLS_DLL void h5tools_dump_init(void);
-H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t dset);
-H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t obj_id);
-H5TOOLS_DLL int h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t container, unsigned flags, hsize_t nelmts, hid_t type, void *_mem);
-H5TOOLS_DLL void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t type);
-H5TOOLS_DLL void h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t space);
-H5TOOLS_DLL void h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- const char *attr_name, hid_t attr_id);
-H5TOOLS_DLL void h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t oid);
-H5TOOLS_DLL void h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t dcpl, hid_t type_id, hid_t obj_id);
-H5TOOLS_DLL void h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t obj_id);
+H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, hid_t dset);
+H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx /*in,out*/,
+ hid_t obj_id);
+H5TOOLS_DLL int h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, hid_t container, unsigned flags,
+ hsize_t nelmts, hid_t type, void *_mem);
+H5TOOLS_DLL void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, hid_t type);
+H5TOOLS_DLL void h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, hid_t space);
+H5TOOLS_DLL void h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, const char *attr_name,
+ hid_t attr_id);
+H5TOOLS_DLL void h5tools_dump_oid(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, hid_t oid);
+H5TOOLS_DLL void h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, hid_t dcpl, hid_t type_id,
+ hid_t obj_id);
+H5TOOLS_DLL void h5tools_dump_comment(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, hid_t obj_id);
H5TOOLS_DLL void h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hid_t obj_id, int obj_data);
+ hid_t obj_id, int obj_data);
H5TOOLS_DLL void h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hid_t container, hid_t f_type, unsigned char *region_buf, int ndims);
-H5TOOLS_DLL hbool_t h5tools_dump_region_attribute(hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter);
+ hid_t container, hid_t f_type, unsigned char *region_buf, int ndims);
+H5TOOLS_DLL hbool_t h5tools_dump_region_attribute(hid_t region_id, FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, h5tools_str_t *buffer,
+ hsize_t *curr_pos, size_t ncols,
+ hsize_t region_elmt_counter, hsize_t elmt_counter);
-H5TOOLS_DLL hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter);
+H5TOOLS_DLL hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, FILE *stream,
+ const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, h5tools_str_t *buffer,
+ hsize_t *curr_pos, size_t ncols,
+ hsize_t region_elmt_counter, hsize_t elmt_counter);
-H5TOOLS_DLL hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter);
+H5TOOLS_DLL hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *stream,
+ const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, h5tools_str_t *buffer,
+ hsize_t *curr_pos, size_t ncols,
+ hsize_t region_elmt_counter, hsize_t elmt_counter);
-H5TOOLS_DLL int h5tools_print_datatype(FILE *stream,
- h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t type, int object_search);
-H5TOOLS_DLL int h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/,
- hid_t space);
-H5TOOLS_DLL int h5tools_print_enum(FILE *stream,
- h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t type);
-H5TOOLS_DLL void h5tools_print_fill_value(
- h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
- hid_t dcpl, hid_t type_id, hid_t obj_id);
-H5TOOLS_DLL void h5tools_print_packed_bits(h5tools_str_t *buffer/*in,out*/, hid_t type);
+H5TOOLS_DLL int h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer /*in,out*/,
+ const h5tool_format_t *info, h5tools_context_t *ctx /*in,out*/,
+ hid_t type, int object_search);
+H5TOOLS_DLL int h5tools_print_dataspace(h5tools_str_t *buffer /*in,out*/, hid_t space);
+H5TOOLS_DLL int h5tools_print_enum(FILE *stream, h5tools_str_t *buffer /*in,out*/,
+ const h5tool_format_t *info, h5tools_context_t *ctx /*in,out*/,
+ hid_t type);
+H5TOOLS_DLL void h5tools_print_fill_value(h5tools_str_t *buffer /*in,out*/, const h5tool_format_t *info,
+ h5tools_context_t *ctx /*in,out*/, hid_t dcpl, hid_t type_id,
+ hid_t obj_id);
+H5TOOLS_DLL void h5tools_print_packed_bits(h5tools_str_t *buffer /*in,out*/, hid_t type);
#ifdef __cplusplus
}
#endif
-#endif /* H5TOOLS_DUMP_H__ */
-
+#endif /* H5TOOLS_DUMP_H */
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index 764fb91..5840a98 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -14,14 +14,14 @@
/*
* Header file for error values, etc.
*/
-#ifndef H5TOOLS_ERROR_H_
-#define H5TOOLS_ERROR_H_
+#ifndef H5TOOLS_ERROR_H
+#define H5TOOLS_ERROR_H
#include "H5Epublic.h"
#include "H5Eprivate.h" /* Error handling */
/* tools-HDF5 Error variables */
-H5TOOLS_DLLVAR int H5tools_INDENT_g;
+H5TOOLS_DLLVAR int H5tools_INDENT_g;
H5TOOLS_DLLVAR hid_t H5tools_ERR_STACK_g;
H5TOOLS_DLLVAR hid_t H5tools_ERR_CLS_g;
H5TOOLS_DLLVAR hid_t H5E_tools_g;
@@ -41,77 +41,77 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
/*
* H5TOOLS_INIT_ERROR macro, used to initialize error reporting.
*/
-#define H5TOOLS_INIT_ERROR() \
-do { \
- char lib_str[256]; \
- \
- /* Initialize library version string for error class */ \
- HDsnprintf(lib_str, sizeof(lib_str), "%d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); \
- \
- /* Create new HDF5 error stack for the tools to use */ \
- if ((H5tools_ERR_STACK_g = H5Ecreate_stack()) < 0) \
- HDfprintf(stderr, "Failed to create HDF5 tools error stack\n"); \
- \
- /* Register errors from the HDF5 tools as a new error class */ \
- if ((H5tools_ERR_CLS_g = H5Eregister_class("H5tools", "HDF5:tools", lib_str)) < 0) \
- HDfprintf(stderr, "Failed to register HDF5 tools error class\n"); \
- \
- /* Create a new HDF5 major error message for errors from the tools library */ \
- if ((H5E_tools_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MAJOR, "Failure in tools library")) < 0) \
- HDfprintf(stderr, "Failed to register major error message for tools library errors\n"); \
- \
- /* Create a new HDF5 minor error message for errors from the tools library */ \
- if ((H5E_tools_min_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "error in function")) < 0) \
- HDfprintf(stderr, "Failed to register minor error message for tools library errors\n"); \
- \
- /* Create a new HDF5 minor error message for info messages from the tools library */ \
- if ((H5E_tools_min_info_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function info")) < 0) \
- HDfprintf(stderr, "Failed to register minor error message for tools library info messages\n"); \
- \
- /* Create a new HDF5 minor error message for debug messages from the tools library */ \
- if ((H5E_tools_min_dbg_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function debug")) < 0) \
- HDfprintf(stderr, "Failed to register minor error message for tools library debug messages\n"); \
-} while(0)
+#define H5TOOLS_INIT_ERROR() \
+ do { \
+ char lib_str[256]; \
+ \
+ /* Initialize library version string for error class */ \
+ HDsnprintf(lib_str, sizeof(lib_str), "%d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); \
+ \
+ /* Create new HDF5 error stack for the tools to use */ \
+ if ((H5tools_ERR_STACK_g = H5Ecreate_stack()) < 0) \
+ HDfprintf(stderr, "Failed to create HDF5 tools error stack\n"); \
+ \
+ /* Register errors from the HDF5 tools as a new error class */ \
+ if ((H5tools_ERR_CLS_g = H5Eregister_class("H5tools", "HDF5:tools", lib_str)) < 0) \
+ HDfprintf(stderr, "Failed to register HDF5 tools error class\n"); \
+ \
+ /* Create a new HDF5 major error message for errors from the tools library */ \
+ if ((H5E_tools_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MAJOR, "Failure in tools library")) < 0) \
+ HDfprintf(stderr, "Failed to register major error message for tools library errors\n"); \
+ \
+ /* Create a new HDF5 minor error message for errors from the tools library */ \
+ if ((H5E_tools_min_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "error in function")) < 0) \
+ HDfprintf(stderr, "Failed to register minor error message for tools library errors\n"); \
+ \
+ /* Create a new HDF5 minor error message for info messages from the tools library */ \
+ if ((H5E_tools_min_info_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function info")) < 0) \
+ HDfprintf(stderr, "Failed to register minor error message for tools library info messages\n"); \
+ \
+ /* Create a new HDF5 minor error message for debug messages from the tools library */ \
+ if ((H5E_tools_min_dbg_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function debug")) < 0) \
+ HDfprintf(stderr, "Failed to register minor error message for tools library debug messages\n"); \
+ } while (0)
/*
* H5TOOLS_CLOSE_ERROR macro, used to terminate error reporting.
*/
-#define H5TOOLS_CLOSE_ERROR() \
-do { \
- /* Close all error messages created by H5TOOLS_INIT_ERROR() */ \
- if (H5Eclose_msg(H5E_tools_min_dbg_id_g) < 0) \
- HDfprintf(stderr, "Failed to close minor error message for tools library debug messages\n"); \
- if (H5Eclose_msg(H5E_tools_min_info_id_g) < 0) \
- HDfprintf(stderr, "Failed to close minor error message for tools library info messages\n"); \
- if (H5Eclose_msg(H5E_tools_min_id_g) < 0) \
- HDfprintf(stderr, "Failed to close minor error message for tools library errors\n"); \
- if (H5Eclose_msg(H5E_tools_g) < 0) \
- HDfprintf(stderr, "Failed to close major error message for tools library errors\n"); \
- \
- /* Unregister the HDF5 tools error class */ \
- if (H5Eunregister_class(H5tools_ERR_CLS_g) < 0) \
- HDfprintf(stderr, "Failed to unregister the HDF5 tools error class\n"); \
- \
- /* Close the tools error stack */ \
- if (H5Eclose_stack(H5tools_ERR_STACK_g) < 0) \
- HDfprintf(stderr, "Failed to close HDF5 tools error stack\n"); \
-} while(0)
+#define H5TOOLS_CLOSE_ERROR() \
+ do { \
+ /* Close all error messages created by H5TOOLS_INIT_ERROR() */ \
+ if (H5Eclose_msg(H5E_tools_min_dbg_id_g) < 0) \
+ HDfprintf(stderr, "Failed to close minor error message for tools library debug messages\n"); \
+ if (H5Eclose_msg(H5E_tools_min_info_id_g) < 0) \
+ HDfprintf(stderr, "Failed to close minor error message for tools library info messages\n"); \
+ if (H5Eclose_msg(H5E_tools_min_id_g) < 0) \
+ HDfprintf(stderr, "Failed to close minor error message for tools library errors\n"); \
+ if (H5Eclose_msg(H5E_tools_g) < 0) \
+ HDfprintf(stderr, "Failed to close major error message for tools library errors\n"); \
+ \
+ /* Unregister the HDF5 tools error class */ \
+ if (H5Eunregister_class(H5tools_ERR_CLS_g) < 0) \
+ HDfprintf(stderr, "Failed to unregister the HDF5 tools error class\n"); \
+ \
+ /* Close the tools error stack */ \
+ if (H5Eclose_stack(H5tools_ERR_STACK_g) < 0) \
+ HDfprintf(stderr, "Failed to close HDF5 tools error stack\n"); \
+ } while (0)
/*
* H5TOOLS_PUSH_ERROR macro, used to push an error to an error stack. Not meant to
* be called directly.
*/
-#define H5TOOLS_PUSH_ERROR(estack_id, err_cls, maj_err_id, min_err_id, ...) \
-do { \
- if (enable_error_stack > 0) { \
- if (estack_id >= 0 && err_cls >= 0) \
- H5Epush2(estack_id, __FILE__, FUNC, __LINE__, err_cls, maj_err_id, min_err_id, __VA_ARGS__); \
- else { \
- HDfprintf(stderr, __VA_ARGS__); \
- HDfprintf(stderr, "\n"); \
- } \
- } \
-} while(0)
+#define H5TOOLS_PUSH_ERROR(estack_id, err_cls, maj_err_id, min_err_id, ...) \
+ do { \
+ if (enable_error_stack > 0) { \
+ if (estack_id >= 0 && err_cls >= 0) \
+ H5Epush2(estack_id, __FILE__, FUNC, __LINE__, err_cls, maj_err_id, min_err_id, __VA_ARGS__); \
+ else { \
+ HDfprintf(stderr, __VA_ARGS__); \
+ HDfprintf(stderr, "\n"); \
+ } \
+ } \
+ } while (0)
/*
* H5TOOLS_ERROR macro, used to facilitate error reporting within a function body.
@@ -121,119 +121,121 @@ do {
* after the `done' label, in which case an infinite loop would ensue if control branched
* backwards.
*/
-#define H5TOOLS_ERROR(ret_val, ...) \
-do { \
- H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, __VA_ARGS__); \
- ret_value = ret_val; \
-} while(0)
+#define H5TOOLS_ERROR(ret_val, ...) \
+ do { \
+ H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, \
+ __VA_ARGS__); \
+ ret_value = ret_val; \
+ } while (0)
/*
* H5TOOLS_GOTO_ERROR macro, used to facilitate error reporting within a function body.
* The arguments are the return value and an error string. The return value is assigned
* to a variable `ret_value' and control branches to the `done' label.
*/
-#define H5TOOLS_GOTO_ERROR(ret_val, ...) \
-do { \
- H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, __VA_ARGS__); \
- H5TOOLS_GOTO_DONE(ret_val); \
-} while(0)
+#define H5TOOLS_GOTO_ERROR(ret_val, ...) \
+ do { \
+ H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, \
+ __VA_ARGS__); \
+ H5TOOLS_GOTO_DONE(ret_val); \
+ } while (0)
/*
* H5TOOLS_GOTO_DONE macro, used to facilitate normal return within a function body.
* The argument is the return value which is assigned to the `ret_value'
* variable. Control branches to the `done' label.
*/
-#define H5TOOLS_GOTO_DONE(ret_val) \
-do { \
- ret_value = ret_val; \
- goto done; \
-} while(0)
+#define H5TOOLS_GOTO_DONE(ret_val) \
+ do { \
+ ret_value = ret_val; \
+ goto done; \
+ } while (0)
/*
* H5TOOLS_GOTO_DONE_NO_RET macro, used to facilitate normal return within a function body.
* Control simply branches to the `done' label without setting any return value.
*/
-#define H5TOOLS_GOTO_DONE_NO_RET() \
-do { \
- goto done; \
-} while(0)
+#define H5TOOLS_GOTO_DONE_NO_RET() \
+ do { \
+ goto done; \
+ } while (0)
/*
* H5TOOLS_INFO macro, used to facilitate error reporting. The arguments are
* a description of the error.
*/
-#define H5TOOLS_INFO(...) \
-do { \
- H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_info_id_g, __VA_ARGS__); \
-} while(0)
+#define H5TOOLS_INFO(...) \
+ do { \
+ H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_info_id_g, \
+ __VA_ARGS__); \
+ } while (0)
#ifdef H5_TOOLS_DEBUG
-#define H5TOOLS_START_DEBUG(...) \
-do { \
- H5tools_INDENT_g += 2; \
- HDfprintf(stderr, "%*sENTER %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
- HDfprintf(stderr, __VA_ARGS__); \
- HDfprintf(stderr, "\n"); \
- HDfflush(stderr); \
-} while(0)
-
-#define H5TOOLS_DEBUG(...) \
-do { \
- HDfprintf(stderr, "%*s %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
- HDfprintf(stderr, __VA_ARGS__); \
- HDfprintf(stderr, "\n"); \
- HDfflush(stderr); \
-} while(0)
-
-#define H5TOOLS_ENDDEBUG(...) \
-do { \
- HDfprintf(stderr, "%*sEXIT %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
- HDfprintf(stderr, __VA_ARGS__); \
- HDfprintf(stderr, "\n"); \
- H5tools_INDENT_g -= 2; \
- HDfflush(stderr); \
-} while(0)
+#define H5TOOLS_START_DEBUG(...) \
+ do { \
+ H5tools_INDENT_g += 2; \
+ HDfprintf(stderr, "%*sENTER %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
+ HDfprintf(stderr, __VA_ARGS__); \
+ HDfprintf(stderr, "\n"); \
+ HDfflush(stderr); \
+ } while (0)
+
+#define H5TOOLS_DEBUG(...) \
+ do { \
+ HDfprintf(stderr, "%*s %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
+ HDfprintf(stderr, __VA_ARGS__); \
+ HDfprintf(stderr, "\n"); \
+ HDfflush(stderr); \
+ } while (0)
+
+#define H5TOOLS_ENDDEBUG(...) \
+ do { \
+ HDfprintf(stderr, "%*sEXIT %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
+ HDfprintf(stderr, __VA_ARGS__); \
+ HDfprintf(stderr, "\n"); \
+ H5tools_INDENT_g -= 2; \
+ HDfflush(stderr); \
+ } while (0)
#else
-#define H5TOOLS_START_DEBUG(...) \
-do { \
- ; \
-} while(0)
+#define H5TOOLS_START_DEBUG(...) \
+ do { \
+ ; \
+ } while (0)
-#define H5TOOLS_DEBUG(...) \
-do { \
- ; \
-} while(0)
+#define H5TOOLS_DEBUG(...) \
+ do { \
+ ; \
+ } while (0)
-#define H5TOOLS_ENDDEBUG(...) \
-do { \
- ; \
-} while(0)
+#define H5TOOLS_ENDDEBUG(...) \
+ do { \
+ ; \
+ } while (0)
#endif
-
/* Macro for "catching" flow of control when an error occurs. Note that the
* H5_LEAVE macro won't jump back here once it's past this point.
*/
-/* #define CATCH catch_except:; past_catch = TRUE; defined in H5Eprivate.h */
+#define CATCH \
+catch_except:; \
+ past_catch = TRUE;
/*
- * H5_LEAVE macro, used to facilitate control flow between a
- * BEGIN_FUNC() and an END_FUNC() within a function body. The argument is
- * the return value.
- * The return value is assigned to a variable `ret_value' and control branches
- * to the `catch_except' label, if we're not already past it.
+ * H5_LEAVE macro, used to facilitate control flow in a function. The argument
+ * is the return value. The return value is assigned to a variable `ret_value'
+ * and control branches to the `catch_except' label, if we're not already past
+ * it.
*/
-/*
- * #define H5_LEAVE(v) { \
- * ret_value = v; \
- * if(!past_catch) \
- * goto catch_except; \
- * }
- * defined in H5Eprivate.h */
+#define H5_LEAVE(v) \
+ { \
+ ret_value = v; \
+ if (!past_catch) \
+ goto catch_except; \
+ }
/*
* H5TOOLS_THROW macro, used to facilitate error reporting within a function body.
@@ -241,11 +243,11 @@ do { \
* The return value is assigned to a variable `ret_value' and control branches
* to the `catch_except' label, if we're not already past it.
*/
-#define H5TOOLS_THROW(ret_val, ...) \
-do { \
- H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, __VA_ARGS__); \
- H5_LEAVE(ret_val) \
-} while(0)
-
-#endif /* H5TOOLS_ERROR_H_ */
-
+#define H5TOOLS_THROW(ret_val, ...) \
+ do { \
+ H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, \
+ __VA_ARGS__); \
+ H5_LEAVE(ret_val) \
+ } while (0)
+
+#endif /* H5TOOLS_ERROR_H */
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 0e4c476..99ee268 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,11 +18,10 @@
* print a warning message
*-------------------------------------------------------------------------
*/
-static void print_filter_warning(const char *dname, const char *fname)
+static void
+print_filter_warning(const char *dname, const char *fname)
{
- HDfprintf(stderr,
- "Warning: dataset <%s> cannot be read, %s filter is not available\n",
- dname, fname);
+ HDfprintf(stderr, "Warning: dataset <%s> cannot be read, %s filter is not available\n", dname, fname);
}
/*-------------------------------------------------------------------------
@@ -40,14 +39,14 @@ static void print_filter_warning(const char *dname, const char *fname)
*-------------------------------------------------------------------------
*/
int
-h5tools_canreadf(const char* name, /* object name, serves also as boolean print */
- hid_t dcpl_id) /* dataset creation property list */
+h5tools_canreadf(const char *name, /* object name, serves also as boolean print */
+ hid_t dcpl_id) /* dataset creation property list */
{
- int nfilters; /* number of filters */
- H5Z_filter_t filtn; /* filter identification number */
- int i; /* index */
- int udfilter_avail; /* index */
- int ret_value = 1;
+ int nfilters; /* number of filters */
+ H5Z_filter_t filtn; /* filter identification number */
+ int i; /* index */
+ int udfilter_avail; /* index */
+ int ret_value = 1;
/* get information about filters */
if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
@@ -59,73 +58,73 @@ h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
/* check availability of filters */
for (i = 0; i < nfilters; i++) {
- if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, 0, 0, 0, (size_t) 0, 0, NULL)) < 0)
+ if ((filtn = H5Pget_filter2(dcpl_id, (unsigned)i, 0, 0, 0, (size_t)0, 0, NULL)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_filter2 failed");
switch (filtn) {
- /*-------------------------------------------------------------------------
- * user defined filter
- *-------------------------------------------------------------------------
- */
- default:
- if ((udfilter_avail = H5Zfilter_avail(filtn)) < 0) {
- H5TOOLS_GOTO_ERROR(FAIL, "H5Zfilter_avail failed");
- }
- else if (!udfilter_avail) {
- if (name)
- print_filter_warning(name, "user defined");
- ret_value = 0;
- }
- break;
-
/*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ * user defined filter
*-------------------------------------------------------------------------
*/
- case H5Z_FILTER_DEFLATE:
+ default:
+ if ((udfilter_avail = H5Zfilter_avail(filtn)) < 0) {
+ H5TOOLS_GOTO_ERROR(FAIL, "H5Zfilter_avail failed");
+ }
+ else if (!udfilter_avail) {
+ if (name)
+ print_filter_warning(name, "user defined");
+ ret_value = 0;
+ }
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_DEFLATE:
#ifndef H5_HAVE_FILTER_DEFLATE
- if (name)
- print_filter_warning(name,"deflate");
- ret_value = 0;
+ if (name)
+ print_filter_warning(name, "deflate");
+ ret_value = 0;
#endif
- break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP 4 , szip compression
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SZIP:
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP 4 , szip compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SZIP:
#ifndef H5_HAVE_FILTER_SZIP
- if (name)
- print_filter_warning(name,"SZIP");
- ret_value = 0;
+ if (name)
+ print_filter_warning(name, "SZIP");
+ ret_value = 0;
#endif
- break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SHUFFLE 2 , shuffle the data
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SHUFFLE:
- break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_FLETCHER32:
- break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_NBIT
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_NBIT:
- break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SCALEOFFSET:
- break;
- }/*switch*/
- }/*for*/
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SHUFFLE:
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_FLETCHER32:
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_NBIT
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_NBIT:
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SCALEOFFSET
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SCALEOFFSET:
+ break;
+ } /*switch*/
+ } /*for*/
done:
return ret_value;
@@ -147,63 +146,64 @@ h5tools_can_encode(H5Z_filter_t filtn)
int ret_value = 1;
switch (filtn) {
- /* user defined filter */
- default:
- H5TOOLS_GOTO_DONE(0);
- break;
- case H5Z_FILTER_DEFLATE:
+ /* user defined filter */
+ default:
+ H5TOOLS_GOTO_DONE(0);
+ break;
+ case H5Z_FILTER_DEFLATE:
#ifndef H5_HAVE_FILTER_DEFLATE
- H5TOOLS_GOTO_DONE(0);
+ H5TOOLS_GOTO_DONE(0);
#endif
break;
- case H5Z_FILTER_SZIP:
+ case H5Z_FILTER_SZIP:
#ifndef H5_HAVE_FILTER_SZIP
- H5TOOLS_GOTO_DONE(0);
+ H5TOOLS_GOTO_DONE(0);
#else
{
unsigned int filter_config_flags;
if (H5Zget_filter_info(filtn, &filter_config_flags) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Zget_filter_info failed");
- if ((filter_config_flags
- & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
+ if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
/* filter present but neither encode nor decode is supported (???) */
H5TOOLS_GOTO_ERROR(FAIL, "neither encode nor decode is supported");
}
- else if ((filter_config_flags
- & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) {
+ else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ H5Z_FILTER_CONFIG_DECODE_ENABLED) {
/* decoder only: read but not write */
H5TOOLS_GOTO_DONE(0);
}
- else if ((filter_config_flags
- & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
+ else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
/* encoder only: write but not read (???) */
H5TOOLS_GOTO_ERROR(FAIL, "encoder only: write but not read");
}
- else if ((filter_config_flags
- & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED))
- == (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
+ else if ((filter_config_flags &
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) ==
+ (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
H5TOOLS_GOTO_DONE(1);
}
}
#endif
break;
- case H5Z_FILTER_SHUFFLE:
+ case H5Z_FILTER_SHUFFLE:
break;
- case H5Z_FILTER_FLETCHER32:
+ case H5Z_FILTER_FLETCHER32:
break;
- case H5Z_FILTER_NBIT:
+ case H5Z_FILTER_NBIT:
break;
- case H5Z_FILTER_SCALEOFFSET:
+ case H5Z_FILTER_SCALEOFFSET:
break;
- }/*switch*/
+ } /*switch*/
done:
return ret_value;
}
-
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index e98a8e2..4effc34 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,7 +18,6 @@
#include "h5tools_utils.h"
#include "h5trav.h"
-
/*
* Table to look up a path name for an object
* reference.
@@ -34,12 +33,12 @@
*/
typedef struct {
- haddr_t objno; /* Object ID (i.e. address) */
- char *path; /* Object path */
+ haddr_t objno; /* Object ID (i.e. address) */
+ char * path; /* Object path */
} ref_path_node_t;
-static H5SL_t *ref_path_table = NULL; /* the "table" (implemented with a skip list) */
-static hid_t thefile = (-1);
+static H5SL_t *ref_path_table = NULL; /* the "table" (implemented with a skip list) */
+static hid_t thefile = (-1);
static int ref_path_table_put(const char *, haddr_t objno);
@@ -57,14 +56,14 @@ static int ref_path_table_put(const char *, haddr_t objno);
*-------------------------------------------------------------------------
*/
static herr_t
-free_ref_path_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *operator_data/*in,out*/)
+free_ref_path_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *operator_data /*in,out*/)
{
ref_path_node_t *node = (ref_path_node_t *)item;
HDfree(node->path);
HDfree(node);
- return(0);
+ return (0);
}
/*-------------------------------------------------------------------------
@@ -80,11 +79,11 @@ free_ref_path_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op
*-------------------------------------------------------------------------
*/
static herr_t
-init_ref_path_cb(const char *obj_name, const H5O_info_t *oinfo,
- const char *already_seen, void H5_ATTR_UNUSED *_udata)
+init_ref_path_cb(const char *obj_name, const H5O_info_t *oinfo, const char *already_seen,
+ void H5_ATTR_UNUSED *_udata)
{
/* Check if the object is already in the path table */
- if(NULL == already_seen) {
+ if (NULL == already_seen) {
/* Insert the object into the path table */
ref_path_table_put(obj_name, oinfo->addr);
} /* end if */
@@ -107,18 +106,18 @@ static int
init_ref_path_table(void)
{
/* Sanity check */
- if(thefile > 0) {
+ if (thefile > 0) {
/* Create skip list to store reference path information */
- if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, NULL))==NULL)
+ if ((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, NULL)) == NULL)
return (-1);
/* Iterate over objects in this file */
- if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL, H5O_INFO_BASIC) < 0) {
+ if (h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL, H5O_INFO_BASIC) < 0) {
error_msg("unable to construct reference path table\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- return(0);
+ return (0);
}
else
return (-1);
@@ -141,10 +140,10 @@ int
term_ref_path_table(void)
{
/* Destroy reference path table, freeing all memory */
- if(ref_path_table)
+ if (ref_path_table)
H5SL_destroy(ref_path_table, free_ref_path_info, NULL);
- return(0);
+ return (0);
}
/*-------------------------------------------------------------------------
@@ -165,30 +164,30 @@ term_ref_path_table(void)
haddr_t
ref_path_table_lookup(const char *thepath)
{
- H5O_info_t oi;
+ H5O_info_t oi;
- if((thepath == NULL) || (HDstrlen(thepath) == 0))
+ if ((thepath == NULL) || (HDstrlen(thepath) == 0))
return HADDR_UNDEF;
/* Allow lookups on the root group, even though it doesn't have any link info */
- if(HDstrcmp(thepath, "/")) {
- H5L_info_t li;
+ if (HDstrcmp(thepath, "/") != 0) {
+ H5L_info_t li;
/* Check for external link first, so we don't return the OID of an object in another file */
- if(H5Lget_info(thefile, thepath, &li, H5P_DEFAULT) < 0)
+ if (H5Lget_info(thefile, thepath, &li, H5P_DEFAULT) < 0)
return HADDR_UNDEF;
/* UD links can't be followed, so they always "dangle" like soft links. */
- if(li.type >= H5L_TYPE_UD_MIN)
+ if (li.type >= H5L_TYPE_UD_MIN)
return HADDR_UNDEF;
} /* end if */
/* Get the object info now */
/* (returns failure for dangling soft links) */
- if(H5Oget_info_by_name2(thefile, thepath, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name2(thefile, thepath, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
return HADDR_UNDEF;
/* Return OID */
- return(oi.addr);
+ return (oi.addr);
}
/*-------------------------------------------------------------------------
@@ -215,14 +214,14 @@ ref_path_table_put(const char *path, haddr_t objno)
{
ref_path_node_t *new_node;
- if(ref_path_table && path) {
- if((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL)
- return(-1);
+ if (ref_path_table && path) {
+ if ((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL)
+ return (-1);
new_node->objno = objno;
- new_node->path = HDstrdup(path);
+ new_node->path = HDstrdup(path);
- return(H5SL_insert(ref_path_table, new_node, &(new_node->objno)));
+ return (H5SL_insert(ref_path_table, new_node, &(new_node->objno)));
}
else
return (-1);
@@ -233,7 +232,9 @@ ref_path_table_put(const char *path, haddr_t objno)
*/
int xid = 1;
-int get_next_xid(void) {
+int
+get_next_xid(void)
+{
return xid++;
}
@@ -245,7 +246,8 @@ int get_next_xid(void) {
*/
haddr_t fake_xid = HADDR_MAX;
haddr_t
-get_fake_xid (void) {
+get_fake_xid(void)
+{
return (fake_xid--);
}
@@ -266,19 +268,19 @@ ref_path_table_gen_fake(const char *path)
fake_objno = get_fake_xid();
/* Create ref path table, if it hasn't already been created */
- if(ref_path_table == NULL)
+ if (ref_path_table == NULL)
init_ref_path_table();
/* Insert "fake" object into table */
ref_path_table_put(path, fake_objno);
- return(fake_objno);
+ return (fake_objno);
}
/*-------------------------------------------------------------------------
* Function: lookup_ref_path
*
- * Purpose: Lookup the path to the object with refernce 'ref'.
+ * Purpose: Lookup the path to the object with reference 'ref'.
*
* Return: Return a path to the object, or NULL if not found.
*
@@ -294,16 +296,16 @@ lookup_ref_path(haddr_t ref)
ref_path_node_t *node;
/* Be safer for h5ls */
- if(thefile < 0)
- return(NULL);
+ if (thefile < 0)
+ return (NULL);
/* Create ref path table, if it hasn't already been created */
- if(ref_path_table == NULL)
+ if (ref_path_table == NULL)
init_ref_path_table();
node = (ref_path_node_t *)H5SL_search(ref_path_table, &ref);
- return(node ? node->path : NULL);
+ return (node ? node->path : NULL);
}
/*-------------------------------------------------------------------------
@@ -328,4 +330,3 @@ fill_ref_path_table(hid_t fid)
return 0;
}
-
diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h
index b7bd9a3..e3d55c6 100644
--- a/tools/lib/h5tools_ref.h
+++ b/tools/lib/h5tools_ref.h
@@ -6,13 +6,13 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5TOOLS_REF_H__
-#define H5TOOLS_REF_H__
+#ifndef H5TOOLS_REF_H
+#define H5TOOLS_REF_H
#include "hdf5.h"
@@ -33,4 +33,3 @@ H5TOOLS_DLL int term_ref_path_table(void);
#endif
#endif
-
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 9f00eee..3102d92 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,17 +15,17 @@
* Purpose: These are string functions for us to use and abuse.
*/
#include "H5private.h"
-#include "h5tools.h" /* for h5tool_format_t structure */
+#include "h5tools.h" /* for h5tool_format_t structure */
#include "h5tools_ref.h"
-#include "h5tools_str.h" /* function prototypes */
+#include "h5tools_str.h" /* function prototypes */
/* Copied from hl/src/H5LDprivate.h */
/* Info about the list of comma-separated compound fields */
typedef struct H5LD_memb_t {
- size_t tot_offset;
- size_t last_tsize;
- hid_t last_tid;
- char **names;
+ size_t tot_offset;
+ size_t last_tsize;
+ hid_t last_tid;
+ char **names;
} H5LD_memb_t;
/*
@@ -42,12 +42,12 @@ typedef struct H5LD_memb_t {
#define REPEAT_VERBOSE
/* Variable length string datatype */
-#define STR_INIT_LEN 4096 /*initial length */
+#define STR_INIT_LEN 4096 /*initial length */
-static char *h5tools_escape(char *s, size_t size);
-static hbool_t h5tools_str_is_zero(const void *_mem, size_t size);
-static void h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch);
-void h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, h5tools_context_t *ctx);
+static char * h5tools_escape(char *s, size_t size);
+static hbool_t h5tools_str_is_zero(const void *_mem, size_t size);
+static void h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch);
+void h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, h5tools_context_t *ctx);
/*-------------------------------------------------------------------------
* Function: h5tools_str_close
@@ -105,23 +105,23 @@ h5tools_str_len(h5tools_str_t *str)
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
+h5tools_str_append(h5tools_str_t *str /*in,out*/, const char *fmt, ...)
{
- va_list ap;
+ va_list ap;
/* Make sure we have some memory into which to print */
- if(!str->s || str->nalloc <= 0)
+ if (!str->s || str->nalloc <= 0)
h5tools_str_reset(str);
- if(HDstrlen(fmt) == 0)
+ if (HDstrlen(fmt) == 0)
/* nothing to print */
return str->s;
/* Format the arguments and append to the value already in `str' */
- while(1) {
+ while (1) {
/* How many bytes available for new value, counting the new NUL */
int nchars = -1;
- size_t avail = str->nalloc - str->len;
+ size_t avail = str->nalloc - str->len;
HDva_start(ap, fmt);
nchars = HDvsnprintf(str->s + str->len, avail, fmt, ap);
@@ -138,11 +138,11 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
* to lack of buffer size, so try one more time after realloc more
* buffer size before return NULL.
*/
- if(nchars < 0)
+ if (nchars < 0)
/* failure, such as bad format */
return NULL;
- if((size_t) nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s")))) {
+ if ((size_t)nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s") != 0))) {
/* Truncation return value as documented by C99, or zero return value with either of the
* following conditions, each of which indicates that the proper C99 return value probably
* should have been positive when the format string is
@@ -151,7 +151,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
*/
size_t newsize = MAX(str->len + (size_t)nchars + 1, 2 * str->nalloc);
HDassert(newsize > str->nalloc); /*overflow*/
- str->s = (char*)HDrealloc(str->s, newsize);
+ str->s = (char *)HDrealloc(str->s, newsize);
HDassert(str->s);
str->nalloc = newsize;
}
@@ -180,16 +180,16 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_reset(h5tools_str_t *str/*in,out*/)
+h5tools_str_reset(h5tools_str_t *str /*in,out*/)
{
- if(!str->s || str->nalloc <= 0) {
+ if (!str->s || str->nalloc <= 0) {
str->nalloc = STR_INIT_LEN;
- str->s = (char*)HDmalloc(str->nalloc);
+ str->s = (char *)HDmalloc(str->nalloc);
HDassert(str->s);
}
str->s[0] = '\0';
- str->len = 0;
+ str->len = 0;
return str->s;
}
@@ -207,10 +207,10 @@ h5tools_str_reset(h5tools_str_t *str/*in,out*/)
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_trunc(h5tools_str_t *str/*in,out*/, size_t size)
+h5tools_str_trunc(h5tools_str_t *str /*in,out*/, size_t size)
{
- if(size < str->len) {
- str->len = size;
+ if (size < str->len) {
+ str->len = size;
str->s[size] = '\0';
}
@@ -235,26 +235,26 @@ h5tools_str_trunc(h5tools_str_t *str/*in,out*/, size_t size)
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
+h5tools_str_fmt(h5tools_str_t *str /*in,out*/, size_t start, const char *fmt)
{
- char _temp[1024], *temp = _temp;
+ char _temp[1024], *temp = _temp;
HDassert(str);
HDassert(fmt);
/* If the format string is simply "%s" then don't bother doing anything */
- if(!HDstrcmp(fmt, "%s"))
+ if (!HDstrcmp(fmt, "%s"))
return str->s;
/*
* Save the input value if there is a `%' anywhere in FMT. Otherwise
* don't bother because we don't need a temporary copy.
*/
- if(HDstrchr(fmt, '%')) {
+ if (HDstrchr(fmt, '%')) {
size_t n = sizeof(_temp);
- if(str->len - start + 1 > n) {
- n = str->len - start + 1;
- temp = (char*)HDmalloc(n);
+ if (str->len - start + 1 > n) {
+ n = str->len - start + 1;
+ temp = (char *)HDmalloc(n);
HDassert(temp);
}
@@ -266,7 +266,7 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
h5tools_str_append(str, fmt, temp);
/* Free the temp buffer if we allocated one */
- if(temp != _temp)
+ if (temp != _temp)
HDfree(temp);
return str->s;
@@ -282,31 +282,31 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hsize_t elmtno,
- h5tools_context_t *ctx)
+h5tools_str_prefix(h5tools_str_t *str /*in,out*/, const h5tool_format_t *info, hsize_t elmtno,
+ h5tools_context_t *ctx)
{
- size_t i = 0;
+ size_t i = 0;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims);
h5tools_str_reset(str);
calc_acc_pos(ctx->ndims, elmtno, ctx->acc, ctx->pos);
- if(ctx->ndims > 0) {
+ if (ctx->ndims > 0) {
/* Print the index values */
- for(i = 0; i < (size_t) ctx->ndims; i++) {
+ for (i = 0; i < (size_t)ctx->ndims; i++) {
if (i)
h5tools_str_append(str, "%s", OPT(info->idx_sep, ","));
- h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t) ctx->pos[i]);
+ h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)ctx->pos[i]);
}
}
- else /* Scalar */
+ else /* Scalar */
h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)elmtno);
H5TOOLS_DEBUG("str=%s", str->s);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
/* Add prefix and suffix to the index */
return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: "));
@@ -322,32 +322,32 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hs
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_region_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hsize_t elmtno,
- hsize_t *ptdata, h5tools_context_t *ctx)
+h5tools_str_region_prefix(h5tools_str_t *str /*in,out*/, const h5tool_format_t *info, hsize_t elmtno,
+ const hsize_t *ptdata, h5tools_context_t *ctx)
{
- size_t i = 0;
+ size_t i = 0;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims);
h5tools_str_reset(str);
calc_acc_pos(ctx->ndims, elmtno, ctx->acc, ctx->pos);
- if(ctx->ndims > 0) {
+ if (ctx->ndims > 0) {
/* Print the index values */
- for(i = 0; i < (size_t) ctx->ndims; i++) {
- ctx->pos[i] += (unsigned long) ptdata[ctx->sm_pos+i];
+ for (i = 0; i < (size_t)ctx->ndims; i++) {
+ ctx->pos[i] += (unsigned long)ptdata[ctx->sm_pos + i];
if (i)
h5tools_str_append(str, "%s", OPT(info->idx_sep, ","));
- h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t) ctx->pos[i]);
+ h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)ctx->pos[i]);
}
}
- else /* Scalar */
+ else /* Scalar */
h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)0);
H5TOOLS_DEBUG("str=%s", str->s);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
/* Add prefix and suffix to the index */
return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: "));
@@ -367,15 +367,15 @@ h5tools_str_region_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *i
*-------------------------------------------------------------------------
*/
void
-h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace,
- const h5tool_format_t *info, h5tools_context_t *ctx)
+h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, const h5tool_format_t *info,
+ h5tools_context_t *ctx)
{
- hsize_t start[H5S_MAX_RANK];
- hsize_t stride[H5S_MAX_RANK];
- hsize_t count[H5S_MAX_RANK];
- hsize_t block[H5S_MAX_RANK];
- int j;
- int ndims = H5Sget_simple_extent_ndims(rspace);
+ hsize_t start[H5S_MAX_RANK];
+ hsize_t stride[H5S_MAX_RANK];
+ hsize_t count[H5S_MAX_RANK];
+ hsize_t block[H5S_MAX_RANK];
+ int j;
+ int ndims = H5Sget_simple_extent_ndims(rspace);
H5Sget_regular_hyperslab(rspace, start, stride, count, block);
@@ -383,7 +383,7 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace,
/* Start coordinates */
h5tools_str_append(str, "%s%s ", info->line_indent, START);
- for(j = 0; j < ndims; j++)
+ for (j = 0; j < ndims; j++)
h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", start[j]);
h5tools_str_append(str, ")");
h5tools_str_append(str, "%s", "\n");
@@ -391,7 +391,7 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace,
/* Stride coordinates */
h5tools_str_append(str, "%s ", STRIDE);
- for(j = 0; j < ndims; j++)
+ for (j = 0; j < ndims; j++)
h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", stride[j]);
h5tools_str_append(str, ")");
h5tools_str_append(str, "%s", "\n");
@@ -399,9 +399,9 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace,
/* Count coordinates */
h5tools_str_append(str, "%s ", COUNT);
- for(j = 0; j < ndims; j++) {
- if(count[j] == H5S_UNLIMITED)
- h5tools_str_append(str, "%s%s", j ? "," : "(","H5S_UNLIMITED");
+ for (j = 0; j < ndims; j++) {
+ if (count[j] == H5S_UNLIMITED)
+ h5tools_str_append(str, "%s%s", j ? "," : "(", "H5S_UNLIMITED");
else
h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", count[j]);
}
@@ -411,9 +411,9 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace,
/* Block coordinates */
h5tools_str_append(str, "%s ", BLOCK);
- for(j = 0; j < ndims; j++) {
- if(block[j] == H5S_UNLIMITED)
- h5tools_str_append(str, "%s%s", j ? "," : "(","H5S_UNLIMITED");
+ for (j = 0; j < ndims; j++) {
+ if (block[j] == H5S_UNLIMITED)
+ h5tools_str_append(str, "%s%s", j ? "," : "(", "H5S_UNLIMITED");
else
h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", block[j]);
}
@@ -432,45 +432,46 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace,
*-------------------------------------------------------------------------
*/
void
-h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace,
- const h5tool_format_t *info)
+h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace, const h5tool_format_t *info)
{
- hssize_t snblocks;
+ hssize_t snblocks;
/*
* This function fails if the rspace does not have blocks.
*/
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
snblocks = H5Sget_select_hyper_nblocks(rspace);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Print block information */
- if(snblocks > 0) {
- hsize_t alloc_size;
- hsize_t nblocks;
- hsize_t *ptdata;
- hsize_t u;
- unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace);
-
- nblocks = (hsize_t)snblocks;
+ if (snblocks > 0) {
+ hsize_t alloc_size;
+ hsize_t nblocks;
+ hsize_t *ptdata;
+ hsize_t u;
+ unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace);
+
+ nblocks = (hsize_t)snblocks;
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
- HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
+ HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
+ ptdata = (hsize_t *)HDmalloc((size_t)alloc_size);
H5Sget_select_hyper_blocklist(rspace, (hsize_t)0, nblocks, ptdata);
- for(u = 0; u < nblocks; u++) {
+ for (u = 0; u < nblocks; u++) {
unsigned v;
- h5tools_str_append(str, info->dset_blockformat_pre, u ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)u);
+ h5tools_str_append(str, info->dset_blockformat_pre, u ? "," OPTIONAL_LINE_BREAK " " : "",
+ (unsigned long)u);
/* Start coordinates and opposite corner */
- for(v = 0; v < ndims; v++)
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(",
- ptdata[u * 2 * ndims + v]);
+ for (v = 0; v < ndims; v++)
+ h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(", ptdata[u * 2 * ndims + v]);
- for(v = 0; v < ndims; v++)
+ for (v = 0; v < ndims; v++)
h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : ")-(",
- ptdata[u * 2 * ndims + v + ndims]);
+ ptdata[u * 2 * ndims + v + ndims]);
h5tools_str_append(str, ")");
}
@@ -491,41 +492,41 @@ h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace,
*-------------------------------------------------------------------------
*/
void
-h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace,
- const h5tool_format_t *info)
+h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace, const h5tool_format_t *info)
{
- hssize_t snpoints;
+ hssize_t snpoints;
/*
* This function fails if the rspace does not have points.
*/
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
snpoints = H5Sget_select_elem_npoints(rspace);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* Print point information */
if (snpoints > 0) {
- hsize_t alloc_size;
- hsize_t npoints;
- hsize_t *ptdata;
- hsize_t u;
- unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace);
+ hsize_t alloc_size;
+ hsize_t npoints;
+ hsize_t *ptdata;
+ hsize_t u;
+ unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace);
- npoints = (hsize_t)snpoints;
+ npoints = (hsize_t)snpoints;
alloc_size = npoints * ndims * sizeof(ptdata[0]);
- HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
+ HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
+ ptdata = (hsize_t *)HDmalloc((size_t)alloc_size);
H5Sget_select_elem_pointlist(rspace, (hsize_t)0, npoints, ptdata);
- for(u = 0; u < npoints; u++) {
+ for (u = 0; u < npoints; u++) {
unsigned v;
h5tools_str_append(str, info->dset_ptformat_pre, u ? "," OPTIONAL_LINE_BREAK " " : "",
(unsigned long)u);
- for(v = 0; v < ndims; v++)
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(",
- (ptdata[u * ndims + v]));
+ for (v = 0; v < ndims; v++)
+ h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(", (ptdata[u * ndims + v]));
h5tools_str_append(str, ")");
}
@@ -546,78 +547,77 @@ h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace,
static void
h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch)
{
- if(info->str_locale == ESCAPE_HTML) {
- if(ch <= ' ' || ch > '~')
+ if (info->str_locale == ESCAPE_HTML) {
+ if (ch <= ' ' || ch > '~')
h5tools_str_append(str, "%%%02x", ch);
else
h5tools_str_append(str, "%c", ch);
}
else {
- switch(ch) {
- case '"':
- if(!info->do_escape)
- h5tools_str_append(str, "\"");
- else
- h5tools_str_append(str, "\\\"");
- break;
- case '\\':
- if (!info->do_escape)
- h5tools_str_append(str, "\\");
- else
- h5tools_str_append(str, "\\\\");
- break;
- case '\b':
- if(!info->do_escape)
- h5tools_str_append(str, "\b");
- else
- h5tools_str_append(str, "\\b");
- break;
- case '\f':
- if(!info->do_escape)
- h5tools_str_append(str, "\f");
- else
- h5tools_str_append(str, "\\f");
- break;
- case '\n':
- if(!info->do_escape) {
- h5tools_str_append(str, "\n");
- h5tools_str_append(str, " ");
- }
- else
- h5tools_str_append(str, "\\n");
- break;
- case '\r':
- if(!info->do_escape) {
- h5tools_str_append(str, "\r");
- h5tools_str_append(str, " ");
- }
- else
- h5tools_str_append(str, "\\r");
- break;
- case '\t':
- if(!info->do_escape)
- h5tools_str_append(str, "\t");
- else
- h5tools_str_append(str, "\\t");
- break;
- default:
- if(isprint(ch))
- h5tools_str_append(str, "%c", ch);
- else
- h5tools_str_append(str, "\\%03o", ch);
+ switch (ch) {
+ case '"':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\"");
+ else
+ h5tools_str_append(str, "\\\"");
+ break;
+ case '\\':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\\");
+ else
+ h5tools_str_append(str, "\\\\");
+ break;
+ case '\b':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\b");
+ else
+ h5tools_str_append(str, "\\b");
+ break;
+ case '\f':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\f");
+ else
+ h5tools_str_append(str, "\\f");
+ break;
+ case '\n':
+ if (!info->do_escape) {
+ h5tools_str_append(str, "\n");
+ h5tools_str_append(str, " ");
+ }
+ else
+ h5tools_str_append(str, "\\n");
+ break;
+ case '\r':
+ if (!info->do_escape) {
+ h5tools_str_append(str, "\r");
+ h5tools_str_append(str, " ");
+ }
+ else
+ h5tools_str_append(str, "\\r");
+ break;
+ case '\t':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\t");
+ else
+ h5tools_str_append(str, "\\t");
+ break;
+ default:
+ if (isprint(ch))
+ h5tools_str_append(str, "%c", ch);
+ else
+ h5tools_str_append(str, "\\%03o", ch);
- break;
+ break;
}
}
}
void
-h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info,
- h5tools_context_t *ctx)
+h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, h5tools_context_t *ctx)
{
unsigned u, indentlevel = 0;
/* Write new prefix */
- if(ctx->indent_level > 0)
+ if (ctx->indent_level > 0)
indentlevel = ctx->indent_level;
else
/*
@@ -628,7 +628,7 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info,
*/
indentlevel = ctx->default_indent_level;
- for(u = 0; u < indentlevel; u++)
+ for (u = 0; u < indentlevel; u++)
h5tools_str_append(str, "%s", OPT(info->line_indent, ""));
}
@@ -642,24 +642,24 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info,
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container,
- hid_t type, void *vp, h5tools_context_t *ctx)
+h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, hid_t type, void *vp,
+ h5tools_context_t *ctx)
{
- size_t nsize, offset, size=0, nelmts, start;
+ size_t nsize, offset, size = 0, nelmts, start;
H5T_sign_t nsign;
- char *name = NULL;
+ char * name = NULL;
unsigned char *ucp_vp = (unsigned char *)vp;
- char *cp_vp = (char *)vp;
- hid_t memb = H5I_INVALID_HID;
- hid_t obj = H5I_INVALID_HID;
+ char * cp_vp = (char *)vp;
+ hid_t memb = H5I_INVALID_HID;
+ hid_t obj = H5I_INVALID_HID;
static char fmt_llong[8], fmt_ullong[8];
H5T_str_t pad;
H5T_class_t type_class;
- char *ret_value = NULL;
+ char * ret_value = NULL;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
/* Build default formats for long long types */
- if(!fmt_llong[0]) {
+ if (!fmt_llong[0]) {
HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH);
HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH);
}
@@ -669,147 +669,156 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
nsize = H5Tget_size(type);
nsign = H5Tget_sign(type);
- if(info->raw) {
+ if (info->raw) {
size_t i;
H5TOOLS_DEBUG("info->raw");
- if(1 == nsize)
+ if (1 == nsize)
h5tools_str_append(str, OPT(info->fmt_raw, "0x%02x"), ucp_vp[0]);
else
- for(i = 0; i < nsize; i++) {
- if(i)
+ for (i = 0; i < nsize; i++) {
+ if (i)
h5tools_str_append(str, ":");
h5tools_str_append(str, OPT(info->fmt_raw, "%02x"), ucp_vp[i]);
}
}
else {
H5TOOLS_DEBUG("H5Tget_class(type)");
- if((type_class = H5Tget_class(type)) < 0) {
+ if ((type_class = H5Tget_class(type)) < 0) {
H5TOOLS_ENDDEBUG(" with %s", "NULL");
return NULL;
}
switch (type_class) {
case H5T_FLOAT:
H5TOOLS_DEBUG("H5T_FLOAT");
- if(sizeof(float) == nsize) {
+ if (sizeof(float) == nsize) {
/* if (H5Tequal(type, H5T_NATIVE_FLOAT)) */
float tempfloat;
HDmemcpy(&tempfloat, vp, sizeof(float));
h5tools_str_append(str, OPT(info->fmt_float, "%g"), (double)tempfloat);
}
- else if(sizeof(double) == nsize) {
+ else if (sizeof(double) == nsize) {
/* if (H5Tequal(type, H5T_NATIVE_DOUBLE)) */
double tempdouble;
HDmemcpy(&tempdouble, vp, sizeof(double));
h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
}
- else if(sizeof(long double) == nsize) {
+ else if (sizeof(long double) == nsize) {
/* if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) */
long double templdouble;
HDmemcpy(&templdouble, vp, sizeof(long double));
- h5tools_str_append(str, OPT(info->fmt_double, "%Lf"), templdouble);
+ h5tools_str_append(str, "%Lg", templdouble);
#endif
}
- break;
+ else {
+ size_t i;
- case H5T_STRING:
- {
- unsigned int i;
- char quote = '\0';
- char *s;
-
- H5TOOLS_DEBUG("H5T_STRING");
- 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 **)((void *)cp_vp);
- if(s != NULL)
- size = HDstrlen(s);
+ for (i = 0; i < nsize; i++) {
+ if (i)
+ h5tools_str_append(str, ":");
+ h5tools_str_append(str, OPT(info->fmt_raw, "%02x"), ucp_vp[i]);
}
- else {
- s = cp_vp;
- size = H5Tget_size(type);
- }
- pad = H5Tget_strpad(type);
+ }
+ break;
- /* 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++) {
- unsigned 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);
- }
+ case H5T_STRING: {
+ unsigned int i;
+ char quote = '\0';
+ char * s;
+
+ H5TOOLS_DEBUG("H5T_STRING");
+ 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 **)((void *)cp_vp);
+ if (s != NULL)
+ size = HDstrlen(s);
+ }
+ else {
+ s = cp_vp;
+ size = H5Tget_size(type);
+ }
+ pad = H5Tget_strpad(type);
- /* Print the character */
- h5tools_print_char(str, info, s[i]);
+ /* 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++) {
+ unsigned 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 repeat count */
- if(info->str_repeat && j > info->str_repeat) {
+ /* 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);
-#endif /* REPEAT_VERBOSE */
- quote = '\0';
- i += j - 1;
- }
+ h5tools_str_append(str, "%c*%d", quote, j - 1);
+#endif /* REPEAT_VERBOSE */
+ 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 */
- }
- break;
+ if (i == 0)
+ /*empty string*/
+ h5tools_str_append(str, "\"\"");
+ } /* end else */
+ } break;
case H5T_INTEGER:
H5TOOLS_DEBUG("H5T_INTEGER");
- if(sizeof(char) == nsize) {
- if(info->ascii)
- h5tools_print_char(str, info, (char) (*ucp_vp));
- else if(H5T_SGN_NONE == nsign) {
+ if (sizeof(char) == nsize) {
+ if (info->ascii)
+ h5tools_print_char(str, info, (char)(*ucp_vp));
+ else if (H5T_SGN_NONE == nsign) {
unsigned char tempuchar;
HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char));
- if(packed_bits_num) {
- if(packed_data_offset >= 8 * sizeof(unsigned char))
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(unsigned char))
tempuchar = 0;
else
- tempuchar = (unsigned char)((unsigned long long)(tempuchar >> packed_data_offset) & packed_data_mask);
+ tempuchar =
+ (unsigned char)((unsigned long long)(tempuchar >> packed_data_offset) &
+ packed_data_mask);
}
h5tools_str_append(str, OPT(info->fmt_uchar, "%hhu"), tempuchar);
}
@@ -817,22 +826,24 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
signed char tempchar;
HDmemcpy(&tempchar, cp_vp, sizeof(char));
- if(packed_bits_num) {
- if(packed_data_offset >= 8 * sizeof(char))
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(char))
tempchar = 0;
else
- tempchar = (signed char)((unsigned long long)(tempchar >> packed_data_offset) & packed_data_mask);
+ tempchar =
+ (signed char)((unsigned long long)(tempchar >> packed_data_offset) &
+ packed_data_mask);
}
h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar);
}
} /* end if (sizeof(char) == nsize) */
- else if(sizeof(int) == nsize) {
- if(H5T_SGN_NONE == nsign) {
+ else if (sizeof(int) == nsize) {
+ if (H5T_SGN_NONE == nsign) {
unsigned int tempuint;
HDmemcpy(&tempuint, vp, sizeof(unsigned int));
- if(packed_bits_num) {
- if(packed_data_offset >= 8 * sizeof(unsigned int))
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(unsigned int))
tempuint = 0;
else
tempuint = (unsigned)((tempuint >> packed_data_offset) & packed_data_mask);
@@ -843,25 +854,28 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
int tempint;
HDmemcpy(&tempint, vp, sizeof(int));
- if(packed_bits_num) {
- if(packed_data_offset >= 8 * sizeof(int))
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(int))
tempint = 0;
else
- tempint = (int)((unsigned long long)(tempint >> packed_data_offset) & packed_data_mask);
+ tempint = (int)((unsigned long long)(tempint >> packed_data_offset) &
+ packed_data_mask);
}
h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
}
} /* end if (sizeof(int) == nsize) */
- else if(sizeof(short) == nsize) {
- if(H5T_SGN_NONE == nsign) {
+ else if (sizeof(short) == nsize) {
+ if (H5T_SGN_NONE == nsign) {
unsigned short tempushort;
HDmemcpy(&tempushort, vp, sizeof(unsigned short));
- if(packed_bits_num) {
- if(packed_data_offset >= 8 * sizeof(unsigned short))
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(unsigned short))
tempushort = 0;
else
- tempushort = (unsigned short)((unsigned long long)(tempushort >> packed_data_offset) & packed_data_mask);
+ tempushort =
+ (unsigned short)((unsigned long long)(tempushort >> packed_data_offset) &
+ packed_data_mask);
}
h5tools_str_append(str, OPT(info->fmt_ushort, "%hu"), tempushort);
}
@@ -869,22 +883,23 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
short tempshort;
HDmemcpy(&tempshort, vp, sizeof(short));
- if(packed_bits_num) {
- if(packed_data_offset >= 8 * sizeof(short))
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(short))
tempshort = 0;
else
- tempshort = (short)((unsigned long long)(tempshort >> packed_data_offset) & packed_data_mask);
+ tempshort = (short)((unsigned long long)(tempshort >> packed_data_offset) &
+ packed_data_mask);
}
h5tools_str_append(str, OPT(info->fmt_short, "%hd"), tempshort);
}
} /* end if (sizeof(short) == nsize) */
- else if(sizeof(long) == nsize) {
- if(H5T_SGN_NONE == nsign) {
+ else if (sizeof(long) == nsize) {
+ if (H5T_SGN_NONE == nsign) {
unsigned long tempulong;
HDmemcpy(&tempulong, vp, sizeof(unsigned long));
- if(packed_bits_num) {
- if(packed_data_offset >= 8 * 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;
@@ -895,23 +910,24 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
long templong;
HDmemcpy(&templong, vp, sizeof(long));
- if(packed_bits_num) {
- if(packed_data_offset >= 8 * sizeof(long))
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(long))
templong = 0;
else
- templong = (long)((unsigned long long)(templong >> packed_data_offset) & packed_data_mask);
+ templong = (long)((unsigned long long)(templong >> packed_data_offset) &
+ packed_data_mask);
}
h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
}
} /* end if (sizeof(long) == nsize) */
#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG
- else if(sizeof(long long) == nsize) {
- if(H5T_SGN_NONE == nsign) {
+ else if (sizeof(long long) == nsize) {
+ if (H5T_SGN_NONE == nsign) {
unsigned long long tempullong;
HDmemcpy(&tempullong, vp, sizeof(unsigned long long));
- if(packed_bits_num) {
- if(packed_data_offset >= 8 * 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;
@@ -922,8 +938,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
long long templlong;
HDmemcpy(&templlong, vp, sizeof(long long));
- if(packed_bits_num) {
- if(packed_data_offset >= 8 * 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;
@@ -931,19 +947,19 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong);
}
} /* end if (sizeof(long long) == nsize) */
-#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */
+#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */
break;
case H5T_COMPOUND:
H5TOOLS_DEBUG("H5T_COMPOUND");
- if(ctx->cmpd_listv) { /* there is <list_of_fields> */
- unsigned save_indent_level; /* The indentation level */
- size_t curr_field; /* Current field to display */
- int i = 0; /* Local index variable */
- unsigned x = 0; /* Local index variable */
- const H5LD_memb_t * const *listv; /* Vector of information for <list_of_fields> */
-
- listv = ctx->cmpd_listv;
+ if (ctx->cmpd_listv) { /* there is <list_of_fields> */
+ unsigned save_indent_level; /* The indentation level */
+ size_t curr_field; /* Current field to display */
+ int i = 0; /* Local index variable */
+ unsigned x = 0; /* Local index variable */
+ const H5LD_memb_t *const *listv; /* Vector of information for <list_of_fields> */
+
+ listv = ctx->cmpd_listv;
ctx->cmpd_listv = NULL;
h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
@@ -954,39 +970,38 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
* put in "{", "}", ",", member name and value accordingly.
*/
save_indent_level = ctx->indent_level;
- for(curr_field = 0; listv[curr_field] != NULL; curr_field++) {
- if(curr_field)
- h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK));
+ for (curr_field = 0; listv[curr_field] != NULL; curr_field++) {
+ if (curr_field)
+ h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", " OPTIONAL_LINE_BREAK));
else
h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
- if(info->arr_linebreak)
+ if (info->arr_linebreak)
h5tools_str_indent(str, info, ctx);
/* Process members of each field */
- for(i = 0; listv[curr_field]->names[i] != NULL; i++) {
+ for (i = 0; listv[curr_field]->names[i] != NULL; i++) {
h5tools_str_append(str, OPT(info->cmpd_name, ""), listv[curr_field]->names[i]);
- if(i) {
+ if (i) {
ctx->indent_level++;
h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
}
}
- h5tools_str_sprint(str, info, container, listv[curr_field]->last_tid, cp_vp + listv[curr_field]->tot_offset, ctx);
- if(ctx->indent_level > 0)
- for(x = ctx->indent_level; x > 0; x--)
+ h5tools_str_sprint(str, info, container, listv[curr_field]->last_tid,
+ cp_vp + listv[curr_field]->tot_offset, ctx);
+ if (ctx->indent_level > 0)
+ for (x = ctx->indent_level; x > 0; x--)
h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
ctx->indent_level = save_indent_level;
}
-
- if(info->arr_linebreak) {
+ 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, "}"));
ctx->cmpd_listv = info->cmpd_listv;
-
}
else {
int retvalue;
@@ -1000,13 +1015,13 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
ctx->indent_level++;
- for(j = 0; j < nmembs; j++) {
- if(j)
- h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK));
+ 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, ""));
- if(info->arr_linebreak)
+ if (info->arr_linebreak)
h5tools_str_indent(str, info, ctx);
/* The name */
@@ -1016,7 +1031,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
/* The value */
offset = H5Tget_member_offset(type, j);
- memb = H5Tget_member_type(type, j);
+ memb = H5Tget_member_type(type, j);
h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx);
@@ -1024,7 +1039,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
ctx->indent_level--;
- if(info->arr_linebreak) {
+ if (info->arr_linebreak) {
h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
h5tools_str_indent(str, info, ctx);
}
@@ -1033,30 +1048,28 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
break;
- case H5T_ENUM:
- {
- char enum_name[1024];
+ case H5T_ENUM: {
+ char enum_name[1024];
- H5TOOLS_DEBUG("H5T_ENUM");
- 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;
- if(1 == nsize)
- h5tools_str_append(str, "0x%02x", ucp_vp[0]);
- else
- for(i = 0; i < nsize; i++)
- h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
- }
+ H5TOOLS_DEBUG("H5T_ENUM");
+ 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;
+ if (1 == nsize)
+ h5tools_str_append(str, "0x%02x", ucp_vp[0]);
+ else
+ for (i = 0; i < nsize; i++)
+ h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
}
- break;
+ } break;
case H5T_REFERENCE:
H5TOOLS_DEBUG("H5T_REFERENCE");
- if(h5tools_str_is_zero(vp, nsize))
+ if (h5tools_str_is_zero(vp, nsize))
h5tools_str_append(str, "NULL");
else {
- if(nsize == H5R_DSET_REG_REF_BUF_SIZE) {
+ if (nsize == H5R_DSET_REG_REF_BUF_SIZE) {
/* if (H5Tequal(type, H5T_STD_REF_DSETREG)) */
H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_DSETREG");
h5tools_str_append(str, H5_TOOLS_DATASET);
@@ -1065,16 +1078,16 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
else if (nsize == H5R_OBJ_REF_BUF_SIZE) {
/* if (H5Tequal(type, H5T_STD_REF_OBJ)) */
/*
- * Object references -- show the type and OID of the referenced object.
- */
- H5O_info_t oi;
+ * Object references -- show the type and OID of the referenced object.
+ */
+ H5O_info_t oi;
H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_OBJ");
obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp);
H5Oget_info2(obj, &oi, H5O_INFO_BASIC);
/* Print object type and close object */
- switch(oi.type) {
+ switch (oi.type) {
case H5O_TYPE_GROUP:
h5tools_str_append(str, H5_TOOLS_GROUP);
break;
@@ -1090,13 +1103,13 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
- h5tools_str_append(str, "%u-", (unsigned) oi.type);
+ h5tools_str_append(str, "%u-", (unsigned)oi.type);
break;
} /* end switch */
H5Oclose(obj);
/* Print OID */
- if(info->obj_hidefileno)
+ 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);
@@ -1106,132 +1119,127 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
break;
- case H5T_ARRAY:
- {
- int k, ndims;
- hsize_t i, dims[H5S_MAX_RANK], temp_nelmts;
- static int is_next_arry_elmt = 0;
-
- H5TOOLS_DEBUG("H5T_ARRAY");
- /* 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, "["));
+ case H5T_ARRAY: {
+ int k, ndims;
+ hsize_t i, dims[H5S_MAX_RANK], temp_nelmts;
+ static int is_next_arry_elmt = 0;
+
+ H5TOOLS_DEBUG("H5T_ARRAY");
+ /* 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++;
+ ctx->indent_level++;
- for(i = 0; i < nelmts; i++) {
- if(i)
- h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK));
+ 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);
+ 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;
+ } /* 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, " ");
+ h5tools_str_append(str, "%s", "\n ");
+ h5tools_str_indent(str, info, ctx);
+ }
+ /* otherwise just add space */
+ else
+ h5tools_str_append(str, " ");
- } /* end else if */
+ } /* 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 */
+ /* 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--;
+ 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);
- }
- break;
+ /* 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);
+ } break;
- case H5T_VLEN:
- {
- unsigned int i;
+ case H5T_VLEN: {
+ unsigned int i;
- H5TOOLS_DEBUG("H5T_VLEN");
- /* Get the VL sequences's base datatype for each element */
- memb = H5Tget_super(type);
- size = H5Tget_size(memb);
+ H5TOOLS_DEBUG("H5T_VLEN");
+ /* 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 *)((void *)cp_vp))->len;
+ /* Get the number of sequence elements */
+ nelmts = ((hvl_t *)((void *)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 */
-#endif /* LATER */
+ 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 *)((void *)cp_vp))->p)) + i * size, ctx);
+ /* Dump the array element */
+ h5tools_str_sprint(str, info, container, memb,
+ ((char *)(((hvl_t *)((void *)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);
- }
- break;
+ h5tools_str_append(str, "%s", OPT(info->vlen_suf, ")"));
+ H5Tclose(memb);
+ } break;
case H5T_TIME:
case H5T_BITFIELD:
- case H5T_OPAQUE:
- {
- /* All other types get printed as hexadecimal */
- size_t i;
-
- H5TOOLS_DEBUG("OTHER");
- if(1 == nsize)
- h5tools_str_append(str, "0x%02x", ucp_vp[0]);
- else
- for(i = 0; i < nsize; i++)
- h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
- }
- break;
+ case H5T_OPAQUE: {
+ /* All other types get printed as hexadecimal */
+ size_t i;
+
+ H5TOOLS_DEBUG("OTHER");
+ if (1 == nsize)
+ h5tools_str_append(str, "0x%02x", ucp_vp[0]);
+ else
+ for (i = 0; i < nsize; i++)
+ h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
+ } break;
case H5T_NO_CLASS:
case H5T_NCLASSES:
@@ -1247,7 +1255,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: h5tools_str_sprint_reference
*
@@ -1259,19 +1266,19 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
void
h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp)
{
- hid_t obj = H5I_INVALID_HID;
- hid_t region = H5I_INVALID_HID;
- char ref_name[1024];
- const char *path;
+ hid_t obj = H5I_INVALID_HID;
+ hid_t region = H5I_INVALID_HID;
+ char ref_name[1024];
+ const char *path;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
h5tools_str_append(str, " \"");
obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, vp);
- if(obj >= 0) {
+ if (obj >= 0) {
region = H5Rget_region(container, H5R_DATASET_REGION, vp);
- if(region >= 0) {
- H5Rget_name(obj, H5R_DATASET_REGION, vp, (char*) ref_name, 1024);
+ if (region >= 0) {
+ H5Rget_name(obj, H5R_DATASET_REGION, vp, (char *)ref_name, 1024);
h5tools_str_append(str, "%s", ref_name);
H5Sclose(region);
@@ -1280,14 +1287,14 @@ h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp)
} /* end if (obj >= 0) */
else {
/* Print name */
- path = lookup_ref_path(*(haddr_t *) vp);
- if(path) {
+ path = lookup_ref_path(*(haddr_t *)vp);
+ if (path) {
h5tools_str_append(str, path);
} /* end if */
}
h5tools_str_append(str, "\"");
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
}
/*-------------------------------------------------------------------------
@@ -1307,70 +1314,70 @@ h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp)
*-------------------------------------------------------------------------
*/
static char *
-h5tools_escape(char *s/*in,out*/, size_t size)
+h5tools_escape(char *s /*in,out*/, size_t size)
{
- register size_t i;
- const char *escape;
- char octal[8];
- size_t n = HDstrlen(s);
+ register size_t i;
+ const char * escape;
+ char octal[8];
+ size_t n = HDstrlen(s);
- for(i = 0; i < n; i++) {
+ for (i = 0; i < n; i++) {
switch (s[i]) {
- case '\'':
- escape = "\\\'";
- break;
- case '\"':
- escape = "\\\"";
- break;
- case '\\':
- escape = "\\\\";
- break;
- case '\?':
- escape = "\\\?";
- break;
- case '\a':
- escape = "\\a";
- break;
- case '\b':
- escape = "\\b";
- break;
- case '\f':
- escape = "\\f";
- break;
- case '\n':
- escape = "\\n";
- break;
- case '\r':
- escape = "\\r";
- break;
- case '\t':
- escape = "\\t";
- break;
- case '\v':
- escape = "\\v";
- break;
- default:
- if(!isprint(s[i])) {
- HDsnprintf(octal, sizeof(octal), "\\%03o", (unsigned char) s[i]);
- escape = octal;
- }
- else
- escape = NULL;
+ case '\'':
+ escape = "\\\'";
+ break;
+ case '\"':
+ escape = "\\\"";
+ break;
+ case '\\':
+ escape = "\\\\";
+ break;
+ case '\?':
+ escape = "\\\?";
+ break;
+ case '\a':
+ escape = "\\a";
+ break;
+ case '\b':
+ escape = "\\b";
+ break;
+ case '\f':
+ escape = "\\f";
+ break;
+ case '\n':
+ escape = "\\n";
+ break;
+ case '\r':
+ escape = "\\r";
+ break;
+ case '\t':
+ escape = "\\t";
+ break;
+ case '\v':
+ escape = "\\v";
+ break;
+ default:
+ if (!isprint(s[i])) {
+ HDsnprintf(octal, sizeof(octal), "\\%03o", (unsigned char)s[i]);
+ escape = octal;
+ }
+ else
+ escape = NULL;
- break;
+ break;
}
- if(escape) {
+ if (escape) {
size_t esc_size = HDstrlen(escape);
- if(n + esc_size + 1 > size)
+ if (n + esc_size + 1 > size)
/*would overflow*/
return NULL;
HDmemmove(s + i + esc_size, s + i + 1, n - i); /*make room*/
- HDmemcpy(s + i, escape, esc_size); /*insert*/
- n += esc_size - 1; /* adjust total string size */
- i += esc_size; /* adjust string position */
+ HDmemcpy(s + i, escape, esc_size); /*insert*/
+ n += esc_size - 1; /* adjust total string size */
+ i += esc_size; /* adjust string position */
}
}
@@ -1391,10 +1398,10 @@ h5tools_escape(char *s/*in,out*/, size_t size)
static hbool_t
h5tools_str_is_zero(const void *_mem, size_t size)
{
- const unsigned char *mem = (const unsigned char *) _mem;
+ const unsigned char *mem = (const unsigned char *)_mem;
- while(size-- > 0)
- if(mem[size])
+ while (size-- > 0)
+ if (mem[size])
return FALSE;
return TRUE;
@@ -1417,30 +1424,31 @@ h5tools_str_is_zero(const void *_mem, size_t size)
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_replace ( const char *string, const char *substr, const char *replacement )
+h5tools_str_replace(const char *string, const char *substr, const char *replacement)
{
char *tok = NULL;
char *newstr = NULL;
char *head = NULL;
- if(substr == NULL || replacement == NULL)
+ if (substr == NULL || replacement == NULL)
return HDstrdup(string);
newstr = HDstrdup(string);
- head = newstr;
- while((tok = HDstrstr(head, substr))) {
+ head = newstr;
+ while ((tok = HDstrstr(head, substr))) {
char *oldstr;
oldstr = newstr;
newstr = (char *)HDmalloc(HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement) + 1);
- if(newstr == NULL) {
+ if (newstr == NULL) {
HDfree(oldstr);
return NULL;
}
HDmemcpy(newstr, oldstr, (size_t)(tok - oldstr));
HDmemcpy(newstr + (tok - oldstr), replacement, HDstrlen(replacement));
- HDmemcpy(newstr + (tok - oldstr) + HDstrlen(replacement), tok + HDstrlen(substr), HDstrlen(oldstr) - HDstrlen(substr) - (size_t)(tok - oldstr));
- HDmemset(newstr + HDstrlen (oldstr) - HDstrlen(substr) + HDstrlen(replacement) , 0, 1);
+ HDmemcpy(newstr + (tok - oldstr) + HDstrlen(replacement), tok + HDstrlen(substr),
+ HDstrlen(oldstr) - HDstrlen(substr) - (size_t)(tok - oldstr));
+ HDmemset(newstr + HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement), 0, 1);
/* move back head right after the last replacement */
head = newstr + (tok - oldstr) + HDstrlen(replacement);
HDfree(oldstr);
@@ -1448,4 +1456,3 @@ h5tools_str_replace ( const char *string, const char *substr, const char *replac
return newstr;
}
-
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index c9ce2ea..ad43590 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,36 +15,35 @@
* Programmer: Bill Wendling
* Monday, 19. February 2001
*/
-#ifndef H5TOOLS_STR_H__
-#define H5TOOLS_STR_H__
+#ifndef H5TOOLS_STR_H
+#define H5TOOLS_STR_H
typedef struct h5tools_str_t {
- char *s; /*allocate string */
- size_t len; /*length of actual value */
- size_t nalloc; /*allocated size of string */
+ char * s; /*allocate string */
+ size_t len; /*length of actual value */
+ size_t nalloc; /*allocated size of string */
} h5tools_str_t;
-H5TOOLS_DLL void h5tools_str_close(h5tools_str_t *str);
-H5TOOLS_DLL size_t h5tools_str_len(h5tools_str_t *str);
-H5TOOLS_DLL char *h5tools_str_append(h5tools_str_t *str, const char *fmt, ...);
-H5TOOLS_DLL char *h5tools_str_reset(h5tools_str_t *str);
-H5TOOLS_DLL char *h5tools_str_trunc(h5tools_str_t *str, size_t size);
-H5TOOLS_DLL char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt);
-H5TOOLS_DLL char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, h5tools_context_t *ctx);
+H5TOOLS_DLL void h5tools_str_close(h5tools_str_t *str);
+H5TOOLS_DLL size_t h5tools_str_len(h5tools_str_t *str);
+H5TOOLS_DLL char * h5tools_str_append(h5tools_str_t *str, const char *fmt, ...);
+H5TOOLS_DLL char * h5tools_str_reset(h5tools_str_t *str);
+H5TOOLS_DLL char * h5tools_str_trunc(h5tools_str_t *str, size_t size);
+H5TOOLS_DLL char * h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt);
+H5TOOLS_DLL char * h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info, hsize_t elmtno,
+ h5tools_context_t *ctx);
/*
* new functions needed to display region reference data
*/
-H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, hsize_t *ptdata, h5tools_context_t *ctx);
-H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5tool_format_t *, h5tools_context_t *ctx);
-H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
-H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
-H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp);
-H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info,
- hid_t container, hid_t type, void *vp,
- h5tools_context_t *ctx);
-H5TOOLS_DLL char *h5tools_str_replace ( const char *string, const char *substr,
- const char *replacement );
+H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, hsize_t elmtno,
+ const hsize_t *ptdata, h5tools_context_t *ctx);
+H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5tool_format_t *,
+ h5tools_context_t *ctx);
+H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
+H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
+H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp);
+H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container,
+ hid_t type, void *vp, h5tools_context_t *ctx);
+H5TOOLS_DLL char *h5tools_str_replace(const char *string, const char *substr, const char *replacement);
-#endif /* H5TOOLS_STR_H__ */
+#endif /* H5TOOLS_STR_H */
diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c
index 22e4a39..fd255f0 100644
--- a/tools/lib/h5tools_type.c
+++ b/tools/lib/h5tools_type.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -26,7 +26,7 @@
hid_t
h5tools_get_little_endian_type(hid_t tid)
{
- hid_t p_type=H5I_INVALID_HID;
+ hid_t p_type = H5I_INVALID_HID;
H5T_class_t type_class;
size_t size;
H5T_sign_t sign;
@@ -35,7 +35,7 @@ h5tools_get_little_endian_type(hid_t tid)
size = H5Tget_size(tid);
sign = H5Tget_sign(tid);
- switch(type_class) {
+ switch (type_class) {
case H5T_INTEGER:
if (size == 1 && sign == H5T_SGN_2)
p_type = H5Tcopy(H5T_STD_I8LE);
@@ -93,7 +93,6 @@ h5tools_get_little_endian_type(hid_t tid)
return p_type;
} /* end h5tools_get_little_endian_type() */
-
/*-------------------------------------------------------------------------
* Function: h5tools_get_big_endian_type
*
@@ -115,7 +114,7 @@ h5tools_get_big_endian_type(hid_t tid)
size = H5Tget_size(tid);
sign = H5Tget_sign(tid);
- switch(type_class) {
+ switch (type_class) {
case H5T_INTEGER:
if (size == 1 && sign == H5T_SGN_2)
p_type = H5Tcopy(H5T_STD_I8BE);
@@ -150,7 +149,7 @@ h5tools_get_big_endian_type(hid_t tid)
else if (size == 4)
p_type = H5Tcopy(H5T_STD_B32BE);
else if (size == 8)
- p_type=H5Tcopy(H5T_STD_B64BE);
+ p_type = H5Tcopy(H5T_STD_B64BE);
break;
case H5T_TIME:
@@ -171,4 +170,3 @@ h5tools_get_big_endian_type(hid_t tid)
return p_type;
} /* end h5tools_get_big_endian_type() */
-
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index cc9270b..36333ec 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -25,14 +25,10 @@
#include "H5FDros3.h"
#endif
-/* global variables */
-unsigned h5tools_nCols = 80;
-/* ``get_option'' variables */
-int opt_err = 1; /*get_option prints errors if this is on */
-int opt_ind = 1; /*token pointer */
-const char *opt_arg; /*flag argument (or value) */
-static int h5tools_d_status = 0;
-static const char *h5tools_progname = "h5tools";
+/* Global variables */
+unsigned h5tools_nCols = 80;
+static int h5tools_d_status = 0;
+static const char *h5tools_progname = "h5tools";
/*
* The output functions need a temporary buffer to hold a piece of the
@@ -41,22 +37,21 @@ static const char *h5tools_progname = "h5tools";
* largest value suitable for your machine (for testing use a small value).
*/
/* Maximum size used in a call to malloc for a dataset */
-hsize_t H5TOOLS_MALLOCSIZE = (256 * 1024 * 1024); /* 256 MB */
+hsize_t H5TOOLS_MALLOCSIZE = (256 * 1024 * 1024); /* 256 MB */
/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */
-hsize_t H5TOOLS_BUFSIZE = ( 32 * 1024 * 1024); /* 32 MB */
-
+hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */
/* ``parallel_print'' variables */
-unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */
-char outBuff[OUTBUFF_SIZE];
-unsigned outBuffOffset;
-FILE* overflow_file = NULL;
+unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */
+char outBuff[OUTBUFF_SIZE];
+unsigned outBuffOffset;
+FILE * overflow_file = NULL;
/* local functions */
static void init_table(table_t **tbl);
#ifdef H5DUMP_DEBUG
-static void dump_table(char* tablename, table_t *table);
-#endif /* H5DUMP_DEBUG */
+static void dump_table(char *tablename, table_t *table);
+#endif /* H5DUMP_DEBUG */
static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t recorded);
/*-------------------------------------------------------------------------
@@ -66,28 +61,29 @@ static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t
*-------------------------------------------------------------------------
*/
void
-parallel_print(const char* format, ...)
+parallel_print(const char *format, ...)
{
- int bytes_written;
+ int bytes_written;
va_list ap;
HDva_start(ap, format);
- if(!g_Parallel)
+ if (!g_Parallel)
HDvprintf(format, ap);
else {
- if(overflow_file == NULL) /*no overflow has occurred yet */ {
+ if (overflow_file == NULL) /*no overflow has occurred yet */ {
bytes_written = HDvsnprintf(outBuff + outBuffOffset, OUTBUFF_SIZE - outBuffOffset, format, ap);
HDva_end(ap);
HDva_start(ap, format);
- if((bytes_written < 0) || ((unsigned)bytes_written >= (OUTBUFF_SIZE - outBuffOffset))) {
+ if ((bytes_written < 0) || ((unsigned)bytes_written >= (OUTBUFF_SIZE - outBuffOffset))) {
/* Terminate the outbuff at the end of the previous output */
outBuff[outBuffOffset] = '\0';
overflow_file = HDtmpfile();
- if(overflow_file == NULL)
- HDfprintf(rawerrorstream, "warning: could not create overflow file. Output may be truncated.\n");
+ if (overflow_file == NULL)
+ HDfprintf(rawerrorstream,
+ "warning: could not create overflow file. Output may be truncated.\n");
else
bytes_written = HDvfprintf(overflow_file, format, ap);
}
@@ -96,12 +92,10 @@ parallel_print(const char* format, ...)
}
else
bytes_written = HDvfprintf(overflow_file, format, ap);
-
}
HDva_end(ap);
}
-
/*-------------------------------------------------------------------------
* Function: error_msg
*
@@ -126,7 +120,6 @@ error_msg(const char *fmt, ...)
HDva_end(ap);
}
-
/*-------------------------------------------------------------------------
* Function: warn_msg
*
@@ -162,171 +155,9 @@ void
help_ref_msg(FILE *output)
{
HDfprintf(output, "Try '-h' or '--help' for more information or ");
- HDfprintf(output, "see the <%s> entry in the 'HDF5 Reference Manual'.\n",h5tools_getprogname());
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: get_option
- *
- * Purpose: Determine the command-line options a user specified. We can
- * accept both short and long type command-lines.
- *
- * Return: Success: The short valued "name" of the command line
- * parameter or EOF if there are no more
- * parameters to process.
- *
- * Failure: A question mark.
- *-------------------------------------------------------------------------
- */
-int
-get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts)
-{
- static int sp = 1; /* character index in current token */
- int opt_opt = '?'; /* option character passed back to user */
-
- if (sp == 1) {
- /* check for more flag-like tokens */
- if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') {
- return EOF;
- }
- else if (HDstrcmp(argv[opt_ind], "--") == 0) {
- opt_ind++;
- return EOF;
- }
- }
-
- if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') {
- /* long command line option */
- const char *arg = &argv[opt_ind][2];
- int i;
-
- for (i = 0; l_opts && l_opts[i].name; i++) {
- size_t len = HDstrlen(l_opts[i].name);
-
- if (HDstrncmp(arg, l_opts[i].name, len) == 0) {
- /* we've found a matching long command line flag */
- opt_opt = l_opts[i].shortval;
-
- if (l_opts[i].has_arg != no_arg) {
- if (arg[len] == '=') {
- opt_arg = &arg[len + 1];
- }
- else if (l_opts[i].has_arg != optional_arg) {
- if (opt_ind < (argc - 1))
- if (argv[opt_ind + 1][0] != '-')
- opt_arg = argv[++opt_ind];
- }
- else if (l_opts[i].has_arg == require_arg) {
- if (opt_err)
- HDfprintf(rawerrorstream,
- "%s: option required for \"--%s\" flag\n",
- argv[0], arg);
-
- opt_opt = '?';
- }
- else
- opt_arg = NULL;
- }
- else {
- if (arg[len] == '=') {
- if (opt_err)
- HDfprintf(rawerrorstream,
- "%s: no option required for \"%s\" flag\n",
- argv[0], arg);
-
- opt_opt = '?';
- }
- opt_arg = NULL;
- }
- break;
- }
- }
-
- if (l_opts[i].name == NULL) {
- /* exhausted all of the l_opts we have and still didn't match */
- if (opt_err)
- HDfprintf(rawerrorstream, "%s: unknown option \"%s\"\n", argv[0], arg);
-
- opt_opt = '?';
- }
-
- opt_ind++;
- sp = 1;
- }
- else {
- register char *cp; /* pointer into current token */
-
- /* short command line option */
- opt_opt = argv[opt_ind][sp];
-
- if (opt_opt == ':' || (cp = HDstrchr(opts, opt_opt)) == 0) {
- if (opt_err)
- HDfprintf(rawerrorstream, "%s: unknown option \"%c\"\n",
- argv[0], opt_opt);
-
- /* if no chars left in this token, move to next token */
- if (argv[opt_ind][++sp] == '\0') {
- opt_ind++;
- sp = 1;
- }
- return '?';
- }
-
- if (*++cp == ':') {
- /* if a value is expected, get it */
- if (argv[opt_ind][sp + 1] != '\0') {
- /* flag value is rest of current token */
- opt_arg = &argv[opt_ind++][sp + 1];
- }
- else if (++opt_ind >= argc) {
- if (opt_err)
- HDfprintf(rawerrorstream,
- "%s: value expected for option \"%c\"\n",
- argv[0], opt_opt);
-
- opt_opt = '?';
- }
- else {
- /* flag value is next token */
- opt_arg = argv[opt_ind++];
- }
-
- sp = 1;
- }
- /* wildcard argument */
- else if (*cp == '*') {
- /* check the next argument */
- opt_ind++;
- /* we do have an extra argument, check if not last */
- if ( (opt_ind+1) < argc ) {
- if ( argv[opt_ind][0] != '-' ) {
- opt_arg = argv[opt_ind++];
- }
- else {
- opt_arg = NULL;
- }
- }
- else {
- opt_arg = NULL;
- }
- }
- else {
- /* set up to look at next char in token, next time */
- if (argv[opt_ind][++sp] == '\0') {
- /* no more in current token, so setup next token */
- opt_ind++;
- sp = 1;
- }
- opt_arg = NULL;
- }
- }
-
- /* return the current flag character found */
- return opt_opt;
+ HDfprintf(output, "see the <%s> entry in the 'HDF5 Reference Manual'.\n", h5tools_getprogname());
}
-
/*****************************************************************************
*
* Function: parse_tuple()
@@ -391,22 +222,16 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
*****************************************************************************
*/
herr_t
-parse_tuple(const char *start,
- int sep,
- char **cpy_out,
- unsigned *nelems,
- char ***ptrs_out)
+parse_tuple(const char *start, int sep, char **cpy_out, unsigned *nelems, char ***ptrs_out)
{
- char *elem_ptr = NULL;
- char *dest_ptr = NULL;
- unsigned elems_count = 0;
- char **elems = NULL; /* more like *elems[], but complier... */
- char **elems_re = NULL; /* temporary pointer, for realloc */
- char *cpy = NULL;
- herr_t ret_value = SUCCEED;
- unsigned init_slots = 2;
-
-
+ char * elem_ptr = NULL;
+ char * dest_ptr = NULL;
+ unsigned elems_count = 0;
+ char ** elems = NULL; /* more like *elems[], but complier... */
+ char ** elems_re = NULL; /* temporary pointer, for realloc */
+ char * cpy = NULL;
+ herr_t ret_value = SUCCEED;
+ unsigned init_slots = 2;
/*****************
* SANITY-CHECKS *
@@ -431,8 +256,6 @@ parse_tuple(const char *start,
elems_count = 0;
-
-
/***********
* PREPARE *
***********/
@@ -440,22 +263,26 @@ parse_tuple(const char *start,
/* create list
*/
elems = (char **)HDmalloc(sizeof(char *) * (init_slots + 1));
- if (elems == NULL) { ret_value = FAIL; goto done; } /* CANTALLOC */
+ if (elems == NULL) {
+ ret_value = FAIL;
+ goto done;
+ } /* CANTALLOC */
/* create destination string
*/
- start++; /* advance past opening paren '(' */
+ start++; /* advance past opening paren '(' */
cpy = (char *)HDmalloc(sizeof(char) * (HDstrlen(start))); /* no +1; less '(' */
- if (cpy == NULL) { ret_value = FAIL; goto done; } /* CANTALLOC */
+ if (cpy == NULL) {
+ ret_value = FAIL;
+ goto done;
+ } /* CANTALLOC */
/* set pointers
*/
- dest_ptr = cpy; /* start writing copy here */
- elem_ptr = cpy; /* first element starts here */
+ dest_ptr = cpy; /* start writing copy here */
+ elem_ptr = cpy; /* first element starts here */
elems[elems_count++] = elem_ptr; /* set first element pointer into list */
-
-
/*********
* PARSE *
*********/
@@ -466,30 +293,30 @@ parse_tuple(const char *start,
if (*start == '\\') {
/* Possibly an escape digraph.
*/
- if ((*(start + 1) == '\\') ||
- (*(start + 1) == sep) )
- {
+ if ((*(start + 1) == '\\') || (*(start + 1) == sep)) {
/* Valid escape digraph of "\\" or "\<sep>".
*/
- start++; /* advance past escape char '\' */
+ start++; /* advance past escape char '\' */
*(dest_ptr++) = *(start++); /* Copy subsequent char */
/* and advance pointers. */
- } else {
- /* Not an accepted escape digraph.
- * Copy backslash character.
- */
+ }
+ else {
+ /* Not an accepted escape digraph.
+ * Copy backslash character.
+ */
*(dest_ptr++) = *(start++);
}
- } else if (*start == sep) {
+ }
+ else if (*start == sep) {
/* Non-escaped separator.
* Terminate elements substring in copy, record element, advance.
* Expand elements list if appropriate.
*/
- *(dest_ptr++) = 0; /* Null-terminate elem substring in copy */
- /* and advance pointer. */
- start++; /* Advance src pointer past separator. */
- elem_ptr = dest_ptr; /* Element pointer points to start of first */
- /* character after null sep in copy. */
+ *(dest_ptr++) = 0; /* Null-terminate elem substring in copy */
+ /* and advance pointer. */
+ start++; /* Advance src pointer past separator. */
+ elem_ptr = dest_ptr; /* Element pointer points to start of first */
+ /* character after null sep in copy. */
elems[elems_count++] = elem_ptr; /* Set elem pointer in list */
/* and increment count. */
@@ -497,8 +324,7 @@ parse_tuple(const char *start,
*/
if (elems_count == init_slots) {
init_slots *= 2;
- elems_re = (char **)realloc(elems, sizeof(char *) * \
- (init_slots + 1));
+ elems_re = (char **)realloc(elems, sizeof(char *) * (init_slots + 1));
if (elems_re == NULL) {
/* CANTREALLOC */
ret_value = FAIL;
@@ -506,24 +332,24 @@ parse_tuple(const char *start,
}
elems = elems_re;
}
- } else if (*start == ')' && *(start + 1) == '\0') {
+ }
+ else if (*start == ')' && *(start + 1) == '\0') {
/* Found terminal, non-escaped close-paren. Last element.
* Write null terminator to copy.
* Advance source pointer to gently break from loop.
* Requred to prevent ")" from always being added to last element.
*/
start++;
- } else {
+ }
+ else {
/* Copy character into destination. Advance pointers.
*/
*(dest_ptr++) = *(start++);
}
}
- *dest_ptr = '\0'; /* Null-terminate destination string. */
+ *dest_ptr = '\0'; /* Null-terminate destination string. */
elems[elems_count] = NULL; /* Null-terminate elements list. */
-
-
/********************
* PASS BACK VALUES *
********************/
@@ -535,18 +361,16 @@ parse_tuple(const char *start,
done:
if (ret_value == FAIL) {
/* CLEANUP */
- if (cpy) free(cpy);
- if (elems) free(elems);
+ if (cpy)
+ free(cpy);
+ if (elems)
+ free(elems);
}
return ret_value;
} /* parse_tuple */
-
-
-
-
/*-------------------------------------------------------------------------
* Function: indentation
*
@@ -568,7 +392,6 @@ indentation(unsigned x)
}
}
-
/*-------------------------------------------------------------------------
* Function: print_version
*
@@ -581,12 +404,10 @@ indentation(unsigned x)
void
print_version(const char *progname)
{
- PRINTSTREAM(rawoutstream, "%s: Version %u.%u.%u%s%s\n",
- progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
- ((const char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE);
+ PRINTSTREAM(rawoutstream, "%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR,
+ H5_VERS_RELEASE, ((const char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE);
}
-
/*-------------------------------------------------------------------------
* Function: init_table
*
@@ -601,14 +422,13 @@ init_table(table_t **tbl)
{
table_t *table = (table_t *)HDmalloc(sizeof(table_t));
- table->size = 20;
+ table->size = 20;
table->nobjs = 0;
- table->objs = (obj_t *)HDmalloc(table->size * sizeof(obj_t));
+ table->objs = (obj_t *)HDmalloc(table->size * sizeof(obj_t));
*tbl = table;
}
-
/*-------------------------------------------------------------------------
* Function: free_table
*
@@ -621,14 +441,15 @@ init_table(table_t **tbl)
void
free_table(table_t *table)
{
- unsigned u; /* Local index value */
+ unsigned u; /* Local index value */
/* Free the names for the objects in the table */
- for(u = 0; u < table->nobjs; u++)
- if(table->objs[u].objname)
+ for (u = 0; u < table->nobjs; u++)
+ if (table->objs[u].objname)
HDfree(table->objs[u].objname);
HDfree(table->objs);
+ HDfree(table);
}
#ifdef H5DUMP_DEBUG
@@ -642,18 +463,16 @@ free_table(table_t *table)
*-------------------------------------------------------------------------
*/
static void
-dump_table(char* tablename, table_t *table)
+dump_table(char *tablename, table_t *table)
{
unsigned u;
- PRINTSTREAM(rawoutstream,"%s: # of entries = %d\n", tablename,table->nobjs);
+ PRINTSTREAM(rawoutstream, "%s: # of entries = %d\n", tablename, table->nobjs);
for (u = 0; u < table->nobjs; u++)
- PRINTSTREAM(rawoutstream,"%a %s %d %d\n", table->objs[u].objno,
- table->objs[u].objname,
- table->objs[u].displayed, table->objs[u].recorded);
+ PRINTSTREAM(rawoutstream, "%a %s %d %d\n", table->objs[u].objno, table->objs[u].objname,
+ table->objs[u].displayed, table->objs[u].recorded);
}
-
/*-------------------------------------------------------------------------
* Function: dump_tables
*
@@ -669,8 +488,7 @@ dump_tables(find_objs_t *info)
dump_table("dset_table", info->dset_table);
dump_table("type_table", info->type_table);
}
-#endif /* H5DUMP_DEBUG */
-
+#endif /* H5DUMP_DEBUG */
/*-------------------------------------------------------------------------
* Function: search_obj
@@ -683,18 +501,17 @@ dump_tables(find_objs_t *info)
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE obj_t *
-search_obj(table_t *table, haddr_t objno)
+ search_obj(table_t *table, haddr_t objno)
{
unsigned u;
- for(u = 0; u < table->nobjs; u++)
- if(table->objs[u].objno == objno)
+ for (u = 0; u < table->nobjs; u++)
+ if (table->objs[u].objno == objno)
return &(table->objs[u]);
return NULL;
}
-
/*-------------------------------------------------------------------------
* Function: find_objs_cb
*
@@ -708,31 +525,31 @@ search_obj(table_t *table, haddr_t objno)
static herr_t
find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen, void *op_data)
{
- find_objs_t *info = (find_objs_t*)op_data;
- herr_t ret_value = 0;
+ find_objs_t *info = (find_objs_t *)op_data;
+ herr_t ret_value = 0;
- switch(oinfo->type) {
+ switch (oinfo->type) {
case H5O_TYPE_GROUP:
- if(NULL == already_seen)
+ if (NULL == already_seen)
add_obj(info->group_table, oinfo->addr, name, TRUE);
break;
case H5O_TYPE_DATASET:
- if(NULL == already_seen) {
+ if (NULL == already_seen) {
hid_t dset = H5I_INVALID_HID;
/* Add the dataset to the list of objects */
add_obj(info->dset_table, oinfo->addr, name, TRUE);
/* Check for a dataset that uses a named datatype */
- if((dset = H5Dopen2(info->fid, name, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dopen2(info->fid, name, H5P_DEFAULT)) >= 0) {
hid_t type = H5Dget_type(dset);
- if(H5Tcommitted(type) > 0) {
+ if (H5Tcommitted(type) > 0) {
H5O_info_t type_oinfo;
H5Oget_info2(type, &type_oinfo, H5O_INFO_BASIC);
- if(search_obj(info->type_table, type_oinfo.addr) == NULL)
+ if (search_obj(info->type_table, type_oinfo.addr) == NULL)
add_obj(info->type_table, type_oinfo.addr, name, FALSE);
} /* end if */
@@ -745,10 +562,10 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
break;
case H5O_TYPE_NAMED_DATATYPE:
- if(NULL == already_seen) {
+ if (NULL == already_seen) {
obj_t *found_obj;
- if((found_obj = search_obj(info->type_table, oinfo->addr)) == NULL)
+ if ((found_obj = search_obj(info->type_table, oinfo->addr)) == NULL)
add_obj(info->type_table, oinfo->addr, name, TRUE);
else {
/* Use latest version of name */
@@ -758,7 +575,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
/* Mark named datatype as having valid name */
found_obj->recorded = TRUE;
} /* end else */
- } /* end if */
+ } /* end if */
break;
case H5O_TYPE_UNKNOWN:
@@ -770,7 +587,6 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: init_objs
*
@@ -782,8 +598,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
*-------------------------------------------------------------------------
*/
herr_t
-init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
- table_t **dset_table, table_t **type_table)
+init_objs(hid_t fid, find_objs_t *info, table_t **group_table, table_t **dset_table, table_t **type_table)
{
herr_t ret_value = SUCCEED;
@@ -793,18 +608,18 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
init_table(type_table);
/* Init the find_objs_t */
- info->fid = fid;
+ info->fid = fid;
info->group_table = *group_table;
- info->type_table = *type_table;
- info->dset_table = *dset_table;
+ info->type_table = *type_table;
+ info->dset_table = *dset_table;
/* Find all shared objects */
- if((ret_value = h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC)) < 0)
+ if ((ret_value = h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "finding shared objects failed");
done:
/* Release resources */
- if(ret_value < 0) {
+ if (ret_value < 0) {
free_table(*group_table);
info->group_table = NULL;
free_table(*type_table);
@@ -815,7 +630,6 @@ done:
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: add_obj
*
@@ -831,7 +645,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
size_t u;
/* See if we need to make table larger */
- if(table->nobjs == table->size) {
+ if (table->nobjs == table->size) {
table->size *= 2;
table->objs = (struct obj_t *)HDrealloc(table->objs, table->size * sizeof(table->objs[0]));
} /* end if */
@@ -840,13 +654,12 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
u = table->nobjs++;
/* Set information about object */
- table->objs[u].objno = objno;
- table->objs[u].objname = HDstrdup(objname);
- table->objs[u].recorded = record;
+ table->objs[u].objno = objno;
+ table->objs[u].objname = HDstrdup(objname);
+ table->objs[u].recorded = record;
table->objs[u].displayed = 0;
}
-
#ifndef H5_HAVE_TMPFILE
/*-------------------------------------------------------------------------
* Function: tmpfile
@@ -887,52 +700,54 @@ tmpfile(void)
* link_info->trg_path must be freed out of this function
*-------------------------------------------------------------------------*/
int
-H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type)
+H5tools_get_symlink_info(hid_t file_id, const char *linkpath, h5tool_link_info_t *link_info,
+ hbool_t get_obj_type)
{
- htri_t l_ret;
+ htri_t l_ret;
H5O_info_t trg_oinfo;
- hid_t fapl = H5P_DEFAULT;
- hid_t lapl = H5P_DEFAULT;
- int ret_value = -1; /* init to fail */
+ hid_t fapl = H5P_DEFAULT;
+ hid_t lapl = H5P_DEFAULT;
+ int ret_value = -1; /* init to fail */
/* init */
link_info->trg_type = H5O_TYPE_UNKNOWN;
/* if path is root, return group type */
- if(!HDstrcmp(linkpath,"/")) {
+ if (!HDstrcmp(linkpath, "/")) {
link_info->trg_type = H5O_TYPE_GROUP;
H5TOOLS_GOTO_DONE(2);
}
/* check if link itself exist */
- if(H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0) {
- if(link_info->opt.msg_mode == 1)
- parallel_print("Warning: link <%s> doesn't exist \n",linkpath);
+ if (H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0) {
+ if (link_info->opt.msg_mode == 1)
+ parallel_print("Warning: link <%s> doesn't exist \n", linkpath);
H5TOOLS_GOTO_DONE(FAIL);
} /* end if */
/* get info from link */
- if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) {
- if(link_info->opt.msg_mode == 1)
- parallel_print("Warning: unable to get link info from <%s>\n",linkpath);
+ if (H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) {
+ if (link_info->opt.msg_mode == 1)
+ parallel_print("Warning: unable to get link info from <%s>\n", linkpath);
H5TOOLS_GOTO_DONE(FAIL);
} /* end if */
/* given path is hard link (object) */
- if(link_info->linfo.type == H5L_TYPE_HARD)
+ if (link_info->linfo.type == H5L_TYPE_HARD)
H5TOOLS_GOTO_DONE(2);
/* trg_path must be freed out of this function when finished using */
- if((link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) {
- if(link_info->opt.msg_mode == 1)
- parallel_print("Warning: unable to allocate buffer for <%s>\n",linkpath);
+ if ((link_info->trg_path = (char *)HDcalloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) {
+ if (link_info->opt.msg_mode == 1)
+ parallel_print("Warning: unable to allocate buffer for <%s>\n", linkpath);
H5TOOLS_GOTO_DONE(FAIL);
} /* end if */
/* get link value */
- if(H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) {
- if(link_info->opt.msg_mode == 1)
- parallel_print("Warning: unable to get link value from <%s>\n",linkpath);
+ if (H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) <
+ 0) {
+ if (link_info->opt.msg_mode == 1)
+ parallel_print("Warning: unable to get link value from <%s>\n", linkpath);
H5TOOLS_GOTO_DONE(FAIL);
} /* end if */
@@ -940,51 +755,51 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
* if link type is external link use different lapl to
* follow object in other file
*/
- if(link_info->linfo.type == H5L_TYPE_EXTERNAL) {
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if (link_info->linfo.type == H5L_TYPE_EXTERNAL) {
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
H5TOOLS_GOTO_DONE(FAIL);
- if(H5Pset_fapl_sec2(fapl) < 0)
+ if (H5Pset_fapl_sec2(fapl) < 0)
H5TOOLS_GOTO_DONE(FAIL);
- if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
+ if ((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
H5TOOLS_GOTO_DONE(FAIL);
- if(H5Pset_elink_fapl(lapl, fapl) < 0)
+ if (H5Pset_elink_fapl(lapl, fapl) < 0)
H5TOOLS_GOTO_DONE(FAIL);
} /* end if */
/* Check for retrieving object info */
- if(get_obj_type) {
+ if (get_obj_type) {
/*--------------------------------------------------------------
* if link's target object exist, get type
*/
- /* check if target object exist */
+ /* check if target object exist */
l_ret = H5Oexists_by_name(file_id, linkpath, lapl);
/* detect dangling link */
- if(l_ret == FALSE) {
+ if (l_ret == FALSE) {
H5TOOLS_GOTO_DONE(0);
}
- else if(l_ret < 0) { /* function failed */
+ else if (l_ret < 0) { /* function failed */
H5TOOLS_GOTO_DONE(FAIL);
}
/* get target object info */
- if(H5Oget_info_by_name2(file_id, linkpath, &trg_oinfo, H5O_INFO_BASIC, lapl) < 0) {
- if(link_info->opt.msg_mode == 1)
+ if (H5Oget_info_by_name2(file_id, linkpath, &trg_oinfo, H5O_INFO_BASIC, lapl) < 0) {
+ if (link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get object information for <%s>\n", linkpath);
H5TOOLS_GOTO_DONE(FAIL);
} /* end if */
/* check unknown type */
- if(trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES) {
- if(link_info->opt.msg_mode == 1)
+ if (trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >= H5O_TYPE_NTYPES) {
+ if (link_info->opt.msg_mode == 1)
parallel_print("Warning: target object of <%s> is unknown type\n", linkpath);
H5TOOLS_GOTO_DONE(FAIL);
- } /* end if */
+ } /* end if */
/* 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;
+ link_info->objno = trg_oinfo.addr;
+ link_info->fileno = trg_oinfo.fileno;
} /* end if */
else
link_info->trg_type = H5O_TYPE_UNKNOWN;
@@ -993,9 +808,9 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
ret_value = 1;
done:
- if(fapl != H5P_DEFAULT)
+ if (fapl != H5P_DEFAULT)
H5Pclose(fapl);
- if(lapl != H5P_DEFAULT)
+ if (lapl != H5P_DEFAULT)
H5Pclose(lapl);
return ret_value;
@@ -1025,13 +840,13 @@ h5tools_setstatus(int D_status)
H5_ATTR_PURE const char *
h5tools_getprogname(void)
{
- return h5tools_progname;
+ return h5tools_progname;
}
H5_ATTR_PURE int
h5tools_getstatus(void)
{
- return h5tools_d_status;
+ return h5tools_d_status;
}
/*-----------------------------------------------------------
@@ -1045,13 +860,13 @@ int
h5tools_getenv_update_hyperslab_bufsize(void)
{
const char *env_str = NULL;
- long hyperslab_bufsize_mb;
- int ret_value = 1;
+ long hyperslab_bufsize_mb;
+ int ret_value = 1;
/* check if environment variable is set for the hyperslab buffer size */
- if (NULL != (env_str = HDgetenv ("H5TOOLS_BUFSIZE"))) {
- errno = 0;
- hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10);
+ if (NULL != (env_str = HDgetenv("H5TOOLS_BUFSIZE"))) {
+ errno = 0;
+ hyperslab_bufsize_mb = HDstrtol(env_str, (char **)NULL, 10);
if (errno != 0 || hyperslab_bufsize_mb <= 0)
H5TOOLS_GOTO_ERROR(FAIL, "hyperslab buffer size failed");
@@ -1080,14 +895,13 @@ done:
*----------------------------------------------------------------------------
*/
herr_t
-h5tools_parse_ros3_fapl_tuple(const char *tuple_str, int delim,
- H5FD_ros3_fapl_t *fapl_config_out)
+h5tools_parse_ros3_fapl_tuple(const char *tuple_str, int delim, H5FD_ros3_fapl_t *fapl_config_out)
{
- const char *ccred[3];
- unsigned nelems = 0;
- char *s3cred_src = NULL;
- char **s3cred = NULL;
- herr_t ret_value = SUCCEED;
+ const char *ccred[3];
+ unsigned nelems = 0;
+ char * s3cred_src = NULL;
+ char ** s3cred = NULL;
+ herr_t ret_value = SUCCEED;
/* Attempt to parse S3 credentials tuple */
if (parse_tuple(tuple_str, delim, &s3cred_src, &nelems, &s3cred) < 0)
@@ -1101,17 +915,18 @@ h5tools_parse_ros3_fapl_tuple(const char *tuple_str, int delim,
ccred[1] = (const char *)s3cred[1];
ccred[2] = (const char *)s3cred[2];
- if (h5tools_populate_ros3_fapl(fapl_config_out, ccred) < 0)
+ if (0 == h5tools_populate_ros3_fapl(fapl_config_out, ccred))
H5TOOLS_GOTO_ERROR(FAIL, "failed to populate S3 VFD FAPL config");
done:
- HDfree(s3cred);
- HDfree(s3cred_src);
+ if (s3cred)
+ HDfree(s3cred);
+ if (s3cred_src)
+ HDfree(s3cred_src);
return ret_value;
}
-
/*----------------------------------------------------------------------------
*
* Function: h5tools_populate_ros3_fapl()
@@ -1177,7 +992,7 @@ done:
herr_t
h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, const char **values)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
if (fa == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "fa cannot be NULL");
@@ -1233,14 +1048,13 @@ done:
*----------------------------------------------------------------------------
*/
herr_t
-h5tools_parse_hdfs_fapl_tuple(const char *tuple_str, int delim,
- H5FD_hdfs_fapl_t *fapl_config_out)
+h5tools_parse_hdfs_fapl_tuple(const char *tuple_str, int delim, H5FD_hdfs_fapl_t *fapl_config_out)
{
- unsigned long k = 0;
- unsigned nelems = 0;
- char *props_src = NULL;
- char **props = NULL;
- herr_t ret_value = SUCCEED;
+ unsigned long k = 0;
+ unsigned nelems = 0;
+ char * props_src = NULL;
+ char ** props = NULL;
+ herr_t ret_value = SUCCEED;
/* Attempt to parse HDFS configuration tuple */
if (parse_tuple(tuple_str, delim, &props_src, &nelems, &props) < 0)
@@ -1285,4 +1099,3 @@ done:
return ret_value;
}
#endif /* H5_HAVE_LIBHDFS */
-
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index 6fe0a75..fed4b52 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,8 +17,8 @@
*
* Purpose: Support functions for the various tools.
*/
-#ifndef H5TOOLS_UTILS_H__
-#define H5TOOLS_UTILS_H__
+#ifndef H5TOOLS_UTILS_H
+#define H5TOOLS_UTILS_H
#include "hdf5.h"
@@ -27,78 +27,26 @@ extern "C" {
#endif
/* ``parallel_print'' information */
-#define PRINT_DATA_MAX_SIZE 512
-#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4)
+#define PRINT_DATA_MAX_SIZE 512
+#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE * 4)
-H5TOOLS_DLLVAR int g_nTasks;
+H5TOOLS_DLLVAR int g_nTasks;
H5TOOLS_DLLVAR unsigned char g_Parallel;
-H5TOOLS_DLLVAR char outBuff[];
-H5TOOLS_DLLVAR unsigned outBuffOffset;
+H5TOOLS_DLLVAR char outBuff[];
+H5TOOLS_DLLVAR unsigned outBuffOffset;
H5TOOLS_DLLVAR FILE *overflow_file;
/* Maximum size used in a call to malloc for a dataset */
H5TOOLS_DLLVAR hsize_t H5TOOLS_MALLOCSIZE;
/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */
H5TOOLS_DLLVAR hsize_t H5TOOLS_BUFSIZE;
-/*
- * begin get_option section
- */
-H5TOOLS_DLLVAR int opt_err; /* getoption prints errors if this is on */
-H5TOOLS_DLLVAR int opt_ind; /* token pointer */
-H5TOOLS_DLLVAR const char *opt_arg; /* flag argument (or value) */
-
-enum {
- no_arg = 0, /* doesn't take an argument */
- require_arg, /* requires an argument */
- optional_arg /* argument is optional */
-};
-
-/*
- * get_option determines which options are specified on the command line and
- * returns a pointer to any arguments possibly associated with the option in
- * the ``opt_arg'' variable. get_option returns the shortname equivalent of
- * the option. The long options are specified in the following way:
- *
- * struct long_options foo[] = {
- * { "filename", require_arg, 'f' },
- * { "append", no_arg, 'a' },
- * { "width", require_arg, 'w' },
- * { NULL, 0, 0 }
- * };
- *
- * Long named options can have arguments specified as either:
- *
- * ``--param=arg'' or ``--param arg''
- *
- * Short named options can have arguments specified as either:
- *
- * ``-w80'' or ``-w 80''
- *
- * and can have more than one short named option specified at one time:
- *
- * -aw80
- *
- * in which case those options which expect an argument need to come at the
- * end.
- */
-typedef struct long_options {
- const char *name; /* name of the long option */
- int has_arg; /* whether we should look for an arg */
- char shortval; /* the shortname equivalent of long arg
- * this gets returned from get_option */
-} long_options;
-
-H5TOOLS_DLL int get_option(int argc, const char **argv, const char *opt, const struct long_options *l_opt);
-/*
- * end get_option section
- */
/*struct taken from the dumper. needed in table struct*/
typedef struct obj_t {
haddr_t objno;
- char *objname;
- hbool_t displayed; /* Flag to indicate that the object has been displayed */
- hbool_t recorded; /* Flag for named datatypes to indicate they were found in the group hierarchy */
+ char * objname;
+ hbool_t displayed; /* Flag to indicate that the object has been displayed */
+ hbool_t recorded; /* Flag for named datatypes to indicate they were found in the group hierarchy */
} obj_t;
/*struct for the tables that the find_objs function uses*/
@@ -110,27 +58,29 @@ typedef struct table_t {
/*this struct stores the information that is passed to the find_objs function*/
typedef struct find_objs_t {
- hid_t fid;
+ hid_t fid;
table_t *group_table;
table_t *type_table;
table_t *dset_table;
} find_objs_t;
-H5TOOLS_DLLVAR unsigned h5tools_nCols; /*max number of columns for outputting */
+H5TOOLS_DLLVAR unsigned h5tools_nCols; /*max number of columns for outputting */
/* Definitions of useful routines */
-H5TOOLS_DLL void indentation(unsigned);
-H5TOOLS_DLL void print_version(const char *progname);
-H5TOOLS_DLL void parallel_print(const char* format, ... );
-H5TOOLS_DLL herr_t parse_tuple(const char *start, int sep, char **cpy_out, unsigned *nelems, char ***ptrs_out);
-H5TOOLS_DLL void error_msg(const char *fmt, ...);
-H5TOOLS_DLL void warn_msg(const char *fmt, ...);
-H5TOOLS_DLL void help_ref_msg(FILE *output);
-H5TOOLS_DLL void free_table(table_t *table);
+H5TOOLS_DLL void indentation(unsigned);
+H5TOOLS_DLL void print_version(const char *progname);
+H5TOOLS_DLL void parallel_print(const char *format, ...);
+H5TOOLS_DLL herr_t parse_tuple(const char *start, int sep, char **cpy_out, unsigned *nelems,
+ char ***ptrs_out);
+H5TOOLS_DLL void error_msg(const char *fmt, ...);
+H5TOOLS_DLL void warn_msg(const char *fmt, ...);
+H5TOOLS_DLL void help_ref_msg(FILE *output);
+H5TOOLS_DLL void free_table(table_t *table);
#ifdef H5DUMP_DEBUG
H5TOOLS_DLL void dump_tables(find_objs_t *info);
-#endif /* H5DUMP_DEBUG */
-H5TOOLS_DLL herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table, table_t **dset_table, table_t **type_table);
+#endif /* H5DUMP_DEBUG */
+H5TOOLS_DLL herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table, table_t **dset_table,
+ table_t **type_table);
H5TOOLS_DLL obj_t *search_obj(table_t *temp, haddr_t objno);
#ifndef H5_HAVE_TMPFILE
H5TOOLS_DLL FILE *tmpfile(void);
@@ -144,46 +94,48 @@ H5TOOLS_DLL FILE *tmpfile(void);
/* This code is layout for common code among tools */
typedef enum toolname_t {
- TOOL_H5DIFF, TOOL_H5LS, TOOL__H5DUMP /* add as necessary */
+ TOOL_H5DIFF,
+ TOOL_H5LS,
+ TOOL__H5DUMP /* add as necessary */
} h5tool_toolname_t;
/* this struct can be used to differntiate among tools */
typedef struct {
h5tool_toolname_t toolname;
- int msg_mode;
+ int msg_mode;
} h5tool_opt_t;
/* obtain link info from H5tools_get_symlink_info() */
typedef struct {
- H5O_type_t trg_type; /* OUT: target type */
- 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 */
+ H5O_type_t trg_type; /* OUT: target type */
+ 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;
-
/* Definitions of routines */
-H5TOOLS_DLL int H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type);
+H5TOOLS_DLL int H5tools_get_symlink_info(hid_t file_id, const char *linkpath, h5tool_link_info_t *link_info,
+ hbool_t get_obj_type);
H5TOOLS_DLL const char *h5tools_getprogname(void);
-H5TOOLS_DLL void h5tools_setprogname(const char*progname);
-H5TOOLS_DLL int h5tools_getstatus(void);
-H5TOOLS_DLL void h5tools_setstatus(int d_status);
-H5TOOLS_DLL int h5tools_getenv_update_hyperslab_bufsize(void);
+H5TOOLS_DLL void h5tools_setprogname(const char *progname);
+H5TOOLS_DLL int h5tools_getstatus(void);
+H5TOOLS_DLL void h5tools_setstatus(int d_status);
+H5TOOLS_DLL int h5tools_getenv_update_hyperslab_bufsize(void);
#ifdef H5_HAVE_ROS3_VFD
H5TOOLS_DLL herr_t h5tools_parse_ros3_fapl_tuple(const char *tuple_str, int delim,
- H5FD_ros3_fapl_t *fapl_config_out);
+ H5FD_ros3_fapl_t *fapl_config_out);
H5TOOLS_DLL herr_t h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, const char **values);
#endif /* H5_HAVE_ROS3_VFD */
#ifdef H5_HAVE_LIBHDFS
H5TOOLS_DLL herr_t h5tools_parse_hdfs_fapl_tuple(const char *tuple_str, int delim,
- H5FD_hdfs_fapl_t *fapl_config_out);
+ H5FD_hdfs_fapl_t *fapl_config_out);
#endif
#ifdef __cplusplus
}
#endif
-#endif /* H5TOOLS_UTILS_H__ */
+#endif /* H5TOOLS_UTILS_H */
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 77ebd5d..dd30cb5 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -6,12 +6,11 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#include "h5trav.h"
#include "h5tools.h"
#include "H5private.h"
@@ -22,32 +21,32 @@
*/
typedef struct trav_addr_path_t {
haddr_t addr;
- char *path;
+ char * path;
} trav_addr_path_t;
typedef struct trav_addr_t {
- size_t nalloc;
- size_t nused;
+ size_t nalloc;
+ size_t nused;
trav_addr_path_t *objs;
} trav_addr_t;
typedef struct {
- h5trav_obj_func_t visit_obj; /* Callback for visiting objects */
- h5trav_lnk_func_t visit_lnk; /* Callback for visiting links */
- void *udata; /* User data to pass to callbacks */
+ h5trav_obj_func_t visit_obj; /* Callback for visiting objects */
+ h5trav_lnk_func_t visit_lnk; /* Callback for visiting links */
+ void * udata; /* User data to pass to callbacks */
} trav_visitor_t;
typedef struct {
- trav_addr_t *seen; /* List of addresses seen already */
- const trav_visitor_t *visitor; /* Information for visiting each link/object */
- hbool_t is_absolute; /* Whether the traversal has absolute paths */
- const char *base_grp_name; /* Name of the group that serves as the base
- * for iteration */
- unsigned fields; /* Fields needed in H5O_info_t struct */
+ trav_addr_t * seen; /* List of addresses seen already */
+ const trav_visitor_t *visitor; /* Information for visiting each link/object */
+ hbool_t is_absolute; /* Whether the traversal has absolute paths */
+ const char * base_grp_name; /* Name of the group that serves as the base
+ * for iteration */
+ unsigned fields; /* Fields needed in H5O_info_t struct */
} trav_ud_traverse_t;
typedef struct {
- hid_t fid; /* File ID being traversed */
+ hid_t fid; /* File ID being traversed */
} trav_print_udata_t;
typedef struct trav_path_op_data_t {
@@ -56,26 +55,22 @@ typedef struct trav_path_op_data_t {
/* format for hsize_t */
#ifdef H5TRAV_PRINT_SPACE
-#define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u"
+#define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u"
#endif /* H5TRAV_PRINT_SPACE */
/*-------------------------------------------------------------------------
* local functions
*-------------------------------------------------------------------------
*/
-static void trav_table_add(trav_table_t *table,
- const char *objname,
- const H5O_info_t *oinfo);
+static void trav_table_add(trav_table_t *table, const char *objname, const H5O_info_t *oinfo);
-static void trav_table_addlink(trav_table_t *table,
- haddr_t objno,
- const char *path);
+static void trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path);
/*-------------------------------------------------------------------------
* local variables
*-------------------------------------------------------------------------
*/
-static H5_index_t trav_index_by = H5_INDEX_NAME;
+static H5_index_t trav_index_by = H5_INDEX_NAME;
static H5_iter_order_t trav_index_order = H5_ITER_INC;
static int trav_verbosity = 0;
@@ -91,7 +86,7 @@ static int trav_verbosity = 0;
void
h5trav_set_index(H5_index_t print_index_by, H5_iter_order_t print_index_order)
{
- trav_index_by = print_index_by;
+ trav_index_by = print_index_by;
trav_index_order = print_index_order;
}
@@ -114,7 +109,6 @@ h5trav_set_verbose(int print_verbose)
*-------------------------------------------------------------------------
*/
-
/*-------------------------------------------------------------------------
* Function: trav_addr_add
*
@@ -126,16 +120,18 @@ h5trav_set_verbose(int print_verbose)
static void
trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
{
- size_t idx; /* Index of address to use */
+ size_t idx; /* Index of address to use */
/* Allocate space if necessary */
- if(visited->nused == visited->nalloc) {
- visited->nalloc = MAX(1, visited->nalloc * 2);;
- visited->objs = (trav_addr_path_t *)HDrealloc(visited->objs, visited->nalloc * sizeof(trav_addr_path_t));
+ if (visited->nused == visited->nalloc) {
+ visited->nalloc = MAX(1, visited->nalloc * 2);
+ ;
+ visited->objs =
+ (trav_addr_path_t *)HDrealloc(visited->objs, visited->nalloc * sizeof(trav_addr_path_t));
} /* end if */
/* Append it */
- idx = visited->nused++;
+ idx = visited->nused++;
visited->objs[idx].addr = addr;
visited->objs[idx].path = HDstrdup(path);
} /* end trav_addr_add() */
@@ -151,16 +147,16 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
H5_ATTR_PURE static const char *
trav_addr_visited(trav_addr_t *visited, haddr_t addr)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Look for address */
- for(u = 0; u < visited->nused; u++)
+ for (u = 0; u < visited->nused; u++)
/* Check for address already in array */
- if(visited->objs[u].addr == addr)
- return(visited->objs[u].path);
+ if (visited->objs[u].addr == addr)
+ return (visited->objs[u].path);
/* Didn't find address */
- return(NULL);
+ return (NULL);
} /* end trav_addr_visited() */
/*-------------------------------------------------------------------------
@@ -170,23 +166,23 @@ trav_addr_visited(trav_addr_t *visited, haddr_t addr)
*-------------------------------------------------------------------------
*/
static herr_t
-traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
- void *_udata)
+traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, void *_udata)
{
- trav_ud_traverse_t *udata = (trav_ud_traverse_t *)_udata; /* User data */
- char *new_name = NULL;
- const char *full_name;
- const char *already_visited = NULL; /* Whether the link/object was already visited */
+ trav_ud_traverse_t *udata = (trav_ud_traverse_t *)_udata; /* User data */
+ char * new_name = NULL;
+ const char * full_name;
+ const char * already_visited = NULL; /* Whether the link/object was already visited */
/* Create the full path name for the link */
- if(udata->is_absolute) {
- size_t base_len = HDstrlen(udata->base_grp_name);
- size_t add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1;
- size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */
-
- if(NULL == (new_name = (char*)HDmalloc(new_name_len)))
- return(H5_ITER_ERROR);
- if(add_slash)
+ if (udata->is_absolute) {
+ size_t base_len = HDstrlen(udata->base_grp_name);
+ size_t add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1;
+ size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1 +
+ 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */
+
+ if (NULL == (new_name = (char *)HDmalloc(new_name_len)))
+ return (H5_ITER_ERROR);
+ if (add_slash)
HDsnprintf(new_name, new_name_len, "%s/%s", udata->base_grp_name, path);
else
HDsnprintf(new_name, new_name_len, "%s%s", udata->base_grp_name, path);
@@ -196,48 +192,47 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
full_name = path;
/* Perform the correct action for different types of links */
- if(linfo->type == H5L_TYPE_HARD) {
+ if (linfo->type == H5L_TYPE_HARD) {
H5O_info_t oinfo;
/* Get information about the object */
- if(H5Oget_info_by_name2(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) {
- if(new_name)
+ if (H5Oget_info_by_name2(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) {
+ if (new_name)
HDfree(new_name);
- return(H5_ITER_ERROR);
+ return (H5_ITER_ERROR);
} /* end if */
/* If the object has multiple links, add it to the list of addresses
* already visited, if it isn't there already
*/
- if(oinfo.rc > 1)
- if(NULL == (already_visited = trav_addr_visited(udata->seen, oinfo.addr)))
+ if (oinfo.rc > 1)
+ if (NULL == (already_visited = trav_addr_visited(udata->seen, oinfo.addr)))
trav_addr_add(udata->seen, oinfo.addr, full_name);
/* Make 'visit object' callback */
- if(udata->visitor->visit_obj)
- if((*udata->visitor->visit_obj)(full_name, &oinfo, already_visited, udata->visitor->udata) < 0) {
- if(new_name)
+ if (udata->visitor->visit_obj)
+ if ((*udata->visitor->visit_obj)(full_name, &oinfo, already_visited, udata->visitor->udata) < 0) {
+ if (new_name)
HDfree(new_name);
- return(H5_ITER_ERROR);
+ return (H5_ITER_ERROR);
} /* end if */
- } /* end if */
+ } /* end if */
else {
/* Make 'visit link' callback */
- if(udata->visitor->visit_lnk)
- if((*udata->visitor->visit_lnk)(full_name, linfo, udata->visitor->udata) < 0) {
- if(new_name)
+ if (udata->visitor->visit_lnk)
+ if ((*udata->visitor->visit_lnk)(full_name, linfo, udata->visitor->udata) < 0) {
+ if (new_name)
HDfree(new_name);
- return(H5_ITER_ERROR);
+ return (H5_ITER_ERROR);
} /* end if */
- } /* end else */
+ } /* end else */
- if(new_name)
+ if (new_name)
HDfree(new_name);
- return(H5_ITER_CONT);
+ return (H5_ITER_CONT);
} /* end traverse_cb() */
-
/*-------------------------------------------------------------------------
* Function: traverse
*
@@ -249,68 +244,69 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
*-------------------------------------------------------------------------
*/
static int
-traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
- hbool_t recurse, const trav_visitor_t *visitor, unsigned fields)
+traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, hbool_t recurse,
+ const trav_visitor_t *visitor, unsigned fields)
{
- H5O_info_t oinfo; /* Object info for starting group */
- int ret_value = 0;
+ H5O_info_t oinfo; /* Object info for starting group */
+ int ret_value = 0;
/* Get info for starting object */
- if(H5Oget_info_by_name2(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name2(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info_by_name failed");
/* Visit the starting object */
- if(visit_start && visitor->visit_obj)
+ if (visit_start && visitor->visit_obj)
(*visitor->visit_obj)(grp_name, &oinfo, NULL, visitor->udata);
/* Go visiting, if the object is a group */
- if(oinfo.type == H5O_TYPE_GROUP) {
- trav_addr_t seen; /* List of addresses seen */
- trav_ud_traverse_t udata; /* User data for iteration callback */
+ if (oinfo.type == H5O_TYPE_GROUP) {
+ trav_addr_t seen; /* List of addresses seen */
+ trav_ud_traverse_t udata; /* User data for iteration callback */
/* Init addresses seen */
seen.nused = seen.nalloc = 0;
- seen.objs = NULL;
+ seen.objs = NULL;
/* Check for multiple links to top group */
- if(oinfo.rc > 1)
+ if (oinfo.rc > 1)
trav_addr_add(&seen, oinfo.addr, grp_name);
/* Set up user data structure */
- udata.seen = &seen;
- udata.visitor = visitor;
- udata.is_absolute = (*grp_name == '/');
+ udata.seen = &seen;
+ udata.visitor = visitor;
+ udata.is_absolute = (*grp_name == '/');
udata.base_grp_name = grp_name;
- udata.fields = fields;
+ udata.fields = fields;
/* Check for iteration of links vs. visiting all links recursively */
- if(recurse) {
+ if (recurse) {
/* Visit all links in group, recursively */
- if(H5Lvisit_by_name(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0)
+ if (H5Lvisit_by_name(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata,
+ H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Lvisit_by_name failed");
} /* end if */
else {
/* Iterate over links in group */
- if(H5Literate_by_name(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0)
+ if (H5Literate_by_name(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb,
+ &udata, H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Literate_by_name failed");
} /* end else */
/* Free visited addresses table */
- if(seen.objs) {
- size_t u; /* Local index variable */
+ if (seen.objs) {
+ size_t u; /* Local index variable */
/* Free paths to objects */
- for(u = 0; u < seen.nused; u++)
+ for (u = 0; u < seen.nused; u++)
HDfree(seen.objs[u].path);
HDfree(seen.objs);
} /* end if */
- } /* end if */
+ } /* end if */
done:
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: trav_info_add
*
@@ -322,25 +318,25 @@ done:
void
trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
{
- size_t idx; /* Index of address to use */
+ size_t idx; /* Index of address to use */
if (info) {
/* Allocate space if necessary */
- if(info->nused == info->nalloc) {
- info->nalloc = MAX(1, info->nalloc * 2);;
+ if (info->nused == info->nalloc) {
+ info->nalloc = MAX(1, info->nalloc * 2);
+ ;
info->paths = (trav_path_t *)HDrealloc(info->paths, info->nalloc * sizeof(trav_path_t));
} /* end if */
/* Append it */
- idx = info->nused++;
- info->paths[idx].path = HDstrdup(path);
- info->paths[idx].type = obj_type;
+ idx = info->nused++;
+ info->paths[idx].path = HDstrdup(path);
+ info->paths[idx].type = obj_type;
info->paths[idx].fileno = 0;
- info->paths[idx].objno = HADDR_UNDEF;
+ info->paths[idx].objno = HADDR_UNDEF;
}
} /* end trav_info_add() */
-
/*-------------------------------------------------------------------------
* Function: trav_fileinfo_add
*
@@ -353,18 +349,17 @@ void
trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
{
H5O_info_t oinfo;
- size_t idx = info->nused - 1;
+ size_t idx = info->nused - 1;
- if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, "."))
- H5Oget_info_by_name2(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ if (info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".") != 0)
+ H5Oget_info_by_name2(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
else
- H5Oget_info2(loc_id, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info2(loc_id, &oinfo, H5O_INFO_BASIC);
- info->paths[idx].objno = oinfo.addr;
+ info->paths[idx].objno = oinfo.addr;
info->paths[idx].fileno = oinfo.fileno;
} /* end trav_fileinfo_add() */
-
/*-------------------------------------------------------------------------
* Function: trav_info_visit_obj
*
@@ -375,10 +370,10 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
*-------------------------------------------------------------------------
*/
int
-trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
- const char H5_ATTR_UNUSED *already_visited, void *udata)
+trav_info_visit_obj(const char *path, const H5O_info_t *oinfo, const char H5_ATTR_UNUSED *already_visited,
+ void *udata)
{
- size_t idx;
+ size_t idx;
trav_info_t *info_p;
/* Add the object to the 'info' struct */
@@ -386,15 +381,14 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
trav_info_add((trav_info_t *)udata, path, (h5trav_type_t)oinfo->type);
/* set object addr and fileno. These are for checking same object */
- info_p = (trav_info_t *) udata;
- idx = info_p->nused - 1;
- info_p->paths[idx].objno = oinfo->addr;
+ info_p = (trav_info_t *)udata;
+ idx = info_p->nused - 1;
+ info_p->paths[idx].objno = oinfo->addr;
info_p->paths[idx].fileno = oinfo->fileno;
- return(0);
+ return (0);
} /* end trav_info_visit_obj() */
-
/*-------------------------------------------------------------------------
* Function: trav_info_visit_lnk
*
@@ -408,12 +402,12 @@ int
trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
{
/* Add the link to the 'info' struct */
- trav_info_add((trav_info_t *)udata, path, ((linfo->type == H5L_TYPE_SOFT) ? H5TRAV_TYPE_LINK : H5TRAV_TYPE_UDLINK));
+ trav_info_add((trav_info_t *)udata, path,
+ ((linfo->type == H5L_TYPE_SOFT) ? H5TRAV_TYPE_LINK : H5TRAV_TYPE_UDLINK));
- return(0);
+ return (0);
} /* end trav_info_visit_lnk() */
-
/*-------------------------------------------------------------------------
* Function: h5trav_getinfo
*
@@ -427,16 +421,16 @@ trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
int
h5trav_getinfo(hid_t file_id, trav_info_t *info)
{
- trav_visitor_t info_visitor; /* Visitor structure for trav_info_t's */
+ trav_visitor_t info_visitor; /* Visitor structure for trav_info_t's */
int ret_value = 0;
/* Init visitor structure */
info_visitor.visit_obj = trav_info_visit_obj;
info_visitor.visit_lnk = trav_info_visit_lnk;
- info_visitor.udata = info;
+ info_visitor.udata = info;
/* Traverse all objects in the file, visiting each object & link */
- if(traverse(file_id, "/", TRUE, TRUE, &info_visitor, H5O_INFO_BASIC) < 0)
+ if (traverse(file_id, "/", TRUE, TRUE, &info_visitor, H5O_INFO_BASIC) < 0)
H5TOOLS_GOTO_ERROR((-1), "traverse failed");
done:
@@ -455,23 +449,22 @@ done:
H5_ATTR_PURE ssize_t
h5trav_getindex(const trav_info_t *info, const char *obj)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Loop over all paths in 'info' struct, looking for object */
- for(u = 0; u < info->nused; u++) {
+ for (u = 0; u < info->nused; u++) {
/* Check for object name having full path (with leading '/') */
- if(HDstrcmp(obj, info->paths[u].path) == 0)
- return((ssize_t)u);
+ if (HDstrcmp(obj, info->paths[u].path) == 0)
+ return ((ssize_t)u);
/* Check for object name without leading '/' */
- if(HDstrcmp(obj, (info->paths[u].path + 1)) == 0)
- return((ssize_t)u);
+ if (HDstrcmp(obj, (info->paths[u].path + 1)) == 0)
+ return ((ssize_t)u);
} /* end for */
- return((ssize_t)-1);
+ return ((ssize_t)-1);
} /* end h5trav_getindex() */
-
/*-------------------------------------------------------------------------
* Function: trav_info_init
*
@@ -487,19 +480,18 @@ trav_info_init(const char *filename, hid_t fileid, trav_info_t **_info)
/* Init info structure */
info->nused = info->nalloc = 0;
- info->paths = NULL;
- info->fname = filename;
- info->fid = fileid;
+ info->paths = NULL;
+ info->fname = filename;
+ info->fid = fileid;
/* Initialize list of visited symbolic links */
- info->symlink_visited.nused = 0;
- info->symlink_visited.nalloc = 0;
- info->symlink_visited.objs = NULL;
+ info->symlink_visited.nused = 0;
+ info->symlink_visited.nalloc = 0;
+ info->symlink_visited.objs = NULL;
info->symlink_visited.dangle_link = FALSE;
- *_info = info;
+ *_info = info;
} /* end trav_info_init() */
-
/*-------------------------------------------------------------------------
* Function: trav_info_free
*
@@ -509,11 +501,11 @@ trav_info_init(const char *filename, hid_t fileid, trav_info_t **_info)
void
trav_info_free(trav_info_t *info)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
- if(info) {
+ if (info) {
/* Free visited symbolic links path and file (if alloc) */
- for(u = 0; u < info->symlink_visited.nused; u++) {
+ for (u = 0; u < info->symlink_visited.nused; u++) {
if (info->symlink_visited.objs[u].file)
HDfree(info->symlink_visited.objs[u].file);
HDfree(info->symlink_visited.objs[u].path);
@@ -521,20 +513,18 @@ trav_info_free(trav_info_t *info)
HDfree(info->symlink_visited.objs);
/* Free path names */
- for(u = 0; u < info->nused; u++)
+ for (u = 0; u < info->nused; u++)
HDfree(info->paths[u].path);
HDfree(info->paths);
HDfree(info);
} /* end if */
} /* end trav_info_free() */
-
/*-------------------------------------------------------------------------
* "h5trav table" public functions. used in h5repack
*-------------------------------------------------------------------------
*/
-
/*-------------------------------------------------------------------------
* Function: trav_table_visit_obj
*
@@ -545,13 +535,12 @@ trav_info_free(trav_info_t *info)
*-------------------------------------------------------------------------
*/
static int
-trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
- const char *already_visited, void *udata)
+trav_table_visit_obj(const char *path, const H5O_info_t *oinfo, const char *already_visited, void *udata)
{
trav_table_t *table = (trav_table_t *)udata;
/* Check if we've already seen this object */
- if(NULL == already_visited)
+ if (NULL == already_visited)
/* add object to table */
trav_table_add(table, path, oinfo);
else
@@ -561,7 +550,6 @@ trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
return 0;
} /* end trav_table_visit_obj() */
-
/*-------------------------------------------------------------------------
* Function: trav_table_visit_lnk
*
@@ -580,7 +568,6 @@ trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, v
return 0;
} /* end trav_table_visit_lnk() */
-
/*-------------------------------------------------------------------------
* Function: h5trav_gettable
*
@@ -593,16 +580,16 @@ trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, v
int
h5trav_gettable(hid_t fid, trav_table_t *table)
{
- trav_visitor_t table_visitor; /* Visitor structure for trav_table_t's */
+ trav_visitor_t table_visitor; /* Visitor structure for trav_table_t's */
int ret_value = 0;
/* Init visitor structure */
table_visitor.visit_obj = trav_table_visit_obj;
table_visitor.visit_lnk = trav_table_visit_lnk;
- table_visitor.udata = table;
+ table_visitor.udata = table;
/* Traverse all objects in the file, visiting each object & link */
- if(traverse(fid, "/", TRUE, TRUE, &table_visitor, H5O_INFO_BASIC) < 0)
+ if (traverse(fid, "/", TRUE, TRUE, &table_visitor, H5O_INFO_BASIC) < 0)
H5TOOLS_GOTO_ERROR((-1), "traverse failed");
done:
@@ -623,31 +610,31 @@ h5trav_getindext(const char *name, const trav_table_t *table)
{
unsigned int i;
- if(table) {
- for(i = 0; i < table->nobjs; i++) {
+ if (table) {
+ for (i = 0; i < table->nobjs; i++) {
/* Check for object name having full path (with leading '/') */
- if(HDstrcmp(name, table->objs[i].name) == 0)
- return((int)i);
+ if (HDstrcmp(name, table->objs[i].name) == 0)
+ return ((int)i);
/* Check for object name without leading '/' */
- if(HDstrcmp(name, table->objs[i].name + 1) == 0)
- return((int)i);
+ if (HDstrcmp(name, table->objs[i].name + 1) == 0)
+ return ((int)i);
/* search also in the list of links */
- if(table->objs[i].nlinks) {
+ if (table->objs[i].nlinks) {
unsigned int j;
- for ( j=0; j<table->objs[i].nlinks; j++) {
+ for (j = 0; j < table->objs[i].nlinks; j++) {
/* Check for object name having full path (with leading '/') */
- if(HDstrcmp(name, table->objs[i].links[j].new_name) == 0)
- return((int)i);
+ if (HDstrcmp(name, table->objs[i].links[j].new_name) == 0)
+ return ((int)i);
/* Check for object name without leading '/' */
- if(HDstrcmp(name, table->objs[i].links[j].new_name + 1) == 0)
- return((int)i);
+ if (HDstrcmp(name, table->objs[i].links[j].new_name + 1) == 0)
+ return ((int)i);
} /* end for */
- } /* end if */
- } /* end for */
+ } /* end if */
+ } /* end for */
}
return -1;
}
@@ -665,21 +652,21 @@ trav_table_add(trav_table_t *table, const char *path, const H5O_info_t *oinfo)
{
size_t new_obj;
- if(table) {
- if(table->nobjs == table->size) {
+ if (table) {
+ if (table->nobjs == table->size) {
table->size = MAX(1, table->size * 2);
table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
} /* end if */
- new_obj = table->nobjs++;
- table->objs[new_obj].objno = oinfo ? oinfo->addr : HADDR_UNDEF;
+ new_obj = table->nobjs++;
+ table->objs[new_obj].objno = oinfo ? oinfo->addr : HADDR_UNDEF;
table->objs[new_obj].flags[0] = table->objs[new_obj].flags[1] = 0;
- table->objs[new_obj].is_same_trgobj = 0;
- table->objs[new_obj].name = (char *)HDstrdup(path);
- table->objs[new_obj].type = oinfo ? (h5trav_type_t)oinfo->type : H5TRAV_TYPE_LINK;
- table->objs[new_obj].nlinks = 0;
+ table->objs[new_obj].is_same_trgobj = 0;
+ table->objs[new_obj].name = (char *)HDstrdup(path);
+ table->objs[new_obj].type = oinfo ? (h5trav_type_t)oinfo->type : H5TRAV_TYPE_LINK;
+ table->objs[new_obj].nlinks = 0;
table->objs[new_obj].sizelinks = 0;
- table->objs[new_obj].links = NULL;
+ table->objs[new_obj].links = NULL;
}
}
@@ -694,34 +681,34 @@ trav_table_add(trav_table_t *table, const char *path, const H5O_info_t *oinfo)
static void
trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path)
{
- size_t i; /* Local index variable */
+ size_t i; /* Local index variable */
- if(table) {
- for(i = 0; i < table->nobjs; i++) {
- if(table->objs[i].objno == objno) {
+ if (table) {
+ for (i = 0; i < table->nobjs; i++) {
+ if (table->objs[i].objno == objno) {
size_t n;
/* already inserted? */
- if(HDstrcmp(table->objs[i].name, path) == 0)
+ if (HDstrcmp(table->objs[i].name, path) == 0)
return;
/* allocate space if necessary */
- if(table->objs[i].nlinks == (unsigned)table->objs[i].sizelinks) {
+ if (table->objs[i].nlinks == (unsigned)table->objs[i].sizelinks) {
table->objs[i].sizelinks = MAX(1, table->objs[i].sizelinks * 2);
- table->objs[i].links = (trav_link_t *)HDrealloc(table->objs[i].links, table->objs[i].sizelinks * sizeof(trav_link_t));
+ table->objs[i].links = (trav_link_t *)HDrealloc(
+ table->objs[i].links, table->objs[i].sizelinks * sizeof(trav_link_t));
} /* end if */
/* insert it */
- n = table->objs[i].nlinks++;
+ n = table->objs[i].nlinks++;
table->objs[i].links[n].new_name = (char *)HDstrdup(path);
return;
} /* end if */
- } /* end for */
- } /* end if */
+ } /* end for */
+ } /* end if */
}
-
/*-------------------------------------------------------------------------
* Function: trav_table_addflags
*
@@ -730,33 +717,30 @@ trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path)
* Return: void
*-------------------------------------------------------------------------
*/
-void trav_table_addflags(unsigned *flags,
- char *name,
- h5trav_type_t type,
- trav_table_t *table)
+void
+trav_table_addflags(const unsigned *flags, char *name, h5trav_type_t type, trav_table_t *table)
{
size_t new_obj;
- if(table) {
- if(table->nobjs == table->size) {
+ if (table) {
+ if (table->nobjs == table->size) {
table->size = MAX(1, table->size * 2);
table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
} /* end if */
- new_obj = table->nobjs++;
- table->objs[new_obj].objno = 0;
- table->objs[new_obj].flags[0] = flags[0];
- table->objs[new_obj].flags[1] = flags[1];
+ new_obj = table->nobjs++;
+ table->objs[new_obj].objno = 0;
+ table->objs[new_obj].flags[0] = flags[0];
+ table->objs[new_obj].flags[1] = flags[1];
table->objs[new_obj].is_same_trgobj = 0;
- table->objs[new_obj].name = (char *)HDstrdup(name);
- table->objs[new_obj].type = type;
- table->objs[new_obj].nlinks = 0;
- table->objs[new_obj].sizelinks = 0;
- table->objs[new_obj].links = NULL;
+ table->objs[new_obj].name = (char *)HDstrdup(name);
+ table->objs[new_obj].type = type;
+ table->objs[new_obj].nlinks = 0;
+ table->objs[new_obj].sizelinks = 0;
+ table->objs[new_obj].links = NULL;
}
}
-
/*-------------------------------------------------------------------------
* Function: trav_table_init
*
@@ -765,18 +749,18 @@ void trav_table_addflags(unsigned *flags,
* Return: void
*-------------------------------------------------------------------------
*/
-void trav_table_init(trav_table_t **tbl)
+void
+trav_table_init(trav_table_t **tbl)
{
- trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t));
- if(table) {
- table->size = 0;
+ trav_table_t *table = (trav_table_t *)HDmalloc(sizeof(trav_table_t));
+ if (table) {
+ table->size = 0;
table->nobjs = 0;
- table->objs = NULL;
+ table->objs = NULL;
}
*tbl = table;
}
-
/*-------------------------------------------------------------------------
* Function: trav_table_free
*
@@ -785,23 +769,24 @@ void trav_table_init(trav_table_t **tbl)
* Return: void
*-------------------------------------------------------------------------
*/
-void trav_table_free(trav_table_t *table)
+void
+trav_table_free(trav_table_t *table)
{
- if(table) {
- if(table->objs) {
+ if (table) {
+ if (table->objs) {
unsigned int i;
- for(i = 0; i < table->nobjs; i++) {
- HDfree(table->objs[i].name );
- if(table->objs[i].nlinks) {
+ for (i = 0; i < table->nobjs; i++) {
+ HDfree(table->objs[i].name);
+ if (table->objs[i].nlinks) {
unsigned int j;
- for(j = 0; j < table->objs[i].nlinks; j++)
+ for (j = 0; j < table->objs[i].nlinks; j++)
HDfree(table->objs[i].links[j].new_name);
HDfree(table->objs[i].links);
} /* end if */
- } /* end for */
+ } /* end for */
HDfree(table->objs);
} /* end if */
HDfree(table);
@@ -811,39 +796,40 @@ void trav_table_free(trav_table_t *table)
static herr_t
trav_attr(hid_t
#ifndef H5TRAV_PRINT_SPACE
- H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5TRAV_PRINT_SPACE */
- obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
+ obj,
+ const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
{
trav_path_op_data_t *op_data = (trav_path_op_data_t *)_op_data;
- const char *buf = op_data->path;
+ const char * buf = op_data->path;
- if((strlen(buf)==1) && (*buf=='/'))
+ if ((strlen(buf) == 1) && (*buf == '/'))
HDprintf(" %-10s %s%s", "attribute", buf, attr_name);
else
HDprintf(" %-10s %s/%s", "attribute", buf, attr_name);
#ifdef H5TRAV_PRINT_SPACE
- if(trav_verbosity < 2) {
+ if (trav_verbosity < 2) {
#endif
HDprintf("\n");
#ifdef H5TRAV_PRINT_SPACE
}
else {
- hid_t attr = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hsize_t size[H5S_MAX_RANK];
- int ndims;
- int i;
- H5S_class_t space_type;
-
- if((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) {
+ hid_t attr = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hsize_t size[H5S_MAX_RANK];
+ int ndims;
+ int i;
+ H5S_class_t space_type;
+
+ if ((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) {
space = H5Aget_space(attr);
/* Data space */
- ndims = H5Sget_simple_extent_dims(space, size, NULL);
+ ndims = H5Sget_simple_extent_dims(space, size, NULL);
space_type = H5Sget_simple_extent_type(space);
- switch(space_type) {
+ switch (space_type) {
case H5S_SCALAR:
/* scalar dataspace */
HDprintf(" scalar\n");
@@ -853,7 +839,7 @@ trav_attr(hid_t
/* simple dataspace */
HDprintf(" {");
for (i = 0; i < ndims; i++) {
- HDprintf("%s" HSIZE_T_FORMAT, i?", ":"", size[i]);
+ HDprintf("%s" HSIZE_T_FORMAT, i ? ", " : "", size[i]);
}
HDprintf("}\n");
break;
@@ -875,10 +861,9 @@ trav_attr(hid_t
}
#endif
- return(0);
+ return (0);
}
-
/*-------------------------------------------------------------------------
* Function: trav_print_visit_obj
*
@@ -889,15 +874,14 @@ trav_attr(hid_t
*-------------------------------------------------------------------------
*/
static int
-trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
- const char *already_visited, void *udata)
+trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, const char *already_visited, void *udata)
{
trav_print_udata_t *print_udata = (trav_print_udata_t *)udata;
/* Print the name of the object */
/* (no new-line, so that objects that we've encountered before can print
* the name of the original object)
*/
- switch(oinfo->type) {
+ switch (oinfo->type) {
case H5O_TYPE_GROUP:
HDprintf(" %-10s %s", "group", path);
break;
@@ -918,24 +902,23 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
} /* end switch */
/* Check if we've already seen this object */
- if(NULL == already_visited) {
+ if (NULL == already_visited) {
trav_path_op_data_t op_data;
op_data.path = path;
/* Finish printing line about object */
HDprintf("\n");
- if(trav_verbosity > 0)
- H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order,
- NULL, trav_attr, &op_data, H5P_DEFAULT);
+ if (trav_verbosity > 0)
+ H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order, NULL, trav_attr,
+ &op_data, H5P_DEFAULT);
}
else
/* Print the link's original name */
HDprintf(" -> %s\n", already_visited);
- return(0);
+ return (0);
} /* end trav_print_visit_obj() */
-
/*-------------------------------------------------------------------------
* Function: trav_print_visit_lnk
*
@@ -951,12 +934,12 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
trav_print_udata_t *print_udata = (trav_print_udata_t *)udata;
/* Print appropriate information for the type of link */
- switch(linfo->type) {
+ switch (linfo->type) {
case H5L_TYPE_SOFT:
- if(linfo->u.val_size > 0) {
- char *targbuf = (char*)HDmalloc(linfo->u.val_size + 1);
- if(targbuf) {
- if(H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0)
+ if (linfo->u.val_size > 0) {
+ char *targbuf = (char *)HDmalloc(linfo->u.val_size + 1);
+ if (targbuf) {
+ if (H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0)
targbuf[0] = 0;
HDprintf(" %-10s %s -> %s\n", "link", path, targbuf);
HDfree(targbuf);
@@ -967,16 +950,16 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
break;
case H5L_TYPE_EXTERNAL:
- if(linfo->u.val_size > 0) {
- char *targbuf = NULL;
+ if (linfo->u.val_size > 0) {
+ char * targbuf = NULL;
const char *filename = NULL;
- const char *objname = NULL;
+ const char *objname = NULL;
- targbuf = (char*)HDmalloc(linfo->u.val_size + 1);
- if(targbuf) {
- if(H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0)
+ targbuf = (char *)HDmalloc(linfo->u.val_size + 1);
+ if (targbuf) {
+ if (H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0)
targbuf[0] = 0;
- if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &objname) >= 0)
+ if (H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &objname) >= 0)
HDprintf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname);
HDfree(targbuf);
}
@@ -987,7 +970,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
case H5L_TYPE_HARD:
/* Should be handled elsewhere */
- return(-1);
+ return (-1);
case H5L_TYPE_ERROR:
case H5L_TYPE_MAX:
@@ -996,10 +979,9 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
break;
} /* end switch() */
- return(0);
+ return (0);
} /* end trav_print_visit_lnk() */
-
/*-------------------------------------------------------------------------
* Function: h5trav_print
*
@@ -1012,9 +994,9 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
int
h5trav_print(hid_t fid)
{
- trav_print_udata_t print_udata; /* User data for traversal */
- trav_visitor_t print_visitor; /* Visitor structure for printing objects */
- int ret_value = 0;
+ trav_print_udata_t print_udata; /* User data for traversal */
+ trav_visitor_t print_visitor; /* Visitor structure for printing objects */
+ int ret_value = 0;
/* Init user data for printing */
print_udata.fid = fid;
@@ -1022,17 +1004,16 @@ h5trav_print(hid_t fid)
/* Init visitor structure */
print_visitor.visit_obj = trav_print_visit_obj;
print_visitor.visit_lnk = trav_print_visit_lnk;
- print_visitor.udata = &print_udata;
+ print_visitor.udata = &print_udata;
/* Traverse all objects in the file, visiting each object & link */
- if(traverse(fid, "/", TRUE, TRUE, &print_visitor, H5O_INFO_BASIC) < 0)
+ if (traverse(fid, "/", TRUE, TRUE, &print_visitor, H5O_INFO_BASIC) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "traverse failed");
done:
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: h5trav_visit
*
@@ -1043,20 +1024,19 @@ done:
*-------------------------------------------------------------------------
*/
int
-h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start,
- hbool_t recurse, h5trav_obj_func_t visit_obj, h5trav_lnk_func_t visit_lnk,
- void *udata, unsigned fields)
+h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start, hbool_t recurse,
+ h5trav_obj_func_t visit_obj, h5trav_lnk_func_t visit_lnk, void *udata, unsigned fields)
{
- trav_visitor_t visitor; /* Visitor structure for objects */
+ trav_visitor_t visitor; /* Visitor structure for objects */
int ret_value = 0;
/* Init visitor structure */
visitor.visit_obj = visit_obj;
visitor.visit_lnk = visit_lnk;
- visitor.udata = udata;
+ visitor.udata = udata;
/* Traverse all objects in the file, visiting each object & link */
- if(traverse(fid, grp_name, visit_start, recurse, &visitor, fields) < 0)
+ if (traverse(fid, grp_name, visit_start, recurse, &visitor, fields) < 0)
H5TOOLS_GOTO_ERROR((-1), "traverse failed");
done:
@@ -1075,15 +1055,15 @@ done:
herr_t
symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
- size_t idx; /* Index of address to use */
+ size_t idx; /* Index of address to use */
herr_t ret_value = SUCCEED;
/* Allocate space if necessary */
- if(visited->nused == visited->nalloc) {
- void *tmp_ptr;
+ if (visited->nused == visited->nalloc) {
+ void *tmp_ptr;
visited->nalloc = MAX(1, visited->nalloc * 2);
- if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t))))
+ if (NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t))))
H5TOOLS_GOTO_ERROR(FAIL, "visited data structure realloc failed");
visited->objs = (symlink_trav_path_t *)tmp_ptr;
} /* end if */
@@ -1095,17 +1075,17 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
visited->objs[idx].file = NULL;
visited->objs[idx].path = NULL;
- if(type == H5L_TYPE_EXTERNAL) {
- if(NULL == (visited->objs[idx].file = HDstrdup(file))) {
+ if (type == H5L_TYPE_EXTERNAL) {
+ if (NULL == (visited->objs[idx].file = HDstrdup(file))) {
visited->nused--;
H5TOOLS_GOTO_ERROR(FAIL, "visited data structure name allocation failed");
} /* end if */
- } /* end if */
+ } /* end if */
- if(NULL == (visited->objs[idx].path = HDstrdup(path))) {
+ if (NULL == (visited->objs[idx].path = HDstrdup(path))) {
visited->nused--;
- if(visited->objs[idx].file)
- HDfree (visited->objs[idx].file);
+ if (visited->objs[idx].file)
+ HDfree(visited->objs[idx].file);
H5TOOLS_GOTO_ERROR(FAIL, "visited data structure path allocation failed");
} /* end if */
@@ -1113,7 +1093,6 @@ done:
return ret_value;
} /* end symlink_visit_add() */
-
/*-------------------------------------------------------------------------
* Function: symlink_is_visited
*
@@ -1125,23 +1104,22 @@ done:
H5_ATTR_PURE hbool_t
symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Look for symlink */
- for(u = 0; u < visited->nused; u++) {
+ for (u = 0; u < visited->nused; u++) {
/* Check for symlink values already in array */
/* check type and path pair to distingush between symbolic links */
- if((visited->objs[u].type == type) && !HDstrcmp(visited->objs[u].path, path)) {
+ if ((visited->objs[u].type == type) && !HDstrcmp(visited->objs[u].path, path)) {
/* if external link, file need to be matched as well */
- if(visited->objs[u].type == H5L_TYPE_EXTERNAL)
- if(!HDstrcmp(visited->objs[u].file, file))
- return(TRUE);
+ if (visited->objs[u].type == H5L_TYPE_EXTERNAL)
+ if (!HDstrcmp(visited->objs[u].file, file))
+ return (TRUE);
return (TRUE);
} /* end if */
- } /* end for */
+ } /* end for */
/* Didn't find symlink */
- return(FALSE);
+ return (FALSE);
} /* end symlink_is_visited() */
-
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index 7bfb73d..8708bc9 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -6,21 +6,20 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5TRAV_H__
-#define H5TRAV_H__
+#ifndef H5TRAV_H
+#define H5TRAV_H
#include "hdf5.h"
/* Typedefs for visiting objects */
-typedef herr_t (*h5trav_obj_func_t)(const char *path_name, const H5O_info_t *oinfo,
- const char *first_seen, void *udata);
-typedef herr_t (*h5trav_lnk_func_t)(const char *path_name, const H5L_info_t *linfo,
- void *udata);
+typedef herr_t (*h5trav_obj_func_t)(const char *path_name, const H5O_info_t *oinfo, const char *first_seen,
+ void *udata);
+typedef herr_t (*h5trav_lnk_func_t)(const char *path_name, const H5L_info_t *linfo, void *udata);
/*-------------------------------------------------------------------------
* public enum to specify type of an object
@@ -34,7 +33,7 @@ typedef herr_t (*h5trav_lnk_func_t)(const char *path_name, const H5L_info_t *lin
*-------------------------------------------------------------------------
*/
typedef enum {
- H5TRAV_TYPE_UNKNOWN = -1, /* Unknown object type */
+ H5TRAV_TYPE_UNKNOWN = -1, /* Unknown object type */
H5TRAV_TYPE_GROUP, /* Object is a group */
H5TRAV_TYPE_DATASET, /* Object is a dataset */
H5TRAV_TYPE_NAMED_DATATYPE, /* Object is a named datatype */
@@ -50,62 +49,59 @@ typedef enum {
* Functions: symlink_visit_add() and symlink_is_visited()
*/
typedef struct symlink_trav_path_t {
- H5L_type_t type;
- char *file;
- char *path;
+ H5L_type_t type;
+ char * file;
+ char * path;
} symlink_trav_path_t;
typedef struct symlink_trav_t {
- size_t nalloc;
- size_t nused;
+ size_t nalloc;
+ size_t nused;
symlink_trav_path_t *objs;
- hbool_t dangle_link;
+ hbool_t dangle_link;
} symlink_trav_t;
typedef struct trav_path_t {
- char *path;
+ char * path;
h5trav_type_t type;
- haddr_t objno; /* object address */
- unsigned long fileno; /* File number that object is located in */
+ haddr_t objno; /* object address */
+ unsigned long fileno; /* File number that object is located in */
} trav_path_t;
typedef struct trav_info_t {
- size_t nalloc;
- size_t nused;
- const char *fname;
- hid_t fid; /* File ID */
- trav_path_t *paths;
- symlink_trav_t symlink_visited; /* already visited symbolic links */
- void * opts; /* optional data passing */
+ size_t nalloc;
+ size_t nused;
+ const char * fname;
+ hid_t fid; /* File ID */
+ trav_path_t * paths;
+ symlink_trav_t symlink_visited; /* already visited symbolic links */
+ void * opts; /* optional data passing */
} trav_info_t;
-
/*-------------------------------------------------------------------------
* keep record of hard link information
*-------------------------------------------------------------------------
*/
typedef struct trav_link_t {
- char *new_name;
+ char *new_name;
} trav_link_t;
-
/*-------------------------------------------------------------------------
* struct to store basic info needed for the h5trav table traversal algorythm
*-------------------------------------------------------------------------
*/
typedef struct trav_obj_t {
- haddr_t objno; /* object address */
- unsigned flags[2]; /* h5diff.object is present or not in both files*/
- hbool_t is_same_trgobj; /* same target object? no need to compare */
- char *name; /* name */
- h5trav_type_t type; /* type of object */
- trav_link_t *links; /* array of possible link names */
- size_t sizelinks; /* size of links array */
- size_t nlinks; /* number of links */
+ haddr_t objno; /* object address */
+ unsigned flags[2]; /* h5diff.object is present or not in both files*/
+ hbool_t is_same_trgobj; /* same target object? no need to compare */
+ char * name; /* name */
+ h5trav_type_t type; /* type of object */
+ trav_link_t * links; /* array of possible link names */
+ size_t sizelinks; /* size of links array */
+ size_t nlinks; /* number of links */
} trav_obj_t;
-
/*-------------------------------------------------------------------------
* private struct that stores all objects
*-------------------------------------------------------------------------
@@ -117,7 +113,6 @@ typedef struct trav_table_t {
trav_obj_t *objs;
} trav_table_t;
-
/*-------------------------------------------------------------------------
* public functions
*-------------------------------------------------------------------------
@@ -131,35 +126,38 @@ extern "C" {
* "h5trav general" public functions
*-------------------------------------------------------------------------
*/
-H5TOOLS_DLL void h5trav_set_index(H5_index_t print_index_by, H5_iter_order_t print_index_order);
-H5TOOLS_DLL int h5trav_visit(hid_t file_id, const char *grp_name,
- hbool_t visit_start, hbool_t recurse, h5trav_obj_func_t visit_obj,
- h5trav_lnk_func_t visit_lnk, void *udata, unsigned fields);
-H5TOOLS_DLL herr_t symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path);
-H5TOOLS_DLL hbool_t symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path);
+H5TOOLS_DLL void h5trav_set_index(H5_index_t print_index_by, H5_iter_order_t print_index_order);
+H5TOOLS_DLL int h5trav_visit(hid_t file_id, const char *grp_name, hbool_t visit_start, hbool_t recurse,
+ h5trav_obj_func_t visit_obj, h5trav_lnk_func_t visit_lnk, void *udata,
+ unsigned fields);
+H5TOOLS_DLL herr_t symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file,
+ const char *path);
+H5TOOLS_DLL hbool_t symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file,
+ const char *path);
/*-------------------------------------------------------------------------
* "h5trav info" public functions
*-------------------------------------------------------------------------
*/
-H5TOOLS_DLL int h5trav_getinfo(hid_t file_id, trav_info_t *info);
+H5TOOLS_DLL int h5trav_getinfo(hid_t file_id, trav_info_t *info);
H5TOOLS_DLL ssize_t h5trav_getindex(const trav_info_t *info, const char *obj);
-H5TOOLS_DLL int trav_info_visit_obj (const char *path, const H5O_info_t *oinfo, const char *already_visited, void *udata);
-H5TOOLS_DLL int trav_info_visit_lnk (const char *path, const H5L_info_t *linfo, void *udata);
+H5TOOLS_DLL int trav_info_visit_obj(const char *path, const H5O_info_t *oinfo, const char *already_visited,
+ void *udata);
+H5TOOLS_DLL int trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata);
/*-------------------------------------------------------------------------
* "h5trav table" public functions
*-------------------------------------------------------------------------
*/
-H5TOOLS_DLL int h5trav_gettable(hid_t fid, trav_table_t *travt);
-H5TOOLS_DLL int h5trav_getindext(const char *obj, const trav_table_t *travt);
+H5TOOLS_DLL int h5trav_gettable(hid_t fid, trav_table_t *travt);
+H5TOOLS_DLL int h5trav_getindext(const char *obj, const trav_table_t *travt);
/*-------------------------------------------------------------------------
* "h5trav print" public functions
*-------------------------------------------------------------------------
*/
-H5TOOLS_DLL int h5trav_print(hid_t fid);
+H5TOOLS_DLL int h5trav_print(hid_t fid);
H5TOOLS_DLL void h5trav_set_verbose(int print_verbose);
#ifdef __cplusplus
@@ -188,10 +186,7 @@ H5TOOLS_DLL void trav_table_init(trav_table_t **table);
H5TOOLS_DLL void trav_table_free(trav_table_t *table);
-H5TOOLS_DLL void trav_table_addflags(unsigned *flags,
- char *objname,
- h5trav_type_t type,
- trav_table_t *table);
-
-#endif /* H5TRAV_H__ */
+H5TOOLS_DLL void trav_table_addflags(const unsigned *flags, char *objname, h5trav_type_t type,
+ trav_table_t *table);
+#endif /* H5TRAV_H */
diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c
index 5c0c31d..aec7e9b 100644
--- a/tools/lib/io_timer.c
+++ b/tools/lib/io_timer.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -30,10 +30,10 @@
* The number to divide the tv_usec field with to get a nice decimal to add to
* the number of seconds.
*/
-#define MICROSECOND 1000000.0F
+#define MICROSECOND 1000000.0F
/* global variables */
-io_time_t *timer_g; /* timer: global for stub functions */
+io_time_t *timer_g; /* timer: global for stub functions */
/*
* Function: sub_time
@@ -42,15 +42,13 @@ io_time_t *timer_g; /* timer: global for stub functions */
* Note that the function assumes that a > b
* Programmer: Leon Arber, 1/27/06
*/
-static double sub_time(struct timeval* a, struct timeval* b)
+static double
+sub_time(struct timeval *a, struct timeval *b)
{
- return (((double)a->tv_sec +
- ((double)a->tv_usec) / (double)MICROSECOND) -
- ((double)b->tv_sec +
- ((double)b->tv_usec) / (double)MICROSECOND));
+ return (((double)a->tv_sec + ((double)a->tv_usec) / (double)MICROSECOND) -
+ ((double)b->tv_sec + ((double)b->tv_usec) / (double)MICROSECOND));
}
-
/*
* Function: io_time_new
* Purpose: Build us a brand, spankin', new performance time object.
@@ -134,67 +132,73 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop)
/* sanity check */
HDassert(pt);
- switch(pt->type){
+ switch (pt->type) {
#ifdef H5_HAVE_PARALLEL
- case MPI_CLOCK:
- if (start_stop == TSTART) {
- pt->mpi_timer[t] = MPI_Wtime();
-
- /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS
- * we compute the time it took to only open the file */
- if(t == HDF5_FINE_WRITE_FIXED_DIMS)
- pt->total_time[HDF5_FILE_WRITE_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_WRITE_FIXED_DIMS];
- else if(t == HDF5_FINE_READ_FIXED_DIMS)
- pt->total_time[HDF5_FILE_READ_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS];
-
- } else {
- pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t];
- pt->mpi_timer[t] = MPI_Wtime();
-
- /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS
- * we compute the time it took to close the file after the last read/write finished */
- if(t == HDF5_GROSS_WRITE_FIXED_DIMS)
- pt->total_time[HDF5_FILE_WRITE_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_WRITE_FIXED_DIMS];
- else if(t == HDF5_GROSS_READ_FIXED_DIMS)
- pt->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS];
- }
- break;
+ case MPI_CLOCK:
+ if (start_stop == TSTART) {
+ pt->mpi_timer[t] = MPI_Wtime();
+
+ /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS
+ * we compute the time it took to only open the file */
+ if (t == HDF5_FINE_WRITE_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_WRITE_OPEN] +=
+ pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_WRITE_FIXED_DIMS];
+ else if (t == HDF5_FINE_READ_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_READ_OPEN] +=
+ pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS];
+ }
+ else {
+ pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t];
+ pt->mpi_timer[t] = MPI_Wtime();
+
+ /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS
+ * we compute the time it took to close the file after the last read/write finished */
+ if (t == HDF5_GROSS_WRITE_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_WRITE_CLOSE] +=
+ pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_WRITE_FIXED_DIMS];
+ else if (t == HDF5_GROSS_READ_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_READ_CLOSE] +=
+ pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS];
+ }
+ break;
#else
- case MPI_CLOCK:
- HDfprintf(stderr, "MPI clock set in serial library\n");
- return NULL;
+ case MPI_CLOCK:
+ HDfprintf(stderr, "MPI clock set in serial library\n");
+ return NULL;
#endif /* H5_HAVE_PARALLEL */
- case SYS_CLOCK:
+ case SYS_CLOCK:
if (start_stop == TSTART) {
HDgettimeofday(&pt->sys_timer[t], NULL);
- /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS
- * we compute the time it took to only open the file */
- if(t == HDF5_FINE_WRITE_FIXED_DIMS)
- pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS]));
- else if(t == HDF5_FINE_READ_FIXED_DIMS)
- pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS]));
-
-
- } else {
+ /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS
+ * we compute the time it took to only open the file */
+ if (t == HDF5_FINE_WRITE_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_WRITE_OPEN] +=
+ sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS]));
+ else if (t == HDF5_FINE_READ_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_READ_OPEN] +=
+ sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS]));
+ }
+ else {
struct timeval sys_t;
HDgettimeofday(&sys_t, NULL);
pt->total_time[t] += sub_time(&sys_t, &(pt->sys_timer[t]));
- /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS
- * we compute the time it took to close the file after the last read/write finished */
- if(t == HDF5_GROSS_WRITE_FIXED_DIMS)
- pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS]));
- else if(t == HDF5_GROSS_READ_FIXED_DIMS)
- pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS]));
-
+ /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS
+ * we compute the time it took to close the file after the last read/write finished */
+ if (t == HDF5_GROSS_WRITE_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_WRITE_CLOSE] +=
+ sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS]));
+ else if (t == HDF5_GROSS_READ_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_READ_CLOSE] +=
+ sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS]));
}
- break;
+ break;
- default:
- HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type);
- return NULL;
+ default:
+ HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type);
+ return NULL;
} /* end switch */
#if 0
diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h
index c1fa58e..02951e1b 100644
--- a/tools/lib/io_timer.h
+++ b/tools/lib/io_timer.h
@@ -6,28 +6,28 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef IO_TIMER__
-#define IO_TIMER__
+#ifndef IO_TIMER
+#define IO_TIMER
#include "hdf5.h"
#if defined(H5_TIME_WITH_SYS_TIME)
-# include <sys/time.h>
-# include <time.h>
+#include <sys/time.h>
+#include <time.h>
#elif defined(H5_HAVE_SYS_TIME_H)
-# include <sys/time.h>
+#include <sys/time.h>
#else
-# include <time.h>
+#include <time.h>
#endif
#ifdef H5_HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif /* H5_HAVE_WINSOCK2_H */
+#include <winsock2.h>
+#endif
/* The different types of timers we can have */
typedef enum timer_type_ {
@@ -49,43 +49,43 @@ typedef enum timer_type_ {
} timer_type;
typedef enum clock_type_ {
- SYS_CLOCK = 0, /* Use system clock to measure time */
- MPI_CLOCK = 1 /* Use MPI clock to measure time */
+ SYS_CLOCK = 0, /* Use system clock to measure time */
+ MPI_CLOCK = 1 /* Use MPI clock to measure time */
} clock_type;
/* Miscellaneous identifiers */
enum {
- TSTART, /* Start a specified timer */
- TSTOP /* Stop a specified timer */
+ TSTART, /* Start a specified timer */
+ TSTOP /* Stop a specified timer */
};
/* The performance time structure */
typedef struct io_time_t {
- clock_type type;
- double total_time[NUM_TIMERS];
- double mpi_timer[NUM_TIMERS];
+ clock_type type;
+ double total_time[NUM_TIMERS];
+ double mpi_timer[NUM_TIMERS];
struct timeval sys_timer[NUM_TIMERS];
} io_time_t;
/* External function declarations */
#ifdef __cplusplus
extern "C" {
-#endif /* __cplusplus */
+#endif /* __cplusplus */
#ifdef STANDALONE
-io_time_t *io_time_new(clock_type t);
-void io_time_destroy(io_time_t *pt);
-io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop);
-double io_time_get(io_time_t *pt, timer_type t);
+io_time_t *io_time_new(clock_type t);
+void io_time_destroy(io_time_t *pt);
+io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop);
+double io_time_get(io_time_t *pt, timer_type t);
#else
-H5TOOLS_DLL io_time_t *io_time_new(clock_type t);
-H5TOOLS_DLL void io_time_destroy(io_time_t *pt);
-H5TOOLS_DLL io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop);
-H5TOOLS_DLL double io_time_get(io_time_t *pt, timer_type t);
+H5TOOLS_DLL io_time_t *io_time_new(clock_type t);
+H5TOOLS_DLL void io_time_destroy(io_time_t *pt);
+H5TOOLS_DLL io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop);
+H5TOOLS_DLL double io_time_get(io_time_t *pt, timer_type t);
#endif
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* IO_TIMER__ */
+#endif /* IO_TIMER */
diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h
index 2189e31..7dce495 100644
--- a/tools/lib/ph5diff.h
+++ b/tools/lib/ph5diff.h
@@ -6,41 +6,38 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef _PH5DIFF_H__
-#define _PH5DIFF_H__
+#ifndef PH5DIFF_H
+#define PH5DIFF_H
/* Send from manager to workers */
-#define MPI_TAG_ARGS 1
-#define MPI_TAG_PRINT_TOK 2
+#define MPI_TAG_ARGS 1
+#define MPI_TAG_PRINT_TOK 2
/*Sent from workers to manager */
-#define MPI_TAG_TOK_REQUEST 3
-#define MPI_TAG_DONE 4
-#define MPI_TAG_TOK_RETURN 5
-#define MPI_TAG_PRINT_DATA 6
+#define MPI_TAG_TOK_REQUEST 3
+#define MPI_TAG_DONE 4
+#define MPI_TAG_TOK_RETURN 5
+#define MPI_TAG_PRINT_DATA 6
/* Operational tags used to init and complete diff */
-#define MPI_TAG_END 7
-#define MPI_TAG_PARALLEL 8
+#define MPI_TAG_END 7
+#define MPI_TAG_PARALLEL 8
-struct diff_mpi_args
-{
- char name1[256];
- char name2[256];
+struct diff_mpi_args {
+ char name1[256];
+ char name2[256];
diff_opt_t opts;
- diff_args_t argdata; /* rest args */
+ diff_args_t argdata; /* rest args */
};
-struct diffs_found
-{
+struct diffs_found {
hsize_t nfound;
- int not_cmp;
+ int not_cmp;
};
-#endif /* _PH5DIFF_H__ */
-
+#endif /* PH5DIFF_H */
diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt
index 3e0f671..1332099 100644
--- a/tools/libtest/CMakeLists.txt
+++ b/tools/libtest/CMakeLists.txt
@@ -6,7 +6,7 @@ project (HDF5_TOOLS_LIBTEST C)
#-----------------------------------------------------------------------------
add_executable (h5tools_test_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_test_utils.c)
target_compile_options(h5tools_test_utils PRIVATE "${HDF5_CMAKE_C_FLAGS}")
-target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5tools_test_utils STATIC)
target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
@@ -16,6 +16,13 @@ else ()
endif ()
set_target_properties (h5tools_test_utils PROPERTIES FOLDER tools)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_H5TOOLS_TEST_SRC_FORMAT h5tools_test_utils)
+endif ()
+
if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
include (CMakeTests.cmake)
endif ()
diff --git a/tools/libtest/CMakeTests.cmake b/tools/libtest/CMakeTests.cmake
index 4feee9b..2d8e877 100644
--- a/tools/libtest/CMakeTests.cmake
+++ b/tools/libtest/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/libtest/Makefile.am b/tools/libtest/Makefile.am
index 0dc18e9..fde05a4 100644
--- a/tools/libtest/Makefile.am
+++ b/tools/libtest/Makefile.am
@@ -1,16 +1,16 @@
#
-# Read-Only S3 Virtual File Driver (VFD)
-# Copyright (c) 2017-2018, The HDF Group.
-#
+# Copyright by The HDF Group.
# All rights reserved.
#
# NOTICE:
-# All information contained herein is, and remains, the property of The HDF
-# Group. The intellectual and technical concepts contained herein are
-# proprietary to The HDF Group. Dissemination of this information or
-# reproduction of this material is strictly forbidden unless prior written
-# permission is obtained from The HDF Group.
-##
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://www.hdfgroup.org/licenses.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
## Makefile.am
## Run automake to generate a Makefile.in from this file.
#
diff --git a/tools/libtest/Makefile.in b/tools/libtest/Makefile.in
index 3798b7c..3c2587f 100644
--- a/tools/libtest/Makefile.in
+++ b/tools/libtest/Makefile.in
@@ -15,17 +15,18 @@
@SET_MAKE@
#
-# Read-Only S3 Virtual File Driver (VFD)
-# Copyright (c) 2017-2018, The HDF Group.
-#
+# Copyright by The HDF Group.
# All rights reserved.
#
# NOTICE:
-# All information contained herein is, and remains, the property of The HDF
-# Group. The intellectual and technical concepts contained herein are
-# proprietary to The HDF Group. Dissemination of this information or
-# reproduction of this material is strictly forbidden unless prior written
-# permission is obtained from The HDF Group.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://www.hdfgroup.org/licenses.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
#
# HDF5 Library Makefile(.in)
#
@@ -115,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -418,12 +420,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -461,11 +463,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -497,8 +544,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -512,7 +557,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -522,6 +569,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -715,7 +763,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1223,8 +1271,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c
index dbc22d2..c4d4555 100644
--- a/tools/libtest/h5tools_test_utils.c
+++ b/tools/libtest/h5tools_test_utils.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,26 +21,18 @@
#include "h5test.h"
/* Selector for which test cases to run */
-typedef enum vfd_tests_e {
- VFD_TESTS_COMMON,
- VFD_TESTS_ROS3,
- VFD_TESTS_HDFS
-} vfd_tests_e;
+typedef enum vfd_tests_e { VFD_TESTS_COMMON, VFD_TESTS_ROS3, VFD_TESTS_HDFS } vfd_tests_e;
/* Whether we pass in H5I_INVALID_HID, H5P_DEFAULT, or a created fapl */
-typedef enum fapl_choice_e {
- FAPL_CHOICE_INVALID,
- FAPL_CHOICE_DEFAULT,
- FAPL_CHOICE_CREATE
-} fapl_choice_e;
+typedef enum fapl_choice_e { FAPL_CHOICE_INVALID, FAPL_CHOICE_DEFAULT, FAPL_CHOICE_CREATE } fapl_choice_e;
/* Test case data */
typedef struct fapl_testcase_t {
- const char error_message[88];
- herr_t expected_result;
- fapl_choice_e fapl_choice;
- const char vfd_name[12];
- void *fa;
+ const char error_message[88];
+ herr_t expected_result;
+ fapl_choice_e fapl_choice;
+ const char vfd_name[12];
+ void * fa;
} fapl_testcase_t;
/* Generic "incorrect" VFD struct */
@@ -50,56 +42,62 @@ typedef struct other_fa_t {
int c;
} other_fa_t;
-other_fa_t wrong_fa_g = {0x432, 0xf82, 0x9093};
+other_fa_t wrong_fa_g = {0x432, 0xf82, 0x9093};
/******************************/
/* Common test configurations */
/******************************/
fapl_testcase_t common_cases_g[] = {
- { "(common) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)",
+ {
+ "(common) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)",
FAIL,
FAPL_CHOICE_INVALID,
"",
NULL,
},
- { "(common) H5I_INVALID_HID + inappropriate VFD struct (UNEXPECTED SUCCESS)",
+ {
+ "(common) H5I_INVALID_HID + inappropriate VFD struct (UNEXPECTED SUCCESS)",
FAIL,
FAPL_CHOICE_INVALID,
"",
&wrong_fa_g,
},
- { "(common) H5P_DEFAULT + NULL VFD struct (FAILED)",
+ {
+ "(common) H5P_DEFAULT + NULL VFD struct (FAILED)",
SUCCEED,
FAPL_CHOICE_DEFAULT,
"",
NULL,
},
- { "(common) H5P_DEFAULT + ignored VFD struct (FAILED)",
+ {
+ "(common) H5P_DEFAULT + ignored VFD struct (FAILED)",
SUCCEED,
FAPL_CHOICE_DEFAULT,
"",
&wrong_fa_g,
},
- { "(common) H5Pcreate() + NULL VFD struct (FAILED)",
+ {
+ "(common) H5Pcreate() + NULL VFD struct (FAILED)",
SUCCEED,
FAPL_CHOICE_CREATE,
"",
NULL,
},
- { "(common) H5Pcreate() + ignored VFD struct (FAILED)",
+ {
+ "(common) H5Pcreate() + ignored VFD struct (FAILED)",
SUCCEED,
FAPL_CHOICE_CREATE,
"",
&wrong_fa_g,
},
- { "(common) H5P_DEFAULT + non-VFD name + NULL VFD struct (UNEXPECTED SUCCESS)",
+ {
+ "(common) H5P_DEFAULT + non-VFD name + NULL VFD struct (UNEXPECTED SUCCESS)",
FAIL,
FAPL_CHOICE_DEFAULT,
"unknown",
NULL,
- }
-};
+ }};
#ifdef H5_HAVE_ROS3_VFD
@@ -109,38 +107,41 @@ fapl_testcase_t common_cases_g[] = {
H5FD_ros3_fapl_t ros3_anon_fa_g = {1, FALSE, "", "", ""};
-fapl_testcase_t ros3_cases_g[] = {
- { "(ROS3) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)",
- FAIL,
- FAPL_CHOICE_INVALID,
- "ros3",
- NULL,
- },
- { "(ROS3) H5I_INVALID_HID + valid VFD struct (UNEXPECTED SUCCESS)",
- FAIL,
- FAPL_CHOICE_INVALID,
- "ros3",
- &ros3_anon_fa_g,
- },
- { "(ROS3) H5Pcreate() + NULL VFD struct (UNEXPECTED SUCCESS)",
- FAIL,
- FAPL_CHOICE_CREATE,
- "ros3",
- NULL,
- },
- { "(ROS3) H5Pcreate() + valid VFD struct (FAILED)",
- SUCCEED,
- FAPL_CHOICE_CREATE,
- "ros3",
- &ros3_anon_fa_g,
- },
- { "(ROS3) H5P_DEFAULT + valid VFD struct (FAILED)",
- SUCCEED,
- FAPL_CHOICE_DEFAULT,
- "ros3",
- &ros3_anon_fa_g,
- }
-};
+fapl_testcase_t ros3_cases_g[] = {{
+ "(ROS3) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)",
+ FAIL,
+ FAPL_CHOICE_INVALID,
+ "ros3",
+ NULL,
+ },
+ {
+ "(ROS3) H5I_INVALID_HID + valid VFD struct (UNEXPECTED SUCCESS)",
+ FAIL,
+ FAPL_CHOICE_INVALID,
+ "ros3",
+ &ros3_anon_fa_g,
+ },
+ {
+ "(ROS3) H5Pcreate() + NULL VFD struct (UNEXPECTED SUCCESS)",
+ FAIL,
+ FAPL_CHOICE_CREATE,
+ "ros3",
+ NULL,
+ },
+ {
+ "(ROS3) H5Pcreate() + valid VFD struct (FAILED)",
+ SUCCEED,
+ FAPL_CHOICE_CREATE,
+ "ros3",
+ &ros3_anon_fa_g,
+ },
+ {
+ "(ROS3) H5P_DEFAULT + valid VFD struct (FAILED)",
+ SUCCEED,
+ FAPL_CHOICE_DEFAULT,
+ "ros3",
+ &ros3_anon_fa_g,
+ }};
#endif /* H5_HAVE_ROS3_VFD */
#ifdef H5_HAVE_LIBHDFS
@@ -158,153 +159,166 @@ H5FD_hdfs_fapl_t hdfs_fa_g = {
2048, /* stream buffer size */
};
-fapl_testcase_t hdfs_cases_g[] = {
- { "(HDFS) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)",
- FAIL,
- FAPL_CHOICE_INVALID,
- "hdfs",
- NULL,
- },
- { "(HDFS) H5I_INVALID_HID + valid VFD struct (UNEXPECTED SUCCESS)",
- FAIL,
- FAPL_CHOICE_INVALID,
- "hdfs",
- &hdfs_fa_g,
- },
- { "(HDFS) H5Pcreate() + NULL VFD struct (UNEXPECTED SUCCESS)",
- FAIL,
- FAPL_CHOICE_CREATE,
- "hdfs",
- NULL,
- },
- { "(HDFS) H5Pcreate() + valid VFD struct (FAILED)",
- SUCCEED,
- FAPL_CHOICE_CREATE,
- "hdfs",
- &hdfs_fa_g,
- },
- { "(HDFS) H5P_DEFAULT + valid VFD struct (FAILED)",
- SUCCEED,
- FAPL_CHOICE_DEFAULT,
- "hdfs",
- &hdfs_fa_g,
- }
-};
+fapl_testcase_t hdfs_cases_g[] = {{
+ "(HDFS) H5I_INVALID_HID + NULL VFD struct (UNEXPECTED SUCCESS)",
+ FAIL,
+ FAPL_CHOICE_INVALID,
+ "hdfs",
+ NULL,
+ },
+ {
+ "(HDFS) H5I_INVALID_HID + valid VFD struct (UNEXPECTED SUCCESS)",
+ FAIL,
+ FAPL_CHOICE_INVALID,
+ "hdfs",
+ &hdfs_fa_g,
+ },
+ {
+ "(HDFS) H5Pcreate() + NULL VFD struct (UNEXPECTED SUCCESS)",
+ FAIL,
+ FAPL_CHOICE_CREATE,
+ "hdfs",
+ NULL,
+ },
+ {
+ "(HDFS) H5Pcreate() + valid VFD struct (FAILED)",
+ SUCCEED,
+ FAPL_CHOICE_CREATE,
+ "hdfs",
+ &hdfs_fa_g,
+ },
+ {
+ "(HDFS) H5P_DEFAULT + valid VFD struct (FAILED)",
+ SUCCEED,
+ FAPL_CHOICE_DEFAULT,
+ "hdfs",
+ &hdfs_fa_g,
+ }};
#endif /* H5_HAVE_LIBHDFS */
-
typedef struct tuple_testcase_t {
- const char *test_msg; /* info about test case */
- const char *in_str; /* input string */
- int sep; /* separator "character" */
+ const char *test_msg; /* info about test case */
+ const char *in_str; /* input string */
+ int sep; /* separator "character" */
herr_t expected_result; /* expected SUCCEED / FAIL */
- unsigned exp_nelems; /* expected number of elements */
- /* (no more than 7!) */
- const char *exp_elems[7]; /* list of elements (no more than 7!) */
+ unsigned exp_nelems; /* expected number of elements */
+ /* (no more than 7!) */
+ const char *exp_elems[7]; /* list of elements (no more than 7!) */
} tuple_testcase_t;
tuple_testcase_t tuple_cases_g[] = {
- { "bad start",
+ {
+ "bad start",
"words(before)",
';',
FAIL,
0,
{NULL},
},
- { "tuple not closed",
+ {
+ "tuple not closed",
"(not ok",
',',
FAIL,
0,
{NULL},
},
- { "empty tuple",
+ {
+ "empty tuple",
"()",
'-',
SUCCEED,
1,
{""},
},
- { "no separator",
+ {
+ "no separator",
"(stuff keeps on going)",
',',
SUCCEED,
1,
{"stuff keeps on going"},
},
- { "4-ple, escaped seperator",
+ {
+ "4-ple, escaped seperator",
"(elem0,elem1,el\\,em2,elem3)", /* "el\,em" */
',',
SUCCEED,
4,
{"elem0", "elem1", "el,em2", "elem3"},
},
- { "5-ple, escaped escaped separator",
+ {
+ "5-ple, escaped escaped separator",
"(elem0,elem1,el\\\\,em2,elem3)",
',',
SUCCEED,
5,
{"elem0", "elem1", "el\\", "em2", "elem3"},
},
- { "escaped non-comma separator",
+ {
+ "escaped non-comma separator",
"(5-2-7-2\\-6-2)",
'-',
SUCCEED,
5,
- {"5","2","7","2-6","2"},
+ {"5", "2", "7", "2-6", "2"},
},
- { "embedded close-paren",
+ {
+ "embedded close-paren",
"(be;fo)re)",
';',
SUCCEED,
2,
{"be", "fo)re"},
},
- { "embedded non-escaping backslash",
+ {
+ "embedded non-escaping backslash",
"(be;fo\\re)",
';',
SUCCEED,
2,
{"be", "fo\\re"},
},
- { "double close-paren at end",
+ {
+ "double close-paren at end",
"(be;fore))",
';',
SUCCEED,
2,
{"be", "fore)"},
},
- { "empty elements",
+ {
+ "empty elements",
"(;a1;;a4;)",
';',
SUCCEED,
5,
{"", "a1", "", "a4", ""},
},
- { "nested tuples with different separators",
+ {
+ "nested tuples with different separators",
"((4,e,a);(6,2,a))",
';',
SUCCEED,
2,
- {"(4,e,a)","(6,2,a)"},
+ {"(4,e,a)", "(6,2,a)"},
},
- { "nested tuples with same separators",
+ {
+ "nested tuples with same separators",
"((4,e,a),(6,2,a))",
',',
SUCCEED,
6,
- {"(4","e","a)","(6","2","a)"},
+ {"(4", "e", "a)", "(6", "2", "a)"},
},
- { "real-world use case",
+ {
+ "real-world use case",
"(us-east-2,AKIAIMC3D3XLYXLN5COA,ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+)",
',',
SUCCEED,
3,
- {"us-east-2",
- "AKIAIMC3D3XLYXLN5COA",
- "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+"},
- }
-};
+ {"us-east-2", "AKIAIMC3D3XLYXLN5COA", "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+"},
+ }};
/*----------------------------------------------------------------------------
*
@@ -323,14 +337,14 @@ tuple_testcase_t tuple_cases_g[] = {
static herr_t
test_parse_tuple(void)
{
- tuple_testcase_t tc;
- unsigned n_tests = 14;
- unsigned u = 0;
- unsigned count = 0;
- unsigned elem_u = 0;
- char **parsed = NULL;
- char *cpy = NULL;
- herr_t ret;
+ tuple_testcase_t tc;
+ unsigned n_tests = 14;
+ unsigned u = 0;
+ unsigned count = 0;
+ unsigned elem_u = 0;
+ char ** parsed = NULL;
+ char * cpy = NULL;
+ herr_t ret;
TESTING("arbitrary-count tuple parsing");
@@ -338,11 +352,11 @@ test_parse_tuple(void)
tc = tuple_cases_g[u];
- ret = parse_tuple(tc.in_str, tc.sep, &cpy, &count, &parsed);
+ ret = parse_tuple(tc.in_str, tc.sep, &cpy, &count, &parsed);
- if(tc.expected_result != ret)
+ if (tc.expected_result != ret)
FAIL_PUTS_ERROR("unexpected result from parse_tuple()")
- if(tc.exp_nelems != count)
+ if (tc.exp_nelems != count)
FAIL_PUTS_ERROR("incorrect number of elements returned from parse_tupble()")
if (ret == SUCCEED) {
@@ -356,7 +370,7 @@ test_parse_tuple(void)
}
else {
/* Failed return case checks */
- if(parsed != NULL)
+ if (parsed != NULL)
FAIL_PUTS_ERROR("should not have returned elements on failure")
}
@@ -376,7 +390,6 @@ error:
} /* test_parse_tuple */
-
/*----------------------------------------------------------------------------
*
* Function: test_populate_ros3_fa()
@@ -394,7 +407,7 @@ error:
static herr_t
test_populate_ros3_fa(void)
{
- int bad_version = 0xf87a; /* arbitrarily wrong version number */
+ int bad_version = 0xf87a; /* arbitrarily wrong version number */
TESTING("ros3 fapl population");
@@ -431,8 +444,8 @@ test_populate_ros3_fa(void)
/* all-empty values yields default fapl */
{
- H5FD_ros3_fapl_t fa = {bad_version, TRUE, "u", "v", "w"};
- const char *values[] = {"", "", ""};
+ H5FD_ros3_fapl_t fa = {bad_version, TRUE, "u", "v", "w"};
+ const char * values[] = {"", "", ""};
/* Should PASS */
if (FAIL == h5tools_populate_ros3_fapl(&fa, values))
@@ -454,8 +467,8 @@ test_populate_ros3_fa(void)
* excess value is ignored
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {"x", "y", "z", "a"};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"x", "y", "z", "a"};
/* Should PASS */
if (FAIL == h5tools_populate_ros3_fapl(&fa, values))
@@ -477,8 +490,8 @@ test_populate_ros3_fa(void)
* yields default fapl
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {NULL, "y", "z", NULL};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {NULL, "y", "z", NULL};
/* Should FAIL */
if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values))
@@ -500,8 +513,8 @@ test_populate_ros3_fa(void)
* yields default fapl
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {"", "y", "z", NULL};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"", "y", "z", NULL};
/* Should FAIL */
if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values))
@@ -523,12 +536,10 @@ test_populate_ros3_fa(void)
* yields default fapl
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {
- "somewhere over the rainbow not too high " \
- "there is another rainbow bounding some darkened sky",
- "y",
- "z"};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"somewhere over the rainbow not too high "
+ "there is another rainbow bounding some darkened sky",
+ "y", "z"};
HDassert(HDstrlen(values[0]) > H5FD_ROS3_MAX_REGION_LEN);
@@ -552,8 +563,8 @@ test_populate_ros3_fa(void)
* yields default fapl
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {"x", NULL, "z", NULL};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"x", NULL, "z", NULL};
/* Should FAIL */
if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values))
@@ -575,8 +586,8 @@ test_populate_ros3_fa(void)
* yields default fapl
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {"x", "", "z", NULL};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"x", "", "z", NULL};
/* Should FAIL */
if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values))
@@ -598,20 +609,19 @@ test_populate_ros3_fa(void)
* partial set: region
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {
- "x",
- "Why is it necessary to solve the problem? " \
- "What benefits will you receive by solving the problem? " \
- "What is the unknown? " \
- "What is it you don't yet understand? " \
- "What is the information you have? " \
- "What isn't the problem? " \
- "Is the information insufficient, redundant, or contradictory? " \
- "Should you draw a diagram or figure of the problem? " \
- "What are the boundaries of the problem? " \
- "Can you separate the various parts of the problem?",
- "z"};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"x",
+ "Why is it necessary to solve the problem? "
+ "What benefits will you receive by solving the problem? "
+ "What is the unknown? "
+ "What is it you don't yet understand? "
+ "What is the information you have? "
+ "What isn't the problem? "
+ "Is the information insufficient, redundant, or contradictory? "
+ "Should you draw a diagram or figure of the problem? "
+ "What are the boundaries of the problem? "
+ "Can you separate the various parts of the problem?",
+ "z"};
HDassert(HDstrlen(values[1]) > H5FD_ROS3_MAX_SECRET_ID_LEN);
@@ -635,8 +645,8 @@ test_populate_ros3_fa(void)
* yields default fapl
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {"x", "y", NULL, NULL};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"x", "y", NULL, NULL};
/* Should FAIL */
if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values))
@@ -658,8 +668,8 @@ test_populate_ros3_fa(void)
* yields authenticating fapl
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {"x", "y", "", NULL};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"x", "y", "", NULL};
/* Should PASS */
if (FAIL == h5tools_populate_ros3_fapl(&fa, values))
@@ -681,8 +691,8 @@ test_populate_ros3_fa(void)
* yields default fapl
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {"", "y", "", NULL};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"", "y", "", NULL};
/* Should FAIL */
if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values))
@@ -704,8 +714,8 @@ test_populate_ros3_fa(void)
* yields default fapl
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {"x", "", "", NULL};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"x", "", "", NULL};
/* Should FAIL */
if (SUCCEED == h5tools_populate_ros3_fapl(&fa, values))
@@ -727,20 +737,18 @@ test_populate_ros3_fa(void)
* partial set: region, id
*/
{
- H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
- const char *values[] = {
- "x",
- "y",
- "Why is it necessary to solve the problem? " \
- "What benefits will you receive by solving the problem? " \
- "What is the unknown? " \
- "What is it you don't yet understand? " \
- "What is the information you have? " \
- "What isn't the problem? " \
- "Is the information insufficient, redundant, or contradictory? " \
- "Should you draw a diagram or figure of the problem? " \
- "What are the boundaries of the problem? " \
- "Can you separate the various parts of the problem?"};
+ H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"};
+ const char * values[] = {"x", "y",
+ "Why is it necessary to solve the problem? "
+ "What benefits will you receive by solving the problem? "
+ "What is the unknown? "
+ "What is it you don't yet understand? "
+ "What is the information you have? "
+ "What isn't the problem? "
+ "Is the information insufficient, redundant, or contradictory? "
+ "Should you draw a diagram or figure of the problem? "
+ "What are the boundaries of the problem? "
+ "Can you separate the various parts of the problem?"};
HDassert(HDstrlen(values[2]) > H5FD_ROS3_MAX_SECRET_KEY_LEN);
@@ -763,12 +771,9 @@ test_populate_ros3_fa(void)
/* use case
*/
{
- H5FD_ros3_fapl_t fa = {0, 0, "", "", ""};
- const char *values[] = {
- "us-east-2",
- "AKIAIMC3D3XLYXLN5COA",
- "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+"
- };
+ H5FD_ros3_fapl_t fa = {0, 0, "", "", ""};
+ const char * values[] = {"us-east-2", "AKIAIMC3D3XLYXLN5COA",
+ "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+"};
/* Should PASS */
if (FAIL == h5tools_populate_ros3_fapl(&fa, values))
@@ -790,7 +795,6 @@ error:
} /* test_populate_ros3_fa */
#endif /* H5_HAVE_ROS3_VFD */
-
/*----------------------------------------------------------------------------
*
* Function: test_set_configured_fapl()
@@ -807,9 +811,9 @@ error:
static herr_t
test_set_configured_fapl(vfd_tests_e test_type, fapl_testcase_t cases[], unsigned n_cases)
{
- hid_t in_fapl_id = H5I_INVALID_HID;
- hid_t out_fapl_id = H5I_INVALID_HID;
- unsigned u;
+ hid_t in_fapl_id = H5I_INVALID_HID;
+ hid_t out_fapl_id = H5I_INVALID_HID;
+ unsigned u;
if (VFD_TESTS_COMMON == test_type)
TESTING("set fapl vfd (common)")
@@ -821,26 +825,26 @@ test_set_configured_fapl(vfd_tests_e test_type, fapl_testcase_t cases[], unsigne
/* Loop over all test cases */
for (u = 0; u < n_cases; u++) {
h5tools_vfd_info_t vfd_info;
- fapl_testcase_t tc = cases[u];
+ fapl_testcase_t tc = cases[u];
/* Setup */
if (tc.fapl_choice == FAPL_CHOICE_DEFAULT) {
in_fapl_id = H5P_DEFAULT;
}
else if (tc.fapl_choice == FAPL_CHOICE_CREATE) {
- if(H5I_INVALID_HID == (in_fapl_id = H5Pcreate(H5P_FILE_ACCESS)))
+ if (H5I_INVALID_HID == (in_fapl_id = H5Pcreate(H5P_FILE_ACCESS)))
TEST_ERROR
}
else
in_fapl_id = H5I_INVALID_HID;
/* Test */
- if(!HDstrcmp("", tc.vfd_name))
+ if (!HDstrcmp("", tc.vfd_name))
out_fapl_id = h5tools_get_fapl(in_fapl_id, NULL);
else {
vfd_info.info = tc.fa;
vfd_info.name = tc.vfd_name;
- out_fapl_id = h5tools_get_fapl(in_fapl_id, &vfd_info);
+ out_fapl_id = h5tools_get_fapl(in_fapl_id, &vfd_info);
}
/* Check */
@@ -858,16 +862,17 @@ test_set_configured_fapl(vfd_tests_e test_type, fapl_testcase_t cases[], unsigne
PASSED();
return SUCCEED;
-error :
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Pclose(in_fapl_id);
H5Pclose(out_fapl_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* test_set_configured_fapl */
-
/*----------------------------------------------------------------------------
*
* Function: main()
@@ -890,19 +895,18 @@ main(void)
HDprintf("Testing tools VFD functionality.\n");
- nerrors += test_parse_tuple() < 0 ? 1 : 0;
- nerrors += test_set_configured_fapl(VFD_TESTS_COMMON, common_cases_g, 7) < 0 ? 1 : 0;
+ nerrors += test_parse_tuple() < 0 ? 1 : 0;
+ nerrors += test_set_configured_fapl(VFD_TESTS_COMMON, common_cases_g, 7) < 0 ? 1 : 0;
#ifdef H5_HAVE_ROS3_VFD
- nerrors += test_populate_ros3_fa() < 0 ? 1 : 0;
- nerrors += test_set_configured_fapl(VFD_TESTS_ROS3, ros3_cases_g, 5) < 0 ? 1 : 0;
+ nerrors += test_populate_ros3_fa() < 0 ? 1 : 0;
+ nerrors += test_set_configured_fapl(VFD_TESTS_ROS3, ros3_cases_g, 5) < 0 ? 1 : 0;
#endif
#ifdef H5_HAVE_LIBHDFS
- nerrors += test_set_configured_fapl(VFD_TESTS_HDFS, hdfs_cases_g, 5) < 0 ? 1 : 0;
+ nerrors += test_set_configured_fapl(VFD_TESTS_HDFS, hdfs_cases_g, 5) < 0 ? 1 : 0;
#endif
- if(nerrors) {
- HDprintf("***** %d tools VFD TEST%s FAILED! *****\n",
- nerrors, nerrors > 1 ? "S" : "");
+ if (nerrors) {
+ HDprintf("***** %d tools VFD TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
return EXIT_FAILURE;
}
@@ -911,5 +915,3 @@ main(void)
return EXIT_SUCCESS;
} /* end main() */
-
-
diff --git a/tools/src/CMakeLists.txt b/tools/src/CMakeLists.txt
index 8c3e361..e291f61 100644
--- a/tools/src/CMakeLists.txt
+++ b/tools/src/CMakeLists.txt
@@ -13,7 +13,7 @@ add_subdirectory (misc)
#-- Add the h5import and test executables
add_subdirectory (h5import)
-#-- h5Repack executables
+#-- h5repack executables
add_subdirectory (h5repack)
#-- Add the h5dump and test executables
@@ -30,3 +30,6 @@ add_subdirectory (h5dump)
#-- Add the h5format_convert and test executables
add_subdirectory (h5format_convert)
+
+#-- h5perf executables
+add_subdirectory (h5perf)
diff --git a/tools/src/Makefile.am b/tools/src/Makefile.am
index 93fcc1e..5af7d06 100644
--- a/tools/src/Makefile.am
+++ b/tools/src/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
@@ -23,6 +23,6 @@ CONFIG=ordered
# All subdirectories
SUBDIRS=h5diff h5ls h5dump misc h5import h5repack h5jam h5copy \
- h5format_convert h5stat
+ h5format_convert h5stat h5perf
include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/Makefile.in b/tools/src/Makefile.in
index d240b56..309cf03 100644
--- a/tools/src/Makefile.in
+++ b/tools/src/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -113,6 +113,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -423,9 +424,9 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -463,11 +464,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -499,8 +545,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -514,7 +558,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -524,6 +570,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -717,7 +764,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -748,7 +795,7 @@ CONFIG = ordered
# All subdirectories
SUBDIRS = h5diff h5ls h5dump misc h5import h5repack h5jam h5copy \
- h5format_convert h5stat
+ h5format_convert h5stat h5perf
# Automake needs to be taught how to build lib, progs and tests targets.
@@ -1241,8 +1288,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt
index 8f230a0..2f924a2 100644
--- a/tools/src/h5copy/CMakeLists.txt
+++ b/tools/src/h5copy/CMakeLists.txt
@@ -6,7 +6,7 @@ project (HDF5_TOOLS_SRC_H5COPY C)
# --------------------------------------------------------------------
if (NOT ONLY_SHARED_LIBS)
add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c)
- target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5copy PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5copy STATIC)
target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -18,7 +18,7 @@ endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c)
- target_include_directories (h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5copy-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5copy-shared SHARED)
target_link_libraries (h5copy-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
@@ -28,6 +28,17 @@ if (BUILD_SHARED_LIBS)
set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5copy-shared)
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_H5COPY_SRC_FORMAT h5copy)
+ else ()
+ clang_format (HDF5_H5COPY_SRC_FORMAT h5copy-shared)
+ endif ()
+endif ()
+
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
diff --git a/tools/src/h5copy/Makefile.am b/tools/src/h5copy/Makefile.am
index d67fafc..328c6f3 100644
--- a/tools/src/h5copy/Makefile.am
+++ b/tools/src/h5copy/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/src/h5copy/Makefile.in b/tools/src/h5copy/Makefile.in
index 7013818..ecac0e0 100644
--- a/tools/src/h5copy/Makefile.in
+++ b/tools/src/h5copy/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -420,12 +421,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -463,11 +464,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -499,8 +545,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -514,7 +558,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -524,6 +570,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -717,7 +764,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1275,8 +1322,9 @@ uninstall-am: uninstall-binPROGRAMS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c
index a6e4d4e..4e9a25e 100644
--- a/tools/src/h5copy/h5copy.c
+++ b/tools/src/h5copy/h5copy.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -19,25 +19,23 @@
#define PROGRAMNAME "h5copy"
/* command-line options: short and long-named parameters */
-static const char *s_opts = "d:f:hi:o:ps:vVE";
-static struct long_options l_opts[] = {
- { "destination", require_arg, 'd' },
- { "flag", require_arg, 'f' },
- { "help", no_arg, 'h' },
- { "input", require_arg, 'i' },
- { "output", require_arg, 'o' },
- { "parents", no_arg, 'p' },
- { "source", require_arg, 's' },
- { "verbose", no_arg, 'v' },
- { "version", no_arg, 'V' },
- { "enable-error-stack", no_arg, 'E' },
- { NULL, 0, '\0' }
-};
-char *fname_src = NULL;
-char *fname_dst = NULL;
-char *oname_src = NULL;
-char *oname_dst = NULL;
-char *str_flag = NULL;
+static const char * s_opts = "d:f:hi:o:ps:vVE";
+static struct h5_long_options l_opts[] = {{"destination", require_arg, 'd'},
+ {"flag", require_arg, 'f'},
+ {"help", no_arg, 'h'},
+ {"input", require_arg, 'i'},
+ {"output", require_arg, 'o'},
+ {"parents", no_arg, 'p'},
+ {"source", require_arg, 's'},
+ {"verbose", no_arg, 'v'},
+ {"version", no_arg, 'V'},
+ {"enable-error-stack", no_arg, 'E'},
+ {NULL, 0, '\0'}};
+char * fname_src = NULL;
+char * fname_dst = NULL;
+char * oname_src = NULL;
+char * oname_dst = NULL;
+char * str_flag = NULL;
/*-------------------------------------------------------------------------
* Function: leave
@@ -71,7 +69,6 @@ leave(int ret)
HDexit(ret);
}
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -86,7 +83,7 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
static void
-usage (void)
+usage(void)
{
FLUSHSTREAM(rawoutstream);
PRINTVALSTREAM(rawoutstream, "\n");
@@ -98,29 +95,41 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " -d, --destination destination object name\n");
PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
- PRINTVALSTREAM(rawoutstream, " -p, --parents No error if existing, make parent groups as needed\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -p, --parents No error if existing, make parent groups as needed\n");
PRINTVALSTREAM(rawoutstream, " -v, --verbose Print information about OBJECTS and OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
- PRINTVALSTREAM(rawoutstream, " Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Prints messages from the HDF5 error stack as they occur.\n");
PRINTVALSTREAM(rawoutstream, " -f, --flag Flag type\n\n");
PRINTVALSTREAM(rawoutstream, " Flag type is one of the following strings:\n\n");
PRINTVALSTREAM(rawoutstream, " shallow Copy only immediate members for groups\n\n");
PRINTVALSTREAM(rawoutstream, " soft Expand soft links into new objects\n\n");
PRINTVALSTREAM(rawoutstream, " ext Expand external links into new objects\n\n");
- PRINTVALSTREAM(rawoutstream, " ref Copy references and any referenced objects, i.e., objects\n");
+ PRINTVALSTREAM(rawoutstream,
+ " ref Copy references and any referenced objects, i.e., objects\n");
PRINTVALSTREAM(rawoutstream, " that the references point to.\n");
- PRINTVALSTREAM(rawoutstream, " Referenced objects are copied in addition to the objects\n");
- PRINTVALSTREAM(rawoutstream, " specified on the command line and reference datasets are\n");
- PRINTVALSTREAM(rawoutstream, " populated with correct reference values. Copies of referenced\n");
- PRINTVALSTREAM(rawoutstream, " datasets outside the copy range specified on the command line\n");
- PRINTVALSTREAM(rawoutstream, " will normally have a different name from the original.\n");
- PRINTVALSTREAM(rawoutstream, " (Default:Without this option, reference value(s) in any\n");
- PRINTVALSTREAM(rawoutstream, " reference datasets are set to NULL and referenced objects are\n");
- PRINTVALSTREAM(rawoutstream, " not copied unless they are otherwise within the copy range\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Referenced objects are copied in addition to the objects\n");
+ PRINTVALSTREAM(rawoutstream,
+ " specified on the command line and reference datasets are\n");
+ PRINTVALSTREAM(rawoutstream,
+ " populated with correct reference values. Copies of referenced\n");
+ PRINTVALSTREAM(rawoutstream,
+ " datasets outside the copy range specified on the command line\n");
+ PRINTVALSTREAM(rawoutstream,
+ " will normally have a different name from the original.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " (Default:Without this option, reference value(s) in any\n");
+ PRINTVALSTREAM(rawoutstream,
+ " reference datasets are set to NULL and referenced objects are\n");
+ PRINTVALSTREAM(rawoutstream,
+ " not copied unless they are otherwise within the copy range\n");
PRINTVALSTREAM(rawoutstream, " specified on the command line.)\n\n");
PRINTVALSTREAM(rawoutstream, " noattr Copy object without copying attributes\n\n");
- PRINTVALSTREAM(rawoutstream, " allflags Switches all flags from the default to the non-default setting\n\n");
+ PRINTVALSTREAM(rawoutstream,
+ " allflags Switches all flags from the default to the non-default setting\n\n");
PRINTVALSTREAM(rawoutstream, " These flag types correspond to the following API symbols\n\n");
PRINTVALSTREAM(rawoutstream, " H5O_COPY_SHALLOW_HIERARCHY_FLAG\n");
PRINTVALSTREAM(rawoutstream, " H5O_COPY_EXPAND_SOFT_LINK_FLAG\n");
@@ -130,8 +139,6 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " H5O_COPY_ALL\n");
}
-
-
/*-------------------------------------------------------------------------
* Function: parse_flag
*
@@ -156,30 +163,30 @@ usage (void)
*-------------------------------------------------------------------------
*/
-
-static int parse_flag(const char* s_flag, unsigned *flag)
+static int
+parse_flag(const char *s_flag, unsigned *flag)
{
- unsigned fla=0;
+ unsigned fla = 0;
if (HDstrcmp(s_flag, "shallow") == 0) {
fla = H5O_COPY_SHALLOW_HIERARCHY_FLAG;
}
- else if (HDstrcmp(s_flag, "soft") == 0) {
+ else if (HDstrcmp(s_flag, "soft") == 0) {
fla = H5O_COPY_EXPAND_SOFT_LINK_FLAG;
}
- else if (HDstrcmp(s_flag, "ext") == 0) {
+ else if (HDstrcmp(s_flag, "ext") == 0) {
fla = H5O_COPY_EXPAND_EXT_LINK_FLAG;
}
- else if (HDstrcmp(s_flag, "ref") == 0) {
+ else if (HDstrcmp(s_flag, "ref") == 0) {
fla = H5O_COPY_EXPAND_REFERENCE_FLAG;
}
- else if (HDstrcmp(s_flag, "noattr") == 0) {
+ else if (HDstrcmp(s_flag, "noattr") == 0) {
fla = H5O_COPY_WITHOUT_ATTR_FLAG;
}
- else if (HDstrcmp(s_flag, "allflags") == 0) {
+ else if (HDstrcmp(s_flag, "allflags") == 0) {
fla = H5O_COPY_ALL;
}
- else if (HDstrcmp(s_flag, "nullmsg") == 0) {
+ else if (HDstrcmp(s_flag, "nullmsg") == 0) {
fla = H5O_COPY_PRESERVE_NULL_FLAG;
}
else {
@@ -205,19 +212,19 @@ static int parse_flag(const char* s_flag, unsigned *flag)
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- hid_t fid_src = H5I_INVALID_HID;
- hid_t fid_dst = H5I_INVALID_HID;
- unsigned flag = 0;
- unsigned verbose = 0;
- unsigned parents = 0;
- hid_t ocpl_id = H5I_INVALID_HID; /* Object copy property list */
- hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list */
- int opt;
- int li_ret;
+ hid_t fid_src = H5I_INVALID_HID;
+ hid_t fid_dst = H5I_INVALID_HID;
+ unsigned flag = 0;
+ unsigned verbose = 0;
+ unsigned parents = 0;
+ hid_t ocpl_id = H5I_INVALID_HID; /* Object copy property list */
+ hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list */
+ int opt;
+ int li_ret;
h5tool_link_info_t linkinfo;
- int ret_value = 0;
+ int ret_value = 0;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -229,90 +236,90 @@ main (int argc, const char *argv[])
HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t));
/* Check for no command line parameters */
- if(argc == 1) {
+ if (argc == 1) {
usage();
leave(EXIT_FAILURE);
} /* end if */
/* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
- case 'd':
- oname_dst = HDstrdup(opt_arg);
- break;
+ case 'd':
+ oname_dst = HDstrdup(H5_optarg);
+ break;
+
+ case 'f':
+ /* validate flag */
+ if (parse_flag(H5_optarg, &flag) < 0) {
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ str_flag = HDstrdup(H5_optarg);
+ break;
+
+ case 'h':
+ usage();
+ leave(EXIT_SUCCESS);
+ break;
+
+ case 'i':
+ fname_src = HDstrdup(H5_optarg);
+ break;
+
+ case 'o':
+ fname_dst = HDstrdup(H5_optarg);
+ break;
+
+ case 'p':
+ parents = 1;
+ break;
- case 'f':
- /* validate flag */
- if (parse_flag(opt_arg, &flag) < 0) {
+ case 's':
+ oname_src = HDstrdup(H5_optarg);
+ break;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ verbose = 1;
+ break;
+
+ case 'E':
+ enable_error_stack = 1;
+ break;
+
+ default:
usage();
leave(EXIT_FAILURE);
- }
- str_flag = HDstrdup(opt_arg);
- break;
-
- case 'h':
- usage();
- leave(EXIT_SUCCESS);
- break;
-
- case 'i':
- fname_src = HDstrdup(opt_arg);
- break;
-
- case 'o':
- fname_dst = HDstrdup(opt_arg);
- break;
-
- case 'p':
- parents = 1;
- break;
-
- case 's':
- oname_src = HDstrdup(opt_arg);
- break;
-
- case 'V':
- print_version(h5tools_getprogname());
- leave(EXIT_SUCCESS);
- break;
-
- case 'v':
- verbose = 1;
- break;
-
- case 'E':
- enable_error_stack = 1;
- break;
-
- default:
- usage();
- leave(EXIT_FAILURE);
}
} /* end of while */
-/*-------------------------------------------------------------------------
- * check for missing file/object names
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * check for missing file/object names
+ *-------------------------------------------------------------------------*/
- if (fname_src==NULL) {
+ if (fname_src == NULL) {
error_msg("Input file name missing\n");
usage();
leave(EXIT_FAILURE);
}
- if (fname_dst==NULL) {
+ if (fname_dst == NULL) {
error_msg("Output file name missing\n");
usage();
leave(EXIT_FAILURE);
}
- if (oname_src==NULL) {
+ if (oname_src == NULL) {
error_msg("Source object name missing\n");
usage();
leave(EXIT_FAILURE);
}
- if (oname_dst==NULL) {
+ if (oname_dst == NULL) {
error_msg("Destination object name missing\n");
usage();
leave(EXIT_FAILURE);
@@ -321,63 +328,61 @@ main (int argc, const char *argv[])
/* enable error reporting if command line option */
h5tools_error_report();
- /*-------------------------------------------------------------------------
- * open output file
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * open output file
+ *-------------------------------------------------------------------------*/
/* Attempt to open an existing HDF5 file first. Need to open the dst file
before the src file just in case that the dst and src are the same file
*/
fid_dst = h5tools_fopen(fname_dst, H5F_ACC_RDWR, H5P_DEFAULT, FALSE, NULL, 0);
- /*-------------------------------------------------------------------------
- * open input file
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * open input file
+ *-------------------------------------------------------------------------*/
fid_src = h5tools_fopen(fname_src, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, 0);
- /*-------------------------------------------------------------------------
- * test for error in opening input file
- *-------------------------------------------------------------------------*/
- if (fid_src==-1) {
+ /*-------------------------------------------------------------------------
+ * test for error in opening input file
+ *-------------------------------------------------------------------------*/
+ if (fid_src == -1) {
error_msg("Could not open input file <%s>...Exiting\n", fname_src);
leave(EXIT_FAILURE);
}
-
- /*-------------------------------------------------------------------------
- * create an output file when failed to open it
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * create an output file when failed to open it
+ *-------------------------------------------------------------------------*/
/* If we couldn't open an existing file, try creating file */
/* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */
- if(fid_dst < 0)
+ if (fid_dst < 0)
fid_dst = H5Fcreate(fname_dst, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
- /*-------------------------------------------------------------------------
- * test for error in opening output file
- *-------------------------------------------------------------------------*/
- if (fid_dst==-1) {
+ /*-------------------------------------------------------------------------
+ * test for error in opening output file
+ *-------------------------------------------------------------------------*/
+ if (fid_dst == -1) {
error_msg("Could not open output file <%s>...Exiting\n", fname_dst);
leave(EXIT_FAILURE);
}
- /*-------------------------------------------------------------------------
- * print some info
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * print some info
+ *-------------------------------------------------------------------------*/
if (verbose) {
- HDprintf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n",
- fname_src, oname_src, fname_dst, oname_dst);
+ HDprintf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n", fname_src, oname_src,
+ fname_dst, oname_dst);
if (flag) {
HDprintf("Using %s flag\n", str_flag);
}
}
-
- /*-------------------------------------------------------------------------
- * create property lists for copy
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * create property lists for copy
+ *-------------------------------------------------------------------------*/
/* create property to pass copy options */
if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
@@ -385,42 +390,42 @@ main (int argc, const char *argv[])
/* set options for object copy */
if (flag) {
- if ( H5Pset_copy_object(ocpl_id, flag) < 0)
+ if (H5Pset_copy_object(ocpl_id, flag) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pset_copy_object failed");
}
/* Create link creation property list */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
error_msg("Could not create link creation property list\n");
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pcreate failed");
} /* end if */
/* Check for creating intermediate groups */
- if(parents) {
+ if (parents) {
/* Set the intermediate group creation property */
- if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) {
+ if (H5Pset_create_intermediate_group(lcpl_id, 1) < 0) {
error_msg("Could not set property for creating parent groups\n");
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pset_create_intermediate_group failed");
} /* end if */
/* Display some output if requested */
- if(verbose)
+ if (verbose)
HDprintf("%s: Creating parent groups\n", h5tools_getprogname());
} /* end if */
else {
/* error, if parent groups doesn't already exist in destination file */
- size_t i, len;
+ size_t i, len;
len = HDstrlen(oname_dst);
/* check if all the parents groups exist. skip root group */
for (i = 1; i < len; i++) {
- if ('/'==oname_dst[i]) {
- char *str_ptr;
+ if ('/' == oname_dst[i]) {
+ char *str_ptr;
str_ptr = (char *)HDcalloc(i + 1, sizeof(char));
HDstrncpy(str_ptr, oname_dst, i);
- str_ptr[i]='\0';
+ str_ptr[i] = '\0';
if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0) {
error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr);
HDfree(str_ptr);
@@ -431,29 +436,27 @@ main (int argc, const char *argv[])
}
}
- /*-------------------------------------------------------------------------
- * do the copy
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * do the copy
+ *-------------------------------------------------------------------------*/
- if(verbose)
+ if (verbose)
linkinfo.opt.msg_mode = 1;
li_ret = H5tools_get_symlink_info(fid_src, oname_src, &linkinfo, 1);
if (li_ret == 0) {
/* dangling link */
- if(H5Lcopy(fid_src, oname_src,
- fid_dst, oname_dst,
- H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcopy(fid_src, oname_src, fid_dst, oname_dst, H5P_DEFAULT, H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Lcopy failed");
}
else {
/* valid link */
- if (H5Ocopy(fid_src, /* Source file or group identifier */
- oname_src, /* Name of the source object to be copied */
- fid_dst, /* Destination file or group identifier */
- oname_dst, /* Name of the destination object */
- ocpl_id, /* Object copy property list */
- lcpl_id)<0) /* Link creation property list */
+ if (H5Ocopy(fid_src, /* Source file or group identifier */
+ oname_src, /* Name of the source object to be copied */
+ fid_dst, /* Destination file or group identifier */
+ oname_dst, /* Name of the destination object */
+ ocpl_id, /* Object copy property list */
+ lcpl_id) < 0) /* Link creation property list */
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Ocopy failed");
}
@@ -462,15 +465,15 @@ main (int argc, const char *argv[])
HDfree(linkinfo.trg_path);
/* close propertis */
- if(H5Pclose(ocpl_id)<0)
+ if (H5Pclose(ocpl_id) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pclose failed");
- if(H5Pclose(lcpl_id)<0)
+ if (H5Pclose(lcpl_id) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pclose failed");
/* close files */
- if (H5Fclose(fid_src)<0)
+ if (H5Fclose(fid_src) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Fclose failed");
- if (H5Fclose(fid_dst)<0)
+ if (H5Fclose(fid_dst) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Fclose failed");
leave(EXIT_SUCCESS);
@@ -482,13 +485,14 @@ done:
if (linkinfo.trg_path)
HDfree(linkinfo.trg_path);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(ocpl_id);
H5Pclose(lcpl_id);
H5Fclose(fid_src);
H5Fclose(fid_dst);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
leave(ret_value);
}
-
diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt
index 4087ab4..e54b2da 100644
--- a/tools/src/h5diff/CMakeLists.txt
+++ b/tools/src/h5diff/CMakeLists.txt
@@ -8,8 +8,9 @@ if (NOT ONLY_SHARED_LIBS)
add_executable (h5diff
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.h
)
- target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}")
#target_compile_definitions (h5diff PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5diff STATIC)
@@ -23,8 +24,9 @@ if (BUILD_SHARED_LIBS)
add_executable (h5diff-shared
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.h
)
- target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5diff-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
#target_compile_definitions (h5diff-shared PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5diff-shared SHARED)
@@ -35,13 +37,24 @@ if (BUILD_SHARED_LIBS)
set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5diff-shared)
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_H5DIFF_SRC_FORMAT h5diff)
+ else ()
+ clang_format (HDF5_H5DIFF_SRC_FORMAT h5diff-shared)
+ endif ()
+endif ()
+
if (H5_HAVE_PARALLEL)
if (NOT ONLY_SHARED_LIBS)
add_executable (ph5diff
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c
)
- target_include_directories (ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(ph5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (ph5diff STATIC)
target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
@@ -54,7 +67,7 @@ if (H5_HAVE_PARALLEL)
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c
)
- target_include_directories (ph5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (ph5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(ph5diff-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (ph5diff-shared SHARED)
target_link_libraries (ph5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
diff --git a/tools/src/h5diff/Makefile.am b/tools/src/h5diff/Makefile.am
index 3957e59..451ad20 100644
--- a/tools/src/h5diff/Makefile.am
+++ b/tools/src/h5diff/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/src/h5diff/Makefile.in b/tools/src/h5diff/Makefile.in
index c8e6682..ff70ff9 100644
--- a/tools/src/h5diff/Makefile.in
+++ b/tools/src/h5diff/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -424,12 +425,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -467,11 +468,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -503,8 +549,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -518,7 +562,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -528,6 +574,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -721,7 +768,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1278,8 +1325,9 @@ uninstall-am: uninstall-binPROGRAMS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index 8c88510..b9f64d7 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,34 +17,32 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-static int check_n_input(const char*);
-static int check_p_input(const char*);
-static int check_d_input(const char*);
+static int check_n_input(const char *);
+static int check_p_input(const char *);
+static int check_d_input(const char *);
/*
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVrv:qn:d:p:NcelxE:A:S";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "version", no_arg, 'V' },
- { "report", no_arg, 'r' },
- { "verbose", optional_arg, 'v' },
- { "quiet", no_arg, 'q' },
- { "count", require_arg, 'n' },
- { "delta", require_arg, 'd' },
- { "relative", require_arg, 'p' },
- { "nan", no_arg, 'N' },
- { "compare", no_arg, 'c' },
- { "use-system-epsilon", no_arg, 'e' },
- { "follow-symlinks", no_arg, 'l' },
- { "no-dangling-links", no_arg, 'x' },
- { "exclude-path", require_arg, 'E' },
- { "exclude-attribute", require_arg, 'A' },
- { "enable-error-stack", no_arg, 'S' },
- { NULL, 0, '\0' }
-};
+static const char * s_opts = "hVrv*qn:d:p:NcelxE:A:S";
+static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"version", no_arg, 'V'},
+ {"report", no_arg, 'r'},
+ {"verbose", optional_arg, 'v'},
+ {"quiet", no_arg, 'q'},
+ {"count", require_arg, 'n'},
+ {"delta", require_arg, 'd'},
+ {"relative", require_arg, 'p'},
+ {"nan", no_arg, 'N'},
+ {"compare", no_arg, 'c'},
+ {"use-system-epsilon", no_arg, 'e'},
+ {"follow-symlinks", no_arg, 'l'},
+ {"no-dangling-links", no_arg, 'x'},
+ {"exclude-path", require_arg, 'E'},
+ {"exclude-attribute", require_arg, 'A'},
+ {"enable-error-stack", no_arg, 'S'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: check_options
@@ -52,7 +50,8 @@ static struct long_options l_opts[] = {
* Purpose: parse command line input
*-------------------------------------------------------------------------
*/
-static void check_options(diff_opt_t* opts)
+static void
+check_options(diff_opt_t *opts)
{
/*--------------------------------------------------------------
* check for mutually exclusive options
@@ -64,12 +63,13 @@ static void check_options(diff_opt_t* opts)
if ((opts->delta_bool + opts->percent_bool + opts->use_system_epsilon) > 1) {
HDprintf("%s error: -d, -p and --use-system-epsilon options are mutually-exclusive;\n", PROGRAMNAME);
HDprintf("use no more than one.\n");
- HDprintf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 Reference Manual'.\n", PROGRAMNAME);
+ HDprintf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 "
+ "Reference Manual'.\n",
+ PROGRAMNAME);
h5diff_exit(EXIT_FAILURE);
}
}
-#if TRILABS-227
/*-------------------------------------------------------------------------
* Function: parse_hsize_list
*
@@ -88,11 +88,11 @@ static void check_options(diff_opt_t* opts)
static void
parse_hsize_list(const char *h_list, subset_d *d)
{
- hsize_t *p_list;
- const char *ptr;
- unsigned int size_count = 0;
- unsigned int i = 0;
- unsigned int last_digit = 0;
+ hsize_t * p_list;
+ const char * ptr;
+ unsigned int size_count = 0;
+ unsigned int i = 0;
+ unsigned int last_digit = 0;
if (!h_list || !*h_list || *h_list == ';')
return;
@@ -118,11 +118,11 @@ parse_hsize_list(const char *h_list, subset_d *d)
H5TOOLS_DEBUG("Number integers to read=%ld", size_count);
/* allocate an array for the integers in the list */
- if((p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t))) == NULL)
+ if ((p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t))) == NULL)
H5TOOLS_INFO("Unable to allocate space for subset data");
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
- if(HDisdigit(*ptr)) {
+ if (HDisdigit(*ptr)) {
/* we should have an integer now */
p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0);
@@ -131,8 +131,8 @@ parse_hsize_list(const char *h_list, subset_d *d)
ptr++;
}
d->data = p_list;
- d->len = size_count;
- H5TOOLS_ENDDEBUG("");
+ d->len = size_count;
+ H5TOOLS_ENDDEBUG(" ");
}
/*-------------------------------------------------------------------------
@@ -148,7 +148,7 @@ static struct subset_t *
parse_subset_params(const char *dset)
{
struct subset_t *s = NULL;
- char *brace;
+ char * brace;
H5TOOLS_START_DEBUG(" - dset:%s", dset);
if ((brace = HDstrrchr(dset, '[')) != NULL) {
@@ -181,11 +181,10 @@ parse_subset_params(const char *dset)
parse_hsize_list(brace, &s->block);
}
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return s;
}
-#endif
/*-------------------------------------------------------------------------
* Function: parse_command_line
@@ -194,16 +193,18 @@ parse_subset_params(const char *dset)
*-------------------------------------------------------------------------
*/
-void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* opts)
+void
+parse_command_line(int argc, const char *argv[], const char **fname1, const char **fname2,
+ const char **objname1, const char **objname2, diff_opt_t *opts)
{
- int i;
- int opt;
+ int i;
+ int opt;
struct exclude_path_list *exclude_head, *exclude_prev, *exclude_node;
struct exclude_path_list *exclude_attr_head, *exclude_attr_prev, *exclude_attr_node;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
/* process the command-line */
- HDmemset(opts, 0, sizeof (diff_opt_t));
+ HDmemset(opts, 0, sizeof(diff_opt_t));
/* assume equal contents initially */
opts->contents = 1;
@@ -225,178 +226,174 @@ void parse_command_line(int argc, const char* argv[], const char** fname1, const
exclude_attr_head = NULL;
/* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
- default:
- usage();
- h5diff_exit(EXIT_FAILURE);
- break;
-
- case 'h':
- usage();
- h5diff_exit(EXIT_SUCCESS);
- break;
-
- case 'V':
- print_version(h5tools_getprogname());
- h5diff_exit(EXIT_SUCCESS);
- break;
-
- case 'v':
- opts->mode_verbose = 1;
- /* This for loop is for handling style like
- * -v, -v1, --verbose, --verbose=1.
- */
- for (i = 1; i < argc; i++) {
- /*
- * short opt
- */
- if (!strcmp (argv[i], "-v")) { /* no arg */
- opt_ind--;
- opts->mode_verbose_level = 0;
- break;
+ default:
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ break;
+
+ case 'h':
+ usage();
+ h5diff_exit(EXIT_SUCCESS);
+ break;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5diff_exit(EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ opts->mode_verbose = 1;
+ for (i = 1; i < argc; i++) {
+ /*
+ * special check for short opt
+ */
+ if (!strcmp(argv[i], "-v")) {
+ if (H5_optarg != NULL)
+ H5_optind--;
+ opts->mode_verbose_level = 0;
+ break;
+ }
+ else if (!strncmp(argv[i], "-v", (size_t)2)) {
+ if (H5_optarg != NULL)
+ H5_optind--;
+ opts->mode_verbose_level = atoi(&argv[i][2]);
+ break;
+ }
+ else {
+ if (H5_optarg != NULL)
+ opts->mode_verbose_level = HDatoi(H5_optarg);
+ else
+ opts->mode_verbose_level = 0;
+ }
}
- else if (!strncmp (argv[i], "-v", (size_t)2)) {
- opts->mode_verbose_level = atoi(&argv[i][2]);
- break;
+ break;
+
+ case 'q':
+ /* use quiet mode; supress the message "0 differences found" */
+ opts->mode_quiet = 1;
+ break;
+
+ case 'r':
+ opts->mode_report = 1;
+ break;
+
+ case 'l':
+ opts->follow_links = TRUE;
+ break;
+
+ case 'x':
+ opts->no_dangle_links = 1;
+ break;
+
+ case 'S':
+ enable_error_stack = 1;
+ break;
+
+ case 'E':
+ opts->exclude_path = 1;
+
+ /* create linked list of excluding objects */
+ if ((exclude_node = (struct exclude_path_list *)HDmalloc(sizeof(struct exclude_path_list))) ==
+ NULL) {
+ HDprintf("Error: lack of memory!\n");
+ h5diff_exit(EXIT_FAILURE);
}
- /*
- * long opt
- */
- if (!strcmp (argv[i], "--verbose")) { /* no arg */
- opts->mode_verbose_level = 0;
- break;
+ /* init */
+ exclude_node->obj_path = H5_optarg;
+ exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN;
+ exclude_prev = exclude_head;
+
+ if (NULL == exclude_head) {
+ exclude_head = exclude_node;
+ exclude_head->next = NULL;
}
- else if (!strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') {
- opts->mode_verbose_level = atoi(&argv[i][10]);
- break;
+ else {
+ while (NULL != exclude_prev->next)
+ exclude_prev = exclude_prev->next;
+
+ exclude_node->next = NULL;
+ exclude_prev->next = exclude_node;
}
- }
- break;
+ break;
- case 'q':
- /* use quiet mode; supress the message "0 differences found" */
- opts->mode_quiet = 1;
- break;
+ case 'A':
+ opts->exclude_attr_path = 1;
- case 'r':
- opts->mode_report = 1;
- break;
+ /* create linked list of excluding objects */
+ if ((exclude_attr_node =
+ (struct exclude_path_list *)HDmalloc(sizeof(struct exclude_path_list))) == NULL) {
+ HDprintf("Error: lack of memory!\n");
+ h5diff_exit(EXIT_FAILURE);
+ }
- case 'l':
- opts->follow_links = TRUE;
- break;
+ /* init */
+ exclude_attr_node->obj_path = H5_optarg;
+ exclude_attr_node->obj_type = H5TRAV_TYPE_UNKNOWN;
+ exclude_attr_prev = exclude_attr_head;
- case 'x':
- opts->no_dangle_links = 1;
- break;
+ if (NULL == exclude_attr_head) {
+ exclude_attr_head = exclude_attr_node;
+ exclude_attr_head->next = NULL;
+ }
+ else {
+ while (NULL != exclude_attr_prev->next)
+ exclude_attr_prev = exclude_attr_prev->next;
- case 'S':
- enable_error_stack = 1;
- break;
+ exclude_attr_node->next = NULL;
+ exclude_attr_prev->next = exclude_attr_node;
+ }
+ break;
- case 'E':
- opts->exclude_path = 1;
+ case 'd':
+ opts->delta_bool = 1;
- /* create linked list of excluding objects */
- if( (exclude_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) {
- HDprintf("Error: lack of memory!\n");
- h5diff_exit(EXIT_FAILURE);
- }
-
- /* init */
- exclude_node->obj_path = opt_arg;
- exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN;
- exclude_prev = exclude_head;
-
- if (NULL == exclude_head) {
- exclude_head = exclude_node;
- exclude_head->next = NULL;
- }
- else {
- while(NULL != exclude_prev->next)
- exclude_prev = exclude_prev->next;
-
- exclude_node->next = NULL;
- exclude_prev->next = exclude_node;
- }
- break;
-
- case 'A':
- opts->exclude_attr_path = 1;
-
- /* create linked list of excluding objects */
- if( (exclude_attr_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) {
- HDprintf("Error: lack of memory!\n");
- h5diff_exit(EXIT_FAILURE);
- }
-
- /* init */
- exclude_attr_node->obj_path = opt_arg;
- exclude_attr_node->obj_type = H5TRAV_TYPE_UNKNOWN;
- exclude_attr_prev = exclude_attr_head;
-
- if (NULL == exclude_attr_head) {
- exclude_attr_head = exclude_attr_node;
- exclude_attr_head->next = NULL;
- }
- else {
- while(NULL != exclude_attr_prev->next)
- exclude_attr_prev = exclude_attr_prev->next;
-
- exclude_attr_node->next = NULL;
- exclude_attr_prev->next = exclude_attr_node;
- }
- break;
-
- case 'd':
- opts->delta_bool = 1;
-
- if (check_d_input(opt_arg) == -1) {
- HDprintf("<-d %s> is not a valid option\n", opt_arg);
- usage();
- h5diff_exit(EXIT_FAILURE);
- }
- opts->delta = HDatof(opt_arg);
- /* do not check against default, the DBL_EPSILON is being replaced by user */
- break;
-
- case 'p':
- opts->percent_bool = 1;
- if (check_p_input(opt_arg) == -1) {
- HDprintf("<-p %s> is not a valid option\n", opt_arg);
- usage();
- h5diff_exit(EXIT_FAILURE);
- }
- opts->percent = HDatof(opt_arg);
-
- /* -p 0 is the same as default */
- if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
- opts->percent_bool = 0;
- break;
-
- case 'n':
- opts->count_bool = 1;
- if (check_n_input(opt_arg) == -1) {
- HDprintf("<-n %s> is not a valid option\n", opt_arg);
- usage();
- h5diff_exit(EXIT_FAILURE);
- }
- opts->count = HDstrtoull(opt_arg, NULL, 0);
- break;
+ if (check_d_input(H5_optarg) == -1) {
+ HDprintf("<-d %s> is not a valid option\n", H5_optarg);
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ opts->delta = HDatof(H5_optarg);
+ /* do not check against default, the DBL_EPSILON is being replaced by user */
+ break;
+
+ case 'p':
+ opts->percent_bool = 1;
+ if (check_p_input(H5_optarg) == -1) {
+ HDprintf("<-p %s> is not a valid option\n", H5_optarg);
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ opts->percent = HDatof(H5_optarg);
+
+ /* -p 0 is the same as default */
+ if (H5_DBL_ABS_EQUAL(opts->percent, 0.0))
+ opts->percent_bool = 0;
+ break;
+
+ case 'n':
+ opts->count_bool = 1;
+ if (check_n_input(H5_optarg) == -1) {
+ HDprintf("<-n %s> is not a valid option\n", H5_optarg);
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ opts->count = HDstrtoull(H5_optarg, NULL, 0);
+ break;
- case 'N':
- opts->do_nans = 0;
- break;
+ case 'N':
+ opts->do_nans = 0;
+ break;
- case 'c':
- opts->mode_list_not_cmp = 1;
- break;
+ case 'c':
+ opts->mode_list_not_cmp = 1;
+ break;
- case 'e':
- opts->use_system_epsilon = 1;
- break;
+ case 'e':
+ opts->use_system_epsilon = 1;
+ break;
}
}
@@ -412,15 +409,15 @@ void parse_command_line(int argc, const char* argv[], const char** fname1, const
opts->exclude_attr = exclude_attr_head;
/* check for file names to be processed */
- if (argc <= opt_ind || argv[opt_ind + 1] == NULL) {
+ if (argc <= H5_optind || argv[H5_optind + 1] == NULL) {
error_msg("missing file names\n");
usage();
h5diff_exit(EXIT_FAILURE);
}
- *fname1 = argv[opt_ind];
- *fname2 = argv[opt_ind + 1];
- *objname1 = argv[opt_ind + 2];
+ *fname1 = argv[H5_optind];
+ *fname2 = argv[H5_optind + 1];
+ *objname1 = argv[H5_optind + 2];
H5TOOLS_DEBUG("file1 = %s", *fname1);
H5TOOLS_DEBUG("file2 = %s", *fname2);
@@ -431,8 +428,8 @@ void parse_command_line(int argc, const char* argv[], const char** fname1, const
}
H5TOOLS_DEBUG("objname1 = %s", *objname1);
- if (argv[opt_ind + 3] != NULL) {
- *objname2 = argv[opt_ind + 3];
+ if (argv[H5_optind + 3] != NULL) {
+ *objname2 = argv[H5_optind + 3];
}
else {
*objname2 = *objname1;
@@ -440,26 +437,24 @@ void parse_command_line(int argc, const char* argv[], const char** fname1, const
H5TOOLS_DEBUG("objname2 = %s", *objname2);
/*
- * TRILABS-227 is complete except for an issue with printing indices
+ * TRILABS_227 is complete except for an issue with printing indices
* the following calls will enable subsetting
- */
-#if TRILABS-227
+ */
opts->sset[0] = parse_subset_params(*objname1);
opts->sset[1] = parse_subset_params(*objname2);
-#endif
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
}
-
/*-------------------------------------------------------------------------
* Function: print_info
*
* Purpose: print several information messages after h5diff call
*-------------------------------------------------------------------------
*/
-void print_info(diff_opt_t* opts)
+void
+print_info(diff_opt_t *opts)
{
if (opts->mode_quiet || opts->err_stat)
return;
@@ -495,7 +490,7 @@ H5_ATTR_PURE static int
check_n_input(const char *str)
{
unsigned i;
- char c;
+ char c;
for (i = 0; i < HDstrlen(str); i++) {
c = str[i];
@@ -503,9 +498,8 @@ check_n_input(const char *str)
if (c < 49 || c > 57) /* ascii values between 1 and 9 */
return -1;
}
- else
- if (c < 48 || c > 57) /* 0 also */
- return -1;
+ else if (c < 48 || c > 57) /* 0 also */
+ return -1;
}
return 1;
}
@@ -573,176 +567,238 @@ check_d_input(const char *str)
*-------------------------------------------------------------------------
*/
-void usage(void)
+void
+usage(void)
{
- PRINTVALSTREAM(rawoutstream, "usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]\n");
- PRINTVALSTREAM(rawoutstream, " file1 File name of the first HDF5 file\n");
- PRINTVALSTREAM(rawoutstream, " file2 File name of the second HDF5 file\n");
- PRINTVALSTREAM(rawoutstream, " [obj1] Name of an HDF5 object, in absolute path\n");
- PRINTVALSTREAM(rawoutstream, " [obj2] Name of an HDF5 object, in absolute path\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
- PRINTVALSTREAM(rawoutstream, " -h, --help\n");
- PRINTVALSTREAM(rawoutstream, " Print a usage message and exit.\n");
- PRINTVALSTREAM(rawoutstream, " -V, --version\n");
- PRINTVALSTREAM(rawoutstream, " Print version number and exit.\n");
- PRINTVALSTREAM(rawoutstream, " -r, --report\n");
- PRINTVALSTREAM(rawoutstream, " Report mode. Print differences.\n");
- PRINTVALSTREAM(rawoutstream, " -v --verbose\n");
- PRINTVALSTREAM(rawoutstream, " Verbose mode. Print differences information and list of objects.\n");
- PRINTVALSTREAM(rawoutstream, " -vN --verbose=N\n");
- PRINTVALSTREAM(rawoutstream, " Verbose mode with level. Print differences and list of objects.\n");
- PRINTVALSTREAM(rawoutstream, " Level of detail depends on value of N:\n");
- PRINTVALSTREAM(rawoutstream, " 0 : Identical to '-v' or '--verbose'.\n");
- PRINTVALSTREAM(rawoutstream, " 1 : All level 0 information plus one-line attribute status summary.\n");
- PRINTVALSTREAM(rawoutstream, " 2 : All level 1 information plus extended attribute status report.\n");
- PRINTVALSTREAM(rawoutstream, " 3 : All level 2 information plus file names.\n");
- PRINTVALSTREAM(rawoutstream, " -q, --quiet\n");
- PRINTVALSTREAM(rawoutstream, " Quiet mode. Do not produce output.\n");
- PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
- PRINTVALSTREAM(rawoutstream, " Prints messages from the HDF5 error stack as they occur.\n");
- PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
- PRINTVALSTREAM(rawoutstream, " Follow symbolic links (soft links and external links and compare the)\n");
- PRINTVALSTREAM(rawoutstream, " links' target objects.\n");
- PRINTVALSTREAM(rawoutstream, " If symbolic link(s) with the same name exist in the files being\n");
- PRINTVALSTREAM(rawoutstream, " compared, then determine whether the target of each link is an existing\n");
- PRINTVALSTREAM(rawoutstream, " object (dataset, group, or named datatype) or the link is a dangling\n");
- PRINTVALSTREAM(rawoutstream, " link (a soft or external link pointing to a target object that does\n");
- PRINTVALSTREAM(rawoutstream, " not yet exist).\n");
- PRINTVALSTREAM(rawoutstream, " - If both symbolic links are dangling links, they are treated as being\n");
- PRINTVALSTREAM(rawoutstream, " the same; by default, h5diff returns an exit code of 0.\n");
- PRINTVALSTREAM(rawoutstream, " If, however, --no-dangling-links is used with --follow-symlinks,\n");
- PRINTVALSTREAM(rawoutstream, " this situation is treated as an error and h5diff returns an\n");
- PRINTVALSTREAM(rawoutstream, " exit code of 2.\n");
- PRINTVALSTREAM(rawoutstream, " - If only one of the two links is a dangling link,they are treated as\n");
- PRINTVALSTREAM(rawoutstream, " being different and h5diff returns an exit code of 1.\n");
- PRINTVALSTREAM(rawoutstream, " If, however, --no-dangling-links is used with --follow-symlinks,\n");
- PRINTVALSTREAM(rawoutstream, " this situation is treated as an error and h5diff returns an\n");
- PRINTVALSTREAM(rawoutstream, " exit code of 2.\n");
- PRINTVALSTREAM(rawoutstream, " - If both symbolic links point to existing objects, h5diff compares the\n");
- PRINTVALSTREAM(rawoutstream, " two objects.\n");
- PRINTVALSTREAM(rawoutstream, " If any symbolic link specified in the call to h5diff does not exist,\n");
- PRINTVALSTREAM(rawoutstream, " h5diff treats it as an error and returns an exit code of 2.\n");
- PRINTVALSTREAM(rawoutstream, " --no-dangling-links\n");
- PRINTVALSTREAM(rawoutstream, " Must be used with --follow-symlinks option; otherwise, h5diff shows\n");
- PRINTVALSTREAM(rawoutstream, " error message and returns an exit code of 2.\n");
- PRINTVALSTREAM(rawoutstream, " Check for any symbolic links (soft links or external links) that do not\n");
- PRINTVALSTREAM(rawoutstream, " resolve to an existing object (dataset, group, or named datatype).\n");
- PRINTVALSTREAM(rawoutstream, " If any dangling link is found, this situation is treated as an error\n");
- PRINTVALSTREAM(rawoutstream, " and h5diff returns an exit code of 2.\n");
- PRINTVALSTREAM(rawoutstream, " -c, --compare\n");
- PRINTVALSTREAM(rawoutstream, " List objects that are not comparable\n");
- PRINTVALSTREAM(rawoutstream, " -N, --nan\n");
- PRINTVALSTREAM(rawoutstream, " Avoid NaNs detection\n");
- PRINTVALSTREAM(rawoutstream, " -n C, --count=C\n");
- PRINTVALSTREAM(rawoutstream, " Print differences up to C. C must be a positive integer.\n");
- PRINTVALSTREAM(rawoutstream, " -d D, --delta=D\n");
- PRINTVALSTREAM(rawoutstream, " Print difference if (|a-b| > D). D must be a positive number. Where a\n");
- PRINTVALSTREAM(rawoutstream, " is the data point value in file1 and b is the data point value in file2.\n");
- PRINTVALSTREAM(rawoutstream, " Can not use with '-p' or '--use-system-epsilon'.\n");
- PRINTVALSTREAM(rawoutstream, " -p R, --relative=R\n");
- PRINTVALSTREAM(rawoutstream, " Print difference if (|(a-b)/b| > R). R must be a positive number. Where a\n");
- PRINTVALSTREAM(rawoutstream, " is the data point value in file1 and b is the data point value in file2.\n");
- PRINTVALSTREAM(rawoutstream, " Can not use with '-d' or '--use-system-epsilon'.\n");
- PRINTVALSTREAM(rawoutstream, " --use-system-epsilon\n");
- PRINTVALSTREAM(rawoutstream, " Print difference if (|a-b| > EPSILON), EPSILON is system defined value. Where a\n");
- PRINTVALSTREAM(rawoutstream, " is the data point value in file1 and b is the data point value in file2.\n");
- PRINTVALSTREAM(rawoutstream, " If the system epsilon is not defined,one of the following predefined\n");
- PRINTVALSTREAM(rawoutstream, " values will be used:\n");
- PRINTVALSTREAM(rawoutstream, " FLT_EPSILON = 1.19209E-07 for floating-point type\n");
- PRINTVALSTREAM(rawoutstream, " DBL_EPSILON = 2.22045E-16 for double precision type\n");
- PRINTVALSTREAM(rawoutstream, " Can not use with '-p' or '-d'.\n");
- PRINTVALSTREAM(rawoutstream, " --exclude-path \"path\"\n");
- PRINTVALSTREAM(rawoutstream, " Exclude the specified path to an object when comparing files or groups.\n");
- PRINTVALSTREAM(rawoutstream, " If a group is excluded, all member objects will also be excluded.\n");
- PRINTVALSTREAM(rawoutstream, " The specified path is excluded wherever it occurs.\n");
- PRINTVALSTREAM(rawoutstream, " This flexibility enables the same option to exclude either objects that\n");
- PRINTVALSTREAM(rawoutstream, " exist only in one file or common objects that are known to differ.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " When comparing files, \"path\" is the absolute path to the excluded;\n");
- PRINTVALSTREAM(rawoutstream, " object; when comparing groups, \"path\" is similar to the relative\n");
- PRINTVALSTREAM(rawoutstream, " path from the group to the excluded object. This \"path\" can be\n");
- PRINTVALSTREAM(rawoutstream, " taken from the first section of the output of the --verbose option.\n");
- PRINTVALSTREAM(rawoutstream, " For example, if you are comparing the group /groupA in two files and\n");
- PRINTVALSTREAM(rawoutstream, " you want to exclude /groupA/groupB/groupC in both files, the exclude\n");
- PRINTVALSTREAM(rawoutstream, " option would read as follows:\n");
- PRINTVALSTREAM(rawoutstream, " --exclude-path \"/groupB/groupC\"\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " If there are multiple paths to an object, only the specified path(s)\n");
- PRINTVALSTREAM(rawoutstream, " will be excluded; the comparison will include any path not explicitly\n");
- PRINTVALSTREAM(rawoutstream, " excluded.\n");
- PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " --exclude-attribute \"path/to/object/with/attribute\"\n");
- PRINTVALSTREAM(rawoutstream, " Exclude attributes on the specified path to an object when comparing files or groups.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " If there are multiple paths to an object, only the specified path(s)\n");
- PRINTVALSTREAM(rawoutstream, " will be excluded; the comparison will include any path not explicitly\n");
- PRINTVALSTREAM(rawoutstream, " excluded.\n");
- PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " Modes of output:\n");
- PRINTVALSTREAM(rawoutstream, " Default mode: print the number of differences found and where they occured\n");
- PRINTVALSTREAM(rawoutstream, " -r Report mode: print the above plus the differences\n");
- PRINTVALSTREAM(rawoutstream, " -v Verbose mode: print the above plus a list of objects and warnings\n");
- PRINTVALSTREAM(rawoutstream, " -q Quiet mode: do not print output\n");
-
- PRINTVALSTREAM(rawoutstream, "\n");
-
- PRINTVALSTREAM(rawoutstream, " File comparison:\n");
- PRINTVALSTREAM(rawoutstream, " If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as\n");
- PRINTVALSTREAM(rawoutstream, " a comparison of the two files' root groups. That is, h5diff first compares\n");
- PRINTVALSTREAM(rawoutstream, " the names of root group members, generates a report of root group objects\n");
- PRINTVALSTREAM(rawoutstream, " that appear in only one file or in both files, and recursively compares\n");
- PRINTVALSTREAM(rawoutstream, " common objects.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
-
- PRINTVALSTREAM(rawoutstream, " Object comparison:\n");
- PRINTVALSTREAM(rawoutstream, " 1) Groups\n");
- PRINTVALSTREAM(rawoutstream, " First compares the names of member objects (relative path, from the\n");
- PRINTVALSTREAM(rawoutstream, " specified group) and generates a report of objects that appear in only\n");
- PRINTVALSTREAM(rawoutstream, " one group or in both groups. Common objects are then compared recursively.\n");
- PRINTVALSTREAM(rawoutstream, " 2) Datasets\n");
- PRINTVALSTREAM(rawoutstream, " Array rank and dimensions, datatypes, and data values are compared.\n");
- PRINTVALSTREAM(rawoutstream, " 3) Datatypes\n");
- PRINTVALSTREAM(rawoutstream, " The comparison is based on the return value of H5Tequal.\n");
- PRINTVALSTREAM(rawoutstream, " 4) Symbolic links\n");
- PRINTVALSTREAM(rawoutstream, " The paths to the target objects are compared.\n");
- PRINTVALSTREAM(rawoutstream, " (The option --follow-symlinks overrides the default behavior when\n");
- PRINTVALSTREAM(rawoutstream, " symbolic links are compared.).\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- /*
- * TRILABS-227 is complete except for an issue with printing indices
- * the following will be needed for subsetting
- PRINTVALSTREAM(rawoutstream, " Subsetting options:\n");
- PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the fcompact form of subsetting, as follows:\n");
- PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]\n");
- PRINTVALSTREAM(rawoutstream, " It is not required to use all parameters, but until the last parameter value used,\n");
- PRINTVALSTREAM(rawoutstream, " all of the semicolons (;) are required, even when a parameter value is not specified. Example:\n");
- PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;;COUNT;BLOCK]\n");
- PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START]\n");
- PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
- PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n");
- PRINTVALSTREAM(rawoutstream, " Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with\n");
- PRINTVALSTREAM(rawoutstream, " one integer for each dimension of the dataset.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
-*/
- PRINTVALSTREAM(rawoutstream, " Exit code:\n");
- PRINTVALSTREAM(rawoutstream, " 0 if no differences, 1 if differences found, 2 if error\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " Examples of use:\n");
- PRINTVALSTREAM(rawoutstream, " 1) h5diff file1 file2 /g1/dset1 /g1/dset2\n");
- PRINTVALSTREAM(rawoutstream, " Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 2) h5diff file1 file2 /g1/dset1\n");
- PRINTVALSTREAM(rawoutstream, " Compares object '/g1/dset1' in both files\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 3) h5diff file1 file2\n");
- PRINTVALSTREAM(rawoutstream, " Compares all objects in both files\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " Notes:\n");
- PRINTVALSTREAM(rawoutstream, " file1 and file2 can be the same file.\n");
- PRINTVALSTREAM(rawoutstream, " Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare\n");
- PRINTVALSTREAM(rawoutstream, " '/g1/dset1' and '/g1/dset2' in the same file\n");
- PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]\n");
+ PRINTVALSTREAM(rawoutstream, " file1 File name of the first HDF5 file\n");
+ PRINTVALSTREAM(rawoutstream, " file2 File name of the second HDF5 file\n");
+ PRINTVALSTREAM(rawoutstream, " [obj1] Name of an HDF5 object, in absolute path\n");
+ PRINTVALSTREAM(rawoutstream, " [obj2] Name of an HDF5 object, in absolute path\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -h, --help\n");
+ PRINTVALSTREAM(rawoutstream, " Print a usage message and exit.\n");
+ PRINTVALSTREAM(rawoutstream, " -V, --version\n");
+ PRINTVALSTREAM(rawoutstream, " Print version number and exit.\n");
+ PRINTVALSTREAM(rawoutstream, " -r, --report\n");
+ PRINTVALSTREAM(rawoutstream, " Report mode. Print differences.\n");
+ PRINTVALSTREAM(rawoutstream, " -v --verbose\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Verbose mode. Print differences information and list of objects.\n");
+ PRINTVALSTREAM(rawoutstream, " -vN --verbose=N\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Verbose mode with level. Print differences and list of objects.\n");
+ PRINTVALSTREAM(rawoutstream, " Level of detail depends on value of N:\n");
+ PRINTVALSTREAM(rawoutstream, " 0 : Identical to '-v' or '--verbose'.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " 1 : All level 0 information plus one-line attribute status summary.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " 2 : All level 1 information plus extended attribute status report.\n");
+ PRINTVALSTREAM(rawoutstream, " 3 : All level 2 information plus file names.\n");
+ PRINTVALSTREAM(rawoutstream, " -q, --quiet\n");
+ PRINTVALSTREAM(rawoutstream, " Quiet mode. Do not produce output.\n");
+ PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Follow symbolic links (soft links and external links and compare the)\n");
+ PRINTVALSTREAM(rawoutstream, " links' target objects.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If symbolic link(s) with the same name exist in the files being\n");
+ PRINTVALSTREAM(rawoutstream,
+ " compared, then determine whether the target of each link is an existing\n");
+ PRINTVALSTREAM(rawoutstream,
+ " object (dataset, group, or named datatype) or the link is a dangling\n");
+ PRINTVALSTREAM(rawoutstream,
+ " link (a soft or external link pointing to a target object that does\n");
+ PRINTVALSTREAM(rawoutstream, " not yet exist).\n");
+ PRINTVALSTREAM(rawoutstream,
+ " - If both symbolic links are dangling links, they are treated as being\n");
+ PRINTVALSTREAM(rawoutstream, " the same; by default, h5diff returns an exit code of 0.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If, however, --no-dangling-links is used with --follow-symlinks,\n");
+ PRINTVALSTREAM(rawoutstream, " this situation is treated as an error and h5diff returns an\n");
+ PRINTVALSTREAM(rawoutstream, " exit code of 2.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " - If only one of the two links is a dangling link,they are treated as\n");
+ PRINTVALSTREAM(rawoutstream, " being different and h5diff returns an exit code of 1.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If, however, --no-dangling-links is used with --follow-symlinks,\n");
+ PRINTVALSTREAM(rawoutstream, " this situation is treated as an error and h5diff returns an\n");
+ PRINTVALSTREAM(rawoutstream, " exit code of 2.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " - If both symbolic links point to existing objects, h5diff compares the\n");
+ PRINTVALSTREAM(rawoutstream, " two objects.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If any symbolic link specified in the call to h5diff does not exist,\n");
+ PRINTVALSTREAM(rawoutstream, " h5diff treats it as an error and returns an exit code of 2.\n");
+ PRINTVALSTREAM(rawoutstream, " --no-dangling-links\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Must be used with --follow-symlinks option; otherwise, h5diff shows\n");
+ PRINTVALSTREAM(rawoutstream, " error message and returns an exit code of 2.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Check for any symbolic links (soft links or external links) that do not\n");
+ PRINTVALSTREAM(rawoutstream,
+ " resolve to an existing object (dataset, group, or named datatype).\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If any dangling link is found, this situation is treated as an error\n");
+ PRINTVALSTREAM(rawoutstream, " and h5diff returns an exit code of 2.\n");
+ PRINTVALSTREAM(rawoutstream, " -c, --compare\n");
+ PRINTVALSTREAM(rawoutstream, " List objects that are not comparable\n");
+ PRINTVALSTREAM(rawoutstream, " -N, --nan\n");
+ PRINTVALSTREAM(rawoutstream, " Avoid NaNs detection\n");
+ PRINTVALSTREAM(rawoutstream, " -n C, --count=C\n");
+ PRINTVALSTREAM(rawoutstream, " Print differences up to C. C must be a positive integer.\n");
+ PRINTVALSTREAM(rawoutstream, " -d D, --delta=D\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Print difference if (|a-b| > D). D must be a positive number. Where a\n");
+ PRINTVALSTREAM(rawoutstream,
+ " is the data point value in file1 and b is the data point value in file2.\n");
+ PRINTVALSTREAM(rawoutstream, " Can not use with '-p' or '--use-system-epsilon'.\n");
+ PRINTVALSTREAM(rawoutstream, " -p R, --relative=R\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Print difference if (|(a-b)/b| > R). R must be a positive number. Where a\n");
+ PRINTVALSTREAM(rawoutstream,
+ " is the data point value in file1 and b is the data point value in file2.\n");
+ PRINTVALSTREAM(rawoutstream, " Can not use with '-d' or '--use-system-epsilon'.\n");
+ PRINTVALSTREAM(rawoutstream, " --use-system-epsilon\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " Print difference if (|a-b| > EPSILON), EPSILON is system defined value. Where a\n");
+ PRINTVALSTREAM(rawoutstream,
+ " is the data point value in file1 and b is the data point value in file2.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If the system epsilon is not defined,one of the following predefined\n");
+ PRINTVALSTREAM(rawoutstream, " values will be used:\n");
+ PRINTVALSTREAM(rawoutstream, " FLT_EPSILON = 1.19209E-07 for floating-point type\n");
+ PRINTVALSTREAM(rawoutstream, " DBL_EPSILON = 2.22045E-16 for double precision type\n");
+ PRINTVALSTREAM(rawoutstream, " Can not use with '-p' or '-d'.\n");
+ PRINTVALSTREAM(rawoutstream, " --exclude-path \"path\"\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Exclude the specified path to an object when comparing files or groups.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If a group is excluded, all member objects will also be excluded.\n");
+ PRINTVALSTREAM(rawoutstream, " The specified path is excluded wherever it occurs.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " This flexibility enables the same option to exclude either objects that\n");
+ PRINTVALSTREAM(rawoutstream,
+ " exist only in one file or common objects that are known to differ.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream,
+ " When comparing files, \"path\" is the absolute path to the excluded;\n");
+ PRINTVALSTREAM(rawoutstream,
+ " object; when comparing groups, \"path\" is similar to the relative\n");
+ PRINTVALSTREAM(rawoutstream,
+ " path from the group to the excluded object. This \"path\" can be\n");
+ PRINTVALSTREAM(rawoutstream,
+ " taken from the first section of the output of the --verbose option.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " For example, if you are comparing the group /groupA in two files and\n");
+ PRINTVALSTREAM(rawoutstream,
+ " you want to exclude /groupA/groupB/groupC in both files, the exclude\n");
+ PRINTVALSTREAM(rawoutstream, " option would read as follows:\n");
+ PRINTVALSTREAM(rawoutstream, " --exclude-path \"/groupB/groupC\"\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If there are multiple paths to an object, only the specified path(s)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " will be excluded; the comparison will include any path not explicitly\n");
+ PRINTVALSTREAM(rawoutstream, " excluded.\n");
+ PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " --exclude-attribute \"path/to/object/with/attribute\"\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " Exclude attributes on the specified path to an object when comparing files or groups.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If there are multiple paths to an object, only the specified path(s)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " will be excluded; the comparison will include any path not explicitly\n");
+ PRINTVALSTREAM(rawoutstream, " excluded.\n");
+ PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Modes of output:\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Default mode: print the number of differences found and where they occured\n");
+ PRINTVALSTREAM(rawoutstream, " -r Report mode: print the above plus the differences\n");
+ PRINTVALSTREAM(rawoutstream, " -v Verbose mode: print the above plus a list of objects and warnings\n");
+ PRINTVALSTREAM(rawoutstream, " -q Quiet mode: do not print output\n");
+
+ PRINTVALSTREAM(rawoutstream, "\n");
+
+ PRINTVALSTREAM(rawoutstream, " File comparison:\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as\n");
+ PRINTVALSTREAM(rawoutstream,
+ " a comparison of the two files' root groups. That is, h5diff first compares\n");
+ PRINTVALSTREAM(rawoutstream,
+ " the names of root group members, generates a report of root group objects\n");
+ PRINTVALSTREAM(rawoutstream,
+ " that appear in only one file or in both files, and recursively compares\n");
+ PRINTVALSTREAM(rawoutstream, " common objects.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+
+ PRINTVALSTREAM(rawoutstream, " Object comparison:\n");
+ PRINTVALSTREAM(rawoutstream, " 1) Groups\n");
+ PRINTVALSTREAM(rawoutstream,
+ " First compares the names of member objects (relative path, from the\n");
+ PRINTVALSTREAM(rawoutstream,
+ " specified group) and generates a report of objects that appear in only\n");
+ PRINTVALSTREAM(rawoutstream,
+ " one group or in both groups. Common objects are then compared recursively.\n");
+ PRINTVALSTREAM(rawoutstream, " 2) Datasets\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Array rank and dimensions, datatypes, and data values are compared.\n");
+ PRINTVALSTREAM(rawoutstream, " 3) Datatypes\n");
+ PRINTVALSTREAM(rawoutstream, " The comparison is based on the return value of H5Tequal.\n");
+ PRINTVALSTREAM(rawoutstream, " 4) Symbolic links\n");
+ PRINTVALSTREAM(rawoutstream, " The paths to the target objects are compared.\n");
+ PRINTVALSTREAM(rawoutstream, " (The option --follow-symlinks overrides the default behavior when\n");
+ PRINTVALSTREAM(rawoutstream, " symbolic links are compared.).\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ /*
+ * TRILABS_227 is complete except for an issue with printing indices
+ * the following will be needed for subsetting
+ */
+ PRINTVALSTREAM(rawoutstream, " Subsetting options:\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Subsetting is available by using the fcompact form of subsetting, as follows:\n");
+ PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]\n");
+ PRINTVALSTREAM(rawoutstream,
+ " It is not required to use all parameters, but until the last parameter value used,\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " all of the semicolons (;) are required, even when a parameter value is not specified. Example:\n");
+ PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;;COUNT;BLOCK]\n");
+ PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START]\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
+ PRINTVALSTREAM(rawoutstream,
+ " each dimension. START is optional and will default to 0 in each dimension.\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with\n");
+ PRINTVALSTREAM(rawoutstream, " one integer for each dimension of the dataset.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Exit code:\n");
+ PRINTVALSTREAM(rawoutstream, " 0 if no differences, 1 if differences found, 2 if error\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Examples of use:\n");
+ PRINTVALSTREAM(rawoutstream, " 1) h5diff file1 file2 /g1/dset1 /g1/dset2\n");
+ PRINTVALSTREAM(rawoutstream, " Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 2) h5diff file1 file2 /g1/dset1\n");
+ PRINTVALSTREAM(rawoutstream, " Compares object '/g1/dset1' in both files\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 3) h5diff file1 file2\n");
+ PRINTVALSTREAM(rawoutstream, " Compares all objects in both files\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Notes:\n");
+ PRINTVALSTREAM(rawoutstream, " file1 and file2 can be the same file.\n");
+ PRINTVALSTREAM(rawoutstream, " Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare\n");
+ PRINTVALSTREAM(rawoutstream, " '/g1/dset1' and '/g1/dset2' in the same file\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
}
diff --git a/tools/src/h5diff/h5diff_common.h b/tools/src/h5diff/h5diff_common.h
index dc0676c..83f4255 100644
--- a/tools/src/h5diff/h5diff_common.h
+++ b/tools/src/h5diff/h5diff_common.h
@@ -6,13 +6,13 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5DIFFCOMMON_H__
-#define H5DIFFCOMMON_H__
+#ifndef H5DIFFCOMMON_H
+#define H5DIFFCOMMON_H
#include "h5tools.h"
/* Name of tool */
@@ -23,12 +23,13 @@ extern "C" {
#endif
void usage(void);
-void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* opts);
+void parse_command_line(int argc, const char *argv[], const char **fname1, const char **fname2,
+ const char **objname1, const char **objname2, diff_opt_t *opts);
void h5diff_exit(int status);
-void print_info(diff_opt_t* opts);
+void print_info(diff_opt_t *opts);
#ifdef __cplusplus
}
#endif
-#endif /* H5DIFFCOMMON_H__ */
+#endif /* H5DIFFCOMMON_H */
diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c
index e14447d..a835953 100644
--- a/tools/src/h5diff/h5diff_main.c
+++ b/tools/src/h5diff/h5diff_main.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,7 +17,6 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -65,17 +64,17 @@
*-------------------------------------------------------------------------
*/
-
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- int ret;
- int i;
- const char *fname1 = NULL;
- const char *fname2 = NULL;
- const char *objname1 = NULL;
- const char *objname2 = NULL;
- hsize_t nfound=0;
- diff_opt_t opts;
+ int ret;
+ int i;
+ const char *fname1 = NULL;
+ const char *fname2 = NULL;
+ const char *objname1 = NULL;
+ const char *objname2 = NULL;
+ hsize_t nfound = 0;
+ diff_opt_t opts;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -84,28 +83,28 @@ int main(int argc, const char *argv[])
h5tools_init();
/*-------------------------------------------------------------------------
- * process the command-line
- *-------------------------------------------------------------------------
- */
+ * process the command-line
+ *-------------------------------------------------------------------------
+ */
parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
/* enable error reporting if command line option */
h5tools_error_report();
/*-------------------------------------------------------------------------
- * do the diff
- *-------------------------------------------------------------------------
- */
+ * do the diff
+ *-------------------------------------------------------------------------
+ */
nfound = h5diff(fname1, fname2, objname1, objname2, &opts);
print_info(&opts);
- /*-------------------------------------------------------------------------
- * exit code
- * 1 if differences, 0 if no differences, 2 if error
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * exit code
+ * 1 if differences, 0 if no differences, 2 if error
+ *-------------------------------------------------------------------------
+ */
ret = (nfound == 0 ? 0 : 1);
@@ -120,17 +119,17 @@ int main(int argc, const char *argv[])
/* free any buffers */
for (i = 0; i < 2; i++) {
if (opts.sset[i]) {
- if(opts.sset[i]->start.data)
+ if (opts.sset[i]->start.data)
HDfree(opts.sset[i]->start.data);
- if(opts.sset[i]->stride.data)
+ if (opts.sset[i]->stride.data)
HDfree(opts.sset[i]->stride.data);
- if(opts.sset[i]->count.data)
+ if (opts.sset[i]->count.data)
HDfree(opts.sset[i]->count.data);
- if(opts.sset[i]->block.data)
+ if (opts.sset[i]->block.data)
HDfree(opts.sset[i]->block.data);
HDfree(opts.sset[i]);
- opts.sset[i]=NULL;
+ opts.sset[i] = NULL;
}
}
@@ -160,4 +159,3 @@ h5diff_exit(int status)
HDexit(status);
}
-
diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c
index 2336378..ec78e49 100644
--- a/tools/src/h5diff/ph5diff_main.c
+++ b/tools/src/h5diff/ph5diff_main.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,7 +21,7 @@
/* Name of tool */
#define PROGRAMNAME "h5diff"
-static void ph5diff_worker(int );
+static void ph5diff_worker(int);
/*-------------------------------------------------------------------------
* Function: main
@@ -43,14 +43,15 @@ static void ph5diff_worker(int );
*-------------------------------------------------------------------------
*/
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- int nID = 0;
- const char *fname1 = NULL;
- const char *fname2 = NULL;
- const char *objname1 = NULL;
- const char *objname2 = NULL;
- diff_opt_t opts;
+ int nID = 0;
+ const char *fname1 = NULL;
+ const char *fname2 = NULL;
+ const char *objname1 = NULL;
+ const char *objname2 = NULL;
+ diff_opt_t opts;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -59,15 +60,14 @@ int main(int argc, const char *argv[])
h5tools_init();
outBuffOffset = 0;
- g_Parallel = 1;
+ g_Parallel = 1;
- MPI_Init(&argc, (char***) &argv);
+ MPI_Init(&argc, (char ***)&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &nID);
MPI_Comm_size(MPI_COMM_WORLD, &g_nTasks);
- if(g_nTasks == 1)
- {
+ if (g_nTasks == 1) {
HDprintf("Only 1 task available...doing serial diff\n");
g_Parallel = 0;
@@ -82,8 +82,7 @@ int main(int argc, const char *argv[])
else {
/* Have the manager process the command-line */
- if(nID == 0)
- {
+ if (nID == 0) {
parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
h5diff(fname1, fname2, objname1, objname2, &opts);
@@ -129,31 +128,27 @@ ph5diff_worker(int nID)
hid_t file1_id = H5I_INVALID_HID;
hid_t file2_id = H5I_INVALID_HID;
- while(1)
- {
+ while (1) {
MPI_Status Status;
MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
/* Check for filenames */
- if(Status.MPI_TAG == MPI_TAG_PARALLEL)
- {
- char filenames[2][MAX_FILENAME];
+ if (Status.MPI_TAG == MPI_TAG_PARALLEL) {
+ char filenames[2][MAX_FILENAME];
/* Retrieve filenames */
- MPI_Recv(filenames, MAX_FILENAME*2, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+ MPI_Recv(filenames, MAX_FILENAME * 2, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
/* disable error reporting */
H5E_BEGIN_TRY
{
/* Open the files */
- if ((file1_id = H5Fopen (filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- {
+ if ((file1_id = H5Fopen(filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
HDprintf("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[0]);
MPI_Abort(MPI_COMM_WORLD, 0);
}
- if ((file2_id = H5Fopen (filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- {
+ if ((file2_id = H5Fopen(filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
HDprintf("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[1]);
MPI_Abort(MPI_COMM_WORLD, 0);
}
@@ -162,15 +157,13 @@ ph5diff_worker(int nID)
H5E_END_TRY;
}
/* Check for work */
- else if(Status.MPI_TAG == MPI_TAG_ARGS)
- {
+ else if (Status.MPI_TAG == MPI_TAG_ARGS) {
struct diff_mpi_args args;
- struct diffs_found diffs;
- unsigned i;
+ struct diffs_found diffs;
+ unsigned i;
/* Make certain we've received the filenames and opened the files already */
- if(file1_id < 0 || file2_id < 0)
- {
+ if (file1_id < 0 || file2_id < 0) {
HDprintf("ph5diff_worker: ERROR: work received before/without filenames\n");
break;
}
@@ -179,44 +172,43 @@ ph5diff_worker(int nID)
MPI_Recv(&args, sizeof(args), MPI_BYTE, 0, MPI_TAG_ARGS, MPI_COMM_WORLD, &Status);
/* Do the diff */
- diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.opts), &(args.argdata));
+ diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.opts), &(args.argdata));
diffs.not_cmp = args.opts.not_cmp;
/* If print buffer has something in it, request print token.*/
- if(outBuffOffset>0)
- {
+ if (outBuffOffset > 0) {
MPI_Send(NULL, 0, MPI_BYTE, 0, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD);
/* Wait for print token. */
MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD, &Status);
/* When get token, send all of our output to the manager task and then return the token */
- for(i=0; i<outBuffOffset; i+=PRINT_DATA_MAX_SIZE)
- MPI_Send(outBuff+i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
+ for (i = 0; i < outBuffOffset; i += PRINT_DATA_MAX_SIZE)
+ MPI_Send(outBuff + i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA,
+ MPI_COMM_WORLD);
/* An overflow file exists, so we send it's output to the manager too and then delete it */
- if(overflow_file)
- {
+ if (overflow_file) {
char out_data[PRINT_DATA_MAX_SIZE];
- int tmp;
+ int tmp;
HDmemset(out_data, 0, PRINT_DATA_MAX_SIZE);
- i=0;
+ i = 0;
rewind(overflow_file);
- while((tmp = getc(overflow_file)) >= 0)
- {
+ while ((tmp = getc(overflow_file)) >= 0) {
*(out_data + i++) = (char)tmp;
- if(i==PRINT_DATA_MAX_SIZE)
- {
- MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
- i=0;
+ if (i == PRINT_DATA_MAX_SIZE) {
+ MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA,
+ MPI_COMM_WORLD);
+ i = 0;
HDmemset(out_data, 0, PRINT_DATA_MAX_SIZE);
}
}
- if(i>0)
- MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
+ if (i > 0)
+ MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA,
+ MPI_COMM_WORLD);
fclose(overflow_file);
overflow_file = NULL;
@@ -232,17 +224,14 @@ ph5diff_worker(int nID)
MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_DONE, MPI_COMM_WORLD);
}
/* Check for leaving */
- else if(Status.MPI_TAG == MPI_TAG_END)
- {
+ else if (Status.MPI_TAG == MPI_TAG_END) {
MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_END, MPI_COMM_WORLD, &Status);
break;
}
- else
- {
+ else {
HDprintf("ph5diff_worker: ERROR: invalid tag (%d) received\n", Status.MPI_TAG);
break;
}
-
}
return;
@@ -262,18 +251,17 @@ ph5diff_worker(int nID)
*
*-------------------------------------------------------------------------
*/
-void print_manager_output(void)
+void
+print_manager_output(void)
{
/* If there was something we buffered, let's print it now */
- if( (outBuffOffset>0) && g_Parallel)
- {
+ if ((outBuffOffset > 0) && g_Parallel) {
HDprintf("%s", outBuff);
- if(overflow_file)
- {
- int tmp;
+ if (overflow_file) {
+ int tmp;
rewind(overflow_file);
- while((tmp = HDgetc(overflow_file)) >= 0)
+ while ((tmp = HDgetc(overflow_file)) >= 0)
HDputchar(tmp);
fclose(overflow_file);
overflow_file = NULL;
@@ -283,8 +271,7 @@ void print_manager_output(void)
HDmemset(outBuff, 0, OUTBUFF_SIZE);
outBuffOffset = 0;
}
- else if( (outBuffOffset>0) && !g_Parallel)
- {
+ else if ((outBuffOffset > 0) && !g_Parallel) {
HDfprintf(stderr, "h5diff error: outBuffOffset>0, but we're not in parallel!\n");
}
}
@@ -305,16 +292,18 @@ void print_manager_output(void)
*
*-------------------------------------------------------------------------
*/
-void h5diff_exit(int status)
+void
+h5diff_exit(int status)
{
/* if in parallel mode, dismiss workers, close down MPI, then exit */
- if(g_Parallel) {
- if(g_nTasks > 1) {
+ if (g_Parallel) {
+ if (g_nTasks > 1) {
phdiff_dismiss_workers();
MPI_Barrier(MPI_COMM_WORLD);
}
MPI_Finalize();
- status = EXIT_SUCCESS; /* Reset exit status, since some mpiexec commands generate output on failure status */
+ status = EXIT_SUCCESS; /* Reset exit status, since some mpiexec commands generate output on failure
+ status */
}
h5tools_close();
@@ -324,4 +313,3 @@ void h5diff_exit(int status)
*/
HDexit(0);
}
-
diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt
index cae7212..8a12434 100644
--- a/tools/src/h5dump/CMakeLists.txt
+++ b/tools/src/h5dump/CMakeLists.txt
@@ -9,10 +9,14 @@ if (NOT ONLY_SHARED_LIBS)
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.h
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_defines.h
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_extern.h
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.h
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.h
)
- target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5dump PRIVATE "${HDF5_CMAKE_C_FLAGS}")
- #target_compile_definitions(h5dump PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5dump STATIC)
target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5dump PROPERTIES FOLDER tools)
@@ -26,10 +30,14 @@ if (BUILD_SHARED_LIBS)
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c
${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.h
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_defines.h
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_extern.h
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.h
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.h
)
- target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5dump-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
- #target_compile_definitions(h5dump-shared PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5dump-shared SHARED)
target_link_libraries (h5dump-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5dump-shared PROPERTIES FOLDER tools)
@@ -38,6 +46,17 @@ if (BUILD_SHARED_LIBS)
set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5dump-shared)
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_H5DUMP_SRC_FORMAT h5dump)
+ else ()
+ clang_format (HDF5_H5DUMP_SRC_FORMAT h5dump-shared)
+ endif ()
+endif ()
+
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
diff --git a/tools/src/h5dump/Makefile.am b/tools/src/h5dump/Makefile.am
index 86109d5..faf9ec6 100644
--- a/tools/src/h5dump/Makefile.am
+++ b/tools/src/h5dump/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/src/h5dump/Makefile.in b/tools/src/h5dump/Makefile.in
index afb9a89..76d66ee 100644
--- a/tools/src/h5dump/Makefile.in
+++ b/tools/src/h5dump/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -420,12 +421,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include files in /src directory and /tools/lib directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -463,11 +464,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -499,8 +545,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -514,7 +558,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -524,6 +570,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -717,7 +764,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1265,8 +1312,9 @@ uninstall-am: uninstall-binPROGRAMS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index f30d8fd..f2a10c2 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,11 +18,11 @@
/* Name of tool */
#define PROGRAMNAME "h5dump"
-static const char *driver_name_g = NULL; /* The driver to open the file with. */
-const char *outfname_g = NULL;
-static hbool_t doxml_g = FALSE;
-static hbool_t useschema_g = TRUE;
-static const char *xml_dtd_uri_g = NULL;
+static const char *driver_name_g = NULL; /* The driver to open the file with. */
+const char * outfname_g = NULL;
+static hbool_t doxml_g = FALSE;
+static hbool_t useschema_g = TRUE;
+static const char *xml_dtd_uri_g = NULL;
#ifdef H5_HAVE_ROS3_VFD
/* Default "anonymous" S3 configuration */
@@ -48,38 +48,25 @@ static H5FD_hdfs_fapl_t hdfs_fa_g = {
#endif /* H5_HAVE_LIBHDFS */
/* module-scoped variables for XML option */
-#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
-#define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/DTD/HDF5-File.dtd"
+#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
+#define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/DTD/HDF5-File.dtd"
/* Standard DDL output */
static const dump_functions ddl_function_table = {
- dump_group,
- dump_named_datatype,
- dump_dataset,
- dump_dataspace,
- dump_datatype,
- dump_attr_cb,
- dump_data
-};
+ dump_group, dump_named_datatype, dump_dataset, dump_dataspace, dump_datatype, dump_attr_cb, dump_data};
/* XML output */
static const dump_functions xml_function_table = {
- xml_dump_group,
- xml_dump_named_datatype,
- xml_dump_dataset,
- xml_dump_dataspace,
- xml_dump_datatype,
- xml_dump_attr,
- xml_dump_data
-};
+ xml_dump_group, xml_dump_named_datatype, xml_dump_dataset, xml_dump_dataspace,
+ xml_dump_datatype, xml_dump_attr, xml_dump_data};
/* internal functions */
-static void init_prefix(char **prfx, size_t prfx_len);
+static void init_prefix(char **prfx, size_t prfx_len);
/* a structure for handling the order command-line parameters come in */
struct handler_t {
void (*func)(hid_t, const char *, void *, int, const char *);
- char *obj;
+ char * obj;
struct subset_t *subset_info;
};
@@ -90,132 +77,51 @@ struct handler_t {
*/
/* The following initialization makes use of C language concatenating */
/* "xxx" "yyy" into "xxxyyy". */
-static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h' },
- { "contents", optional_arg, 'n' },
- { "properties", no_arg, 'p' },
- { "superblock", no_arg, 'B' },
- { "boot-block", no_arg, 'B' },
- { "boot-bloc", no_arg, 'B' },
- { "boot-blo", no_arg, 'B' },
- { "boot-bl", no_arg, 'B' },
- { "boot-b", no_arg, 'B' },
- { "boot", no_arg, 'B' },
- { "boo", no_arg, 'B' },
- { "bo", no_arg, 'B' },
- { "header", no_arg, 'H' },
- { "heade", no_arg, 'H' },
- { "head", no_arg, 'H' },
- { "hea", no_arg, 'H' },
- { "object-ids", no_arg, 'i' },
- { "object-id", no_arg, 'i' },
- { "object-i", no_arg, 'i' },
- { "object", no_arg, 'i' },
- { "objec", no_arg, 'i' },
- { "obje", no_arg, 'i' },
- { "obj", no_arg, 'i' },
- { "ob", no_arg, 'i' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "ver", no_arg, 'V' },
- { "ve", no_arg, 'V' },
- { "attribute", require_arg, 'a' },
- { "attribut", require_arg, 'a' },
- { "attribu", require_arg, 'a' },
- { "attrib", require_arg, 'a' },
- { "attri", require_arg, 'a' },
- { "attr", require_arg, 'a' },
- { "att", require_arg, 'a' },
- { "at", require_arg, 'a' },
- { "block", require_arg, 'k' },
- { "bloc", require_arg, 'k' },
- { "blo", require_arg, 'k' },
- { "bl", require_arg, 'k' },
- { "count", require_arg, 'c' },
- { "coun", require_arg, 'c' },
- { "cou", require_arg, 'c' },
- { "co", require_arg, 'c' },
- { "dataset", require_arg, 'd' },
- { "datase", require_arg, 'd' },
- { "datas", require_arg, 'd' },
- { "datatype", require_arg, 't' },
- { "datatyp", require_arg, 't' },
- { "dataty", require_arg, 't' },
- { "datat", require_arg, 't' },
- { "filedriver", require_arg, 'f' },
- { "filedrive", require_arg, 'f' },
- { "filedriv", require_arg, 'f' },
- { "filedri", require_arg, 'f' },
- { "filedr", require_arg, 'f' },
- { "filed", require_arg, 'f' },
- { "file", require_arg, 'f' },
- { "fil", require_arg, 'f' },
- { "fi", require_arg, 'f' },
- { "group", require_arg, 'g' },
- { "grou", require_arg, 'g' },
- { "gro", require_arg, 'g' },
- { "gr", require_arg, 'g' },
- { "output", optional_arg, 'o' },
- { "outpu", optional_arg, 'o' },
- { "outp", optional_arg, 'o' },
- { "out", optional_arg, 'o' },
- { "ou", optional_arg, 'o' },
- { "soft-link", require_arg, 'l' },
- { "soft-lin", require_arg, 'l' },
- { "soft-li", require_arg, 'l' },
- { "soft-l", require_arg, 'l' },
- { "soft", require_arg, 'l' },
- { "sof", require_arg, 'l' },
- { "start", require_arg, 's' },
- { "star", require_arg, 's' },
- { "sta", require_arg, 's' },
- { "stride", require_arg, 'S' },
- { "strid", require_arg, 'S' },
- { "string", no_arg, 'r' },
- { "strin", no_arg, 'r' },
- { "use-dtd", no_arg, 'u' },
- { "use-dt", no_arg, 'u' },
- { "use-d", no_arg, 'u' },
- { "use-", no_arg, 'u' },
- { "use", no_arg, 'u' },
- { "us", no_arg, 'u' },
- { "u", no_arg, 'u' },
- { "width", require_arg, 'w' },
- { "widt", require_arg, 'w' },
- { "wid", require_arg, 'w' },
- { "wi", require_arg, 'w' },
- { "xml-dtd", require_arg, 'D' },
- { "xml-dt", require_arg, 'D' },
- { "xml-d", require_arg, 'D' },
- { "xml-ns", require_arg, 'X' },
- { "xml-n", require_arg, 'X' },
- { "xml", no_arg, 'x' },
- { "xm", no_arg, 'x' },
- { "onlyattr", optional_arg, 'A' },
- { "escape", no_arg, 'e' },
- { "noindex", no_arg, 'y' },
- { "binary", optional_arg, 'b' },
- { "form", require_arg, 'F' },
- { "sort_by", require_arg, 'q' },
- { "sort_order", require_arg, 'z' },
- { "format", require_arg, 'm' },
- { "region", no_arg, 'R' },
- { "enable-error-stack", optional_arg, 'E' },
- { "packed-bits", require_arg, 'M' },
- { "no-compact-subset", no_arg, 'C' },
- { "ddl", optional_arg, 'O' },
- { "any_path", require_arg, 'N' },
- { "vds-view-first-missing", no_arg, 'v' },
- { "vds-gap-size", require_arg, 'G' },
- { "s3-cred", require_arg, '$' },
- { "hdfs-attrs", require_arg, '#' },
- { NULL, 0, '\0' }
-};
-
+static const char * s_opts = "a:b*c:d:ef:g:hik:l:m:n*o*pq:rs:t:uvw:xyz:A*BCD:E*F:G:HM:N:O*RS:VX:";
+static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'},
+ {"binary", optional_arg, 'b'},
+ {"count", require_arg, 'c'},
+ {"dataset", require_arg, 'd'},
+ {"escape", no_arg, 'e'},
+ {"filedriver", require_arg, 'f'},
+ {"group", require_arg, 'g'},
+ {"help", no_arg, 'h'},
+ {"object-ids", no_arg, 'i'},
+ {"block", require_arg, 'k'},
+ {"soft-link", require_arg, 'l'},
+ {"format", require_arg, 'm'},
+ {"contents", optional_arg, 'n'},
+ {"output", optional_arg, 'o'},
+ {"properties", no_arg, 'p'},
+ {"sort_by", require_arg, 'q'},
+ {"string", no_arg, 'r'},
+ {"start", require_arg, 's'},
+ {"datatype", require_arg, 't'},
+ {"use-dtd", no_arg, 'u'},
+ {"vds-view-first-missing", no_arg, 'v'},
+ {"width", require_arg, 'w'},
+ {"xml", no_arg, 'x'},
+ {"noindex", no_arg, 'y'},
+ {"sort_order", require_arg, 'z'},
+ {"onlyattr", optional_arg, 'A'},
+ {"superblock", no_arg, 'B'},
+ {"boot-block", no_arg, 'B'},
+ {"no-compact-subset", no_arg, 'C'},
+ {"xml-dtd", require_arg, 'D'},
+ {"enable-error-stack", optional_arg, 'E'},
+ {"form", require_arg, 'F'},
+ {"vds-gap-size", require_arg, 'G'},
+ {"header", no_arg, 'H'},
+ {"packed-bits", require_arg, 'M'},
+ {"any_path", require_arg, 'N'},
+ {"ddl", optional_arg, 'O'},
+ {"region", no_arg, 'R'},
+ {"stride", require_arg, 'S'},
+ {"version", no_arg, 'V'},
+ {"xml-ns", require_arg, 'X'},
+ {"s3-cred", require_arg, '$'},
+ {"hdfs-attrs", require_arg, '#'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: leave
@@ -233,7 +139,6 @@ leave(int ret)
HDexit(ret);
}
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -259,40 +164,59 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -o F, --output=F Output raw data into file F\n");
PRINTVALSTREAM(rawoutstream, " -b B, --binary=B Binary file output, of form B\n");
PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n");
- PRINTVALSTREAM(rawoutstream, " Use blank(empty) filename F to suppress ddl display\n");
- PRINTVALSTREAM(rawoutstream, " --s3-cred=<cred> Supply S3 authentication information to \"ros3\" vfd.\n");
- PRINTVALSTREAM(rawoutstream, " <cred> :: \"(<aws-region>,<access-id>,<access-key>)\"\n");
- PRINTVALSTREAM(rawoutstream, " If absent or <cred> -> \"(,,)\", no authentication.\n");
- PRINTVALSTREAM(rawoutstream, " Has no effect is filedriver is not `ros3'.\n");
- PRINTVALSTREAM(rawoutstream, " --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Use blank(empty) filename F to suppress ddl display\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --s3-cred=<cred> Supply S3 authentication information to \"ros3\" vfd.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " <cred> :: \"(<aws-region>,<access-id>,<access-key>)\"\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If absent or <cred> -> \"(,,)\", no authentication.\n");
+ PRINTVALSTREAM(rawoutstream, " Has no effect if filedriver is not \"ros3\".\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.\n");
PRINTVALSTREAM(rawoutstream, " For use with \"--filedriver=hdfs\"\n");
PRINTVALSTREAM(rawoutstream, " <attrs> :: (<namenode name>,<namenode port>,\n");
PRINTVALSTREAM(rawoutstream, " <kerberos cache path>,<username>,\n");
PRINTVALSTREAM(rawoutstream, " <buffer size>)\n");
- PRINTVALSTREAM(rawoutstream, " Any absent attribute will use a default value.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Any absent attribute will use a default value.\n");
PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n");
- PRINTVALSTREAM(rawoutstream, " If an attribute name contains a slash (/), escape the\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If an attribute name contains a slash (/), escape the\n");
PRINTVALSTREAM(rawoutstream, " slash with a preceding backslash (\\).\n");
PRINTVALSTREAM(rawoutstream, " (See example section below.)\n");
PRINTVALSTREAM(rawoutstream, " -d P, --dataset=P Print the specified dataset\n");
PRINTVALSTREAM(rawoutstream, " -g P, --group=P Print the specified group and all members\n");
PRINTVALSTREAM(rawoutstream, " -l P, --soft-link=P Print the value(s) of the specified soft link\n");
PRINTVALSTREAM(rawoutstream, " -t P, --datatype=P Print the specified named datatype\n");
- PRINTVALSTREAM(rawoutstream, " -N P, --any_path=P Print any attribute, dataset, group, datatype, or link that matches P\n");
- PRINTVALSTREAM(rawoutstream, " P can be the absolute path or just a relative path.\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " -N P, --any_path=P Print any attribute, dataset, group, datatype, or link that matches P\n");
+ PRINTVALSTREAM(rawoutstream,
+ " P can be the absolute path or just a relative path.\n");
PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n");
- PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n");
- PRINTVALSTREAM(rawoutstream, " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n");
- PRINTVALSTREAM(rawoutstream, " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Optional value 0 suppresses printing attributes.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n");
PRINTVALSTREAM(rawoutstream, "--------------- Object Property Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n");
- PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n");
- PRINTVALSTREAM(rawoutstream, " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n");
- PRINTVALSTREAM(rawoutstream, " format L for an integer dataset specified with\n");
- PRINTVALSTREAM(rawoutstream, " option -d. L is a list of offset,length values,\n");
- PRINTVALSTREAM(rawoutstream, " separated by commas. Offset is the beginning bit in\n");
- PRINTVALSTREAM(rawoutstream, " the data value and length is the number of bits of\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -p, --properties Print dataset filters, storage layout and fill value\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n");
+ PRINTVALSTREAM(rawoutstream,
+ " format L for an integer dataset specified with\n");
+ PRINTVALSTREAM(rawoutstream,
+ " option -d. L is a list of offset,length values,\n");
+ PRINTVALSTREAM(rawoutstream,
+ " separated by commas. Offset is the beginning bit in\n");
+ PRINTVALSTREAM(rawoutstream,
+ " the data value and length is the number of bits of\n");
PRINTVALSTREAM(rawoutstream, " the mask.\n");
PRINTVALSTREAM(rawoutstream, " -R, --region Print dataset pointed by region references\n");
PRINTVALSTREAM(rawoutstream, "--------------- Formatting Options ---------------\n");
@@ -302,12 +226,17 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -m T, --format=T Set the floating point output format\n");
PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n");
PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n");
- PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n");
- PRINTVALSTREAM(rawoutstream, " Optional value 2 also prints file open errors.\n");
- PRINTVALSTREAM(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Optional value 2 also prints file open errors.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --no-compact-subset Disable compact form of subsetting and allow the use\n");
PRINTVALSTREAM(rawoutstream, " of \"[\" in dataset names.\n");
- PRINTVALSTREAM(rawoutstream, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n");
- PRINTVALSTREAM(rawoutstream, " sets the number of columns to the maximum (65535).\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " sets the number of columns to the maximum (65535).\n");
PRINTVALSTREAM(rawoutstream, " Default width is 80 columns.\n");
PRINTVALSTREAM(rawoutstream, "--------------- XML Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -x, --xml Output in XML using Schema\n");
@@ -315,31 +244,44 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -D U, --xml-dtd=U Use the DTD or schema at U\n");
PRINTVALSTREAM(rawoutstream, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n");
PRINTVALSTREAM(rawoutstream, " \":\": no namespace, default: \"hdf5:\"\n");
- PRINTVALSTREAM(rawoutstream, " E.g., to dump a file called `-f', use h5dump -- -f\n");
+ PRINTVALSTREAM(rawoutstream,
+ " E.g., to dump a file called \"-f\", use h5dump -- -f\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "--------------- Subsetting Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the following options with a dataset\n");
PRINTVALSTREAM(rawoutstream, " option. Subsetting is done by selecting a hyperslab from the data.\n");
PRINTVALSTREAM(rawoutstream, " Thus, the options mirror those for performing a hyperslab selection.\n");
- PRINTVALSTREAM(rawoutstream, " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n");
- PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
- PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
+ PRINTVALSTREAM(rawoutstream,
+ " each dimension. START is optional and will default to 0 in each dimension.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " -s START, --start=START Offset of start of subsetting selection\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -s START, --start=START Offset of start of subsetting selection\n");
PRINTVALSTREAM(rawoutstream, " -S STRIDE, --stride=STRIDE Hyperslab stride\n");
- PRINTVALSTREAM(rawoutstream, " -c COUNT, --count=COUNT Number of blocks to include in selection\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -c COUNT, --count=COUNT Number of blocks to include in selection\n");
PRINTVALSTREAM(rawoutstream, " -k BLOCK, --block=BLOCK Size of block in hyperslab\n");
- PRINTVALSTREAM(rawoutstream, " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n");
PRINTVALSTREAM(rawoutstream, " number of dimensions in the dataspace being queried\n");
- PRINTVALSTREAM(rawoutstream, " (Alternate compact form of subsetting is described in the Reference Manual)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " (Alternate compact form of subsetting is described in the Reference Manual)\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "--------------- Option Argument Conventions ---------------\n");
PRINTVALSTREAM(rawoutstream, " D - is the file driver to use in opening the file. Acceptable values\n");
- PRINTVALSTREAM(rawoutstream, " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n");
PRINTVALSTREAM(rawoutstream, " the file driver flag, the file will be opened with each driver in\n");
PRINTVALSTREAM(rawoutstream, " turn and in the order specified above until one driver succeeds\n");
PRINTVALSTREAM(rawoutstream, " in opening the file.\n");
- PRINTVALSTREAM(rawoutstream, " See examples below for family, split, and multi driver special file name usage.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " See examples below for family, split, and multi driver special file name usage.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " F - is a filename.\n");
PRINTVALSTREAM(rawoutstream, " P - is the full path from the root group to the object.\n");
@@ -347,12 +289,17 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " T - is a string containing the floating point format, e.g '%%.3f'\n");
PRINTVALSTREAM(rawoutstream, " U - is a URI reference (as defined in [IETF RFC 2396],\n");
PRINTVALSTREAM(rawoutstream, " updated by [IETF RFC 2732])\n");
- PRINTVALSTREAM(rawoutstream, " B - is the form of binary output: NATIVE for a memory type, FILE for the\n");
- PRINTVALSTREAM(rawoutstream, " file type, LE or BE for pre-existing little or big endian types.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " B - is the form of binary output: NATIVE for a memory type, FILE for the\n");
+ PRINTVALSTREAM(rawoutstream,
+ " file type, LE or BE for pre-existing little or big endian types.\n");
PRINTVALSTREAM(rawoutstream, " Must be used with -o (output file) and it is recommended that\n");
- PRINTVALSTREAM(rawoutstream, " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n");
- PRINTVALSTREAM(rawoutstream, " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n");
- PRINTVALSTREAM(rawoutstream, " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "--------------- Examples ---------------\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -366,14 +313,16 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " 2) Selecting a subset from dataset /foo in file quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n");
+ PRINTVALSTREAM(rawoutstream,
+ " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin'\n");
PRINTVALSTREAM(rawoutstream, " using a little-endian type\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /dset -b LE -o out.bin quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n");
+ PRINTVALSTREAM(rawoutstream,
+ " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /dset -M 0,1,4,3 quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -385,17 +334,19 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f split splitfile\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 7) Dataset foo in multi files mf-s.h5, mf-b.h5, mf-r.h5, mf-g.h5, mf-l.h5 and mf-o.h5\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " 7) Dataset foo in multi files mf-s.h5, mf-b.h5, mf-r.h5, mf-g.h5, mf-l.h5 and mf-o.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f multi mf\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 8) Dataset foo in family files fam00000.h5 fam00001.h5 and fam00002.h5\n");
+ PRINTVALSTREAM(rawoutstream,
+ " 8) Dataset foo in family files fam00000.h5 fam00001.h5 and fam00002.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f family fam%%05d.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
}
-
/*-------------------------------------------------------------------------
* Function: table_list_add
*
@@ -407,28 +358,30 @@ usage(const char *prog)
ssize_t
table_list_add(hid_t oid, unsigned long file_no)
{
- size_t idx; /* Index of table to use */
+ size_t idx; /* Index of table to use */
find_objs_t info;
/* Allocate space if necessary */
- if(table_list.nused == table_list.nalloc) {
- h5dump_table_items_t *tmp_ptr;
+ if (table_list.nused == table_list.nalloc) {
+ h5dump_table_items_t *tmp_ptr;
table_list.nalloc = MAX(1, table_list.nalloc * 2);
- if(NULL == (tmp_ptr = (h5dump_table_items_t *)HDrealloc(table_list.tables, table_list.nalloc * sizeof(table_list.tables[0]))))
+ if (NULL == (tmp_ptr = (h5dump_table_items_t *)HDrealloc(
+ table_list.tables, table_list.nalloc * sizeof(table_list.tables[0]))))
return -1;
table_list.tables = tmp_ptr;
} /* end if */
/* Append it */
- idx = table_list.nused++;
+ idx = table_list.nused++;
table_list.tables[idx].fileno = file_no;
- table_list.tables[idx].oid = oid;
- if(H5Iinc_ref(oid) < 0) {
+ table_list.tables[idx].oid = oid;
+ if (H5Iinc_ref(oid) < 0) {
table_list.nused--;
return -1;
}
- if(init_objs(oid, &info, &table_list.tables[idx].group_table, &table_list.tables[idx].dset_table, &table_list.tables[idx].type_table) < 0) {
+ if (init_objs(oid, &info, &table_list.tables[idx].group_table, &table_list.tables[idx].dset_table,
+ &table_list.tables[idx].type_table) < 0) {
H5Idec_ref(oid);
table_list.nused--;
return -1;
@@ -438,10 +391,9 @@ table_list_add(hid_t oid, unsigned long file_no)
dump_tables(&info);
#endif /* H5DUMP_DEBUG */
- return((ssize_t) idx);
+ return ((ssize_t)idx);
} /* end table_list_add() */
-
/*-------------------------------------------------------------------------
* Function: table_list_visited
*
@@ -453,19 +405,18 @@ table_list_add(hid_t oid, unsigned long file_no)
H5_ATTR_PURE ssize_t
table_list_visited(unsigned long file_no)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Look for table */
- for(u = 0; u < table_list.nused; u++)
+ for (u = 0; u < table_list.nused; u++)
/* Check for fileno value already in array */
- if(table_list.tables[u].fileno == file_no)
- return((ssize_t) u);
+ if (table_list.tables[u].fileno == file_no)
+ return ((ssize_t)u);
/* Didn't find table */
- return(-1);
+ return (-1);
} /* end table_list_visited() */
-
/*-------------------------------------------------------------------------
* Function: table_list_free
*
@@ -477,21 +428,18 @@ table_list_visited(unsigned long file_no)
static void
table_list_free(void)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Iterate over tables */
- for(u = 0; u < table_list.nused; u++) {
+ for (u = 0; u < table_list.nused; u++) {
/* Release object id */
- if(H5Idec_ref(table_list.tables[u].oid) < 0)
+ if (H5Idec_ref(table_list.tables[u].oid) < 0)
h5tools_setstatus(EXIT_FAILURE);
/* Free each table */
free_table(table_list.tables[u].group_table);
- HDfree(table_list.tables[u].group_table);
free_table(table_list.tables[u].dset_table);
- HDfree(table_list.tables[u].dset_table);
free_table(table_list.tables[u].type_table);
- HDfree(table_list.tables[u].type_table);
}
/* Free the table list */
@@ -514,15 +462,15 @@ set_binary_form(const char *form)
{
int bform = -1;
- if (HDstrcmp(form,"NATIVE") == 0 || HDstrcmp(form,"MEMORY") == 0) {
+ if (HDstrcmp(form, "NATIVE") == 0 || HDstrcmp(form, "MEMORY") == 0) {
/* native form */
bform = 0;
}
- else if (HDstrcmp(form,"FILE") == 0) /* file type form */
+ else if (HDstrcmp(form, "FILE") == 0) /* file type form */
bform = 1;
- else if (HDstrcmp(form,"LE") == 0) /* convert to little endian */
+ else if (HDstrcmp(form, "LE") == 0) /* convert to little endian */
bform = 2;
- else if (HDstrcmp(form,"BE") == 0) /* convert to big endian */
+ else if (HDstrcmp(form, "BE") == 0) /* convert to big endian */
bform = 3;
return bform;
@@ -543,9 +491,9 @@ set_sort_by(const char *form)
{
H5_index_t idx_type = H5_INDEX_UNKNOWN;
- if (HDstrcmp(form,"name")==0) /* H5_INDEX_NAME */
+ if (HDstrcmp(form, "name") == 0) /* H5_INDEX_NAME */
idx_type = H5_INDEX_NAME;
- else if (HDstrcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */
+ else if (HDstrcmp(form, "creation_order") == 0) /* H5_INDEX_CRT_ORDER */
idx_type = H5_INDEX_CRT_ORDER;
return idx_type;
@@ -566,9 +514,9 @@ set_sort_order(const char *form)
{
H5_iter_order_t iter_order = H5_ITER_UNKNOWN;
- if (HDstrcmp(form,"ascending")==0) /* H5_ITER_INC */
+ if (HDstrcmp(form, "ascending") == 0) /* H5_ITER_INC */
iter_order = H5_ITER_INC;
- else if (HDstrcmp(form,"descending")==0) /* H5_ITER_DEC */
+ else if (HDstrcmp(form, "descending") == 0) /* H5_ITER_DEC */
iter_order = H5_ITER_DEC;
return iter_order;
@@ -592,11 +540,11 @@ set_sort_order(const char *form)
static void
parse_hsize_list(const char *h_list, subset_d *d)
{
- hsize_t *p_list;
- const char *ptr;
- unsigned int size_count = 0;
- unsigned int i = 0;
- unsigned int last_digit = 0;
+ hsize_t * p_list;
+ const char * ptr;
+ unsigned int size_count = 0;
+ unsigned int i = 0;
+ unsigned int last_digit = 0;
if (!h_list || !*h_list || *h_list == ';')
return;
@@ -621,7 +569,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t));
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
- if(HDisdigit(*ptr)) {
+ if (HDisdigit(*ptr)) {
/* we should have an integer now */
p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0);
@@ -630,7 +578,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
ptr++;
}
d->data = p_list;
- d->len = size_count;
+ d->len = size_count;
}
/*-------------------------------------------------------------------------
@@ -646,7 +594,7 @@ static struct subset_t *
parse_subset_params(const char *dset)
{
struct subset_t *s = NULL;
- char *brace;
+ char * brace;
if (!dump_opts.disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) {
*brace++ = '\0';
@@ -701,11 +649,11 @@ parse_mask_list(const char *h_list)
int slength_value;
unsigned length_value;
unsigned long long temp_mask;
- const char *ptr = NULL;
+ const char * ptr = NULL;
/* sanity check */
- if(h_list) {
- HDmemset(packed_mask,0,sizeof(packed_mask));
+ if (h_list) {
+ HDmemset(packed_mask, 0, sizeof(packed_mask));
packed_bits_num = 0;
/* scan in pair of offset,length separated by commas. */
@@ -717,10 +665,10 @@ parse_mask_list(const char *h_list)
return FAIL;
}
soffset_value = HDatoi(ptr);
- offset_value = (unsigned)soffset_value;
+ offset_value = (unsigned)soffset_value;
if (soffset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) {
- error_msg("Packed Bit offset value(%d) must be between 0 and %u\n",
- soffset_value, (unsigned)(PACKED_BITS_SIZE_MAX - 1));
+ error_msg("Packed Bit offset value(%d) must be between 0 and %u\n", soffset_value,
+ (unsigned)(PACKED_BITS_SIZE_MAX - 1));
return FAIL;
}
@@ -746,7 +694,7 @@ parse_mask_list(const char *h_list)
length_value = (unsigned)slength_value;
if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX) {
error_msg("Packed Bit offset+length value(%u) too large. Max is %u\n",
- offset_value+length_value, (unsigned)PACKED_BITS_SIZE_MAX);
+ offset_value + length_value, (unsigned)PACKED_BITS_SIZE_MAX);
return FAIL;
}
@@ -766,8 +714,8 @@ parse_mask_list(const char *h_list)
/* After packed_mask is calculated, packed_length is not needed but */
/* keep it for debug purpose. */
temp_mask = ~0ULL;
- if(length_value < (int)(8 *sizeof(unsigned long long))) {
- temp_mask = temp_mask << length_value;
+ if (length_value < (int)(8 * sizeof(unsigned long long))) {
+ temp_mask = temp_mask << length_value;
packed_mask[packed_bits_num] = ~temp_mask;
}
else
@@ -783,7 +731,7 @@ parse_mask_list(const char *h_list)
}
}
}
- if(packed_bits_num > PACKED_BITS_MAX) {
+ if (packed_bits_num > PACKED_BITS_MAX) {
error_msg("Maximum number of packed bits exceeded\n");
return FAIL;
}
@@ -794,13 +742,12 @@ parse_mask_list(const char *h_list)
}
return SUCCEED;
}
- else {
+ else {
error_msg("Bad mask list argument\n");
return FAIL;
}
}
-
/*-------------------------------------------------------------------------
* Function: free_handler
*
@@ -816,25 +763,25 @@ free_handler(struct handler_t *hand, int len)
{
int i;
- if(hand) {
+ if (hand) {
for (i = 0; i < len; i++) {
- if(hand[i].obj) {
+ if (hand[i].obj) {
HDfree(hand[i].obj);
- hand[i].obj=NULL;
+ hand[i].obj = NULL;
}
if (hand[i].subset_info) {
- if(hand[i].subset_info->start.data)
+ if (hand[i].subset_info->start.data)
HDfree(hand[i].subset_info->start.data);
- if(hand[i].subset_info->stride.data)
+ if (hand[i].subset_info->stride.data)
HDfree(hand[i].subset_info->stride.data);
- if(hand[i].subset_info->count.data)
+ if (hand[i].subset_info->count.data)
HDfree(hand[i].subset_info->count.data);
- if(hand[i].subset_info->block.data)
+ if (hand[i].subset_info->block.data)
HDfree(hand[i].subset_info->block.data);
HDfree(hand[i].subset_info);
- hand[i].subset_info=NULL;
+ hand[i].subset_info = NULL;
}
}
@@ -842,7 +789,6 @@ free_handler(struct handler_t *hand, int len)
}
}
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -857,11 +803,11 @@ free_handler(struct handler_t *hand, int len)
static struct handler_t *
parse_command_line(int argc, const char *argv[])
{
- struct handler_t *hand = NULL;
- struct handler_t *last_dset = NULL;
- int i;
- int opt;
- int last_was_dset = FALSE;
+ struct handler_t *hand = NULL;
+ struct handler_t *last_dset = NULL;
+ int i;
+ int opt;
+ int last_was_dset = FALSE;
/* no arguments */
if (argc == 1) {
@@ -870,432 +816,430 @@ parse_command_line(int argc, const char *argv[])
}
/* this will be plenty big enough to hold the info */
- if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t))) == NULL) {
+ if ((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t))) == NULL) {
goto error;
}
/* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
parse_start:
switch ((char)opt) {
- case 'R':
- dump_opts.display_region = TRUE;
- region_output = TRUE;
- break;
- case 'B':
- dump_opts.display_bb = TRUE;
- last_was_dset = FALSE;
- break;
- case 'n':
- dump_opts.display_fi = TRUE;
- last_was_dset = FALSE;
- if (opt_arg != NULL)
- h5trav_set_verbose(HDatoi(opt_arg));
- break;
- case 'p':
- dump_opts.display_dcpl = TRUE;
- break;
- case 'y':
- dump_opts.display_ai = FALSE;
- break;
- case 'e':
- dump_opts.display_escape = TRUE;
- break;
- case 'H':
- dump_opts.display_data = FALSE;
- dump_opts.display_attr_data = FALSE;
- last_was_dset = FALSE;
- break;
- case 'A':
- if (opt_arg != NULL) {
- if(0 == HDatoi(opt_arg))
- dump_opts.include_attrs = FALSE;
- }
- else {
- dump_opts.display_data = FALSE;
- dump_opts.display_attr_data = TRUE;
- last_was_dset = FALSE;
- }
- break;
- case 'i':
- dump_opts.display_oid = TRUE;
- last_was_dset = FALSE;
- break;
- case 'r':
- dump_opts.display_char = TRUE;
- break;
- case 'V':
- print_version(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
- h5tools_setstatus(EXIT_SUCCESS);
- goto done;
- break;
- case 'w':
- {
- int sh5tools_nCols = HDatoi(opt_arg);
+ case 'R':
+ dump_opts.display_region = TRUE;
+ region_output = TRUE;
+ break;
+ case 'B':
+ dump_opts.display_bb = TRUE;
+ last_was_dset = FALSE;
+ break;
+ case 'n':
+ dump_opts.display_fi = TRUE;
+ last_was_dset = FALSE;
+ if (H5_optarg != NULL)
+ h5trav_set_verbose(HDatoi(H5_optarg));
+ break;
+ case 'p':
+ dump_opts.display_dcpl = TRUE;
+ break;
+ case 'y':
+ dump_opts.display_ai = FALSE;
+ break;
+ case 'e':
+ dump_opts.display_escape = TRUE;
+ break;
+ case 'H':
+ dump_opts.display_data = FALSE;
+ dump_opts.display_attr_data = FALSE;
+ last_was_dset = FALSE;
+ break;
+ case 'A':
+ if (H5_optarg != NULL) {
+ if (0 == HDatoi(H5_optarg))
+ dump_opts.include_attrs = FALSE;
+ }
+ else {
+ dump_opts.display_data = FALSE;
+ dump_opts.display_attr_data = TRUE;
+ last_was_dset = FALSE;
+ }
+ break;
+ case 'i':
+ dump_opts.display_oid = TRUE;
+ last_was_dset = FALSE;
+ break;
+ case 'r':
+ dump_opts.display_char = TRUE;
+ break;
+ case 'V':
+ print_version(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ break;
+ case 'w': {
+ int sh5tools_nCols = HDatoi(H5_optarg);
if (sh5tools_nCols <= 0)
h5tools_nCols = 65535;
else
h5tools_nCols = (unsigned)sh5tools_nCols;
last_was_dset = FALSE;
- }
- break;
- case 'N':
- dump_opts.display_all = 0;
-
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_paths;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
-
- last_was_dset = FALSE;
- break;
- case 'a':
- dump_opts.display_all = 0;
+ } break;
+ case 'N':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_paths;
+ hand[i].obj = HDstrdup(H5_optarg);
+ break;
+ }
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_attributes;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
+ last_was_dset = FALSE;
+ break;
+ case 'a':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_attributes;
+ hand[i].obj = HDstrdup(H5_optarg);
+ break;
+ }
- last_was_dset = FALSE;
- break;
- case 'd':
- dump_opts.display_all = 0;
-
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_datasets;
- hand[i].obj = HDstrdup(opt_arg);
- hand[i].subset_info = parse_subset_params(hand[i].obj);
- last_dset = &hand[i];
- break;
- }
+ last_was_dset = FALSE;
+ break;
+ case 'd':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_datasets;
+ hand[i].obj = HDstrdup(H5_optarg);
+ hand[i].subset_info = parse_subset_params(hand[i].obj);
+ last_dset = &hand[i];
+ break;
+ }
- last_was_dset = TRUE;
- break;
- case 'f':
- driver_name_g = opt_arg;
- break;
- case 'g':
- dump_opts.display_all = 0;
-
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_groups;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
+ last_was_dset = TRUE;
+ break;
+ case 'f':
+ driver_name_g = H5_optarg;
+ break;
+ case 'g':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_groups;
+ hand[i].obj = HDstrdup(H5_optarg);
+ break;
+ }
- last_was_dset = FALSE;
- break;
- case 'l':
- dump_opts.display_all = 0;
+ last_was_dset = FALSE;
+ break;
+ case 'l':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_links;
+ hand[i].obj = HDstrdup(H5_optarg);
+ break;
+ }
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_links;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
+ last_was_dset = FALSE;
+ break;
+ case 't':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_datatypes;
+ hand[i].obj = HDstrdup(H5_optarg);
+ break;
+ }
- last_was_dset = FALSE;
- break;
- case 't':
- dump_opts.display_all = 0;
+ last_was_dset = FALSE;
+ break;
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_datatypes;
- hand[i].obj = HDstrdup(opt_arg);
- break;
+ case 'O':
+ if (h5tools_set_output_file(H5_optarg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
}
+ break;
- last_was_dset = FALSE;
- break;
+ case 'o':
+ if (bin_output) {
+ if (h5tools_set_data_output_file(H5_optarg, 1) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ else {
+ if (dump_opts.display_attr_data && !dump_opts.display_data) {
+ if (h5tools_set_attr_output_file(H5_optarg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ if (dump_opts.display_data || dump_opts.display_all) {
+ if (h5tools_set_data_output_file(H5_optarg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ }
- case 'O':
- if (h5tools_set_output_file(opt_arg, 0) < 0) {
- usage(h5tools_getprogname());
- goto error;
- }
- break;
+ dump_opts.usingdasho = TRUE;
+ last_was_dset = FALSE;
+ outfname_g = H5_optarg;
+ break;
- case 'o':
- if (bin_output) {
- if (h5tools_set_data_output_file(opt_arg, 1) < 0) {
- usage(h5tools_getprogname());
- goto error;
- }
- }
- else {
- if(dump_opts.display_attr_data && !dump_opts.display_data) {
- if (h5tools_set_attr_output_file(opt_arg, 0) < 0) {
+ case 'b':
+ if (H5_optarg != NULL) {
+ if ((bin_form = set_binary_form(H5_optarg)) < 0) {
+ /* failed to set binary form */
usage(h5tools_getprogname());
goto error;
}
}
- if(dump_opts.display_data || dump_opts.display_all) {
- if (h5tools_set_data_output_file(opt_arg, 0) < 0) {
+ bin_output = TRUE;
+ if (outfname_g != NULL) {
+ if (h5tools_set_data_output_file(outfname_g, 1) < 0) {
+ /* failed to set output file */
usage(h5tools_getprogname());
goto error;
}
+
+ last_was_dset = FALSE;
}
- }
+ break;
+
+ case 'q':
+ if ((sort_by = set_sort_by(H5_optarg)) < 0) {
+ /* failed to set "sort by" form */
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ break;
- dump_opts.usingdasho = TRUE;
- last_was_dset = FALSE;
- outfname_g = opt_arg;
- break;
+ case 'z':
+ if ((sort_order = set_sort_order(H5_optarg)) < 0) {
+ /* failed to set "sort order" form */
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ break;
- case 'b':
- if (opt_arg != NULL) {
- if ((bin_form = set_binary_form(opt_arg)) < 0) {
- /* failed to set binary form */
+ case 'M':
+ if (!last_was_dset) {
+ error_msg("option \"-%c\" can only be used after --dataset option\n", opt);
+ goto error;
+ }
+ if (parse_mask_list(H5_optarg) != SUCCEED) {
usage(h5tools_getprogname());
goto error;
}
- }
- bin_output = TRUE;
- if (outfname_g != NULL) {
- if (h5tools_set_data_output_file(outfname_g, 1) < 0) {
- /* failed to set output file */
+ dump_opts.display_packed_bits = TRUE;
+ break;
+ case 'v':
+ dump_opts.display_vds_first = TRUE;
+ break;
+ case 'G':
+ dump_opts.vds_gap_size = HDatoi(H5_optarg);
+ if (dump_opts.vds_gap_size < 0) {
usage(h5tools_getprogname());
goto error;
}
+ break;
- last_was_dset = FALSE;
- }
- break;
+ /** begin XML parameters **/
+ case 'x':
+ /* select XML output */
+ doxml_g = TRUE;
+ useschema_g = TRUE;
+ h5tools_dump_header_format = NULL;
+ dump_function_table = &xml_function_table;
+ h5tools_nCols = 0;
+ break;
+ case 'u':
+ doxml_g = TRUE;
+ useschema_g = FALSE;
+ xmlnsprefix = "";
+ h5tools_dump_header_format = NULL;
+ dump_function_table = &xml_function_table;
+ h5tools_nCols = 0;
+ break;
+ case 'D':
+ /* specify alternative XML DTD or schema */
+ /* To Do: check format of this value? */
+ xml_dtd_uri_g = H5_optarg;
+ h5tools_nCols = 0;
+ break;
- case 'q':
- if ((sort_by = set_sort_by(opt_arg)) < 0) {
- /* failed to set "sort by" form */
- usage(h5tools_getprogname());
- goto error;
- }
- break;
+ case 'm':
+ /* specify alternative floating point printing format */
+ fp_format = H5_optarg;
+ h5tools_nCols = 0;
+ break;
- case 'z':
- if ((sort_order = set_sort_order(opt_arg)) < 0) {
- /* failed to set "sort order" form */
- usage(h5tools_getprogname());
- goto error;
- }
- break;
+ case 'X':
+ /* specify XML namespace (default="hdf5:"), or none */
+ /* To Do: check format of this value? */
+ if (!useschema_g) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ if (HDstrcmp(H5_optarg, ":") == 0)
+ xmlnsprefix = "";
+ else
+ xmlnsprefix = H5_optarg;
+ h5tools_nCols = 0;
+ break;
+ /** end XML parameters **/
- case 'M':
- if (!last_was_dset) {
- error_msg("option `-%c' can only be used after --dataset option\n", opt);
- goto error;
- }
- if (parse_mask_list(opt_arg) != SUCCEED){
- usage(h5tools_getprogname());
- goto error;
- }
- dump_opts.display_packed_bits = TRUE;
- break;
- case 'v':
- dump_opts.display_vds_first = TRUE;
- break;
- case 'G':
- dump_opts.vds_gap_size = HDatoi(opt_arg);
- if (dump_opts.vds_gap_size < 0) {
- usage(h5tools_getprogname());
- goto error;
- }
- break;
-
- /** begin XML parameters **/
- case 'x':
- /* select XML output */
- doxml_g = TRUE;
- useschema_g = TRUE;
- h5tools_dump_header_format = NULL;
- dump_function_table = &xml_function_table;
- h5tools_nCols = 0;
- break;
- case 'u':
- doxml_g = TRUE;
- useschema_g = FALSE;
- xmlnsprefix = "";
- h5tools_dump_header_format = NULL;
- dump_function_table = &xml_function_table;
- h5tools_nCols = 0;
- break;
- case 'D':
- /* specify alternative XML DTD or schema */
- /* To Do: check format of this value? */
- xml_dtd_uri_g = opt_arg;
- h5tools_nCols = 0;
- break;
-
- case 'm':
- /* specify alternative floating point printing format */
- fp_format = opt_arg;
- h5tools_nCols = 0;
- break;
-
- case 'X':
- /* specify XML namespace (default="hdf5:"), or none */
- /* To Do: check format of this value? */
- if (!useschema_g) {
- usage(h5tools_getprogname());
- goto error;
- }
- if (HDstrcmp(opt_arg,":") == 0)
- xmlnsprefix = "";
- else
- xmlnsprefix = opt_arg;
- h5tools_nCols = 0;
- break;
- /** end XML parameters **/
-
- /** begin subsetting parameters **/
- case 's':
- case 'S':
- case 'c':
- case 'k': {
- struct subset_t *s;
-
- if (!last_was_dset) {
- error_msg("option `-%c' can only be used after --dataset option\n", opt);
- goto error;
- }
+ /** begin subsetting parameters **/
+ case 's':
+ case 'S':
+ case 'c':
+ case 'k': {
+ struct subset_t *s;
+
+ if (!last_was_dset) {
+ error_msg("option \"-%c\" can only be used after --dataset option\n", opt);
+ goto error;
+ }
+
+ if (last_dset->subset_info) {
+ /*
+ * This overrides the "terse" syntax if they actually mixed
+ * the two.
+ */
+ s = last_dset->subset_info;
+ }
+ else {
+ last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
+ }
- if (last_dset->subset_info) {
/*
- * This overrides the "terse" syntax if they actually mixed
- * the two.
+ * slightly convoluted, but...we are only interested in options
+ * for subsetting: "--start", "--stride", "--count", and "--block"
+ * which can come in any order. If we run out of parameters (EOF)
+ * or run into one which isn't a subsetting parameter (NOT s, S,
+ * c, or K), then we exit the do-while look, set the subset_info
+ * to the structure we've been filling. If we've reached the end
+ * of the options, we exit the parsing (goto parse_end) otherwise,
+ * since we've "read" the next option, we need to parse it. So we
+ * jump to the beginning of the switch statement (goto parse_start).
*/
- s = last_dset->subset_info;
- }
- else {
- last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
- }
-
- /*
- * slightly convoluted, but...we are only interested in options
- * for subsetting: "--start", "--stride", "--count", and "--block"
- * which can come in any order. If we run out of parameters (EOF)
- * or run into one which isn't a subsetting parameter (NOT s, S,
- * c, or K), then we exit the do-while look, set the subset_info
- * to the structure we've been filling. If we've reached the end
- * of the options, we exit the parsing (goto parse_end) otherwise,
- * since we've "read" the next option, we need to parse it. So we
- * jump to the beginning of the switch statement (goto parse_start).
- */
- do {
- switch ((char)opt) {
- case 's':
- if (s->start.data) {
- HDfree(s->start.data);
- s->start.data = NULL;
- }
- parse_hsize_list(opt_arg, &s->start);
- break;
- case 'S':
- if (s->stride.data) {
- HDfree(s->stride.data);
- s->stride.data = NULL;
- }
- parse_hsize_list(opt_arg, &s->stride);
- break;
- case 'c':
- if (s->count.data) {
- HDfree(s->count.data);
- s->count.data = NULL;
- }
- parse_hsize_list(opt_arg, &s->count);
- break;
- case 'k':
- if (s->block.data) {
- HDfree(s->block.data);
- s->block.data = NULL;
+ do {
+ switch ((char)opt) {
+ case 's':
+ if (s->start.data) {
+ HDfree(s->start.data);
+ s->start.data = NULL;
+ }
+ parse_hsize_list(H5_optarg, &s->start);
+ break;
+ case 'S':
+ if (s->stride.data) {
+ HDfree(s->stride.data);
+ s->stride.data = NULL;
+ }
+ parse_hsize_list(H5_optarg, &s->stride);
+ break;
+ case 'c':
+ if (s->count.data) {
+ HDfree(s->count.data);
+ s->count.data = NULL;
+ }
+ parse_hsize_list(H5_optarg, &s->count);
+ break;
+ case 'k':
+ if (s->block.data) {
+ HDfree(s->block.data);
+ s->block.data = NULL;
+ }
+ parse_hsize_list(H5_optarg, &s->block);
+ break;
+ default:
+ goto end_collect;
}
- parse_hsize_list(opt_arg, &s->block);
- break;
- default:
- goto end_collect;
- }
- } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF);
+ } while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF);
end_collect:
- last_was_dset = FALSE;
-
- if (opt != EOF)
- goto parse_start;
- else
- goto parse_end;
- }
- /** end subsetting parameters **/
+ last_was_dset = FALSE;
- case 'E':
- if (opt_arg != NULL)
- enable_error_stack = HDatoi(opt_arg);
- else
- enable_error_stack = 1;
- break;
- case 'C':
- dump_opts.disable_compact_subset = TRUE;
- break;
- case 'h':
- usage(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
- h5tools_setstatus(EXIT_SUCCESS);
- goto done;
+ if (opt != EOF)
+ goto parse_start;
+ else
+ goto parse_end;
+ }
+ /** end subsetting parameters **/
- case '$':
-#ifdef H5_HAVE_ROS3_VFD
- if (h5tools_parse_ros3_fapl_tuple(opt_arg, ',', &ros3_fa_g) < 0) {
- error_msg("failed to parse S3 VFD credential info\n");
+ case 'E':
+ if (H5_optarg != NULL)
+ enable_error_stack = HDatoi(H5_optarg);
+ else
+ enable_error_stack = 1;
+ break;
+ case 'C':
+ dump_opts.disable_compact_subset = TRUE;
+ break;
+ case 'h':
usage(h5tools_getprogname());
free_handler(hand, argc);
hand = NULL;
- h5tools_setstatus(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_SUCCESS);
goto done;
- }
+
+ case '$':
+#ifdef H5_HAVE_ROS3_VFD
+ if (h5tools_parse_ros3_fapl_tuple(H5_optarg, ',', &ros3_fa_g) < 0) {
+ error_msg("failed to parse S3 VFD credential info\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
#else
- error_msg("Read-Only S3 VFD not enabled.\n");
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
+ error_msg("Read-Only S3 VFD not enabled.\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
#endif
- break;
+ break;
- case '#':
+ case '#':
#ifdef H5_HAVE_LIBHDFS
- if (h5tools_parse_hdfs_fapl_tuple(opt_arg, ',', &hdfs_fa_g) < 0) {
- error_msg("failed to parse HDFS VFD configuration info\n");
- usage(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
+ if (h5tools_parse_hdfs_fapl_tuple(H5_optarg, ',', &hdfs_fa_g) < 0) {
+ error_msg("failed to parse HDFS VFD configuration info\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+#else
+ error_msg("HDFS VFD not enabled.\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
-#else
- error_msg("HDFS VFD not enabled.\n");
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
#endif
- break;
+ break;
- case '?':
- default:
- usage(h5tools_getprogname());
- goto error;
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ goto error;
}
}
parse_end:
/* check for file name to be processed */
- if (argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
goto error;
@@ -1313,7 +1257,6 @@ error:
return hand;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1326,25 +1269,25 @@ error:
int
main(int argc, const char *argv[])
{
- hid_t fid = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t fapl_id = H5P_DEFAULT;
- H5O_info_t oi;
- struct handler_t *hand = NULL;
- int i;
- unsigned u;
- char *fname = NULL;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t fapl_id = H5P_DEFAULT;
+ H5O_info_t oi;
+ struct handler_t *hand = NULL;
+ int i;
+ unsigned u;
+ char * fname = NULL;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
h5tools_dump_header_format = &h5tools_standardformat;
- dump_function_table = &ddl_function_table;
- dump_indent = 0;
+ dump_function_table = &ddl_function_table;
+ dump_indent = 0;
/* Initialize h5tools lib */
h5tools_init();
- if((hand = parse_command_line(argc, argv))==NULL) {
+ if ((hand = parse_command_line(argc, argv)) == NULL) {
goto done;
}
@@ -1388,7 +1331,7 @@ main(int argc, const char *argv[])
}
}
- if (argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
@@ -1404,8 +1347,8 @@ main(int argc, const char *argv[])
if (driver_name_g != NULL) {
h5tools_vfd_info_t vfd_info;
- vfd_info.info = NULL;
- vfd_info.name = driver_name_g;
+ vfd_info.info = NULL;
+ vfd_info.name = driver_name_g;
if (!HDstrcmp(driver_name_g, drivernames[ROS3_VFD_IDX])) {
#ifdef H5_HAVE_ROS3_VFD
@@ -1433,11 +1376,10 @@ main(int argc, const char *argv[])
}
} /* driver name defined */
- while(opt_ind < argc) {
- fname = HDstrdup(argv[opt_ind++]);
+ while (H5_optind < argc) {
+ fname = HDstrdup(argv[H5_optind++]);
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id,
- (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
@@ -1451,7 +1393,7 @@ main(int argc, const char *argv[])
/* Prepare to find objects that might be targets of a reference */
fill_ref_path_table(fid);
- if(doxml_g) {
+ if (doxml_g) {
/* initialize XML */
/* reset prefix! */
HDstrcpy(prefix, "");
@@ -1463,12 +1405,13 @@ main(int argc, const char *argv[])
}
else {
xml_dtd_uri_g = DEFAULT_DTD;
- xmlnsprefix = "";
+ xmlnsprefix = "";
}
}
else {
- if (useschema_g && HDstrcmp(xmlnsprefix,"")) {
- error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
+ if (useschema_g && HDstrcmp(xmlnsprefix, "") != 0) {
+ error_msg(
+ "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
@@ -1476,21 +1419,21 @@ main(int argc, const char *argv[])
}
/* Get object info for root group */
- if(H5Oget_info_by_name2(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name2(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Initialize object tables */
- if(table_list_add(fid, oi.fileno) < 0) {
+ if (table_list_add(fid, oi.fileno) < 0) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
group_table = table_list.tables[0].group_table;
- dset_table = table_list.tables[0].dset_table;
- type_table = table_list.tables[0].type_table;
+ dset_table = table_list.tables[0].dset_table;
+ type_table = table_list.tables[0].type_table;
/* does there exist unamed committed datatype */
for (u = 0; u < type_table->nobjs; u++)
@@ -1501,35 +1444,42 @@ main(int argc, const char *argv[])
/* start to dump - display file header information */
if (!doxml_g) {
- begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin);
+ begin_obj(h5tools_dump_header_format->filebegin, fname,
+ h5tools_dump_header_format->fileblockbegin);
}
else {
PRINTVALSTREAM(rawoutstream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
/* alternative first element, depending on schema or DTD. */
if (useschema_g) {
- if (HDstrcmp(xmlnsprefix,"") == 0) {
- PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n", xml_dtd_uri_g);
+ if (HDstrcmp(xmlnsprefix, "") == 0) {
+ PRINTSTREAM(rawoutstream,
+ "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xsi:noNamespaceSchemaLocation=\"%s\">\n",
+ xml_dtd_uri_g);
}
else {
/* TO DO: make -url option work in this case (may need new option) */
char *ns;
char *indx;
- ns = HDstrdup(xmlnsprefix);
- indx = HDstrrchr(ns,(int)':');
+ ns = HDstrdup(xmlnsprefix);
+ indx = HDstrrchr(ns, (int)':');
if (indx)
*indx = '\0';
- PRINTSTREAM(rawoutstream, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\" "
- "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
- "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File "
- "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns);
+ PRINTSTREAM(rawoutstream,
+ "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\" "
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File "
+ "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",
+ xmlnsprefix, ns);
HDfree(ns);
}
}
else {
- PRINTSTREAM(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n", xml_dtd_uri_g);
+ PRINTSTREAM(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n",
+ xml_dtd_uri_g);
PRINTVALSTREAM(rawoutstream, "<HDF5-File>\n");
}
}
@@ -1538,7 +1488,7 @@ main(int argc, const char *argv[])
if (dump_opts.display_fi) {
PRINTVALSTREAM(rawoutstream, "\n");
dump_fcontents(fid);
- end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend);
+ end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend);
PRINTVALSTREAM(rawoutstream, "\n");
goto done;
}
@@ -1547,36 +1497,35 @@ main(int argc, const char *argv[])
dump_fcpl(fid);
}
- if(dump_opts.display_all) {
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
+ if (dump_opts.display_all) {
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
error_msg("unable to open root group\n");
h5tools_setstatus(EXIT_FAILURE);
}
else {
if (!doxml_g)
dump_indent += COL;
- dump_function_table->dump_group_function(gid, "/" );
+ dump_function_table->dump_group_function(gid, "/");
if (!doxml_g)
dump_indent -= COL;
PRINTVALSTREAM(rawoutstream, "\n");
}
- if(H5Gclose(gid) < 0) {
+ if (H5Gclose(gid) < 0) {
error_msg("unable to close root group\n");
h5tools_setstatus(EXIT_FAILURE);
}
-
}
else {
/* Note: this option is not supported for XML */
- if(doxml_g) {
+ if (doxml_g) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
} /* end if */
- for(i = 0; i < argc; i++) {
- if(hand[i].func) {
+ for (i = 0; i < argc; i++) {
+ if (hand[i].func) {
hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL);
}
}
@@ -1593,21 +1542,21 @@ main(int argc, const char *argv[])
/* Free tables for objects */
table_list_free();
- if(fid >=0)
+ if (fid >= 0)
if (H5Fclose(fid) < 0)
h5tools_setstatus(EXIT_FAILURE);
- if(prefix) {
+ if (prefix) {
HDfree(prefix);
prefix = NULL;
}
- if(fname) {
+ if (fname) {
HDfree(fname);
fname = NULL;
}
} /* end while */
- if(hand)
+ if (hand)
free_handler(hand, argc);
/* To Do: clean up XML table */
@@ -1623,20 +1572,20 @@ done:
h5tools_setstatus(EXIT_FAILURE);
}
- if(fid >=0)
+ if (fid >= 0)
if (H5Fclose(fid) < 0)
h5tools_setstatus(EXIT_FAILURE);
- if(prefix) {
+ if (prefix) {
HDfree(prefix);
prefix = NULL;
}
- if(fname) {
+ if (fname) {
HDfree(fname);
fname = NULL;
}
- if(hand)
+ if (hand)
free_handler(hand, argc);
/* To Do: clean up XML table */
@@ -1644,7 +1593,6 @@ done:
leave(h5tools_getstatus());
} /* main */
-
/*-------------------------------------------------------------------------
* Function: init_prefix
*
@@ -1659,13 +1607,12 @@ done:
static void
init_prefix(char **prfx, size_t prfx_len)
{
- if(prfx_len > 0)
+ if (prfx_len > 0)
*prfx = (char *)HDcalloc(prfx_len, 1);
else
error_msg("unable to allocate prefix buffer\n");
}
-
/*-------------------------------------------------------------------------
* Function: add_prefix
*
@@ -1681,12 +1628,11 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name)
size_t new_len = HDstrlen(*prfx) + HDstrlen(name) + 2;
/* Check if we need more space */
- if(*prfx_len <= new_len) {
+ if (*prfx_len <= new_len) {
*prfx_len = new_len + 1;
- *prfx = (char *)HDrealloc(*prfx, *prfx_len);
+ *prfx = (char *)HDrealloc(*prfx, *prfx_len);
}
/* Append object name to prefix */
HDstrcat(HDstrcat(*prfx, "/"), name);
} /* end add_prefix */
-
diff --git a/tools/src/h5dump/h5dump.h b/tools/src/h5dump/h5dump.h
index 548af09..a53d1ba 100644
--- a/tools/src/h5dump/h5dump.h
+++ b/tools/src/h5dump/h5dump.h
@@ -6,12 +6,12 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5DUMP_H__
-#define H5DUMP_H__
+#ifndef H5DUMP_H
+#define H5DUMP_H
#include "hdf5.h"
#include "H5private.h"
@@ -26,66 +26,67 @@
**/
/* the table of dump functions */
typedef struct dump_functions_t {
- void (*dump_group_function) (hid_t, const char *);
- void (*dump_named_datatype_function) (hid_t, const char *);
- void (*dump_dataset_function) (hid_t, const char *, struct subset_t *);
- void (*dump_dataspace_function) (hid_t);
- void (*dump_datatype_function) (hid_t);
- herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *);
- void (*dump_data_function) (hid_t, int, struct subset_t *, int);
+ void (*dump_group_function)(hid_t, const char *);
+ void (*dump_named_datatype_function)(hid_t, const char *);
+ void (*dump_dataset_function)(hid_t, const char *, struct subset_t *);
+ void (*dump_dataspace_function)(hid_t);
+ void (*dump_datatype_function)(hid_t);
+ herr_t (*dump_attribute_function)(hid_t, const char *, const H5A_info_t *, void *);
+ void (*dump_data_function)(hid_t, int, struct subset_t *, int);
} dump_functions;
/* List of table structures. There is one table structure for each file */
typedef struct h5dump_table_items_t {
- unsigned long fileno; /* File number that these tables refer to */
- hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
- table_t *group_table; /* Table of groups */
- table_t *dset_table; /* Table of datasets */
- table_t *type_table; /* Table of datatypes */
+ unsigned long fileno; /* File number that these tables refer to */
+ hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
+ table_t * group_table; /* Table of groups */
+ table_t * dset_table; /* Table of datasets */
+ table_t * type_table; /* Table of datatypes */
} h5dump_table_items_t;
typedef struct h5dump_table_list_t {
- size_t nalloc;
- size_t nused;
- h5dump_table_items_t *tables;
+ size_t nalloc;
+ size_t nused;
+ h5dump_table_items_t *tables;
} h5dump_table_list_t;
-h5dump_table_list_t table_list = {0, 0, NULL};
-table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
+h5dump_table_list_t table_list = {0, 0, NULL};
+table_t * group_table = NULL, *dset_table = NULL, *type_table = NULL;
-unsigned dump_indent = 0; /* how far in to indent the line */
-int unamedtype = 0; /* shared datatype with no name */
-hbool_t hit_elink = FALSE; /* whether we have traversed an external link */
-size_t prefix_len = 1024;
-char *prefix = NULL;
-const char *fp_format = NULL;
+unsigned dump_indent = 0; /* how far in to indent the line */
+int unamedtype = 0; /* shared datatype with no name */
+hbool_t hit_elink = FALSE; /* whether we have traversed an external link */
+size_t prefix_len = 1024;
+char * prefix = NULL;
+const char *fp_format = NULL;
/* things to display or which are set via command line parameters */
typedef struct {
- int display_all;
- int display_oid;
- int display_data;
- int display_attr_data;
- int display_char; /* print 1-byte numbers as ASCII */
- int usingdasho;
- int display_bb; /* superblock */
- int display_dcpl; /* dcpl */
- int display_fi; /* file index */
- int display_ai; /* array index */
- int display_escape; /* escape non printable characters */
- int display_region; /* print region reference data */
- int disable_compact_subset; /* disable compact form of subset notation */
- int display_packed_bits; /* print 1-8 byte numbers as packed bits */
- int include_attrs; /* Display attributes */
- int display_vds_first; /* vds display to all by default */
- int vds_gap_size; /* vds skip missing files default is none */
+ int display_all;
+ int display_oid;
+ int display_data;
+ int display_attr_data;
+ int display_char; /* print 1-byte numbers as ASCII */
+ int usingdasho;
+ int display_bb; /* superblock */
+ int display_dcpl; /* dcpl */
+ int display_fi; /* file index */
+ int display_ai; /* array index */
+ int display_escape; /* escape non printable characters */
+ int display_region; /* print region reference data */
+ int disable_compact_subset; /* disable compact form of subset notation */
+ int display_packed_bits; /* print 1-8 byte numbers as packed bits */
+ int include_attrs; /* Display attributes */
+ int display_vds_first; /* vds display to all by default */
+ int vds_gap_size; /* vds skip missing files default is none */
} dump_opt_t;
-dump_opt_t dump_opts = {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0};
+dump_opt_t dump_opts = {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE,
+ TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0};
-#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
-#define PACKED_BITS_SIZE_MAX (8*sizeof(long long)) /* Maximum bits size of integer types of packed-bits */
+#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
+#define PACKED_BITS_SIZE_MAX (8 * sizeof(long long)) /* Maximum bits size of integer types of packed-bits */
/* mask list for packed bits */
-unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
+unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
/* packed bits display parameters */
unsigned packed_offset[PACKED_BITS_MAX];
@@ -98,16 +99,17 @@ unsigned packed_length[PACKED_BITS_MAX];
const dump_functions *dump_function_table;
#ifdef __cplusplus
-"C" {
+"C"
+{
#endif
-void add_prefix(char **prfx, size_t *prfx_len, const char *name);
-hid_t h5_fileaccess(void);
-ssize_t table_list_add(hid_t oid, unsigned long file_no);
-ssize_t table_list_visited(unsigned long file_no);
+ void add_prefix(char **prfx, size_t *prfx_len, const char *name);
+ hid_t h5_fileaccess(void);
+ ssize_t table_list_add(hid_t oid, unsigned long file_no);
+ ssize_t table_list_visited(unsigned long file_no);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_H__ */
+#endif /* H5DUMP_H */
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index c752fbb..8d5a4a8 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,18 +21,18 @@
#include "h5dump_ddl.h"
typedef struct {
- hid_t fid; /* File ID being traversed */
- const char *op_name; /* Object name wanted */
+ hid_t fid; /* File ID being traversed */
+ const char *op_name; /* Object name wanted */
} trav_handle_udata_t;
typedef struct {
- const char *path; /* Path of object being searched */
- const char *op_name; /* Object name wanted */
+ const char *path; /* Path of object being searched */
+ const char *op_name; /* Object name wanted */
} trav_attr_udata_t;
/* callback function used by H5Literate() */
-static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data);
-static int dump_extlink(hid_t group, const char *linkname, const char *objname);
+static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data);
+static int dump_extlink(hid_t group, const char *linkname, const char *objname);
/*-------------------------------------------------------------------------
* Function: dump_datatype
@@ -46,12 +46,12 @@ static int dump_extlink(hid_t group, const char *linkname, const char *objn
void
dump_datatype(hid_t type)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
h5dump_type_table = type_table;
h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type);
@@ -70,17 +70,16 @@ dump_datatype(hid_t type)
void
dump_dataspace(hid_t space)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
}
-
/*-------------------------------------------------------------------------
* Function: dump_attr_cb
*
@@ -91,48 +90,49 @@ dump_dataspace(hid_t space)
*-------------------------------------------------------------------------
*/
herr_t
-dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
+dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info,
+ void H5_ATTR_UNUSED *_op_data)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hid_t attr_id;
- herr_t ret = SUCCEED;
+ hid_t attr_id;
+ herr_t ret = SUCCEED;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
ctx.display_index = dump_opts.display_ai;
- ctx.display_char = dump_opts.display_char;
+ ctx.display_char = dump_opts.display_char;
- attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
- oid_output = dump_opts.display_oid;
- data_output = dump_opts.display_data;
+ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
+ oid_output = dump_opts.display_oid;
+ data_output = dump_opts.display_data;
attr_data_output = dump_opts.display_attr_data;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
h5dump_type_table = type_table;
h5tools_dump_attribute(rawoutstream, outputformat, &ctx, attr_name, attr_id);
h5dump_type_table = NULL;
- if(attr_id < 0) {
+ if (attr_id < 0) {
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
@@ -140,7 +140,6 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: dump_all_cb
*
@@ -154,43 +153,43 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
static herr_t
dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
{
- hid_t obj;
- hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
- herr_t ret = SUCCEED;
- char *obj_path = NULL; /* Full path of object */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ hid_t obj;
+ hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
+ herr_t ret = SUCCEED;
+ char * obj_path = NULL; /* Full path of object */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
/* Build the object's path name */
obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
- if(!obj_path) {
+ if (!obj_path) {
ret = FAIL;
goto done;
}
@@ -199,354 +198,368 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
HDstrcat(obj_path, "/");
HDstrcat(obj_path, name);
- if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ if (linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
goto done;
} /* end if */
- switch(oinfo.type) {
- case H5O_TYPE_GROUP:
- if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg("unable to dump group \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- char *old_prefix; /* Pointer to previous prefix */
+ switch (oinfo.type) {
+ case H5O_TYPE_GROUP:
+ if ((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump group \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ char *old_prefix; /* Pointer to previous prefix */
- /* Keep copy of prefix before iterating into group */
- old_prefix = HDstrdup(prefix);
- if (old_prefix) {
- /* Append group name to prefix */
- add_prefix(&prefix, &prefix_len, name);
+ /* Keep copy of prefix before iterating into group */
+ old_prefix = HDstrdup(prefix);
+ if (old_prefix) {
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
- /* Iterate into group */
- dump_function_table->dump_group_function(obj, name);
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
- /* Restore old prefix name */
- HDstrcpy(prefix, old_prefix);
- HDfree(old_prefix);
- }
- else
- error_msg("warning: null prefix\n");
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
+ }
+ else
+ error_msg("warning: null prefix\n");
- /* Close group */
- H5Gclose(obj);
- }
- break;
+ /* Close group */
+ H5Gclose(obj);
+ }
+ break;
- case H5O_TYPE_DATASET:
- if(dump_opts.display_data) {
- if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
- error_msg("error in creating default access property list ID\n");
+ case H5O_TYPE_DATASET:
+ if (dump_opts.display_data) {
+ if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
+ error_msg("error in creating default access property list ID\n");
+ }
+ if (dump_opts.display_vds_first) {
+ if (H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
+ error_msg("error in setting access property list ID, virtual_view\n");
+ }
+ if (dump_opts.vds_gap_size > 0) {
+ if (H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
+ error_msg("error in setting access property list ID, virtual_printf_gap\n");
+ }
}
- if (dump_opts.display_vds_first) {
- if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
- error_msg("error in setting access property list ID, virtual_view\n");
+ if ((obj = H5Dopen2(group, name, dapl_id)) >= 0) {
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
+
+ found_obj = search_obj(dset_table, oinfo.addr);
+
+ if (found_obj == NULL) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s",
+ h5tools_dump_header_format->datasetblockend);
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
+ goto done;
+ }
+ else if (found_obj->displayed) {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s",
+ h5tools_dump_header_format->datasetblockend);
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
+ goto done;
+ }
+ else {
+ found_obj->displayed = TRUE;
+ }
+ } /* end if */
+
+ dump_function_table->dump_dataset_function(obj, name, NULL);
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
}
- if (dump_opts.vds_gap_size > 0) {
- if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
- error_msg("error in setting access property list ID, virtual_printf_gap\n");
+ else {
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ error_msg("unable to dump dataset \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
}
- }
- if((obj = H5Dopen2(group, name, dapl_id)) >= 0) {
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
-
- found_obj = search_obj(dset_table, oinfo.addr);
-
- if(found_obj == NULL) {
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datasetbegin, name,
- h5tools_dump_header_format->datasetblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ case H5O_TYPE_NAMED_DATATYPE:
+ if ((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump datatype \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ dump_function_table->dump_named_datatype_function(obj, name);
+ H5Tclose(obj);
+ }
+ break;
- error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ error_msg("unknown object \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ } /* end if */
+ else {
+ char *targbuf;
- ctx.need_prefix = TRUE;
+ switch (linfo->type) {
+ case H5L_TYPE_SOFT:
+ if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->softlinkbegin,
+ name, h5tools_dump_header_format->softlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ ctx.indent_level++;
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get link value\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- H5Dclose(obj);
- goto done;
}
- else if(found_obj->displayed) {
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datasetbegin, name,
- h5tools_dump_header_format->datasetblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
-
+ else {
+ /* print the value of a soft link */
+ /* Standard DDL: no modification */
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- H5Dclose(obj);
- goto done;
+ h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
- else {
- found_obj->displayed = TRUE;
- }
- } /* end if */
- dump_function_table->dump_dataset_function(obj, name, NULL);
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- H5Dclose(obj);
- }
- else {
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- error_msg("unable to dump dataset \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- break;
-
- case H5O_TYPE_NAMED_DATATYPE:
- if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg("unable to dump datatype \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- dump_function_table->dump_named_datatype_function(obj, name);
- H5Tclose(obj);
- }
- break;
+ ctx.indent_level--;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- error_msg("unknown object \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- } /* end if */
- else {
- char *targbuf;
-
- switch(linfo->type) {
- case H5L_TYPE_SOFT:
- if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
- error_msg("unable to allocate buffer\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->softlinkbegin, name,
- h5tools_dump_header_format->softlinkblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->softlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend);
+ if (HDstrlen(h5tools_dump_header_format->softlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->softlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
+ HDfree(targbuf);
+ }
+ break;
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get link value\n");
+ case H5L_TYPE_EXTERNAL:
+ if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- /* print the value of a soft link */
- /* Standard DDL: no modification */
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->extlinkbegin,
+ name, h5tools_dump_header_format->extlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ indentation(dump_indent);
+ error_msg("unable to get external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ const char *filename;
+ const char *targname;
+
+ if (H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ indentation(dump_indent);
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* dump the external link */
+ dump_extlink(group, name, targname);
+ ctx.indent_level--;
+ } /* end else */
+ } /* end else */
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->extlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend);
+ if (HDstrlen(h5tools_dump_header_format->extlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->extlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->softlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend);
- if(HDstrlen(h5tools_dump_header_format->softlinkend))
- h5tools_str_append(&buffer, " ");
+ HDfree(targbuf);
}
- if(HDstrlen(h5tools_dump_header_format->softlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- HDfree(targbuf);
- }
- break;
+ break;
- case H5L_TYPE_EXTERNAL:
- if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
- error_msg("unable to allocate buffer\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->extlinkbegin, name,
- h5tools_dump_header_format->extlinkblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- indentation(dump_indent);
- error_msg("unable to get external link value\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- } /* end if */
- else {
- const char *filename;
- const char *targname;
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->udlinkbegin, name,
+ h5tools_dump_header_format->udlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
- indentation(dump_indent);
- error_msg("unable to unpack external link value\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- } /* end if */
- else {
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "LINKCLASS %d", linfo->type);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- /* dump the external link */
- dump_extlink(group, name, targname);
- ctx.indent_level--;
- } /* end else */
- } /* end else */
ctx.need_prefix = TRUE;
-
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->extlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend);
- if(HDstrlen(h5tools_dump_header_format->extlinkend))
+ if (HDstrlen(h5tools_dump_header_format->udlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkblockend);
+ if (HDstrlen(h5tools_dump_header_format->udlinkend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->extlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- HDfree(targbuf);
- }
- break;
-
- case H5L_TYPE_ERROR:
- case H5L_TYPE_MAX:
- case H5L_TYPE_HARD:
- default:
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->udlinkbegin, name,
- h5tools_dump_header_format->udlinkblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "LINKCLASS %d", linfo->type);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
-
- ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->udlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkblockend);
- if(HDstrlen(h5tools_dump_header_format->udlinkend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->udlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (HDstrlen(h5tools_dump_header_format->udlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ break;
} /* end switch */
- } /* end else */
+ } /* end else */
done:
h5tools_str_close(&buffer);
- if(obj_path)
+ if (obj_path)
HDfree(obj_path);
return ret;
}
@@ -564,19 +577,19 @@ attr_iteration(hid_t gid, unsigned attr_crt_order_flags)
{
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
- if(dump_opts.include_attrs) {
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ if (dump_opts.include_attrs) {
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if (H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
}
}
@@ -594,7 +607,7 @@ link_iteration(hid_t gid, unsigned crt_order_flags)
/* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group, then, sort by creation order, otherwise by name */
- if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL);
else
H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
@@ -613,11 +626,11 @@ dump_named_datatype(hid_t tid, const char *name)
{
H5O_info_t oinfo;
unsigned attr_crt_order_flags;
- hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
/* setup */
@@ -625,24 +638,24 @@ dump_named_datatype(hid_t tid, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
if ((tcpl_id = H5Tget_create_plist(tid)) < 0) {
error_msg("error in getting creation property list ID\n");
@@ -655,7 +668,7 @@ dump_named_datatype(hid_t tid, const char *name)
h5tools_setstatus(EXIT_FAILURE);
}
- if(H5Pclose(tcpl_id) < 0) {
+ if (H5Pclose(tcpl_id) < 0) {
error_msg("error in closing creation property list ID\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -664,18 +677,18 @@ dump_named_datatype(hid_t tid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datatypebegin, name,
- h5tools_dump_header_format->datatypeblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datatypebegin, name,
+ h5tools_dump_header_format->datatypeblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC);
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
*/
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
found_obj = search_obj(type_table, oinfo.addr);
@@ -688,7 +701,8 @@ dump_named_datatype(hid_t tid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
goto done;
}
else
@@ -699,11 +713,12 @@ dump_named_datatype(hid_t tid, const char *name)
h5tools_str_reset(&buffer);
h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE);
- if(H5Tget_class(tid) != H5T_COMPOUND) {
+ if (H5Tget_class(tid) != H5T_COMPOUND) {
h5tools_str_append(&buffer, ";");
}
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* print attributes */
dump_indent += COL;
@@ -715,14 +730,15 @@ dump_named_datatype(hid_t tid, const char *name)
done:
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datatypeblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend);
- if(HDstrlen(h5tools_dump_header_format->datatypeend))
+ if (HDstrlen(h5tools_dump_header_format->datatypeend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->datatypeend))
+ if (HDstrlen(h5tools_dump_header_format->datatypeend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -738,18 +754,18 @@ done:
void
dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
- hid_t dset;
- hid_t type;
- hid_t gcpl_id;
- unsigned crt_order_flags;
- unsigned attr_crt_order_flags;
- char type_name[1024];
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ H5O_info_t oinfo;
+ hid_t dset;
+ hid_t type;
+ hid_t gcpl_id;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ char type_name[1024];
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -763,12 +779,12 @@ dump_group(hid_t gid, const char *name)
}
/* query the group creation properties */
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
error_msg("error in getting group creation properties\n");
h5tools_setstatus(EXIT_FAILURE);
}
- if(H5Pclose(gcpl_id) < 0) {
+ if (H5Pclose(gcpl_id) < 0) {
error_msg("error in closing group creation property list ID\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -778,53 +794,53 @@ dump_group(hid_t gid, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->groupbegin, name,
- h5tools_dump_header_format->groupblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->groupbegin, name,
+ h5tools_dump_header_format->groupblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
- if(!HDstrcmp(name, "/") && unamedtype) {
- unsigned u; /* Local index variable */
+ if (!HDstrcmp(name, "/") && unamedtype) {
+ unsigned u; /* Local index variable */
/* dump unamed type in root group */
- for(u = 0; u < type_table->nobjs; u++)
- if(!type_table->objs[u].recorded) {
+ for (u = 0; u < type_table->nobjs; u++)
+ if (!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
}
} /* end if */
- if(dump_opts.display_oid)
+ if (dump_opts.display_oid)
h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid);
h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid);
@@ -834,8 +850,8 @@ dump_group(hid_t gid, const char *name)
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
*/
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
found_obj = search_obj(group_table, oinfo.addr);
@@ -849,7 +865,8 @@ dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
found_obj->displayed = TRUE;
@@ -869,14 +886,15 @@ dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->groupblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->groupblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupblockend);
- if(HDstrlen(h5tools_dump_header_format->groupend))
+ if (HDstrlen(h5tools_dump_header_format->groupend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->groupend))
+ if (HDstrlen(h5tools_dump_header_format->groupend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -892,35 +910,35 @@ dump_group(hid_t gid, const char *name)
void
dump_dataset(hid_t did, const char *name, struct subset_t *sset)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hid_t type, space;
- unsigned attr_crt_order_flags;
- hid_t dcpl_id; /* dataset creation property list ID */
- h5tools_str_t buffer; /* string into which to render */
- hsize_t curr_pos = 0; /* total data element position */
+ hid_t type, space;
+ unsigned attr_crt_order_flags;
+ hid_t dcpl_id; /* dataset creation property list ID */
+ h5tools_str_t buffer; /* string into which to render */
+ hsize_t curr_pos = 0; /* total data element position */
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
if ((dcpl_id = H5Dget_create_plist(did)) < 0) {
error_msg("error in getting creation property list ID\n");
@@ -939,19 +957,19 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
+ /* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datasetbegin, name,
- h5tools_dump_header_format->datasetblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_dump_comment(rawoutstream, outputformat, &ctx, did);
dump_indent += COL;
ctx.indent_level++;
- type = H5Dget_type(did);
+ type = H5Dget_type(did);
h5dump_type_table = type_table;
h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type);
h5dump_type_table = NULL;
@@ -960,74 +978,74 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
H5Sclose(space);
- if(dump_opts.display_oid) {
+ if (dump_opts.display_oid) {
h5tools_dump_oid(rawoutstream, outputformat, &ctx, did);
}
- if(dump_opts.display_dcpl) {
+ if (dump_opts.display_dcpl) {
h5dump_type_table = type_table;
h5tools_dump_dcpl(rawoutstream, outputformat, &ctx, dcpl_id, type, did);
h5dump_type_table = NULL;
}
H5Pclose(dcpl_id);
- ctx.sset = sset;
+ ctx.sset = sset;
ctx.display_index = dump_opts.display_ai;
- ctx.display_char = dump_opts.display_char;
- if(dump_opts.display_data) {
- unsigned data_loop = 1;
- unsigned u;
+ ctx.display_char = dump_opts.display_char;
+ if (dump_opts.display_data) {
+ unsigned data_loop = 1;
+ unsigned u;
- if(dump_opts.display_packed_bits)
+ if (dump_opts.display_packed_bits)
data_loop = packed_bits_num;
- for(u = 0; u < data_loop; u++) {
- if(dump_opts.display_packed_bits) {
+ for (u = 0; u < data_loop; u++) {
+ if (dump_opts.display_packed_bits) {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
/* Render the element */
h5tools_str_reset(&buffer);
- packed_data_mask = packed_mask[u];
+ packed_data_mask = packed_mask[u];
packed_data_offset = packed_offset[u];
packed_data_length = packed_length[u];
h5tools_print_packed_bits(&buffer, type);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
- switch(H5Tget_class(type)) {
- case H5T_TIME:
- ctx.indent_level++;
+ switch (H5Tget_class(type)) {
+ case H5T_TIME:
+ ctx.indent_level++;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "DATA{ not yet implemented.}");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "DATA{ not yet implemented.}");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
- break;
+ ctx.indent_level--;
+ break;
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY: {
h5tools_dump_data(rawoutstream, outputformat, &ctx, did, TRUE);
- }
- break;
+ } break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- default:
- error_msg("invalid H5TCLASS type\n");
- break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
+ error_msg("invalid H5TCLASS type\n");
+ break;
} /* end switch */
- } /* for(u=0; u<data_loop; u++) */
+ } /* for(u=0; u<data_loop; u++) */
}
H5Tclose(type);
@@ -1042,14 +1060,15 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
- if(HDstrlen(h5tools_dump_header_format->datasetend))
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->datasetend))
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -1065,8 +1084,8 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
void
dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
int print_dataset = FALSE;
@@ -1074,32 +1093,31 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
- ctx.sset = sset;
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+ ctx.sset = sset;
ctx.display_index = display_index;
- ctx.display_char = dump_opts.display_char;
+ ctx.display_char = dump_opts.display_char;
- if(obj_data == DATASET_DATA)
+ if (obj_data == DATASET_DATA)
print_dataset = TRUE;
h5tools_dump_data(rawoutstream, outputformat, &ctx, obj_id, print_dataset);
}
-
/*-------------------------------------------------------------------------
* Function: dump_fcpl
*
@@ -1111,125 +1129,126 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
void
dump_fcpl(hid_t fid)
{
- hid_t fcpl; /* file creation property list ID */
- hsize_t userblock; /* userblock size retrieved from FCPL */
- size_t off_size; /* size of offsets in the file */
- size_t len_size; /* size of lengths in the file */
- H5F_fspace_strategy_t fs_strategy; /* file space strategy */
- hbool_t fs_persist; /* Persisting free-space or not */
- hsize_t fs_threshold; /* free-space section threshold */
- hsize_t fsp_size; /* file space page size */
- H5F_info2_t finfo; /* file information */
+ hid_t fcpl; /* file creation property list ID */
+ hsize_t userblock; /* userblock size retrieved from FCPL */
+ size_t off_size; /* size of offsets in the file */
+ size_t len_size; /* size of lengths in the file */
+ H5F_fspace_strategy_t fs_strategy; /* file space strategy */
+ hbool_t fs_persist; /* Persisting free-space or not */
+ hsize_t fs_threshold; /* free-space section threshold */
+ hsize_t fsp_size; /* file space page size */
+ H5F_info2_t finfo; /* file information */
#ifdef SHOW_FILE_DRIVER
- hid_t fapl; /* file access property list ID */
- hid_t fdriver; /* file driver */
- char dname[32]; /* buffer to store driver name */
+ hid_t fapl; /* file access property list ID */
+ hid_t fdriver; /* file driver */
+ char dname[32]; /* buffer to store driver name */
#endif
unsigned sym_lk; /* symbol table B-tree leaf 'K' value */
unsigned sym_ik; /* symbol table B-tree internal 'K' value */
unsigned istore_ik; /* indexed storage B-tree internal 'K' value */
- fcpl=H5Fget_create_plist(fid);
+ fcpl = H5Fget_create_plist(fid);
H5Fget_info2(fid, &finfo);
- H5Pget_userblock(fcpl,&userblock);
- H5Pget_sizes(fcpl,&off_size,&len_size);
- H5Pget_sym_k(fcpl,&sym_ik,&sym_lk);
- H5Pget_istore_k(fcpl,&istore_ik);
+ H5Pget_userblock(fcpl, &userblock);
+ H5Pget_sizes(fcpl, &off_size, &len_size);
+ H5Pget_sym_k(fcpl, &sym_ik, &sym_lk);
+ H5Pget_istore_k(fcpl, &istore_ik);
H5Pget_file_space_strategy(fcpl, &fs_strategy, &fs_persist, &fs_threshold);
H5Pget_file_space_page_size(fcpl, &fsp_size);
H5Pclose(fcpl);
#ifdef SHOW_FILE_DRIVER
- fapl=h5_fileaccess();
- fdriver=H5Pget_driver(fapl);
+ fapl = h5_fileaccess();
+ fdriver = H5Pget_driver(fapl);
H5Pclose(fapl);
#endif
- /*-------------------------------------------------------------------------
- * SUPER_BLOCK
- *-------------------------------------------------------------------------
- */
- PRINTSTREAM(rawoutstream, "\n%s %s\n",SUPER_BLOCK, BEGIN);
+ /*-------------------------------------------------------------------------
+ * SUPER_BLOCK
+ *-------------------------------------------------------------------------
+ */
+ PRINTSTREAM(rawoutstream, "\n%s %s\n", SUPER_BLOCK, BEGIN);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "SUPERBLOCK_VERSION", finfo.super.version);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","FREELIST_VERSION", finfo.free.version);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "FREELIST_VERSION", finfo.free.version);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */
+ PRINTSTREAM(rawoutstream, "%s %u\n", "SYMBOLTABLE_VERSION",
+ 0); /* Retain this for backward compatibility, for now (QAK) */
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "OBJECTHEADER_VERSION", finfo.sohm.version);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream,"%s %zu\n","OFFSET_SIZE", off_size);
+ PRINTSTREAM(rawoutstream, "%s %zu\n", "OFFSET_SIZE", off_size);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream,"%s %zu\n","LENGTH_SIZE", len_size);
+ PRINTSTREAM(rawoutstream, "%s %zu\n", "LENGTH_SIZE", len_size);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "BTREE_RANK", sym_ik);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %d\n","BTREE_LEAF", sym_lk);
+ PRINTSTREAM(rawoutstream, "%s %d\n", "BTREE_LEAF", sym_lk);
#ifdef SHOW_FILE_DRIVER
- if(H5FD_CORE==fdriver)
- HDstrcpy(dname,"H5FD_CORE");
+ if (H5FD_CORE == fdriver)
+ HDstrcpy(dname, "H5FD_CORE");
#ifdef H5_HAVE_DIRECT
- else if(H5FD_DIRECT==fdriver)
- HDstrcpy(dname,"H5FD_DIRECT");
+ else if (H5FD_DIRECT == fdriver)
+ HDstrcpy(dname, "H5FD_DIRECT");
#endif
- else if(H5FD_FAMILY==fdriver)
- HDstrcpy(dname,"H5FD_FAMILY");
- else if(H5FD_LOG==fdriver)
- HDstrcpy(dname,"H5FD_LOG");
- else if(H5FD_MPIO==fdriver)
- HDstrcpy(dname,"H5FD_MPIO");
- else if(H5FD_MULTI==fdriver)
- HDstrcpy(dname,"H5FD_MULTI");
- else if(H5FD_SEC2==fdriver)
- HDstrcpy(dname,"H5FD_SEC2");
- else if(H5FD_STDIO==fdriver)
- HDstrcpy(dname,"H5FD_STDIO");
+ else if (H5FD_FAMILY == fdriver)
+ HDstrcpy(dname, "H5FD_FAMILY");
+ else if (H5FD_LOG == fdriver)
+ HDstrcpy(dname, "H5FD_LOG");
+ else if (H5FD_MPIO == fdriver)
+ HDstrcpy(dname, "H5FD_MPIO");
+ else if (H5FD_MULTI == fdriver)
+ HDstrcpy(dname, "H5FD_MULTI");
+ else if (H5FD_SEC2 == fdriver)
+ HDstrcpy(dname, "H5FD_SEC2");
+ else if (H5FD_STDIO == fdriver)
+ HDstrcpy(dname, "H5FD_STDIO");
else
- HDstrcpy(dname,"Unknown driver");
+ HDstrcpy(dname, "Unknown driver");
- /* Take out this because the driver used can be different from the
- * standard output. */
- /*indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/
+ /* Take out this because the driver used can be different from the
+ * standard output. */
+ /*indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/
#endif
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","ISTORE_K", istore_ik);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "ISTORE_K", istore_ik);
indentation(dump_indent + COL);
- if(fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR) {
+ if (fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_FSM_AGGR");
}
- else if(fs_strategy == H5F_FSPACE_STRATEGY_PAGE) {
+ else if (fs_strategy == H5F_FSPACE_STRATEGY_PAGE) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_PAGE");
}
- else if(fs_strategy == H5F_FSPACE_STRATEGY_AGGR) {
+ else if (fs_strategy == H5F_FSPACE_STRATEGY_AGGR) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_AGGR");
}
- else if(fs_strategy == H5F_FSPACE_STRATEGY_NONE) {
+ else if (fs_strategy == H5F_FSPACE_STRATEGY_NONE) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_NONE");
}
else
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy");
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %s\n","FREE_SPACE_PERSIST", fs_persist ? "TRUE" : "FALSE");
+ PRINTSTREAM(rawoutstream, "%s %s\n", "FREE_SPACE_PERSIST", fs_persist ? "TRUE" : "FALSE");
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %Hu\n","FREE_SPACE_SECTION_THRESHOLD", fs_threshold);
+ PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n", "FREE_SPACE_SECTION_THRESHOLD", fs_threshold);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %Hu\n","FILE_SPACE_PAGE_SIZE", fsp_size);
+ PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n", "FILE_SPACE_PAGE_SIZE", fsp_size);
/*-------------------------------------------------------------------------
- * USER_BLOCK
- *-------------------------------------------------------------------------
- */
+ * USER_BLOCK
+ *-------------------------------------------------------------------------
+ */
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "USER_BLOCK %s\n",BEGIN);
+ PRINTSTREAM(rawoutstream, "USER_BLOCK %s\n", BEGIN);
indentation(dump_indent + COL + COL);
- PRINTSTREAM(rawoutstream,"%s %Hu\n","USERBLOCK_SIZE", userblock);
+ PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n", "USERBLOCK_SIZE", userblock);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s\n",END);
+ PRINTSTREAM(rawoutstream, "%s\n", END);
- PRINTSTREAM(rawoutstream, "%s",END);
+ PRINTSTREAM(rawoutstream, "%s", END);
}
/*-------------------------------------------------------------------------
@@ -1243,7 +1262,7 @@ dump_fcpl(hid_t fid)
void
dump_fcontents(hid_t fid)
{
- PRINTSTREAM(rawoutstream, "%s %s\n",FILE_CONTENTS, BEGIN);
+ PRINTSTREAM(rawoutstream, "%s %s\n", FILE_CONTENTS, BEGIN);
/* special case of unamed types in root group */
if (unamedtype) {
@@ -1251,59 +1270,60 @@ dump_fcontents(hid_t fid)
for (u = 0; u < type_table->nobjs; u++) {
if (!type_table->objs[u].recorded)
- PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno);
+ PRINTSTREAM(rawoutstream, " %-10s /#" H5_PRINTF_HADDR_FMT "\n", "datatype",
+ type_table->objs[u].objno);
}
}
/* print objects in the files */
h5trav_print(fid);
- PRINTSTREAM(rawoutstream, " %s\n",END);
+ PRINTSTREAM(rawoutstream, " %s\n", END);
}
static herr_t
attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
{
- herr_t ret = SUCCEED;
- int j;
- char *obj_op_name;
- char *obj_name;
- trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data;
- const char *buf = attr_data->path;
- const char *op_name = attr_data->op_name;
+ herr_t ret = SUCCEED;
+ int j;
+ char * obj_op_name;
+ char * obj_name;
+ trav_attr_udata_t *attr_data = (trav_attr_udata_t *)_op_data;
+ const char * buf = attr_data->path;
+ const char * op_name = attr_data->op_name;
j = (int)HDstrlen(op_name) - 1;
/* find the last / */
- while(j >= 0) {
- if(op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\')))
+ while (j >= 0) {
+ if (op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\')))
break;
j--;
}
obj_op_name = h5tools_str_replace(op_name + j + 1, "\\/", "/");
- if(obj_op_name == NULL) {
+ if (obj_op_name == NULL) {
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- if(HDstrcmp(attr_name, obj_op_name)==0) {
+ if (HDstrcmp(attr_name, obj_op_name) == 0) {
size_t u, v, w;
/* object name */
- u = HDstrlen(buf);
- v = HDstrlen(op_name);
- w = u + 1 + v + 1 + 2;
+ u = HDstrlen(buf);
+ v = HDstrlen(op_name);
+ w = u + 1 + v + 1 + 2;
obj_name = (char *)HDmalloc(w);
- if(obj_name == NULL) {
+ if (obj_name == NULL) {
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
HDmemset(obj_name, '\0', w);
- if(op_name[0] != '/') {
+ if (op_name[0] != '/') {
HDstrncat(obj_name, buf, u + 1);
- if(buf[u - 1] != '/')
+ if (buf[u - 1] != '/')
HDstrncat(obj_name, "/", (size_t)2);
}
HDstrncat(obj_name, op_name, v + 1);
@@ -1320,16 +1340,17 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a
static herr_t
obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
{
- trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
- const char *op_name = handle_data->op_name;
- trav_attr_udata_t attr_data;
+ trav_handle_udata_t *handle_data = (trav_handle_udata_t *)_op_data;
+ const char * op_name = handle_data->op_name;
+ trav_attr_udata_t attr_data;
- attr_data.path = path;
+ attr_data.path = path;
attr_data.op_name = op_name;
- H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search, (void*)&attr_data, H5P_DEFAULT);
+ H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search,
+ (void *)&attr_data, H5P_DEFAULT);
- if(HDstrcmp(path, op_name) == 0) {
- switch(oi->type) {
+ if (HDstrcmp(path, op_name) == 0) {
+ switch (oi->type) {
case H5O_TYPE_GROUP:
handle_groups(handle_data->fid, path, NULL, 0, NULL);
break;
@@ -1356,19 +1377,19 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al
static herr_t
lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
{
- size_t search_len;
- size_t k;
- char *search_name;
- trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
- const char *op_name = handle_data->op_name;
+ size_t search_len;
+ size_t k;
+ char * search_name;
+ trav_handle_udata_t *handle_data = (trav_handle_udata_t *)_op_data;
+ const char * op_name = handle_data->op_name;
search_len = HDstrlen(op_name);
- if(search_len > 0 && op_name[0] != '/')
+ if (search_len > 0 && op_name[0] != '/')
k = 2;
else
k = 1;
search_name = (char *)HDmalloc(search_len + k);
- if(search_name == NULL) {
+ if (search_name == NULL) {
error_msg("creating temporary link\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1381,20 +1402,20 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
HDstrncpy(search_name, op_name, search_len + 1);
search_name[search_len + k - 1] = '\0';
- if(HDstrcmp(path, search_name) == 0) {
- switch(li->type) {
- case H5L_TYPE_SOFT:
- case H5L_TYPE_EXTERNAL:
- handle_links(handle_data->fid, op_name, NULL, 0, NULL);
- break;
+ if (HDstrcmp(path, search_name) == 0) {
+ switch (li->type) {
+ case H5L_TYPE_SOFT:
+ case H5L_TYPE_EXTERNAL:
+ handle_links(handle_data->fid, op_name, NULL, 0, NULL);
+ break;
- case H5L_TYPE_HARD:
- case H5L_TYPE_MAX:
- case H5L_TYPE_ERROR:
- default:
- error_msg("unknown link type value\n");
- h5tools_setstatus(EXIT_FAILURE);
- break;
+ case H5L_TYPE_HARD:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_ERROR:
+ default:
+ error_msg("unknown link type value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ break;
} /* end switch() */
}
HDfree(search_name);
@@ -1411,19 +1432,20 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
*-------------------------------------------------------------------------
*/
void
-handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name)
{
- hid_t gid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
error_msg("unable to open root group\n");
h5tools_setstatus(EXIT_FAILURE);
}
else {
- hid_t gcpl_id;
- unsigned crt_order_flags;
- unsigned attr_crt_order_flags;
- trav_handle_udata_t handle_udata; /* User data for traversal */
+ hid_t gcpl_id;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ trav_handle_udata_t handle_udata; /* User data for traversal */
if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -1437,19 +1459,19 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
}
/* query the group creation properties */
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
error_msg("error in getting group creation properties\n");
h5tools_setstatus(EXIT_FAILURE);
}
- if(H5Pclose(gcpl_id) < 0) {
+ if (H5Pclose(gcpl_id) < 0) {
error_msg("error in closing group creation property list ID\n");
h5tools_setstatus(EXIT_FAILURE);
}
- handle_udata.fid = fid;
+ handle_udata.fid = fid;
handle_udata.op_name = path_name;
- if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata, H5O_INFO_BASIC) < 0) {
+ if (h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata, H5O_INFO_BASIC) < 0) {
error_msg("error traversing information\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1465,33 +1487,34 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
*-------------------------------------------------------------------------
*/
void
-handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name)
{
- hid_t oid = H5I_INVALID_HID;
- hid_t attr_id = H5I_INVALID_HID;
- char *obj_name = NULL;
- char *attr_name = NULL;
- int j;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ hid_t oid = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
+ char * obj_name = NULL;
+ char * attr_name = NULL;
+ int j;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
- j = (int)HDstrlen(attr) - 1;
+ j = (int)HDstrlen(attr) - 1;
obj_name = (char *)HDmalloc((size_t)j + 2);
- if(obj_name == NULL)
+ if (obj_name == NULL)
goto error;
/* find the last / */
- while(j >= 0) {
- if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\')))
+ while (j >= 0) {
+ if (attr[j] == '/' && (j == 0 || (j > 0 && attr[j - 1] != '\\')))
break;
j--;
}
/* object name */
- if(j == -1)
+ if (j == -1)
HDstrcpy(obj_name, "/");
else {
HDstrncpy(obj_name, attr, (size_t)j + 1);
@@ -1500,32 +1523,32 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
dump_indent += COL;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
ctx.display_index = dump_opts.display_ai;
- ctx.display_char = dump_opts.display_char;
+ ctx.display_char = dump_opts.display_char;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/");
/* handle error case: cannot open the object with the attribute */
- if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) {
+ if ((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) {
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1533,45 +1556,46 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->attributebegin, attr,
- h5tools_dump_header_format->attributeblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->attributebegin, attr,
+ h5tools_dump_header_format->attributeblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
error_msg("unable to open object \"%s\"\n", obj_name);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->attributeblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->attributeblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeblockend);
- if(HDstrlen(h5tools_dump_header_format->attributeend))
+ if (HDstrlen(h5tools_dump_header_format->attributeend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->attributeend))
+ if (HDstrlen(h5tools_dump_header_format->attributeend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
goto error;
} /* end if */
- attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
- oid_output = dump_opts.display_oid;
- data_output = dump_opts.display_data;
+ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
+ oid_output = dump_opts.display_oid;
+ data_output = dump_opts.display_data;
attr_data_output = dump_opts.display_attr_data;
h5dump_type_table = type_table;
h5tools_dump_attribute(rawoutstream, outputformat, &ctx, attr_name, attr_id);
h5dump_type_table = NULL;
- if(attr_id < 0) {
+ if (attr_id < 0) {
goto error;
}
/* Close object */
- if(H5Oclose(oid) < 0) {
+ if (H5Oclose(oid) < 0) {
goto error;
} /* end if */
@@ -1582,16 +1606,18 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
error:
h5tools_setstatus(EXIT_FAILURE);
- if(obj_name)
+ if (obj_name)
HDfree(obj_name);
if (attr_name)
HDfree(attr_name);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Oclose(oid);
H5Aclose(attr_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
dump_indent -= COL;
}
@@ -1608,69 +1634,69 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
{
H5O_info_t oinfo;
hid_t dsetid;
- hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
- struct subset_t *sset = (struct subset_t *)data;
- const char *real_name = display_name ? display_name : dset;
+ hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
+ struct subset_t *sset = (struct subset_t *)data;
+ const char * real_name = display_name ? display_name : dset;
- if(dump_opts.display_data) {
+ if (dump_opts.display_data) {
if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
error_msg("error in creating default access property list ID\n");
}
if (dump_opts.display_vds_first) {
- if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
error_msg("error in setting access property list ID, virtual_view\n");
}
if (dump_opts.vds_gap_size > 0) {
- if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
+ if (H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
error_msg("error in setting access property list ID, virtual_printf_gap\n");
}
}
- if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) {
+ if ((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) {
if (pe)
handle_links(fid, dset, data, pe, display_name);
return;
} /* end if */
- if(sset) {
+ if (sset) {
unsigned int i;
unsigned int ndims;
- hid_t sid = H5Dget_space(dsetid);
- int ndims_res = H5Sget_simple_extent_ndims(sid);
+ hid_t sid = H5Dget_space(dsetid);
+ int ndims_res = H5Sget_simple_extent_ndims(sid);
H5Sclose(sid);
- if(ndims_res < 0) {
+ if (ndims_res < 0) {
error_msg("H5Sget_simple_extent_ndims failed\n");
h5tools_setstatus(EXIT_FAILURE);
return;
}
ndims = (unsigned)ndims_res;
- if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) {
+ if (!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) {
/* they didn't specify a ``stride'' or ``block''. default to 1 in all
* dimensions */
- if(!sset->start.data) {
+ if (!sset->start.data) {
/* default to (0, 0, ...) for the start coord */
sset->start.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->start.len = ndims;
+ sset->start.len = ndims;
}
- if(!sset->stride.data) {
+ if (!sset->stride.data) {
sset->stride.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->stride.len = ndims;
+ sset->stride.len = ndims;
for (i = 0; i < ndims; i++)
sset->stride.data[i] = 1;
}
- if(!sset->count.data) {
+ if (!sset->count.data) {
sset->count.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->count.len = ndims;
+ sset->count.len = ndims;
for (i = 0; i < ndims; i++)
sset->count.data[i] = 1;
}
- if(!sset->block.data) {
+ if (!sset->block.data) {
sset->block.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->block.len = ndims;
+ sset->block.len = ndims;
for (i = 0; i < ndims; i++)
sset->block.data[i] = 1;
}
@@ -1680,22 +1706,22 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
* check for dimension overflow
*-------------------------------------------------------------------------
*/
- if(sset->start.len > ndims) {
+ if (sset->start.len > ndims) {
error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
}
- if(sset->stride.len > ndims) {
+ if (sset->stride.len > ndims) {
error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
}
- if(sset->count.len > ndims) {
+ if (sset->count.len > ndims) {
error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
}
- if(sset->block.len > ndims) {
+ if (sset->block.len > ndims) {
error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
@@ -1705,29 +1731,29 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
* check for block overlap
*-------------------------------------------------------------------------
*/
- for(i = 0; i < ndims; i++) {
- if(sset->count.data[i] > 1) {
- if(sset->stride.data[i] < sset->block.data[i]) {
+ for (i = 0; i < ndims; i++) {
+ if (sset->count.data[i] > 1) {
+ if (sset->stride.data[i] < sset->block.data[i]) {
error_msg("wrong subset selection; blocks overlap\n");
h5tools_setstatus(EXIT_FAILURE);
return;
} /* end if */
- } /* end if */
- } /* end for */
- } /* end if */
-
+ } /* end if */
+ } /* end for */
+ } /* end if */
H5Oget_info2(dsetid, &oinfo, H5O_INFO_BASIC);
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
found_obj = search_obj(dset_table, oinfo.addr);
- if(found_obj) {
+ if (found_obj) {
if (found_obj->displayed) {
PRINTVALSTREAM(rawoutstream, "\n");
indentation(dump_indent);
- begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin);
+ begin_obj(h5tools_dump_header_format->datasetbegin, real_name,
+ h5tools_dump_header_format->datasetblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(dump_indent + COL);
PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname);
@@ -1751,7 +1777,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
}
if (dapl_id != H5P_DEFAULT)
H5Pclose(dapl_id);
- if(H5Dclose(dsetid) < 0)
+ if (H5Dclose(dsetid) < 0)
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1767,12 +1793,13 @@ void
handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, const char *display_name)
{
hid_t gid;
- const char *real_name = display_name ? display_name : group;
+ const char *real_name = display_name ? display_name : group;
- if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) {
+ if ((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) {
if (pe) {
PRINTVALSTREAM(rawoutstream, "\n");
- begin_obj(h5tools_dump_header_format->groupbegin, real_name, h5tools_dump_header_format->groupblockbegin);
+ begin_obj(h5tools_dump_header_format->groupbegin, real_name,
+ h5tools_dump_header_format->groupblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(COL);
error_msg("unable to open group \"%s\"\n", real_name);
@@ -1783,9 +1810,9 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
else {
size_t new_len = HDstrlen(group) + 1;
- if(prefix_len <= new_len) {
+ if (prefix_len <= new_len) {
prefix_len = new_len;
- prefix = (char *)HDrealloc(prefix, prefix_len);
+ prefix = (char *)HDrealloc(prefix, prefix_len);
} /* end if */
HDstrcpy(prefix, group);
@@ -1794,7 +1821,7 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
dump_group(gid, real_name);
dump_indent -= COL;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
h5tools_setstatus(EXIT_FAILURE);
} /* end else */
} /* end handle_groups() */
@@ -1808,15 +1835,16 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
*-------------------------------------------------------------------------
*/
void
-handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name)
{
H5L_info_t linfo;
- if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
+ if (H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
error_msg("unable to get link info from \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
- else if(linfo.type == H5L_TYPE_HARD) {
+ else if (linfo.type == H5L_TYPE_HARD) {
error_msg("\"%s\" is a hard link\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1824,56 +1852,60 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
char *buf = (char *)HDmalloc(linfo.u.val_size);
PRINTVALSTREAM(rawoutstream, "\n");
- switch(linfo.type) {
- case H5L_TYPE_SOFT: /* Soft link */
- begin_obj(h5tools_dump_header_format->softlinkbegin, links, h5tools_dump_header_format->softlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- indentation(COL);
- if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
- PRINTSTREAM(rawoutstream, "LINKTARGET \"%s\"\n", buf);
- }
- else {
- error_msg("h5dump error: unable to get link value for \"%s\"\n", links);
- h5tools_setstatus(EXIT_FAILURE);
- }
- end_obj(h5tools_dump_header_format->softlinkend, h5tools_dump_header_format->softlinkblockend);
- break;
+ switch (linfo.type) {
+ case H5L_TYPE_SOFT: /* Soft link */
+ begin_obj(h5tools_dump_header_format->softlinkbegin, links,
+ h5tools_dump_header_format->softlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ if (H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
+ PRINTSTREAM(rawoutstream, "LINKTARGET \"%s\"\n", buf);
+ }
+ else {
+ error_msg("h5dump error: unable to get link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ end_obj(h5tools_dump_header_format->softlinkend,
+ h5tools_dump_header_format->softlinkblockend);
+ break;
- case H5L_TYPE_EXTERNAL:
- begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
- const char *elink_file;
- const char *elink_path;
-
- if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) {
- indentation(COL);
- PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file);
- indentation(COL);
- PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path);
+ case H5L_TYPE_EXTERNAL:
+ begin_obj(h5tools_dump_header_format->extlinkbegin, links,
+ h5tools_dump_header_format->extlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ if (H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
+ const char *elink_file;
+ const char *elink_path;
+
+ if (H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path) >= 0) {
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file);
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path);
+ }
+ else {
+ error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
}
else {
- error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links);
+ error_msg("h5dump error: unable to get external link value for \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
- }
- else {
- error_msg("h5dump error: unable to get external link value for \"%s\"\n", links);
- h5tools_setstatus(EXIT_FAILURE);
- }
- end_obj(h5tools_dump_header_format->extlinkend, h5tools_dump_header_format->extlinkblockend);
- break;
+ end_obj(h5tools_dump_header_format->extlinkend, h5tools_dump_header_format->extlinkblockend);
+ break;
- case H5L_TYPE_ERROR:
- case H5L_TYPE_MAX:
- case H5L_TYPE_HARD:
- default:
- begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- indentation(COL);
- PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type);
- end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend);
- break;
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default:
+ begin_obj(h5tools_dump_header_format->udlinkbegin, links,
+ h5tools_dump_header_format->udlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type);
+ end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend);
+ break;
} /* end switch */
HDfree(buf);
} /* end else */
@@ -1888,44 +1920,46 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
*-------------------------------------------------------------------------
*/
void
-handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe, const char *display_name)
+handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, int pe, const char *display_name)
{
hid_t type_id;
- const char *real_name = display_name ? display_name : type;
+ const char *real_name = display_name ? display_name : type;
- if((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) {
+ if ((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) {
/* check if type is unamed datatype */
unsigned idx = 0;
- while(idx < type_table->nobjs ) {
+ while (idx < type_table->nobjs) {
char name[128];
- if(!type_table->objs[idx].recorded) {
+ if (!type_table->objs[idx].recorded) {
/* unamed datatype */
- HDsprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
+ HDsprintf(name, "/#" H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
- if(!HDstrcmp(name, real_name))
+ if (!HDstrcmp(name, real_name))
break;
} /* end if */
idx++;
} /* end while */
- if(idx == type_table->nobjs) {
+ if (idx == type_table->nobjs) {
if (pe) {
/* unknown type */
PRINTVALSTREAM(rawoutstream, "\n");
- begin_obj(h5tools_dump_header_format->datatypebegin, real_name, h5tools_dump_header_format->datatypeblockbegin);
+ begin_obj(h5tools_dump_header_format->datatypebegin, real_name,
+ h5tools_dump_header_format->datatypeblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(COL);
error_msg("unable to open datatype \"%s\"\n", real_name);
- end_obj(h5tools_dump_header_format->datatypeend, h5tools_dump_header_format->datatypeblockend);
+ end_obj(h5tools_dump_header_format->datatypeend,
+ h5tools_dump_header_format->datatypeblockend);
h5tools_setstatus(EXIT_FAILURE);
}
}
else {
hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT);
- type_id = H5Dget_type(dsetid);
+ type_id = H5Dget_type(dsetid);
dump_indent += COL;
dump_named_datatype(type_id, real_name);
@@ -1940,12 +1974,11 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
dump_named_datatype(type_id, real_name);
dump_indent -= COL;
- if(H5Tclose(type_id) < 0)
+ if (H5Tclose(type_id) < 0)
h5tools_setstatus(EXIT_FAILURE);
}
}
-
/*-------------------------------------------------------------------------
* Function: dump_extlink
*
@@ -1959,13 +1992,13 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
static int
dump_extlink(hid_t group, const char *linkname, const char *objname)
{
- hid_t oid;
- H5O_info_t oi;
- table_t *old_group_table = group_table;
- table_t *old_dset_table = dset_table;
- table_t *old_type_table = type_table;
- hbool_t old_hit_elink;
- ssize_t idx;
+ hid_t oid;
+ H5O_info_t oi;
+ table_t * old_group_table = group_table;
+ table_t * old_dset_table = dset_table;
+ table_t * old_type_table = type_table;
+ hbool_t old_hit_elink;
+ ssize_t idx;
/* Open target object */
if ((oid = H5Oopen(group, linkname, H5P_DEFAULT)) < 0)
@@ -1990,12 +2023,12 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
if (idx) {
/* Update table pointers */
group_table = table_list.tables[idx].group_table;
- dset_table = table_list.tables[idx].dset_table;
- type_table = table_list.tables[idx].type_table;
+ dset_table = table_list.tables[idx].dset_table;
+ type_table = table_list.tables[idx].type_table;
/* We will now traverse the external link, set this global to indicate this */
old_hit_elink = hit_elink;
- hit_elink = TRUE;
+ hit_elink = TRUE;
/* add some indentation to distinguish that these objects are external */
dump_indent += COL;
@@ -2024,8 +2057,8 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
/* Reset table pointers */
group_table = old_group_table;
- dset_table = old_dset_table;
- type_table = old_type_table;
+ dset_table = old_dset_table;
+ type_table = old_type_table;
/* Reset hit_elink */
hit_elink = old_hit_elink;
@@ -2039,4 +2072,3 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
fail:
return FAIL;
}
-
diff --git a/tools/src/h5dump/h5dump_ddl.h b/tools/src/h5dump/h5dump_ddl.h
index ae01086..8487270 100644
--- a/tools/src/h5dump/h5dump_ddl.h
+++ b/tools/src/h5dump/h5dump_ddl.h
@@ -6,13 +6,13 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5DUMP_DDL_H__
-#define H5DUMP_DDL_H__
+#ifndef H5DUMP_DDL_H
+#define H5DUMP_DDL_H
#ifdef __cplusplus
extern "C" {
@@ -20,17 +20,17 @@ extern "C" {
/* The dump functions of the dump_function_table */
/* standard format: no change */
-void dump_group(hid_t, const char *);
-void dump_named_datatype(hid_t, const char *);
-void dump_dataset(hid_t, const char *, struct subset_t *);
-void dump_dataspace(hid_t space);
-void dump_datatype(hid_t type);
-void dump_data(hid_t, int, struct subset_t *, int);
-void dump_fcpl(hid_t fid);
-void dump_fcontents(hid_t fid);
+void dump_group(hid_t, const char *);
+void dump_named_datatype(hid_t, const char *);
+void dump_dataset(hid_t, const char *, struct subset_t *);
+void dump_dataspace(hid_t space);
+void dump_datatype(hid_t type);
+void dump_data(hid_t, int, struct subset_t *, int);
+void dump_fcpl(hid_t fid);
+void dump_fcontents(hid_t fid);
/* callback function used by H5Aiterate2() */
-herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data);
+herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data);
/* other iteration functions */
void link_iteration(hid_t gid, unsigned crt_order_flags);
@@ -38,13 +38,16 @@ void attr_iteration(hid_t gid, unsigned attr_crt_order_flags);
void handle_paths(hid_t fid, const char *path_name, void *data, int pe, const char *display_name);
void handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name);
-void handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name);
+void handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name);
void handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, const char *display_name);
-void handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name);
-void handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe, const char *display_name);
+void handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name);
+void handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, int pe,
+ const char *display_name);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_DDL_H__ */
+#endif /* H5DUMP_DDL_H */
diff --git a/tools/src/h5dump/h5dump_defines.h b/tools/src/h5dump/h5dump_defines.h
index 7a9d4c0..21a31dd 100644
--- a/tools/src/h5dump/h5dump_defines.h
+++ b/tools/src/h5dump/h5dump_defines.h
@@ -6,49 +6,48 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5DUMP_DEFINES_H__
-#define H5DUMP_DEFINES_H__
+#ifndef H5DUMP_DEFINES_H
+#define H5DUMP_DEFINES_H
-#define H5DUMP_MAX_RANK H5S_MAX_RANK
+#define H5DUMP_MAX_RANK H5S_MAX_RANK
-#define ATTRIBUTE_DATA 0
-#define DATASET_DATA 1
-#define ENUM_DATA 2
-#define COL 3
+#define ATTRIBUTE_DATA 0
+#define DATASET_DATA 1
+#define ENUM_DATA 2
+#define COL 3
/* Macros for displaying objects */
-#define begin_obj(obj,name,begin) \
- do { \
- if ((name)) { \
- PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \
- } \
- else { \
- PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \
- } \
- } while(0);
-
-#define end_obj(obj,end) \
- do { \
- if(HDstrlen(end)) { \
- PRINTSTREAM(rawoutstream, "%s", end); \
- if(HDstrlen(obj)) \
- PRINTVALSTREAM(rawoutstream, " "); \
- } \
- if(HDstrlen(obj)) \
- PRINTSTREAM(rawoutstream, "%s", obj); \
- } while(0);
+#define begin_obj(obj, name, begin) \
+ do { \
+ if ((name)) { \
+ PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \
+ } \
+ else { \
+ PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \
+ } \
+ } while (0);
+#define end_obj(obj, end) \
+ do { \
+ if (HDstrlen(end)) { \
+ PRINTSTREAM(rawoutstream, "%s", end); \
+ if (HDstrlen(obj)) \
+ PRINTVALSTREAM(rawoutstream, " "); \
+ } \
+ if (HDstrlen(obj)) \
+ PRINTSTREAM(rawoutstream, "%s", obj); \
+ } while (0);
/* 3 private values: can't be set, but can be read.
Note: these are defined in H5Zprivate, they are
duplicated here.
*/
-#define H5_SZIP_LSB_OPTION_MASK 8
-#define H5_SZIP_MSB_OPTION_MASK 16
-#define H5_SZIP_RAW_OPTION_MASK 128
+#define H5_SZIP_LSB_OPTION_MASK 8
+#define H5_SZIP_MSB_OPTION_MASK 16
+#define H5_SZIP_RAW_OPTION_MASK 128
-#endif /* !H5DUMP_DEFINES_H__ */
+#endif /* H5DUMP_DEFINES_H */
diff --git a/tools/src/h5dump/h5dump_extern.h b/tools/src/h5dump/h5dump_extern.h
index c615621..308f602 100644
--- a/tools/src/h5dump/h5dump_extern.h
+++ b/tools/src/h5dump/h5dump_extern.h
@@ -6,12 +6,12 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5DUMP_EXTERN_H__
-#define H5DUMP_EXTERN_H__
+#ifndef H5DUMP_EXTERN_H
+#define H5DUMP_EXTERN_H
#include "hdf5.h"
#include "H5private.h"
@@ -26,64 +26,65 @@
**/
/* the table of dump functions */
typedef struct dump_functions_t {
- void (*dump_group_function) (hid_t, const char *);
- void (*dump_named_datatype_function) (hid_t, const char *);
- void (*dump_dataset_function) (hid_t, const char *, struct subset_t *);
- void (*dump_dataspace_function) (hid_t);
- void (*dump_datatype_function) (hid_t);
- herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *);
- void (*dump_data_function) (hid_t, int, struct subset_t *, int);
+ void (*dump_group_function)(hid_t, const char *);
+ void (*dump_named_datatype_function)(hid_t, const char *);
+ void (*dump_dataset_function)(hid_t, const char *, struct subset_t *);
+ void (*dump_dataspace_function)(hid_t);
+ void (*dump_datatype_function)(hid_t);
+ herr_t (*dump_attribute_function)(hid_t, const char *, const H5A_info_t *, void *);
+ void (*dump_data_function)(hid_t, int, struct subset_t *, int);
} dump_functions;
/* List of table structures. There is one table structure for each file */
typedef struct h5dump_table_list_t {
- size_t nalloc;
- size_t nused;
+ size_t nalloc;
+ size_t nused;
struct {
- unsigned long fileno; /* File number that these tables refer to */
- hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
- table_t *group_table; /* Table of groups */
- table_t *dset_table; /* Table of datasets */
- table_t *type_table; /* Table of datatypes */
- } *tables;
+ unsigned long fileno; /* File number that these tables refer to */
+ hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
+ table_t * group_table; /* Table of groups */
+ table_t * dset_table; /* Table of datasets */
+ table_t * type_table; /* Table of datatypes */
+ } * tables;
} h5dump_table_list_t;
-extern h5dump_table_list_t table_list;
-extern table_t *group_table, *dset_table, *type_table;
+extern h5dump_table_list_t table_list;
+extern table_t * group_table, *dset_table, *type_table;
-extern unsigned dump_indent; /* how far in to indent the line */
-extern int unamedtype; /* shared datatype with no name */
-extern hbool_t hit_elink; /* whether we have traversed an external link */
-extern size_t prefix_len;
-extern char *prefix;
-extern const char *fp_format;
+extern unsigned dump_indent; /* how far in to indent the line */
+extern int unamedtype; /* shared datatype with no name */
+extern hbool_t hit_elink; /* whether we have traversed an external link */
+extern size_t prefix_len;
+extern char * prefix;
+extern const char *fp_format;
/* things to display or which are set via command line parameters */
typedef struct {
- int display_all;
- int display_oid;
- int display_data;
- int display_attr_data;
- int display_char; /* print 1-byte numbers as ASCII */
- int usingdasho;
- int display_bb; /* superblock */
- int display_dcpl; /* dcpl */
- int display_fi; /* file index */
- int display_ai; /* array index */
- int display_escape; /* escape non printable characters */
- int display_region; /* print region reference data */
- int disable_compact_subset; /* disable compact form of subset notation */
- int display_packed_bits; /* print 1-8 byte numbers as packed bits */
- int include_attrs; /* Display attributes */
- int display_vds_first; /* vds display to all by default */
- int vds_gap_size; /* vds skip missing files default is none */
+ int display_all;
+ int display_oid;
+ int display_data;
+ int display_attr_data;
+ int display_char; /* print 1-byte numbers as ASCII */
+ int usingdasho;
+ int display_bb; /* superblock */
+ int display_dcpl; /* dcpl */
+ int display_fi; /* file index */
+ int display_ai; /* array index */
+ int display_escape; /* escape non printable characters */
+ int display_region; /* print region reference data */
+ int disable_compact_subset; /* disable compact form of subset notation */
+ int display_packed_bits; /* print 1-8 byte numbers as packed bits */
+ int include_attrs; /* Display attributes */
+ int display_vds_first; /* vds display to all by default */
+ int vds_gap_size; /* vds skip missing files default is none */
} dump_opt_t;
extern dump_opt_t dump_opts;
-#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
-#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */
+#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
+#define PACKED_BITS_SIZE_MAX 8 * sizeof(long long) /* Maximum bits size of integer types of packed-bits */
/* mask list for packed bits */
-extern unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
+extern unsigned long long
+ packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
/* packed bits display parameters */
extern unsigned packed_offset[PACKED_BITS_MAX];
@@ -99,13 +100,13 @@ extern const dump_functions *dump_function_table;
extern "C" {
#endif
-void add_prefix(char **prfx, size_t *prfx_len, const char *name);
-hid_t h5_fileaccess(void);
-ssize_t table_list_add(hid_t oid, unsigned long file_no);
-ssize_t table_list_visited(unsigned long file_no);
+void add_prefix(char **prfx, size_t *prfx_len, const char *name);
+hid_t h5_fileaccess(void);
+ssize_t table_list_add(hid_t oid, unsigned long file_no);
+ssize_t table_list_visited(unsigned long file_no);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_EXTERN_H__ */
+#endif /* H5DUMP_EXTERN_H */
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index f2cca21..61c2ce2 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -20,7 +20,7 @@
#include "h5dump_extern.h"
#include "h5dump_xml.h"
-const char *xmlnsprefix="hdf5:";
+const char *xmlnsprefix = "hdf5:";
/*
* Alternative formating for data dumped to XML
@@ -34,53 +34,54 @@ const char *xmlnsprefix="hdf5:";
*
* This table only affects XML output.
*/
-static h5tool_format_t xml_dataformat = {
- 0, /*raw */
-
- "", /*fmt_raw */
- "%d", /*fmt_int */
- "%u", /*fmt_uint */
- "%hhd", /*fmt_schar */
- "%u", /*fmt_uchar */
- "%d", /*fmt_short */
- "%u", /*fmt_ushort */
- "%ld", /*fmt_long */
- "%lu", /*fmt_ulong */
- NULL, /*fmt_llong */
- NULL, /*fmt_ullong */
- "%g", /*fmt_double */
- "%g", /*fmt_float */
-
- 0, /*ascii */
- 0, /*str_locale */
- 0, /*str_repeat */
-
- "", /*arr_pre */
- "", /*arr_sep */
- "", /*arr_suf */
- 1, /*arr_linebreak */
-
- "", /*cmpd_name */
- "", /*cmpd_sep */
- "", /*cmpd_pre */
- "", /*cmpd_suf */
- "", /*cmpd_end */
- NULL, /*cmpd_listv */
-
- " ", /*vlen_sep */
- " ", /*vlen_pre */
- "", /*vlen_suf */
- "", /*vlen_end */
-
- "%s", /*elmt_fmt */
- "", /*elmt_suf1 */
- " ", /*elmt_suf2 */
-
- "", /*idx_n_fmt */
- "", /*idx_sep */
- "", /*idx_fmt */
-
- 80, /*line_ncols *//*standard default columns */
+static h5tool_format_t xml_dataformat = {
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%hhd", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ "", /*arr_pre */
+ "", /*arr_sep */
+ "", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ "", /*cmpd_sep */
+ "", /*cmpd_pre */
+ "", /*cmpd_suf */
+ "", /*cmpd_end */
+ NULL, /*cmpd_listv */
+
+ " ", /*vlen_sep */
+ " ", /*vlen_pre */
+ "", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ "", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ "", /*idx_n_fmt */
+ "", /*idx_sep */
+ "", /*idx_fmt */
+
+ 80,
+ /*line_ncols */ /*standard default columns */
0, /*line_per_line */
"", /*line_pre */
"%s", /*line_1st */
@@ -90,31 +91,30 @@ static h5tool_format_t xml_dataformat = {
1, /*line_multi_new */
" ", /*line_indent */
- 1, /*skip_first */
+ 1, /*skip_first */
1, /*obj_hidefileno */
- " "H5_PRINTF_HADDR_FMT, /*obj_format */
-
- 1, /*dset_hidefileno */
- "DATASET %s ", /*dset_format */
- "%s", /*dset_blockformat_pre */
- "%s", /*dset_ptformat_pre */
- "%s", /*dset_ptformat */
- 0, /*array indices */
- 0 /*escape non printable characters */
+ " %" PRIuHADDR, /*obj_format */
+
+ 1, /*dset_hidefileno */
+ "DATASET %s ", /*dset_format */
+ "%s", /*dset_blockformat_pre */
+ "%s", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
+ 0, /*array indices */
+ 0 /*escape non printable characters */
};
-
/* internal functions */
-static int xml_name_to_XID(const char *, char *, int , int );
+static int xml_name_to_XID(const char *, char *, int, int);
/* internal functions used by XML option */
-static void xml_print_datatype(hid_t, unsigned);
-static void xml_print_enum(hid_t);
-static int xml_print_refs(hid_t, int);
-static int xml_print_strs(hid_t, int);
-static char *xml_escape_the_string(const char *, int);
-static char *xml_escape_the_name(const char *);
+static void xml_print_datatype(hid_t, unsigned);
+static void xml_print_enum(hid_t);
+static int xml_print_refs(hid_t, int);
+static int xml_print_strs(hid_t, int);
+static char *xml_escape_the_string(const char *, int);
+static char *xml_escape_the_name(const char *);
/*-------------------------------------------------------------------------
* Function: xml_dump_all_cb
@@ -133,41 +133,41 @@ static herr_t
xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
{
hid_t obj;
- herr_t ret = SUCCEED;
- char *obj_path = NULL; /* Full path of object */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ herr_t ret = SUCCEED;
+ char * obj_path = NULL; /* Full path of object */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
- string_dataformat.line_ncols = 65535;
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
/* Build the object's path name */
obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
- if(!obj_path) {
+ if (!obj_path) {
ret = FAIL;
goto done;
}
@@ -176,354 +176,361 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
HDstrcat(obj_path, "/");
HDstrcat(obj_path, name);
- if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ if (linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
goto done;
} /* end if */
- switch(oinfo.type) {
- case H5O_TYPE_GROUP:
- if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg("unable to dump group \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- char *old_prefix; /* Pointer to previous prefix */
-
- /* Keep copy of prefix before iterating into group */
- if((old_prefix = HDstrdup(prefix)) == NULL) {
- error_msg("unable to allocate buffer\n");
+ switch (oinfo.type) {
+ case H5O_TYPE_GROUP:
+ if ((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump group \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- /* Append group name to prefix */
- add_prefix(&prefix, &prefix_len, name);
-
- /* Iterate into group */
- dump_function_table->dump_group_function(obj, name);
-
- /* Restore old prefix name */
- HDstrcpy(prefix, old_prefix);
- HDfree(old_prefix);
- }
-
- /* Close group */
- H5Gclose(obj);
- }
- break;
-
- case H5O_TYPE_DATASET:
- if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) {
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
-
- found_obj = search_obj(dset_table, oinfo.addr);
-
- if(found_obj == NULL) {
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datasetbegin, name,
- h5tools_dump_header_format->datasetblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
+ char *old_prefix; /* Pointer to previous prefix */
+ /* Keep copy of prefix before iterating into group */
+ if ((old_prefix = HDstrdup(prefix)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- H5Dclose(obj);
- goto done;
}
- else if(found_obj->displayed) {
- /* the XML version */
- char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_name = xml_escape_the_name(name);
- char *t_objname = xml_escape_the_name(found_obj->objname);
- char dsetxid[100];
- char parentxid[100];
- char pointerxid[100];
-
- /* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
- "H5Path=\"%s\" Parents=\"%s\" "
- "H5ParentPaths=\"%s\">",
- xmlnsprefix,
- t_name, /* Dataset Name */
- dsetxid, get_next_xid(), /* OBJ-XID */
- t_obj_path, /* H5Path */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
-
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
- xmlnsprefix,
- pointerxid,t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ else {
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
- HDfree(t_name);
- HDfree(t_obj_path);
- HDfree(t_prefix);
- HDfree(t_objname);
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
- H5Dclose(obj);
- goto done;
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
}
- else
- found_obj->displayed = TRUE;
- } /* end if */
- dump_function_table->dump_dataset_function(obj, name, NULL);
- H5Dclose(obj);
- }
- else {
- error_msg("unable to dump dataset \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- break;
+ /* Close group */
+ H5Gclose(obj);
+ }
+ break;
- case H5O_TYPE_NAMED_DATATYPE:
- if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg("unable to dump datatype \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- dump_function_table->dump_named_datatype_function(obj, name);
- H5Tclose(obj);
- }
- break;
+ case H5O_TYPE_DATASET:
+ if ((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) {
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
+
+ found_obj = search_obj(dset_table, oinfo.addr);
+
+ if (found_obj == NULL) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s",
+ h5tools_dump_header_format->datasetblockend);
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ H5Dclose(obj);
+ goto done;
+ }
+ else if (found_obj->displayed) {
+ /* the XML version */
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_objname = xml_escape_the_name(found_obj->objname);
+ char dsetxid[100];
+ char parentxid[100];
+ char pointerxid[100];
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
+ "H5Path=\"%s\" Parents=\"%s\" "
+ "H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, /* Dataset Name */
+ dsetxid, get_next_xid(), /* OBJ-XID */
+ t_obj_path, /* H5Path */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
+ xmlnsprefix, pointerxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_name);
+ HDfree(t_obj_path);
+ HDfree(t_prefix);
+ HDfree(t_objname);
+
+ H5Dclose(obj);
+ goto done;
+ }
+ else
+ found_obj->displayed = TRUE;
+ } /* end if */
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- error_msg("unknown object \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- } /* end if */
- else {
- char *targbuf;
+ dump_function_table->dump_dataset_function(obj, name, NULL);
+ H5Dclose(obj);
+ }
+ else {
+ error_msg("unable to dump dataset \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ break;
- switch(linfo->type) {
- case H5L_TYPE_SOFT:
- if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
- error_msg("unable to allocate buffer\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get link value\n");
+ case H5O_TYPE_NAMED_DATATYPE:
+ if ((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump datatype \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- /* print the value of a soft link */
- /* XML */
- char linkxid[100];
- char parentxid[100];
- char targetxid[100];
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_name = xml_escape_the_name(name);
- char *t_targbuf = xml_escape_the_name(targbuf);
- char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_link_path;
- int res;
-
- t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
- if(targbuf[0] == '/')
- HDstrcpy(t_link_path, targbuf);
- else {
- HDstrcpy(t_link_path, prefix);
- HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
- } /* end else */
-
- /* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
-
- /* Try to create an OBJ-XID for the object pointed to */
- res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
- if (res == 0) {
- /* target obj found */
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetPath=\"%s\" TargetObj=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- t_targbuf, /* TargetPath */
- targetxid, /* TargetObj */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
- /* dangling link -- omit from xml attributes */
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- t_targbuf, /* TargetPath */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
-
- HDfree(t_prefix);
- HDfree(t_name);
- HDfree(t_targbuf);
- HDfree(t_obj_path);
- HDfree(t_link_path);
+ dump_function_table->dump_named_datatype_function(obj, name);
+ H5Tclose(obj);
}
+ break;
- HDfree(targbuf);
- }
- break;
-
- case H5L_TYPE_EXTERNAL:
- if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
- error_msg("unable to allocate buffer\n");
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ error_msg("unknown object \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- }
- else {
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get external link value\n");
+ }
+ } /* end if */
+ else {
+ char *targbuf;
+
+ switch (linfo->type) {
+ case H5L_TYPE_SOFT:
+ if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- } /* end if */
+ }
else {
- const char *filename;
- const char *targname;
-
- if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
- error_msg("unable to unpack external link value\n");
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get link value\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- } /* end if */
+ }
else {
- char linkxid[100];
- char parentxid[100];
- char *t_name = xml_escape_the_name(name);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ /* print the value of a soft link */
+ /* XML */
+ char linkxid[100];
+ char parentxid[100];
+ char targetxid[100];
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_targbuf = xml_escape_the_name(targbuf);
char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_filename = xml_escape_the_name(filename);
- char *t_targname = xml_escape_the_name(targname);
+ char *t_link_path;
+ int res;
+
+ t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
+ if (targbuf[0] == '/')
+ HDstrcpy(t_link_path, targbuf);
+ else {
+ HDstrcpy(t_link_path, prefix);
+ HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
+ } /* end else */
/* Create OBJ-XIDs for the parent and object */
xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sExternalLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetFilename=\"%s\" "
- "TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- filename, /* TargetFilename */
- targname, /* TargetPath*/
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Try to create an OBJ-XID for the object pointed to */
+ res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
+ if (res == 0) {
+ /* target obj found */
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" TargetObj=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ targetxid, /* TargetObj */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ /* dangling link -- omit from xml attributes */
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
HDfree(t_prefix);
HDfree(t_name);
- HDfree(t_filename);
- HDfree(t_targname);
+ HDfree(t_targbuf);
HDfree(t_obj_path);
- } /* end else */
- } /* end else */
- HDfree(targbuf);
- }
- break;
+ HDfree(t_link_path);
+ }
- case H5L_TYPE_ERROR:
- case H5L_TYPE_MAX:
- case H5L_TYPE_HARD:
- default:
- {
- char linkxid[100];
- char parentxid[100];
- char *t_name = xml_escape_the_name(name);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ HDfree(targbuf);
+ }
+ break;
+
+ case H5L_TYPE_EXTERNAL:
+ if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ const char *filename;
+ const char *targname;
+
+ if (H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_filename = xml_escape_the_name(filename);
+ char *t_targname = xml_escape_the_name(targname);
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sExternalLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetFilename=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ filename, /* TargetFilename */
+ targname, /* TargetPath*/
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_filename);
+ HDfree(t_targname);
+ HDfree(t_obj_path);
+ } /* end else */
+ } /* end else */
+ HDfree(targbuf);
+ }
+ break;
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default: {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
char *t_obj_path = xml_escape_the_name(obj_path);
/* Create OBJ-XIDs for the parent and object */
@@ -534,34 +541,34 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sUserDefined LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "LinkClass=\"%d\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- linfo->type, /* LinkClass */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sUserDefined LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "LinkClass=\"%d\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ linfo->type, /* LinkClass */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_prefix);
HDfree(t_name);
HDfree(t_obj_path);
- }
- break;
+ } break;
} /* end switch */
- } /* end else */
+ } /* end else */
done:
h5tools_str_close(&buffer);
- if(obj_path)
+ if (obj_path)
HDfree(obj_path);
return ret;
}
@@ -574,11 +581,12 @@ done:
* 1 - generate a fake entry and return fake id.
*/
int
-xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
+xml_name_to_XID(const char *str, char *outstr, int outlen, int gen)
{
- haddr_t objno; /* Object ID for object at path */
+ haddr_t objno; /* Object ID for object at path */
- if (outlen < 22) return 1;
+ if (outlen < 22)
+ return 1;
objno = ref_path_table_lookup(str);
if (objno == HADDR_UNDEF) {
@@ -587,7 +595,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
if (objno == HADDR_UNDEF) {
if (gen) {
objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno);
return 0;
}
else {
@@ -598,7 +606,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
else {
if (gen) {
objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno);
return 0;
}
else {
@@ -607,16 +615,16 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
}
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno);
return 0;
}
-static const char *quote = "&quot;";
-static const char *amp = "&amp;";
-static const char *lt = "&lt;";
-static const char *gt = "&gt;";
-static const char *apos = "&apos;";
+static const char *quote = "&quot;";
+static const char *amp = "&amp;";
+static const char *lt = "&lt;";
+static const char *gt = "&gt;";
+static const char *apos = "&apos;";
/*-------------------------------------------------------------------------
* Function: xml_escape_the_name
@@ -629,22 +637,22 @@ static const char *apos = "&apos;";
* Programmer: REMcG
*-------------------------------------------------------------------------
*/
-static char *
+static char *
xml_escape_the_name(const char *str)
{
size_t extra;
size_t len;
size_t i;
const char *cp;
- char *ncp;
- char *rcp;
+ char * ncp;
+ char * rcp;
size_t ncp_len;
if (!str)
return NULL;
- cp = str;
- len = HDstrlen(str);
+ cp = str;
+ len = HDstrlen(str);
extra = 0;
for (i = 0; i < len; i++) {
@@ -665,12 +673,12 @@ xml_escape_the_name(const char *str)
if (extra == 0)
return HDstrdup(str);
- cp = str;
+ cp = str;
ncp_len = len + extra + 1;
rcp = ncp = (char *)HDmalloc(ncp_len);
if (!ncp)
- return NULL; /* ?? */
+ return NULL; /* ?? */
for (i = 0; i < len; i++) {
size_t esc_len;
@@ -696,7 +704,7 @@ xml_escape_the_name(const char *str)
esc_len = HDstrlen(amp);
}
else {
- *ncp = *cp;
+ *ncp = *cp;
esc_len = 1;
}
ncp += esc_len;
@@ -725,9 +733,9 @@ xml_escape_the_string(const char *str, int slen)
size_t extra;
size_t len;
size_t i;
- const char *cp = NULL;
- char *ncp = NULL;
- char *rcp = NULL;
+ const char *cp = NULL;
+ char * ncp = NULL;
+ char * rcp = NULL;
size_t ncp_len;
if (!str)
@@ -758,9 +766,9 @@ xml_escape_the_string(const char *str, int slen)
cp++;
}
- cp = str;
+ cp = str;
ncp_len = len + extra + 1;
- rcp = ncp = (char *) HDcalloc(ncp_len, sizeof(char));
+ rcp = ncp = (char *)HDcalloc(ncp_len, sizeof(char));
if (ncp == NULL)
return NULL; /* ?? */
@@ -771,13 +779,13 @@ xml_escape_the_string(const char *str, int slen)
if (*cp == '\\') {
*ncp++ = '\\';
ncp_len--;
- *ncp = *cp;
+ *ncp = *cp;
esc_len = 1;
}
else if (*cp == '\"') {
*ncp++ = '\\';
ncp_len--;
- *ncp = *cp;
+ *ncp = *cp;
esc_len = 1;
}
else if (*cp == '\'') {
@@ -797,7 +805,7 @@ xml_escape_the_string(const char *str, int slen)
esc_len = HDstrlen(amp);
}
else {
- *ncp = *cp;
+ *ncp = *cp;
esc_len = 1;
}
ncp += esc_len;
@@ -828,69 +836,69 @@ xml_escape_the_string(const char *str, int slen)
static void
xml_print_datatype(hid_t type, unsigned in_group)
{
- char *mname;
- hid_t mtype;
- unsigned nmembers;
- unsigned ndims;
- unsigned i;
- size_t size;
- hsize_t dims[H5DUMP_MAX_RANK];
- H5T_str_t str_pad;
- H5T_cset_t cset;
- hid_t super;
- H5T_order_t ord;
- H5T_sign_t sgn;
- size_t sz;
- size_t spos;
- size_t epos;
- size_t esize;
- size_t mpos;
- size_t msize;
- int nmembs;
- htri_t is_vlstr = FALSE;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ char * mname;
+ hid_t mtype;
+ unsigned nmembers;
+ unsigned ndims;
+ unsigned i;
+ size_t size;
+ hsize_t dims[H5DUMP_MAX_RANK];
+ H5T_str_t str_pad;
+ H5T_cset_t cset;
+ hid_t super;
+ H5T_order_t ord;
+ H5T_sign_t sgn;
+ size_t sz;
+ size_t spos;
+ size_t epos;
+ size_t esize;
+ size_t mpos;
+ size_t msize;
+ int nmembs;
+ htri_t is_vlstr = FALSE;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
- string_dataformat.line_ncols = 65535;
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
- if(!in_group && H5Tcommitted(type) > 0) {
+ if (!in_group && H5Tcommitted(type) > 0) {
H5O_info_t oinfo;
- obj_t *found_obj; /* Found object */
+ obj_t * found_obj; /* Found object */
/* detect a shared datatype, output only once */
H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
found_obj = search_obj(type_table, oinfo.addr);
- if(found_obj) {
+ if (found_obj) {
/* This should be defined somewhere else */
/* These 2 cases are handled the same right now, but
probably will have something different eventually */
- char * dtxid = (char *)HDmalloc((size_t)100);
+ char *dtxid = (char *)HDmalloc((size_t)100);
xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
@@ -901,9 +909,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>",
- xmlnsprefix, dtxid);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>", xmlnsprefix, dtxid);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
/* point to the NDT by name */
@@ -913,9 +921,10 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
- xmlnsprefix, dtxid, t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix,
+ dtxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
}
HDfree(dtxid);
@@ -926,7 +935,8 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_setstatus(EXIT_FAILURE);
}
}
@@ -937,8 +947,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
/* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */
@@ -949,7 +960,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"", xmlnsprefix);
switch (ord) {
case H5T_ORDER_LE:
h5tools_str_append(&buffer, "LE");
@@ -986,15 +997,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
sz = H5Tget_size(type);
h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
h5tools_str_append(&buffer, "\" />");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_FLOAT:
@@ -1008,15 +1021,16 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"", xmlnsprefix);
switch (ord) {
case H5T_ORDER_LE:
@@ -1040,17 +1054,21 @@ xml_print_datatype(hid_t type, unsigned in_group)
h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos);
- h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos);
- h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ",
+ (unsigned long)esize, (unsigned long)epos);
+ h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />",
+ (unsigned long)msize, (unsigned long)mpos);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_TIME:
@@ -1058,16 +1076,18 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sTimeType />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_append(&buffer, "<!-- H5T_TIME: not yet implemented -->");
ctx.indent_level--;
@@ -1075,23 +1095,25 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_STRING:
/* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */
- size = H5Tget_size(type);
- str_pad = H5Tget_strpad(type);
- cset = H5Tget_cset(type);
+ size = H5Tget_size(type);
+ str_pad = H5Tget_strpad(type);
+ cset = H5Tget_cset(type);
is_vlstr = H5Tis_variable_str(type);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
@@ -1099,17 +1121,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sStringType Cset=\"", xmlnsprefix);
if (cset == H5T_CSET_ASCII)
h5tools_str_append(&buffer, "H5T_CSET_ASCII\" ");
else
h5tools_str_append(&buffer, "unknown_cset\" ");
- if(is_vlstr)
+ if (is_vlstr)
h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\"");
else
- h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size);
+ h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int)size);
if (str_pad == H5T_STR_NULLTERM)
h5tools_str_append(&buffer, "H5T_STR_NULLTERM\"/>");
@@ -1119,15 +1141,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
h5tools_str_append(&buffer, "H5T_STR_SPACEPAD\"/>");
else
h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_BITFIELD:
@@ -1138,15 +1162,16 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"", xmlnsprefix);
switch (ord) {
case H5T_ORDER_LE:
@@ -1165,15 +1190,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
size = H5Tget_size(type);
h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_OPAQUE:
@@ -1183,8 +1210,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
mname = H5Tget_tag(type);
@@ -1192,19 +1220,21 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname);
+ h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ", xmlnsprefix, mname);
H5free_memory(mname);
size = H5Tget_size(type);
h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_COMPOUND:
@@ -1217,8 +1247,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sCompoundType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* List each member Field of the type */
/* <hdf5:Field FieldName="name" > */
@@ -1228,16 +1259,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
for (i = 0; i < nmembers; i++) {
char *t_fname;
- mname = H5Tget_member_name(type, i);
- mtype = H5Tget_member_type(type, i);
+ mname = H5Tget_member_name(type, i);
+ mtype = H5Tget_member_type(type, i);
t_fname = xml_escape_the_name(mname);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">", xmlnsprefix, t_fname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5free_memory(mname);
HDfree(t_fname);
@@ -1248,11 +1280,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
- xml_print_datatype(mtype,0);
+ xml_print_datatype(mtype, 0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1260,8 +1293,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1269,8 +1303,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sField>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sField>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
dump_indent -= COL;
ctx.indent_level--;
@@ -1279,8 +1314,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sCompoundType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sCompoundType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_REFERENCE:
@@ -1288,8 +1324,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
/* Only Object references supported at this time */
@@ -1297,32 +1334,36 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sReferenceType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sObjectReferenceType />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sReferenceType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sReferenceType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_ENUM:
@@ -1333,8 +1374,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent += COL;
ctx.indent_level++;
@@ -1342,16 +1384,18 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">", xmlnsprefix, nmembs);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
xml_print_enum(type);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sEnumType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sEnumType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1359,8 +1403,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_VLEN:
@@ -1368,8 +1413,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sVLType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
super = H5Tget_super(type);
dump_indent += COL;
ctx.indent_level++;
@@ -1378,11 +1424,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent += COL;
ctx.indent_level++;
- xml_print_datatype(super,0);
+ xml_print_datatype(super, 0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1390,8 +1437,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1399,8 +1447,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sVLType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sVLType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5Tclose(super);
break;
@@ -1414,10 +1463,11 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sArrayType Ndims=\"", xmlnsprefix);
ndims = (unsigned)H5Tget_array_ndims(type);
h5tools_str_append(&buffer, "%u\">", ndims);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Get array information */
H5Tget_array_dims2(type, dims);
@@ -1429,8 +1479,10 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix,
+ (int)dims[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
@@ -1441,11 +1493,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent += COL;
ctx.indent_level++;
- xml_print_datatype(super,0);
+ xml_print_datatype(super, 0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1453,8 +1506,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1462,8 +1516,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sArrayType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sArrayType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Close array base type */
H5Tclose(super);
break;
@@ -1476,7 +1531,8 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- unknown datatype -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_setstatus(EXIT_FAILURE);
break;
}
@@ -1498,48 +1554,48 @@ xml_print_datatype(hid_t type, unsigned in_group)
void
xml_dump_datatype(hid_t type)
{
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.indent_level++;
dump_indent += COL;
- if(H5Tcommitted(type) > 0) {
+ if (H5Tcommitted(type) > 0) {
H5O_info_t oinfo;
- obj_t *found_obj; /* Found object */
+ obj_t * found_obj; /* Found object */
/* Datatype is a shared or named datatype */
H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
found_obj = search_obj(type_table, oinfo.addr);
- if(found_obj) {
+ if (found_obj) {
/* Shared datatype, must be entered as an object */
/* These 2 cases are the same now, but may change */
char *dtxid = (char *)HDmalloc((size_t)100);
@@ -1556,9 +1612,9 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>",
- xmlnsprefix, dtxid);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>", xmlnsprefix, dtxid);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
/* pointer to a named datatype already in XML */
@@ -1569,8 +1625,9 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />",
- xmlnsprefix, dtxid, t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ xmlnsprefix, dtxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
}
HDfree(dtxid);
@@ -1581,7 +1638,8 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
}
else {
@@ -1590,7 +1648,8 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
xml_print_datatype(type, 0);
@@ -1602,7 +1661,8 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
dump_indent -= COL;
@@ -1626,38 +1686,38 @@ xml_dump_dataspace(hid_t space)
hsize_t size[H5DUMP_MAX_RANK];
hsize_t maxsize[H5DUMP_MAX_RANK];
int i;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
- int ndims = H5Sget_simple_extent_dims(space, size, maxsize);
- H5S_class_t space_type = H5Sget_simple_extent_type(space);
+ int ndims = H5Sget_simple_extent_dims(space, size, maxsize);
+ H5S_class_t space_type = H5Sget_simple_extent_type(space);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.indent_level++;
@@ -1666,96 +1726,111 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataspace>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
switch (space_type) {
- case H5S_SCALAR:
- /* scalar dataspace (just a tag, no XML attrs. defined */
+ case H5S_SCALAR:
+ /* scalar dataspace (just a tag, no XML attrs. defined */
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sScalarDataspace />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sScalarDataspace />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- case H5S_SIMPLE:
- /* simple dataspace */
- /* <hdf5:SimpleDataspace Ndims="nd"> */
+ case H5S_SIMPLE:
+ /* simple dataspace */
+ /* <hdf5:SimpleDataspace Ndims="nd"> */
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">",xmlnsprefix, ndims);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">", xmlnsprefix, ndims);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* print the <hdf5:Dimension> elements */
- ctx.indent_level++;
- for (i = 0; i < ndims; i++) {
- if (maxsize[i] == H5S_UNLIMITED) {
- ctx.need_prefix = TRUE;
+ /* print the <hdf5:Dimension> elements */
+ ctx.indent_level++;
+ for (i = 0; i < ndims; i++) {
+ if (maxsize[i] == H5S_UNLIMITED) {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"UNLIMITED\"/>",
- xmlnsprefix,size[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else if (maxsize[i] == (hsize_t) 0) {
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
+ "u\" MaxDimSize=\"UNLIMITED\"/>",
+ xmlnsprefix, size[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else if (maxsize[i] == (hsize_t)0) {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
- xmlnsprefix,size[i], size[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
+ "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
+ xmlnsprefix, size[i], size[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
- xmlnsprefix, size[i], maxsize[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
+ "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
+ xmlnsprefix, size[i], maxsize[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
}
- }
- ctx.indent_level--;
+ ctx.indent_level--;
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sSimpleDataspace>", xmlnsprefix );
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sSimpleDataspace>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
#ifdef TMP
- /* Commented out: wait until the schema is updated first */
- case H5S_NULL:
- /* null dataspace (just a tag, no XML attrs. defined */
+ /* Commented out: wait until the schema is updated first */
+ case H5S_NULL:
+ /* null dataspace (just a tag, no XML attrs. defined */
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNullDataspace />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNullDataspace />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
#endif /* TMP */
- case H5S_NULL:
- case H5S_NO_CLASS:
- default:
- ctx.need_prefix = TRUE;
+ case H5S_NULL:
+ case H5S_NO_CLASS:
+ default:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- unknown dataspace -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- unknown dataspace -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
@@ -1765,7 +1840,8 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataspace>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
h5tools_str_close(&buffer);
@@ -1784,19 +1860,19 @@ xml_dump_dataspace(hid_t space)
void
xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset, int H5_ATTR_UNUSED pindex)
{
- hid_t space = H5I_INVALID_HID;
- hid_t type = H5I_INVALID_HID;
- hid_t p_type = H5I_INVALID_HID;
- int status = -1;
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
+ hid_t space = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
+ hid_t p_type = H5I_INVALID_HID;
+ int status = -1;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
/* Print all the values. */
/* setup */
@@ -1806,29 +1882,30 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.cmpd_sep = " ";
- string_dataformat.cmpd_pre = "";
- string_dataformat.cmpd_suf = "";
- string_dataformat.cmpd_end = "";
+ string_dataformat.cmpd_sep = " ";
+ string_dataformat.cmpd_pre = "";
+ string_dataformat.cmpd_suf = "";
+ string_dataformat.cmpd_end = "";
string_dataformat.arr_linebreak = 0;
- string_dataformat.arr_pre = "";
- outputformat = &string_dataformat;
+ string_dataformat.arr_pre = "";
+ outputformat = &string_dataformat;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
@@ -1837,7 +1914,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -1853,10 +1931,10 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
else {
h5tools_context_t datactx;
HDmemset(&datactx, 0, sizeof(datactx));
- datactx.need_prefix = TRUE;
+ datactx.need_prefix = TRUE;
datactx.indent_level = ctx.indent_level;
- datactx.cur_column = ctx.cur_column;
- status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id);
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id);
}
}
else {
@@ -1875,18 +1953,18 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
else if (H5Tget_class(type) == H5T_STRING) {
status = xml_print_strs(obj_id, ATTRIBUTE_DATA);
}
- else { /* all other data */
+ else { /* all other data */
space = H5Aget_space(obj_id);
- if(space == H5S_NULL || space == H5S_NO_CLASS) {
+ if (space == H5S_NULL || space == H5S_NO_CLASS) {
status = SUCCEED;
}
else {
h5tools_context_t datactx;
HDmemset(&datactx, 0, sizeof(datactx));
- datactx.need_prefix = TRUE;
+ datactx.need_prefix = TRUE;
datactx.indent_level = ctx.indent_level;
- datactx.cur_column = ctx.cur_column;
- status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id);
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id);
}
H5Tclose(p_type);
H5Sclose(space);
@@ -1902,7 +1980,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "Unable to print data.");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -1917,8 +1996,9 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -1927,7 +2007,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -1944,16 +2025,16 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
*/
herr_t
xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info,
- void H5_ATTR_UNUSED * op_data)
+ void H5_ATTR_UNUSED *op_data)
{
hid_t attr_id = H5I_INVALID_HID;
- hid_t type = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
H5S_class_t space_type;
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
char *t_aname = xml_escape_the_name(attr_name);
@@ -1963,36 +2044,37 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_aname);
if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) {
- type = H5Aget_type(attr_id);
- space = H5Aget_space(attr_id);
+ type = H5Aget_type(attr_id);
+ space = H5Aget_space(attr_id);
space_type = H5Sget_simple_extent_type(space);
dump_function_table->dump_dataspace_function(space);
@@ -2003,158 +2085,175 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
if (dump_opts.display_attr_data && space_type != H5S_NULL) {
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_ARRAY:
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+
+ case H5T_TIME:
+ ctx.indent_level++;
+ dump_indent += COL;
- case H5T_TIME:
- ctx.indent_level++;
- dump_indent += COL;
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<hdf5:Data>");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<hdf5:Data>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
- ctx.indent_level--;
- dump_indent -= COL;
- break;
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
- case H5T_COMPOUND:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
+ case H5T_REFERENCE:
+ ctx.need_prefix = TRUE;
- case H5T_REFERENCE:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_print_refs(attr_id, ATTRIBUTE_DATA);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_VLEN:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
+ h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- xml_print_refs(attr_id, ATTRIBUTE_DATA);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
-
- case H5T_VLEN:
- ctx.need_prefix = TRUE;
+ h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- default:
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
}
}
else {
@@ -2165,7 +2264,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
@@ -2174,7 +2274,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2183,7 +2284,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
dump_indent -= COL;
@@ -2197,7 +2299,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
return SUCCEED;
@@ -2211,7 +2314,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- h5dump error: unable to open attribute. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2220,7 +2324,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
@@ -2242,17 +2347,17 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
void
xml_dump_named_datatype(hid_t type, const char *name)
{
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- char *tmp;
- char *dtxid;
- char *parentxid;
- char *t_tmp;
- char *t_prefix;
- char *t_name;
+ char * tmp;
+ char * dtxid;
+ char * parentxid;
+ char * t_tmp;
+ char * t_prefix;
+ char * t_name;
tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
@@ -2264,34 +2369,34 @@ xml_dump_named_datatype(hid_t type, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
- dtxid = (char *)HDmalloc((size_t)100);
+ dtxid = (char *)HDmalloc((size_t)100);
parentxid = (char *)HDmalloc((size_t)100);
- t_tmp = xml_escape_the_name(tmp);
- t_prefix = xml_escape_the_name(prefix);
- t_name = xml_escape_the_name(name);
+ t_tmp = xml_escape_the_name(tmp);
+ t_prefix = xml_escape_the_name(prefix);
+ t_name = xml_escape_the_name(name);
xml_name_to_XID(tmp, dtxid, 100, 1);
xml_name_to_XID(prefix, parentxid, 100, 1);
- if(HDstrncmp(name, "#", (size_t)1) == 0) {
+ if (HDstrncmp(name, "#", (size_t)1) == 0) {
/* Special: this is an 'anonymous' NDT, deleted but
still in use.
We follow the dumper's undocumented practice, and
@@ -2305,31 +2410,32 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix,
- name, dtxid,
- parentxid, HDstrcmp(prefix,"") ? t_prefix : "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, name, dtxid, parentxid, HDstrcmp(prefix, "") ? t_prefix : "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
- H5O_info_t oinfo; /* Object info */
+ H5O_info_t oinfo; /* Object info */
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
- "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix,
- t_name, dtxid,
- t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/"));
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, dtxid, t_tmp, parentxid,
+ (HDstrcmp(prefix, "") ? t_prefix : "/"));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Check uniqueness of named datatype */
H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
- if(oinfo.rc > 1) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1) {
+ obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
found_obj = search_obj(type_table, oinfo.addr);
@@ -2340,11 +2446,11 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- else if(found_obj->displayed) {
+ else if (found_obj->displayed) {
/* We have already printed this named datatype, print it as a
* NamedDatatypePtr
*/
- char pointerxid[100];
+ char pointerxid[100];
char *t_objname = xml_escape_the_name(found_obj->objname);
ctx.indent_level++;
@@ -2355,8 +2461,10 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid, t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix,
+ pointerxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2365,7 +2473,8 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
goto done;
}
@@ -2381,12 +2490,13 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
- xml_print_datatype(type,1);
+ xml_print_datatype(type, 1);
ctx.indent_level--;
dump_indent -= COL;
@@ -2394,8 +2504,9 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -2404,8 +2515,9 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sNamedDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
done:
@@ -2432,23 +2544,23 @@ done:
void
xml_dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
- hid_t gcpl_id;
- hid_t dset, type;
- unsigned crt_order_flags;
- unsigned attr_crt_order_flags;
- int isRoot = 0;
- char type_name[1024];
- char *t_objname = NULL;
- char *par_name = NULL;
- char *cp = NULL;
- char *tmp = NULL;
- char *par = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ H5O_info_t oinfo;
+ hid_t gcpl_id;
+ hid_t dset, type;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ int isRoot = 0;
+ char type_name[1024];
+ char * t_objname = NULL;
+ char * par_name = NULL;
+ char * cp = NULL;
+ char * tmp = NULL;
+ char * par = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -2462,12 +2574,12 @@ xml_dump_group(hid_t gid, const char *name)
}
/* query the group creation properties */
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
error_msg("error in getting group creation properties\n");
h5tools_setstatus(EXIT_FAILURE);
}
- if(H5Pclose(gcpl_id) < 0) {
+ if (H5Pclose(gcpl_id) < 0) {
error_msg("error in closing group creation property list ID\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -2477,36 +2589,36 @@ xml_dump_group(hid_t gid, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
- if(HDstrcmp(name, "/") == 0) {
+ if (HDstrcmp(name, "/") == 0) {
isRoot = 1;
- tmp = HDstrdup("/");
+ tmp = HDstrdup("/");
}
else {
tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
par = HDstrdup(tmp);
- cp = HDstrrchr(par, '/');
- if(cp) {
- if((cp == par) && HDstrlen(par) > 1)
+ cp = HDstrrchr(par, '/');
+ if (cp) {
+ if ((cp == par) && HDstrlen(par) > 1)
*(cp + 1) = '\0';
else
*cp = '\0';
@@ -2515,8 +2627,8 @@ xml_dump_group(hid_t gid, const char *name)
H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC);
- if(oinfo.rc > 1) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1) {
+ obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
found_obj = search_obj(group_table, oinfo.addr);
@@ -2527,15 +2639,15 @@ xml_dump_group(hid_t gid, const char *name)
h5tools_setstatus(EXIT_FAILURE);
}
else {
- char *t_name = xml_escape_the_name(name);
- char *grpxid = (char *)HDmalloc((size_t)100);
+ char *t_name = xml_escape_the_name(name);
+ char *grpxid = (char *)HDmalloc((size_t)100);
char *parentxid = (char *)HDmalloc((size_t)100);
- if(found_obj->displayed) {
+ if (found_obj->displayed) {
char *ptrstr = (char *)HDmalloc((size_t)100);
/* already seen: enter a groupptr */
- if(isRoot) {
+ if (isRoot) {
/* probably can't happen! */
xml_name_to_XID("/", grpxid, 100, 1);
@@ -2543,13 +2655,14 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">",
- xmlnsprefix, grpxid, "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix,
+ grpxid, "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
t_objname = xml_escape_the_name(found_obj->objname);
- par_name = xml_escape_the_name(par);
+ par_name = xml_escape_the_name(par);
xml_name_to_XID(tmp, grpxid, 100, 1);
xml_name_to_XID(par, parentxid, 100, 1);
@@ -2557,18 +2670,20 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix,t_name, grpxid, get_next_xid(),
- t_objname, parentxid, par_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, grpxid, get_next_xid(), t_objname, parentxid,
+ par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
HDfree(par_name);
ctx.indent_level++;
- t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */
- par_name = xml_escape_the_name(par);
+ t_objname = xml_escape_the_name(found_obj->objname); /* point to the NDT by name */
+ par_name = xml_escape_the_name(par);
xml_name_to_XID(found_obj->objname, ptrstr, 100, 1);
xml_name_to_XID(par, parentxid, 100, 1);
@@ -2576,11 +2691,12 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- ptrstr, t_objname, parentxid, par_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, ptrstr, t_objname, parentxid, par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2592,16 +2708,17 @@ xml_dump_group(hid_t gid, const char *name)
else {
/* first time this group has been seen -- describe it */
- if(isRoot) {
+ if (isRoot) {
xml_name_to_XID("/", grpxid, 100, 1);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">",
- xmlnsprefix, grpxid, "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix,
+ grpxid, "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_tmp = xml_escape_the_name(tmp);
@@ -2614,10 +2731,12 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" >",
- xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" >",
+ xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_tmp);
HDfree(par_name);
@@ -2629,28 +2748,30 @@ xml_dump_group(hid_t gid, const char *name)
ctx.indent_level++;
dump_indent += COL;
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if (H5Aiterate2(gid, sort_by, sort_order, NULL,
+ dump_function_table->dump_attribute_function, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL,
+ dump_function_table->dump_attribute_function, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
- if(isRoot && unamedtype) {
+ if (isRoot && unamedtype) {
unsigned u;
/* Very special case: dump unamed type in root group */
- for(u = 0; u < type_table->nobjs; u++) {
- if(!type_table->objs[u].recorded) {
+ for (u = 0; u < type_table->nobjs; u++) {
+ if (!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2660,7 +2781,7 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
- if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
@@ -2675,8 +2796,8 @@ xml_dump_group(hid_t gid, const char *name)
}
else {
/* only link -- must be first time! */
- char *t_name = xml_escape_the_name(name);
- char *grpxid = (char *)HDmalloc((size_t)100);
+ char *t_name = xml_escape_the_name(name);
+ char *grpxid = (char *)HDmalloc((size_t)100);
char *parentxid = (char *)HDmalloc((size_t)100);
ctx.need_prefix = TRUE;
@@ -2684,9 +2805,10 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- if(isRoot) {
+ if (isRoot) {
xml_name_to_XID("/", grpxid, 100, 1);
- h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/");
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid,
+ "/");
}
else {
char *t_tmp = xml_escape_the_name(tmp);
@@ -2694,13 +2816,15 @@ xml_dump_group(hid_t gid, const char *name)
par_name = xml_escape_the_name(par);
xml_name_to_XID(tmp, grpxid, 100, 1);
xml_name_to_XID(par, parentxid, 100, 1);
- h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" >",
- xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
+ h5tools_str_append(&buffer,
+ "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" >",
+ xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
HDfree(t_tmp);
HDfree(par_name);
}
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_name);
HDfree(grpxid);
@@ -2711,28 +2835,30 @@ xml_dump_group(hid_t gid, const char *name)
ctx.indent_level++;
dump_indent += COL;
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if (H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function,
+ NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL,
+ dump_function_table->dump_attribute_function, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
- if(isRoot && unamedtype) {
+ if (isRoot && unamedtype) {
unsigned u;
/* Very special case: dump unamed type in root group */
- for(u = 0; u < type_table->nobjs; u++) {
- if(!type_table->objs[u].recorded) {
+ for (u = 0; u < type_table->nobjs; u++) {
+ if (!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2742,7 +2868,7 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
- if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
@@ -2755,17 +2881,18 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- if(isRoot)
+ if (isRoot)
h5tools_str_append(&buffer, "</%sRootGroup>", xmlnsprefix);
else
h5tools_str_append(&buffer, "</%sGroup>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
- if(par)
+ if (par)
HDfree(par);
- if(tmp)
+ if (tmp)
HDfree(tmp);
}
@@ -2783,18 +2910,18 @@ static int
xml_print_refs(hid_t did, int source)
{
herr_t e;
- hid_t type = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hssize_t ssiz = -1;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hssize_t ssiz = -1;
hsize_t i;
size_t tsiz;
- hobj_ref_t *refbuf = NULL;
- char *buf = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ hobj_ref_t * refbuf = NULL;
+ char * buf = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
if (source == DATASET_DATA) {
type = H5Dget_type(did);
@@ -2822,7 +2949,7 @@ xml_print_refs(hid_t did, int source)
if ((tsiz = H5Tget_size(type)) == 0)
goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *)HDcalloc((size_t)ssiz, tsiz);
if (buf == NULL)
goto error;
e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
@@ -2837,7 +2964,7 @@ xml_print_refs(hid_t did, int source)
if ((tsiz = H5Tget_size(type)) == 0)
goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *)HDcalloc((size_t)ssiz, tsiz);
if (buf == NULL)
goto error;
e = H5Aread(did, H5T_STD_REF_OBJ, buf);
@@ -2853,24 +2980,24 @@ xml_print_refs(hid_t did, int source)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
for (i = 0; i < (hsize_t)ssiz; i++) {
const char *path = lookup_ref_path(*refbuf);
@@ -2882,7 +3009,8 @@ xml_print_refs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", "NULL");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_path = xml_escape_the_string(path, -1);
@@ -2892,7 +3020,8 @@ xml_print_refs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", t_path);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_path);
}
ctx.indent_level--;
@@ -2908,13 +3037,15 @@ xml_print_refs(hid_t did, int source)
return SUCCEED;
error:
- if(buf)
+ if (buf)
HDfree(buf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(type);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -2932,21 +3063,21 @@ static int
xml_print_strs(hid_t did, int source)
{
herr_t e;
- hid_t type = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hssize_t ssiz = -1;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hssize_t ssiz = -1;
htri_t is_vlstr = FALSE;
- size_t tsiz = 0;
+ size_t tsiz = 0;
hsize_t i;
- size_t str_size = 0;
- char *bp = NULL;
- char *onestring = NULL;
- void *buf = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ size_t str_size = 0;
+ char * bp = NULL;
+ char * onestring = NULL;
+ void * buf = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
if (source == DATASET_DATA)
type = H5Dget_type(did);
@@ -2963,9 +3094,9 @@ xml_print_strs(hid_t did, int source)
if (source == DATASET_DATA) {
space = H5Dget_space(did);
- if((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
+ if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if((tsiz = H5Tget_size(type)) == 0)
+ if ((tsiz = H5Tget_size(type)) == 0)
goto error;
buf = HDmalloc((size_t)ssiz * tsiz);
@@ -2978,9 +3109,9 @@ xml_print_strs(hid_t did, int source)
}
else if (source == ATTRIBUTE_DATA) {
space = H5Aget_space(did);
- if((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
+ if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if((tsiz = H5Tget_size(type)) == 0)
+ if ((tsiz = H5Tget_size(type)) == 0)
goto error;
buf = HDmalloc((size_t)ssiz * tsiz);
@@ -2992,33 +3123,33 @@ xml_print_strs(hid_t did, int source)
goto error;
}
- bp = (char*) buf;
+ bp = (char *)buf;
if (!is_vlstr)
- onestring = (char *) HDcalloc(tsiz, sizeof(char));
+ onestring = (char *)HDcalloc(tsiz, sizeof(char));
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
for (i = 0; i < (hsize_t)ssiz; i++) {
if (is_vlstr) {
@@ -3037,7 +3168,8 @@ xml_print_strs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "NULL");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_onestring = xml_escape_the_string(onestring, (int)str_size);
@@ -3048,7 +3180,8 @@ xml_print_strs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", t_onestring);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_onestring);
}
}
@@ -3071,13 +3204,15 @@ xml_print_strs(hid_t did, int source)
return SUCCEED;
error:
- if(buf)
+ if (buf)
HDfree(buf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(type);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -3102,41 +3237,42 @@ check_filters(hid_t dcpl)
size_t cd_nelmts = 20;
unsigned int cd_values[20];
unsigned int flags;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
nfilt = H5Pget_nfilters(dcpl);
if (nfilt <= 0)
return;
for (i = 0; i < nfilt; i++) {
- filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, (size_t)120, namebuf, NULL);
+ filter = H5Pget_filter2(dcpl, (unsigned)i, &flags, (size_t *)&cd_nelmts, cd_values, (size_t)120,
+ namebuf, NULL);
if (filter == H5Z_FILTER_DEFLATE) {
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -3152,7 +3288,8 @@ check_filters(hid_t dcpl)
h5tools_str_append(&buffer, "%d", cd_values[0]);
}
h5tools_str_append(&buffer, "\"/>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (filter == H5Z_FILTER_FLETCHER32) {
@@ -3162,7 +3299,8 @@ check_filters(hid_t dcpl)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sFletcher32 />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (filter == H5Z_FILTER_SHUFFLE) {
@@ -3172,7 +3310,8 @@ check_filters(hid_t dcpl)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sShuffle />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (filter == H5Z_FILTER_SZIP) {
@@ -3219,7 +3358,8 @@ check_filters(hid_t dcpl)
h5tools_str_append(&buffer, "Header=\"Raw\"");
}
h5tools_str_append(&buffer, "/>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else {
@@ -3236,37 +3376,37 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
size_t sz;
size_t i;
hsize_t space;
- void *buf;
- char *name;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ void * buf;
+ char * name;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.indent_level++;
dump_indent += COL;
@@ -3276,31 +3416,34 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
space = H5Tget_size(type);
- buf = HDmalloc((size_t) space);
+ buf = HDmalloc((size_t)space);
H5Pget_fill_value(dcpl, type, buf);
if (H5Tget_class(type) == H5T_REFERENCE) {
- const char * path = lookup_ref_path(*(hobj_ref_t *) buf);
+ const char *path = lookup_ref_path(*(hobj_ref_t *)buf);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
if (!path) {
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", "NULL");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_path = xml_escape_the_string(path, -1);
@@ -3310,7 +3453,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", t_path);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_path);
}
@@ -3319,7 +3463,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else if (H5Tget_class(type) == H5T_STRING) {
/* ????? */
@@ -3328,197 +3473,221 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- String fill values not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
/* all other data */
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- ctx.need_prefix = TRUE;
+ case H5T_INTEGER:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"%d\"", *(int *) buf);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%d\"", *(int *)buf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_FLOAT:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_FLOAT:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"%f\"", (double)*(float *)buf);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%f\"", (double)*(float *)buf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- sz = H5Tget_size(type);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ sz = H5Tget_size(type);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"");
- for (i = 0; i < sz; i++) {
- h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf + (i * sizeof(unsigned int)));
- }
- h5tools_str_append(&buffer, "\"");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"");
+ for (i = 0; i < sz; i++) {
+ h5tools_str_append(&buffer, "%x ", *(unsigned int *)buf + (i * sizeof(unsigned int)));
+ }
+ h5tools_str_append(&buffer, "\"");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_ENUM:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_ENUM:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- name = H5Tget_member_name(type, *(unsigned *) buf);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ name = H5Tget_member_name(type, *(unsigned *)buf);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"%s\"", name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if(name)
- H5free_memory(name);
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%s\"", name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (name)
+ H5free_memory(name);
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_ARRAY:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_ARRAY:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Array fill values not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Array fill values not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_TIME:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_TIME:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Time fill not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time fill not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_COMPOUND:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Compound fill not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Compound fill not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_VLEN:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_VLEN:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- VL fill not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- VL fill not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- case H5T_STRING:
- case H5T_REFERENCE:
- default:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ case H5T_STRING:
+ case H5T_REFERENCE:
+ default:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Unknown fill datatype: %d -->", H5Tget_class(type));
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Unknown fill datatype: %d -->", H5Tget_class(type));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
}
}
HDfree(buf);
@@ -3530,7 +3699,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3548,32 +3718,32 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
void
xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *sset)
{
- hid_t type;
- hid_t space;
- hid_t dcpl;
- H5D_fill_value_t fvstatus;
- int maxdims;
- hsize_t *chsize;
- int ndims;
- int i;
- H5D_alloc_time_t at;
- H5D_fill_time_t ft;
- hsize_t tempi;
- char *tmp;
- char *t_name;
- char *t_tmp;
- char *t_prefix;
- unsigned attr_crt_order_flags;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
-
- char *rstr = (char*) HDmalloc((size_t)100);
- char *pstr = (char*) HDmalloc((size_t)100);
-
- tmp = (char*) HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ hid_t type;
+ hid_t space;
+ hid_t dcpl;
+ H5D_fill_value_t fvstatus;
+ int maxdims;
+ hsize_t * chsize;
+ int ndims;
+ int i;
+ H5D_alloc_time_t at;
+ H5D_fill_time_t ft;
+ hsize_t tempi;
+ char * tmp;
+ char * t_name;
+ char * t_tmp;
+ char * t_prefix;
+ unsigned attr_crt_order_flags;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ char *rstr = (char *)HDmalloc((size_t)100);
+ char *pstr = (char *)HDmalloc((size_t)100);
+
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
HDstrcat(tmp, "/");
HDstrcat(tmp, name);
@@ -3583,28 +3753,28 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
- t_name = xml_escape_the_name(name);
- t_tmp = xml_escape_the_name(tmp);
+ t_name = xml_escape_the_name(name);
+ t_tmp = xml_escape_the_name(tmp);
t_prefix = xml_escape_the_name(prefix);
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
xml_name_to_XID(tmp, rstr, 100, 1);
xml_name_to_XID(prefix, pstr, 100, 1);
@@ -3613,10 +3783,11 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix, t_name, rstr, t_tmp, pstr,
- strcmp(prefix, "") ? t_prefix : "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(
+ &buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, rstr, t_tmp, pstr, strcmp(prefix, "") ? t_prefix : "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_name);
HDfree(t_tmp);
@@ -3625,8 +3796,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
HDfree(pstr);
HDfree(tmp);
- dcpl = H5Dget_create_plist(did);
- type = H5Dget_type(did);
+ dcpl = H5Dget_create_plist(did);
+ type = H5Dget_type(did);
space = H5Dget_space(did);
/* query the creation properties for attributes */
@@ -3634,7 +3805,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Print information about storage layout */
if (H5D_CHUNKED == H5Pget_layout(dcpl)) {
- if((maxdims = H5Sget_simple_extent_ndims(space)) < 0) {
+ if ((maxdims = H5Sget_simple_extent_ndims(space)) < 0) {
error_msg("unable to get maxdims\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -3648,7 +3819,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
@@ -3659,7 +3831,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
h5tools_str_append(&buffer, "<%sChunkedLayout ", xmlnsprefix);
ndims = H5Pget_chunk(dcpl, maxdims, chsize);
h5tools_str_append(&buffer, "Ndims=\"%d\">", ndims);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
@@ -3670,8 +3843,10 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />", xmlnsprefix, chsize[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />",
+ xmlnsprefix, chsize[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.need_prefix = TRUE;
@@ -3679,7 +3854,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
@@ -3692,7 +3868,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sRequiredFilter>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3702,7 +3879,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sChunkedLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3711,7 +3889,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
HDfree(chsize);
@@ -3725,7 +3904,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -3733,7 +3913,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sContiguousLayout/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
@@ -3741,7 +3922,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (H5D_COMPACT == H5Pget_layout(dcpl)) {
@@ -3752,7 +3934,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -3760,7 +3943,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sCompactLayout/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
@@ -3768,7 +3952,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
/* and check for external.... ?? */
@@ -3821,7 +4006,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
} /* end switch */
h5tools_str_append(&buffer, "\"");
h5tools_str_append(&buffer, ">");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
@@ -3831,10 +4017,12 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sFillValue>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5Pfill_value_defined(dcpl, &fvstatus);
- if (fvstatus == H5D_FILL_VALUE_UNDEFINED || (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) {
+ if (fvstatus == H5D_FILL_VALUE_UNDEFINED ||
+ (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) {
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -3842,7 +4030,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoFill/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else {
@@ -3854,7 +4043,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sFillValue>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3864,7 +4054,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sFillValueInfo>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3876,17 +4067,19 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
dump_indent += COL;
if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if (H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if (H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) <
+ 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if (H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if (H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function,
+ NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
ctx.indent_level--;
dump_indent -= COL;
@@ -3894,166 +4087,182 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
if (dump_opts.display_data && (tempi > 0)) {
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_ARRAY:
- ctx.indent_level++;
- dump_indent += COL;
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- ctx.indent_level--;
- dump_indent -= COL;
- break;
-
- case H5T_TIME:
- ctx.indent_level++;
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
- ctx.need_prefix = TRUE;
+ case H5T_TIME:
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.indent_level--;
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- case H5T_COMPOUND:
- ctx.need_prefix = TRUE;
+ ctx.indent_level--;
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
- ctx.indent_level++;
- dump_indent += COL;
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- ctx.indent_level--;
- dump_indent -= COL;
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- case H5T_REFERENCE:
- ctx.need_prefix = TRUE;
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ case H5T_REFERENCE:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_print_refs(did, DATASET_DATA);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_VLEN:
+ ctx.indent_level--;
+ dump_indent -= COL;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- xml_print_refs(did, DATASET_DATA);
+ h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ dump_indent += COL;
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
-
- case H5T_VLEN:
- ctx.indent_level--;
- dump_indent -= COL;
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
- dump_indent += COL;
-
- ctx.indent_level++;
- dump_indent += COL;
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- ctx.indent_level--;
- dump_indent -= COL;
- break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- default:
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
}
}
else {
@@ -4065,7 +4274,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -4073,7 +4283,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
@@ -4081,7 +4292,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
@@ -4094,7 +4306,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -4113,62 +4326,64 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
static void
xml_print_enum(hid_t type)
{
- char **name = NULL; /*member names */
- unsigned char *value = NULL; /*value array */
- unsigned nmembs; /*number of members */
- hid_t super; /*enum base integer type */
- hid_t native = H5I_INVALID_HID; /*native integer datatype */
- size_t dst_size; /*destination value type size */
- unsigned i; /*miscellaneous counters */
- size_t j;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ char ** name = NULL; /*member names */
+ unsigned char * value = NULL; /*value array */
+ unsigned nmembs; /*number of members */
+ hid_t super; /*enum base integer type */
+ hid_t native = H5I_INVALID_HID; /*native integer datatype */
+ size_t dst_size; /*destination value type size */
+ unsigned i; /*miscellaneous counters */
+ size_t j;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
nmembs = (unsigned)H5Tget_nmembers(type);
- super = H5Tget_super(type);
+ super = H5Tget_super(type);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- xml_print_datatype(super,0);
+ xml_print_datatype(super, 0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/*
* Determine what datatype to use for the native values. To simplify
@@ -4192,7 +4407,7 @@ xml_print_enum(hid_t type)
}
/* Get the names and raw values of all members */
- name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
+ name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < nmembs; i++) {
@@ -4217,8 +4432,9 @@ xml_print_enum(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sEnumElement>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sEnumElement>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -4226,7 +4442,8 @@ xml_print_enum(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s", t_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_name);
ctx.indent_level--;
@@ -4234,15 +4451,17 @@ xml_print_enum(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sEnumElement>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sEnumElement>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sEnumValue>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sEnumValue>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -4256,22 +4475,24 @@ xml_print_enum(hid_t type)
h5tools_str_append(&buffer, "%02x", value[i * dst_size + j]);
}
else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *)
- ((void *) (value + i * dst_size))));
+ h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "u",
+ *((unsigned long long *)((void *)(value + i * dst_size))));
}
else {
- h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d",
- *((long long *) ((void *) (value + i * dst_size))));
+ h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "d",
+ *((long long *)((void *)(value + i * dst_size))));
}
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sEnumValue>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sEnumValue>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
dump_indent -= COL;
@@ -4286,4 +4507,3 @@ xml_print_enum(hid_t type)
HDfree(value);
H5Tclose(super);
}
-
diff --git a/tools/src/h5dump/h5dump_xml.h b/tools/src/h5dump/h5dump_xml.h
index 3c59917..d69f6d5 100644
--- a/tools/src/h5dump/h5dump_xml.h
+++ b/tools/src/h5dump/h5dump_xml.h
@@ -6,14 +6,14 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5DUMP_XML_H__
-#define H5DUMP_XML_H__
+#ifndef H5DUMP_XML_H
+#define H5DUMP_XML_H
-extern const char *xmlnsprefix;
+extern const char *xmlnsprefix;
#ifdef __cplusplus
extern "C" {
@@ -22,16 +22,16 @@ extern "C" {
/* The dump functions of the dump_function_table */
/* XML format: same interface, alternative output */
-void xml_dump_group(hid_t, const char *);
-void xml_dump_named_datatype(hid_t, const char *);
-void xml_dump_dataset(hid_t, const char *, struct subset_t *);
-void xml_dump_dataspace(hid_t space);
-void xml_dump_datatype(hid_t type);
-herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *);
-void xml_dump_data(hid_t, int, struct subset_t *, int);
+void xml_dump_group(hid_t, const char *);
+void xml_dump_named_datatype(hid_t, const char *);
+void xml_dump_dataset(hid_t, const char *, struct subset_t *);
+void xml_dump_dataspace(hid_t space);
+void xml_dump_datatype(hid_t type);
+herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *);
+void xml_dump_data(hid_t, int, struct subset_t *, int);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_XML_H__ */
+#endif /* H5DUMP_XML_H */
diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt
index 863ecbe..d0ddb32 100644
--- a/tools/src/h5format_convert/CMakeLists.txt
+++ b/tools/src/h5format_convert/CMakeLists.txt
@@ -6,7 +6,7 @@ project (HDF5_TOOLS_SRC_H5FC C)
# --------------------------------------------------------------------
if (NOT ONLY_SHARED_LIBS)
add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c)
- target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5format_convert PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5format_convert STATIC)
target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -17,7 +17,7 @@ if (NOT ONLY_SHARED_LIBS)
endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5format_convert-shared ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c)
- target_include_directories (h5format_convert-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5format_convert-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5format_convert-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5format_convert-shared SHARED)
target_link_libraries (h5format_convert-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
@@ -27,6 +27,17 @@ if (BUILD_SHARED_LIBS)
set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5format_convert-shared)
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_H5FORMAT_SRC_FORMAT h5format_convert)
+ else ()
+ clang_format (HDF5_H5FORMAT_SRC_FORMAT h5format_convert-shared)
+ endif ()
+endif ()
+
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
diff --git a/tools/src/h5format_convert/Makefile.am b/tools/src/h5format_convert/Makefile.am
index 2b36949..2c968a3 100644
--- a/tools/src/h5format_convert/Makefile.am
+++ b/tools/src/h5format_convert/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/src/h5format_convert/Makefile.in b/tools/src/h5format_convert/Makefile.in
index 066bf8e..49d4769 100644
--- a/tools/src/h5format_convert/Makefile.in
+++ b/tools/src/h5format_convert/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -422,12 +423,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -465,11 +466,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -501,8 +547,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -516,7 +560,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -526,6 +572,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -719,7 +766,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1301,8 +1348,9 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
index bd02e3b..3923344 100644
--- a/tools/src/h5format_convert/h5format_convert.c
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,7 +15,6 @@
* Programmer: Vailin Choi; Feb 2015
*/
-
/*
* We include the private header file so we can get to the uniform
* programming environment it declares.
@@ -29,42 +28,22 @@
/* Name of tool */
#define PROGRAMNAME "h5format_convert"
-static char *fname_g = NULL;
-static char *dname_g = NULL;
-static int dset_g = FALSE;
-static int noop_g = FALSE;
-static int verbose_g = 0;
+static char *fname_g = NULL;
+static char *dname_g = NULL;
+static int dset_g = FALSE;
+static int noop_g = FALSE;
+static int verbose_g = 0;
/*
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVvd:n";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h'},
- { "he", no_arg, 'h'},
- { "version", no_arg, 'V' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "verbose", no_arg, 'v' },
- { "verbos", no_arg, 'v' },
- { "verbo", no_arg, 'v' },
- { "verb", no_arg, 'v' },
- { "dname", require_arg, 'd' },
- { "dnam", require_arg, 'd' },
- { "dna", require_arg, 'd' },
- { "dn", require_arg, 'd' },
- { "noop", no_arg, 'n' },
- { "noo", no_arg, 'n' },
- { "no", no_arg, 'n' },
- { "enable-error-stack", no_arg, 'E' },
- { NULL, 0, '\0' }
-};
-
-
+static const char * s_opts = "hVvd:n";
+static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"version", no_arg, 'V'},
+ {"verbose", no_arg, 'v'}, {"dname", require_arg, 'd'},
+ {"noop", no_arg, 'n'}, {"enable-error-stack", no_arg, 'E'},
+ {NULL, 0, '\0'}};
+
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -74,7 +53,8 @@ static struct long_options l_opts[] = {
*
*-------------------------------------------------------------------------
*/
-static void usage(const char *prog)
+static void
+usage(const char *prog)
{
HDfprintf(stdout, "usage: %s [OPTIONS] file_name\n", prog);
HDfprintf(stdout, " OPTIONS\n");
@@ -118,7 +98,7 @@ parse_command_line(int argc, const char **argv)
{
int opt;
- /* no arguments */
+ /* no arguments */
if (argc == 1) {
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
@@ -126,8 +106,8 @@ parse_command_line(int argc, const char **argv)
}
/* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char) opt) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
case 'h':
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
@@ -143,11 +123,11 @@ parse_command_line(int argc, const char **argv)
break;
case 'd': /* -d dname */
- if(opt_arg != NULL && *opt_arg)
- dname_g = HDstrdup(opt_arg);
- if(dname_g == NULL) {
+ if (H5_optarg != NULL && *H5_optarg)
+ dname_g = HDstrdup(H5_optarg);
+ if (dname_g == NULL) {
h5tools_setstatus(EXIT_FAILURE);
- error_msg("No dataset name\n", opt_arg);
+ error_msg("No dataset name\n", H5_optarg);
usage(h5tools_getprogname());
goto error;
}
@@ -168,24 +148,24 @@ parse_command_line(int argc, const char **argv)
goto error;
break;
} /* switch */
- } /* while */
+ } /* while */
- if (argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- fname_g = HDstrdup(argv[opt_ind]);
+ fname_g = HDstrdup(argv[H5_optind]);
- return(0);
+ return 0;
error:
- return(-1); ;
+ return -1;
+ ;
} /* parse_command_line() */
-
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -224,134 +204,138 @@ leave(int ret)
static int
convert(hid_t fid, const char *dname)
{
- hid_t dcpl = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- H5D_layout_t layout_type;
+ hid_t dcpl = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ H5D_layout_t layout_type;
H5D_chunk_index_t idx_type;
/* Open the dataset */
- if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) {
+ if ((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) {
error_msg("unable to open dataset \"%s\"\n", dname);
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Open the dataset\n");
/* Get the dataset's creation property list */
- if((dcpl = H5Dget_create_plist(did)) < 0) {
+ if ((dcpl = H5Dget_create_plist(did)) < 0) {
error_msg("unable to get the dataset creation property list\n");
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
/* Get the dataset's layout */
- if((layout_type = H5Pget_layout(dcpl)) < 0) {
+ if ((layout_type = H5Pget_layout(dcpl)) < 0) {
error_msg("unable to get the dataset layout type\n");
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Retrieve the dataset's layout\n");
- switch(layout_type) {
- case H5D_CHUNKED:
- if(verbose_g)
- HDfprintf(stdout, "Dataset is a chunked dataset\n");
-
- /* Get the dataset's chunk indexing type */
- if(H5Dget_chunk_index_type(did, &idx_type) < 0) {
- error_msg("unable to get the chunk indexing type for \"%s\"\n", dname);
- h5tools_setstatus(EXIT_FAILURE);
- goto error;
- }
- else if(verbose_g)
- HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n");
+ switch (layout_type) {
+ case H5D_CHUNKED:
+ if (verbose_g)
+ HDfprintf(stdout, "Dataset is a chunked dataset\n");
- if(idx_type == H5D_CHUNK_IDX_BTREE) {
- if(verbose_g)
- HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n");
- h5tools_setstatus(EXIT_SUCCESS);
+ /* Get the dataset's chunk indexing type */
+ if (H5Dget_chunk_index_type(did, &idx_type) < 0) {
+ error_msg("unable to get the chunk indexing type for \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+ else if (verbose_g)
+ HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n");
+
+ if (idx_type == H5D_CHUNK_IDX_BTREE) {
+ if (verbose_g)
+ HDfprintf(
+ stdout,
+ "Dataset's chunk indexing type is already version 1 B-tree: no further action\n");
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ }
+ else if (verbose_g)
+ HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n");
+
+ break;
+
+ case H5D_CONTIGUOUS:
+ if (verbose_g)
+ HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n");
+ break;
+
+ case H5D_COMPACT:
+ if (verbose_g)
+ HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n");
+ break;
+
+ case H5D_VIRTUAL:
+ if (verbose_g)
+ HDfprintf(stdout, "No further action for virtual dataset\n");
goto done;
- }
- else if (verbose_g)
- HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n");
- break;
-
- case H5D_CONTIGUOUS:
- if(verbose_g)
- HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n");
- break;
-
- case H5D_COMPACT:
- if(verbose_g)
- HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n");
- break;
-
- case H5D_VIRTUAL:
- if(verbose_g)
- HDfprintf(stdout, "No further action for virtual dataset\n");
- goto done;
-
- case H5D_NLAYOUTS:
- case H5D_LAYOUT_ERROR:
- default:
- error_msg("unknown layout type for \"%s\"\n", dname);
- h5tools_setstatus(EXIT_FAILURE);
- goto error;
+ case H5D_NLAYOUTS:
+ case H5D_LAYOUT_ERROR:
+ default:
+ error_msg("unknown layout type for \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
} /* end switch */
/* No further action if it is a noop */
- if(noop_g) {
- if(verbose_g)
+ if (noop_g) {
+ if (verbose_g)
HDfprintf(stdout, "Not converting the dataset\n");
h5tools_setstatus(EXIT_SUCCESS);
goto done;
}
- if(verbose_g)
+ if (verbose_g)
HDfprintf(stdout, "Converting the dataset...\n");
/* Downgrade the dataset */
- if(H5Dformat_convert(did) < 0) {
+ if (H5Dformat_convert(did) < 0) {
error_msg("unable to downgrade dataset \"%s\"\n", dname);
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Done\n");
done:
/* Close the dataset */
- if(H5Dclose(did) < 0) {
+ if (H5Dclose(did) < 0) {
error_msg("unable to close dataset \"%s\"\n", dname);
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Close the dataset\n");
/* Close the dataset creation property list */
- if(H5Pclose(dcpl) < 0) {
+ if (H5Pclose(dcpl) < 0) {
error_msg("unable to close dataset creation property list\n");
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- else if(verbose_g)
+ else if (verbose_g)
HDprintf("Close the dataset creation property list\n");
return 0;
error:
- if(verbose_g)
+ if (verbose_g)
HDfprintf(stdout, "Error encountered\n");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* convert() */
@@ -372,14 +356,14 @@ convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_vis
hid_t fid = *(hid_t *)_fid;
/* If the object has already been seen then just return */
- if(NULL == already_visited) {
- if(oi->type == H5O_TYPE_DATASET) {
- if(verbose_g)
+ if (NULL == already_visited) {
+ if (oi->type == H5O_TYPE_DATASET) {
+ if (verbose_g)
HDfprintf(stdout, "Going to process dataset:%s...\n", path);
- if(convert(fid, path) < 0)
+ if (convert(fid, path) < 0)
goto error;
} /* end if */
- } /* end if */
+ } /* end if */
return 0;
@@ -387,7 +371,6 @@ error:
return -1;
} /* end convert_dsets_cb() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -411,41 +394,41 @@ main(int argc, const char *argv[])
h5tools_init();
/* Parse command line options */
- if(parse_command_line(argc, argv) < 0)
+ if (parse_command_line(argc, argv) < 0)
goto done;
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Process command line options\n");
- if(noop_g && verbose_g)
+ if (noop_g && verbose_g)
HDfprintf(stdout, "It is noop...\n");
/* enable error reporting if command line option */
h5tools_error_report();
/* Open the HDF5 file */
- if((fid = h5tools_fopen(fname_g, H5F_ACC_RDWR, H5P_DEFAULT, FALSE, NULL, 0)) < 0) {
+ if ((fid = h5tools_fopen(fname_g, H5F_ACC_RDWR, H5P_DEFAULT, FALSE, NULL, 0)) < 0) {
error_msg("unable to open file \"%s\"\n", fname_g);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Open the file %s\n", fname_g);
- if(dset_g) { /* Convert a specified dataset in the file */
- if(verbose_g)
+ if (dset_g) { /* Convert a specified dataset in the file */
+ if (verbose_g)
HDfprintf(stdout, "Going to process dataset: %s...\n", dname_g);
- if(convert(fid, dname_g) < 0)
+ if (convert(fid, dname_g) < 0)
goto done;
}
else { /* Convert all datasets in the file */
- if(verbose_g)
+ if (verbose_g)
HDfprintf(stdout, "Processing all datasets in the file...\n");
- if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, H5O_INFO_BASIC) < 0)
+ if (h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, H5O_INFO_BASIC) < 0)
goto done;
} /* end else */
- if(verbose_g) {
- if(noop_g) {
+ if (verbose_g) {
+ if (noop_g) {
HDfprintf(stdout, "Not processing the file's superblock...\n");
h5tools_setstatus(EXIT_SUCCESS);
goto done;
@@ -454,7 +437,7 @@ main(int argc, const char *argv[])
} /* end if */
/* Process superblock */
- if(H5Fformat_convert(fid) < 0) {
+ if (H5Fformat_convert(fid) < 0) {
error_msg("unable to convert file's superblock\"%s\"\n", fname_g);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -462,22 +445,21 @@ main(int argc, const char *argv[])
done:
/* Close the file */
- if(fid >= 0) {
- if(H5Fclose(fid) < 0) {
+ if (fid >= 0) {
+ if (H5Fclose(fid) < 0) {
error_msg("unable to close file \"%s\"\n", fname_g);
h5tools_setstatus(EXIT_FAILURE);
}
- else if(verbose_g) {
+ else if (verbose_g) {
HDfprintf(stdout, "Close the file\n");
}
- } /* end if */
+ } /* end if */
- if(fname_g)
+ if (fname_g)
HDfree(fname_g);
- if(dname_g)
+ if (dname_g)
HDfree(dname_g);
leave(h5tools_getstatus());
} /* end main() */
-
diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt
index a52467e..a7f238e 100644
--- a/tools/src/h5import/CMakeLists.txt
+++ b/tools/src/h5import/CMakeLists.txt
@@ -5,8 +5,8 @@ project (HDF5_TOOLS_SRC_H5IMPORT C)
# Add the h5import executables
# --------------------------------------------------------------------
if (NOT ONLY_SHARED_LIBS)
- add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c)
- target_include_directories (h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.h)
+ target_include_directories (h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5import STATIC)
target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
#set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT)
@@ -17,8 +17,8 @@ if (NOT ONLY_SHARED_LIBS)
endif ()
if (BUILD_SHARED_LIBS)
- add_executable (h5import-shared ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c)
- target_include_directories (h5import-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ add_executable (h5import-shared ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.h)
+ target_include_directories (h5import-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5import-shared SHARED)
target_link_libraries (h5import-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
#set_target_properties (h5import-shared PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT)
@@ -28,6 +28,17 @@ if (BUILD_SHARED_LIBS)
set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5import-shared)
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_H5IMPORT_SRC_FORMAT h5import)
+ else ()
+ clang_format (HDF5_H5IMPORT_SRC_FORMAT h5import-shared)
+ endif ()
+endif ()
+
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
diff --git a/tools/src/h5import/Makefile.am b/tools/src/h5import/Makefile.am
index 4623eb5..14a8670 100644
--- a/tools/src/h5import/Makefile.am
+++ b/tools/src/h5import/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/src/h5import/Makefile.in b/tools/src/h5import/Makefile.in
index c5e2871..e6d4ff0 100644
--- a/tools/src/h5import/Makefile.in
+++ b/tools/src/h5import/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -419,12 +420,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -462,11 +463,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -498,8 +544,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -513,7 +557,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -523,6 +569,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -716,7 +763,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1259,8 +1306,9 @@ uninstall-am: uninstall-binPROGRAMS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index 4221eec..04e1c35 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -27,68 +27,69 @@
#endif
/* Local function declarations */
-static int gtoken(char *s);
-static int process(struct Options *opt);
-static int processConfigurationFile(char *infile, struct Input *in);
-static int mapKeywordToIndex(char *key);
-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 getInputByteOrder(struct Input *in, FILE *strm);
-static int InputClassStrToInt(char *temp);
-static int getRank(struct Input *in, FILE *strm);
-static int getDimensionSizes(struct Input *in, FILE *strm);
-static int getOutputSize(struct Input *in, FILE *strm);
-static int getOutputClass(struct Input *in, FILE *strm);
-static int OutputClassStrToInt(char *temp);
-static int getOutputArchitecture(struct Input *in, FILE *strm);
-static int OutputArchStrToInt(const char *temp);
-static int getOutputByteOrder(struct Input *in, FILE *strm);
-static int OutputByteOrderStrToInt(const char *temp);
-static int getChunkedDimensionSizes(struct Input *in, FILE *strm);
-static int getCompressionType(struct Input *in, FILE *strm);
-static int CompressionTypeStrToInt(char *temp);
-static int getCompressionParameter(struct Input *in, FILE *strm);
-static int getExternalFilename(struct Input *in, FILE *strm);
-static int getMaximumDimensionSizes(struct Input *in, FILE *strm);
-static int processDataFile(char *infile, struct Input *in, hid_t file_id);
-static int readIntegerData(FILE *strm, struct Input *in);
-static int readFloatData(FILE *strm, struct Input *in);
-static int allocateIntegerStorage(struct Input *in);
-static int allocateFloatStorage(struct Input *in);
-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);
-uint16_t swap_uint16(uint16_t val);
-int16_t swap_int16(int16_t val);
-uint32_t swap_uint32(uint32_t val);
-int32_t swap_int32(int32_t val);
-int64_t swap_int64(int64_t val);
-uint64_t swap_uint64(uint64_t val);
-
-int main(int argc, char *argv[])
+static int gtoken(char *s);
+static int process(struct Options *opt);
+static int processConfigurationFile(char *infile, struct Input *in);
+static int mapKeywordToIndex(char *key);
+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 getInputByteOrder(struct Input *in, FILE *strm);
+static int InputClassStrToInt(char *temp);
+static int getRank(struct Input *in, FILE *strm);
+static int getDimensionSizes(struct Input *in, FILE *strm);
+static int getOutputSize(struct Input *in, FILE *strm);
+static int getOutputClass(struct Input *in, FILE *strm);
+static int OutputClassStrToInt(char *temp);
+static int getOutputArchitecture(struct Input *in, FILE *strm);
+static int OutputArchStrToInt(const char *temp);
+static int getOutputByteOrder(struct Input *in, FILE *strm);
+static int OutputByteOrderStrToInt(const char *temp);
+static int getChunkedDimensionSizes(struct Input *in, FILE *strm);
+static int getCompressionType(struct Input *in, FILE *strm);
+static int CompressionTypeStrToInt(char *temp);
+static int getCompressionParameter(struct Input *in, FILE *strm);
+static int getExternalFilename(struct Input *in, FILE *strm);
+static int getMaximumDimensionSizes(struct Input *in, FILE *strm);
+static int processDataFile(char *infile, struct Input *in, hid_t file_id);
+static int readIntegerData(FILE *strm, struct Input *in);
+static int readFloatData(FILE *strm, struct Input *in);
+static int allocateIntegerStorage(struct Input *in);
+static int allocateFloatStorage(struct Input *in);
+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);
+uint16_t swap_uint16(uint16_t val);
+int16_t swap_int16(int16_t val);
+uint32_t swap_uint32(uint32_t val);
+int32_t swap_int32(int32_t val);
+int64_t swap_int64(int64_t val);
+uint64_t swap_uint64(uint64_t val);
+
+int
+main(int argc, char *argv[])
{
struct Options *opt;
int outfile_named = FALSE;
int token;
int i;
int state = 0;
- struct Input *in = NULL;
-
- const char *err1 = "Invalid number of arguments: %d.\n";
- const char *err2 = "Error in state table.\n";
- const char *err3 = "No output file given.\n";
- const char *err4 = "Program aborted.\n";
- const char *err5 = "Invalid path %s.\n";
- const char *err6 = "Invalid dimensions - %s.\n";
- const char *err7 = "Invalid type of data - %s.\n";
- const char *err8 = "Invalid size of data - %s.\n";
- const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n";
- const char *err10 = "Length of output file name limited to 255 chars.\n";
+ struct Input * in = NULL;
+
+ const char *err1 = "Invalid number of arguments: %d.\n";
+ const char *err2 = "Error in state table.\n";
+ const char *err3 = "No output file given.\n";
+ const char *err4 = "Program aborted.\n";
+ const char *err5 = "Invalid path %s.\n";
+ const char *err6 = "Invalid dimensions - %s.\n";
+ const char *err7 = "Invalid type of data - %s.\n";
+ const char *err8 = "Invalid size of data - %s.\n";
+ const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n";
+ const char *err10 = "Length of output file name limited to 255 chars.\n";
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -96,10 +97,10 @@ int main(int argc, char *argv[])
/* Initialize h5tools lib */
h5tools_init();
- (void) HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0);
- (void) HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0);
+ (void)HDsetvbuf(stderr, (char *)NULL, _IOLBF, 0);
+ (void)HDsetvbuf(stdout, (char *)NULL, _IOLBF, 0);
- if((opt = (struct Options *)HDcalloc(1, sizeof(struct Options))) == NULL)
+ if ((opt = (struct Options *)HDcalloc(1, sizeof(struct Options))) == NULL)
goto err;
if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) {
@@ -111,7 +112,7 @@ int main(int argc, char *argv[])
* validate the number of command line arguments
*/
if (argc < 2) {
- (void) HDfprintf(stderr, err1, argc);
+ (void)HDfprintf(stderr, err1, argc);
usage(argv[0]);
goto err;
}
@@ -129,105 +130,105 @@ int main(int argc, char *argv[])
switch (state) {
- case 1: /* counting input files */
- if (opt->fcount < 29) {
- (void) HDstrcpy(opt->infiles[opt->fcount].datafile, argv[i]);
- in = &(opt->infiles[opt->fcount].in);
- opt->infiles[opt->fcount].config = 0;
- setDefaultValues(in, opt->fcount);
- opt->fcount++;
- }
- else {
- (void) HDfprintf(stderr, err9, argv[i]);
- goto err;
- }
+ case 1: /* counting input files */
+ if (opt->fcount < 29) {
+ (void)HDstrcpy(opt->infiles[opt->fcount].datafile, argv[i]);
+ in = &(opt->infiles[opt->fcount].in);
+ opt->infiles[opt->fcount].config = 0;
+ setDefaultValues(in, opt->fcount);
+ opt->fcount++;
+ }
+ else {
+ (void)HDfprintf(stderr, err9, argv[i]);
+ goto err;
+ }
- break;
+ break;
- case 2: /* -c found; look for configfile */
- break;
+ case 2: /* -c found; look for configfile */
+ break;
- case 3: /* get configfile name */
- (void) HDstrcpy(opt->infiles[opt->fcount-1].configfile, argv[i]);
- opt->infiles[opt->fcount - 1].config = 1;
- break;
+ case 3: /* get configfile name */
+ (void)HDstrcpy(opt->infiles[opt->fcount - 1].configfile, argv[i]);
+ opt->infiles[opt->fcount - 1].config = 1;
+ break;
- case 4: /* -o found; look for outfile */
- break;
+ case 4: /* -o found; look for outfile */
+ break;
- case 5: /* get outfile found */
- if (HDstrlen(argv[i]) > MAX_PATH_NAME_LENGTH) {
- (void) HDfprintf(stderr, err10, argv[i]);
- goto err;
- }
- (void) HDstrcpy(opt->outfile, argv[i]);
- outfile_named = TRUE;
- break;
+ case 5: /* get outfile found */
+ if (HDstrlen(argv[i]) > MAX_PATH_NAME_LENGTH) {
+ (void)HDfprintf(stderr, err10, argv[i]);
+ goto err;
+ }
+ (void)HDstrcpy(opt->outfile, argv[i]);
+ outfile_named = TRUE;
+ break;
- case 6: /* -h found; help, then exit */
- help(argv[0]);
- HDexit(EXIT_SUCCESS);
- break;
+ case 6: /* -h found; help, then exit */
+ help(argv[0]);
+ HDexit(EXIT_SUCCESS);
+ break;
- case 7: /* -d found; look for dimensions */
- break;
+ case 7: /* -d found; look for dimensions */
+ break;
- case 8: /* read dimensions */
- if (parseDimensions(in, argv[i]) == -1) {
- (void) HDfprintf(stderr, err6, argv[i]);
- goto err;
- }
- break;
+ case 8: /* read dimensions */
+ if (parseDimensions(in, argv[i]) == -1) {
+ (void)HDfprintf(stderr, err6, argv[i]);
+ goto err;
+ }
+ break;
- case 9: /* -p found; look for path name */
- break;
+ case 9: /* -p found; look for path name */
+ break;
- case 10: /* read path name */
- if (parsePathInfo(&in->path, argv[i]) == -1) {
- (void) HDfprintf(stderr, err5, argv[i]);
- goto err;
- }
- break;
+ case 10: /* read path name */
+ if (parsePathInfo(&in->path, argv[i]) == -1) {
+ (void)HDfprintf(stderr, err5, argv[i]);
+ goto err;
+ }
+ break;
- case 11: /* -t found; look for data type */
- break;
+ case 11: /* -t found; look for data type */
+ break;
- case 12: /* read data type */
- if (getInputClass(in, argv[i]) == -1) {
- (void) HDfprintf(stderr, err7, argv[i]);
- goto err;
- }
+ case 12: /* read data type */
+ if (getInputClass(in, argv[i]) == -1) {
+ (void)HDfprintf(stderr, err7, argv[i]);
+ goto err;
+ }
- 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 == 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 13: /* -s found; look for data size */
- break;
+ case 13: /* -s found; look for data size */
+ break;
- case 14: /* read data size */
- if (getInputSize(in, (int) HDstrtol(argv[i], NULL, BASE_10)) == -1) {
- (void) HDfprintf(stderr, err8, argv[i]);
- goto err;
- }
- /*set default value for output-size */
- in->outputSize = in->inputSize;
- break;
+ case 14: /* read data size */
+ if (getInputSize(in, (int)HDstrtol(argv[i], NULL, BASE_10)) == -1) {
+ (void)HDfprintf(stderr, err8, argv[i]);
+ goto err;
+ }
+ /*set default value for output-size */
+ in->outputSize = in->inputSize;
+ break;
- case ERR: /* command syntax error */
- default:
- (void) HDfprintf(stderr, "%s", err2);
- usage(argv[0]);
- goto err;
+ case ERR: /* command syntax error */
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ usage(argv[0]);
+ goto err;
}
}
if (FALSE == outfile_named) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
usage(argv[0]);
goto err;
}
@@ -252,7 +253,7 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;
err:
- (void) HDfprintf(stderr, "%s", err4);
+ (void)HDfprintf(stderr, "%s", err4);
for (i = 0; i < opt->fcount; i++) {
in = &(opt->infiles[i].in);
if (in->sizeOfDimension)
@@ -271,10 +272,11 @@ err:
return EXIT_FAILURE;
}
-static int gtoken(char *s)
+static int
+gtoken(char *s)
{
- size_t len;
- int token = ERR;
+ size_t len;
+ int token = ERR;
const char *err1 = "Illegal argument: %s.\n";
@@ -284,47 +286,47 @@ static int gtoken(char *s)
if (s[0] == '-') { /* option name (or negative number) */
len = HDstrlen(&s[1]);
switch (s[1]) {
- case 'o':
- if (!HDstrncmp("outfile", &s[1], len))
- token = OPT_o;
- break;
+ case 'o':
+ if (!HDstrncmp("outfile", &s[1], len))
+ token = OPT_o;
+ break;
- case 'c':
- if (!HDstrncmp("config", &s[1], len))
- token = OPT_c;
- break;
+ case 'c':
+ if (!HDstrncmp("config", &s[1], len))
+ token = OPT_c;
+ break;
- case 'h':
- if (!HDstrncmp("help", &s[1], len))
- token = OPT_h;
- break;
+ case 'h':
+ if (!HDstrncmp("help", &s[1], len))
+ token = OPT_h;
+ break;
- case 'd':
- if (!HDstrncmp("dims", &s[1], len))
- token = OPT_d;
- break;
+ case 'd':
+ if (!HDstrncmp("dims", &s[1], len))
+ token = OPT_d;
+ break;
- case 'p':
- if (!HDstrncmp("path", &s[1], len))
- token = OPT_p;
- break;
+ case 'p':
+ if (!HDstrncmp("path", &s[1], len))
+ token = OPT_p;
+ break;
- case 't':
- if (!HDstrncmp("type", &s[1], len))
- token = OPT_t;
- break;
+ case 't':
+ if (!HDstrncmp("type", &s[1], len))
+ token = OPT_t;
+ break;
- case 's':
- if (!HDstrncmp("size", &s[1], len))
- token = OPT_s;
- break;
- default:
- token = ERR; /* not a supported option tag */
- break;
+ case 's':
+ if (!HDstrncmp("size", &s[1], len))
+ token = OPT_s;
+ break;
+ default:
+ token = ERR; /* not a supported option tag */
+ break;
}
if (token == ERR)
- (void) HDfprintf(stderr, err1, s);
+ (void)HDfprintf(stderr, err1, s);
}
else { /* filename */
token = FILNAME;
@@ -347,19 +349,20 @@ static int gtoken(char *s)
*-------------------------------------------------------------------------
*/
-static int processDataFile(char *infile, struct Input *in, hid_t file_id)
+static int
+processDataFile(char *infile, struct Input *in, hid_t file_id)
{
- FILE *strm = NULL;
- const char *err1 = "Unable to open the input file %s for reading.\n";
- const char *err2 = "Error in allocating integer data storage.\n";
- const char *err3 = "Error in allocating floating-point data storage.\n";
- const char *err4 = "Error in reading integer data.\n";
- const char *err5 = "Error in reading floating-point data.\n";
- const char *err6 = "Error in allocating unsigned integer data storage.\n";
- const char *err7 = "Error in reading unsigned integer data.\n";
- const char *err10 = "Unrecognized input class type.\n";
- const char *err11 = "Error in reading string data.\n";
- int retval = -1;
+ FILE * strm = NULL;
+ const char *err1 = "Unable to open the input file %s for reading.\n";
+ const char *err2 = "Error in allocating integer data storage.\n";
+ const char *err3 = "Error in allocating floating-point data storage.\n";
+ const char *err4 = "Error in reading integer data.\n";
+ const char *err5 = "Error in reading floating-point data.\n";
+ const char *err6 = "Error in allocating unsigned integer data storage.\n";
+ const char *err7 = "Error in reading unsigned integer data.\n";
+ const char *err10 = "Unrecognized input class type.\n";
+ const char *err11 = "Error in reading string data.\n";
+ int retval = -1;
/*-------------------------------------------------------------------------
* special case for opening binary classes in H5_HAVE_WIN32_API
@@ -368,10 +371,10 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
* "UIN" denotes an unsigned integer binary file,
*-------------------------------------------------------------------------
*/
- if (in->inputClass == 4 /* "IN" */|| in->inputClass == 3 /* "FP" */|| in->inputClass == 7 /* "UIN" */) {
+ if (in->inputClass == 4 /* "IN" */ || in->inputClass == 3 /* "FP" */ || in->inputClass == 7 /* "UIN" */) {
if ((strm = HDfopen(infile, READ_OPEN_FLAGS)) == NULL) {
- (void) HDfprintf(stderr, err1, infile);
+ (void)HDfprintf(stderr, err1, infile);
goto error;
}
}
@@ -381,85 +384,85 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
*/
else {
if ((strm = HDfopen(infile, "r")) == NULL) {
- (void) HDfprintf(stderr, err1, infile);
+ (void)HDfprintf(stderr, err1, infile);
goto error;
}
}
switch (in->inputClass) {
- case 0: /* TEXTIN */
- case 4: /* IN */
- if (allocateIntegerStorage(in) == -1) {
- (void) HDfprintf(stderr, err2, infile);
- goto error;
- }
+ case 0: /* TEXTIN */
+ case 4: /* IN */
+ if (allocateIntegerStorage(in) == -1) {
+ (void)HDfprintf(stderr, err2, infile);
+ goto error;
+ }
- if (readIntegerData(strm, in) == -1) {
- (void) HDfprintf(stderr, err4, infile);
- goto error;
- }
- break;
+ if (readIntegerData(strm, in) == -1) {
+ (void)HDfprintf(stderr, err4, infile);
+ goto error;
+ }
+ break;
- case 1: /* TEXTFP */
- case 2: /* TEXTFPE */
- case 3: /* FP */
- if (allocateFloatStorage(in) == -1) {
- (void) HDfprintf(stderr, err3, infile);
- goto error;
+ case 1: /* TEXTFP */
+ case 2: /* TEXTFPE */
+ case 3: /* FP */
+ if (allocateFloatStorage(in) == -1) {
+ (void)HDfprintf(stderr, err3, infile);
+ goto error;
+ }
- }
+ if (readFloatData(strm, in) == -1) {
+ (void)HDfprintf(stderr, err5, infile);
+ goto error;
+ }
+ break;
- if (readFloatData(strm, in) == -1) {
- (void) HDfprintf(stderr, err5, infile);
- goto error;
- }
- break;
+ case 5: /* STR */
+ if (in->h5dumpInput) {
+ if (processStrHDFData(strm, in, file_id) == -1) {
+ (void)HDfprintf(stderr, err11, infile);
+ goto error;
+ }
+ }
+ else {
+ if (processStrData(strm, in, file_id) == -1) {
+ (void)HDfprintf(stderr, err11, infile);
+ goto error;
+ }
+ }
+
+ break;
- case 5: /* STR */
- if (in->h5dumpInput) {
- if (processStrHDFData(strm, in, file_id) == -1) {
- (void) HDfprintf(stderr, err11, infile);
+ case 6: /* TEXTUIN */
+ case 7: /* UIN */
+ if (allocateUIntegerStorage(in) == -1) {
+ (void)HDfprintf(stderr, err6, infile);
goto error;
}
- }
- else {
- if (processStrData(strm, in, file_id) == -1) {
- (void) HDfprintf(stderr, err11, infile);
+ if (readUIntegerData(strm, in) == -1) {
+ (void)HDfprintf(stderr, err7, infile);
goto error;
}
- }
-
- break;
+ break;
- case 6: /* TEXTUIN */
- case 7: /* UIN */
- if (allocateUIntegerStorage(in) == -1) {
- (void) HDfprintf(stderr, err6, infile);
- goto error;
- }
- if (readUIntegerData(strm, in) == -1) {
- (void) HDfprintf(stderr, err7, infile);
+ default:
+ (void)HDfprintf(stderr, "%s", err10);
goto error;
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err10);
- goto error;
}
/* Set success return value */
retval = 0;
error:
- if(strm)
+ if (strm)
HDfclose(strm);
- return(retval);
+ return (retval);
}
-static int readIntegerData(FILE *strm, struct Input *in)
+static int
+readIntegerData(FILE *strm, struct Input *in)
{
- H5DT_INT8 *in08;
+ H5DT_INT8 * in08;
H5DT_INT16 *in16;
H5DT_INT16 temp16;
H5DT_INT32 *in32;
@@ -469,9 +472,9 @@ static int readIntegerData(FILE *strm, struct Input *in)
H5DT_INT64 temp64;
char buffer[256];
#endif
- hsize_t len = 1;
- hsize_t i;
- int j;
+ hsize_t len = 1;
+ hsize_t i;
+ int j;
const char *err1 = "Unable to get integer value from file.\n";
const char *err2 = "Unrecognized input class type.\n";
@@ -481,160 +484,161 @@ static int readIntegerData(FILE *strm, struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 8:
- switch (in->inputClass) {
- case 0: /* TEXTIN */
- in08 = (H5DT_INT8 *) in->data;
- for (i = 0; i < len; i++, in08++) {
- if (fscanf(strm, "%hd", &temp16) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- (*in08) = (H5DT_INT8) temp16;
- }
- break;
+ case 8:
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ in08 = (H5DT_INT8 *)in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (HDfscanf(strm, "%hd", &temp16) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ (*in08) = (H5DT_INT8)temp16;
+ }
+ break;
- case 4: /* IN */
- in08 = (H5DT_INT8 *) in->data;
- for (i = 0; i < len; i++, in08++) {
- if (HDfread((char *) in08, sizeof(H5DT_INT8), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
+ case 4: /* IN */
+ in08 = (H5DT_INT8 *)in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (HDfread((char *)in08, sizeof(H5DT_INT8), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
#ifdef H5DEBUGIMPORT
- HDprintf("readIntegerData %d (0x%.8X)\n", *in08, *in08);
+ HDprintf("readIntegerData %d (0x%.8X)\n", *in08, *in08);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
- case 16:
- in16 = (H5DT_INT16 *) in->data;
- switch (in->inputClass) {
- case 0: /* TEXTIN */
- for (i = 0; i < len; i++, in16++) {
- if (fscanf(strm, "%hd", in16) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
}
- in16 = (H5DT_INT16 *) in->data;
break;
- case 4: /* IN */
- for (i = 0; i < len; i++, in16++) {
- if (HDfread((char *)&temp16, sizeof(H5DT_INT16), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in16 = swap_int16(temp16);
- else
-*/
- *in16 = temp16;
+ case 16:
+ in16 = (H5DT_INT16 *)in->data;
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ for (i = 0; i < len; i++, in16++) {
+ if (HDfscanf(strm, "%hd", in16) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ in16 = (H5DT_INT16 *)in->data;
+ break;
+
+ case 4: /* IN */
+ for (i = 0; i < len; i++, in16++) {
+ if (HDfread((char *)&temp16, sizeof(H5DT_INT16), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in16 = swap_int16(temp16);
+ else
+ */
+ *in16 = temp16;
#ifdef H5DEBUGIMPORT
- HDprintf("readIntegerData %d (0x%.8X)\n", *in16, temp16);
+ HDprintf("readIntegerData %d (0x%.8X)\n", *in16, temp16);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
- case 32:
- in32 = (H5DT_INT32 *) in->data;
- switch (in->inputClass) {
- case 0: /* TEXTIN */
- for (i = 0; i < len; i++, in32++) {
- if (fscanf(strm, "%d", in32) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
}
break;
- case 4: /* IN */
- for (i = 0; i < len; i++, in32++) {
- if (HDfread((char *)&temp32, sizeof(H5DT_INT32), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in32 = swap_int32(temp32);
- else
-*/
- *in32 = temp32;
+ case 32:
+ in32 = (H5DT_INT32 *)in->data;
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ for (i = 0; i < len; i++, in32++) {
+ if (HDfscanf(strm, "%d", in32) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ case 4: /* IN */
+ for (i = 0; i < len; i++, in32++) {
+ if (HDfread((char *)&temp32, sizeof(H5DT_INT32), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in32 = swap_int32(temp32);
+ else
+ */
+ *in32 = temp32;
#ifdef H5DEBUGIMPORT
- HDprintf("readIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32);
+ HDprintf("readIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
-#ifdef H5_SIZEOF_LONG_LONG
- case 64:
- in64 = (H5DT_INT64 *) in->data;
- switch (in->inputClass) {
- case 0: /* TEXTIN */
- for (i = 0; i < len; i++, in64++) {
- if (fscanf(strm, "%s", buffer) < 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
- *in64 = (H5DT_INT64) HDstrtoll(buffer, NULL, 10);
}
break;
- case 4: /* IN */
- for (i = 0; i < len; i++, in64++) {
- if (HDfread((char *)&temp64, sizeof(H5DT_INT64), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in64 = swap_int64(temp64);
- else
-*/
- *in64 = temp64;
+#ifdef H5_SIZEOF_LONG_LONG
+ case 64:
+ in64 = (H5DT_INT64 *)in->data;
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ for (i = 0; i < len; i++, in64++) {
+ if (HDfscanf(strm, "%s", buffer) < 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ *in64 = (H5DT_INT64)HDstrtoll(buffer, NULL, 10);
+ }
+ break;
+
+ case 4: /* IN */
+ for (i = 0; i < len; i++, in64++) {
+ if (HDfread((char *)&temp64, sizeof(H5DT_INT64), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in64 = swap_int64(temp64);
+ else
+ */
+ *in64 = temp64;
#ifdef H5DEBUGIMPORT
- HDprintf("readIntegerData %d (0x%.8X)\n", *in64, temp64);
+ HDprintf("readIntegerData %d (0x%.8X)\n", *in64, temp64);
#endif
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
}
break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
#endif /* ifdef H5_SIZEOF_LONG_LONG */
- default:
- (void) HDfprintf(stderr, "%s", err3);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ break;
}
return (0);
}
-static int readUIntegerData(FILE *strm, struct Input *in)
+static int
+readUIntegerData(FILE *strm, struct Input *in)
{
- H5DT_UINT8 *in08;
+ H5DT_UINT8 * in08;
H5DT_UINT16 *in16;
H5DT_UINT16 temp16;
H5DT_UINT32 *in32;
@@ -642,7 +646,7 @@ static int readUIntegerData(FILE *strm, struct Input *in)
#ifdef H5_SIZEOF_LONG_LONG
H5DT_UINT64 *in64;
H5DT_UINT64 temp64;
- char buffer[256];
+ char buffer[256];
#endif
hsize_t len = 1;
hsize_t i;
@@ -655,161 +659,162 @@ static int readUIntegerData(FILE *strm, struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 8:
- switch (in->inputClass) {
- case 6: /* TEXTUIN */
- in08 = (H5DT_UINT8 *) in->data;
- for (i = 0; i < len; i++, in08++) {
- if (fscanf(strm, "%hu", &temp16) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- (*in08) = (H5DT_UINT8) temp16;
- }
- break;
-
- case 7: /* UIN */
- in08 = (H5DT_UINT8 *) in->data;
- for (i = 0; i < len; i++, in08++) {
- if (HDfread((char *) in08, sizeof(H5DT_UINT8), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- }
- break;
+ case 8:
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ in08 = (H5DT_UINT8 *)in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (HDfscanf(strm, "%hu", &temp16) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ (*in08) = (H5DT_UINT8)temp16;
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ case 7: /* UIN */
+ in08 = (H5DT_UINT8 *)in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (HDfread((char *)in08, sizeof(H5DT_UINT8), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
- case 16:
- in16 = (H5DT_UINT16 *) in->data;
- switch (in->inputClass) {
- case 6: /* TEXTUIN */
- for (i = 0; i < len; i++, in16++) {
- if (fscanf(strm, "%hu", in16) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
}
break;
- case 7: /* UIN */
- for (i = 0; i < len; i++, in16++) {
- if (HDfread((char *)&temp16, sizeof(H5DT_UINT16), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in16 = swap_uint16(temp16);
- else
-*/
- *in16 = temp16;
+ case 16:
+ in16 = (H5DT_UINT16 *)in->data;
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ for (i = 0; i < len; i++, in16++) {
+ if (HDfscanf(strm, "%hu", in16) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ case 7: /* UIN */
+ for (i = 0; i < len; i++, in16++) {
+ if (HDfread((char *)&temp16, sizeof(H5DT_UINT16), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in16 = swap_uint16(temp16);
+ else
+ */
+ *in16 = temp16;
#ifdef H5DEBUGIMPORT
- HDprintf("readUIntegerData %d (0x%.4X = 0x%.4X)\n", *in16, *in16, temp16);
+ HDprintf("readUIntegerData %d (0x%.4X = 0x%.4X)\n", *in16, *in16, temp16);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
- case 32:
- in32 = (H5DT_UINT32 *) in->data;
- switch (in->inputClass) {
- case 6: /* TEXTUIN */
- for (i = 0; i < len; i++, in32++) {
- if (fscanf(strm, "%u", in32) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
}
break;
- case 7: /* UIN */
- for (i = 0; i < len; i++, in32++) {
- if (HDfread((char *)&temp32, sizeof(H5DT_UINT32), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in32 = swap_uint32(temp32);
- else
-*/
- *in32 = temp32;
+ case 32:
+ in32 = (H5DT_UINT32 *)in->data;
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ for (i = 0; i < len; i++, in32++) {
+ if (HDfscanf(strm, "%u", in32) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ case 7: /* UIN */
+ for (i = 0; i < len; i++, in32++) {
+ if (HDfread((char *)&temp32, sizeof(H5DT_UINT32), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in32 = swap_uint32(temp32);
+ else
+ */
+ *in32 = temp32;
#ifdef H5DEBUGIMPORT
- HDprintf("readUIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32);
+ HDprintf("readUIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
-#ifdef H5_SIZEOF_LONG_LONG
- case 64:
- in64 = (H5DT_UINT64 *) in->data;
- switch (in->inputClass) {
- case 6: /* TEXTUIN */
- for (i = 0; i < len; i++, in64++) {
- if (fscanf(strm, "%s", buffer) < 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
- *in64 = (H5DT_UINT64) HDstrtoll(buffer, NULL, 10);
}
break;
- case 7: /* UIN */
- for (i = 0; i < len; i++, in64++) {
- if (HDfread((char *)&temp64, sizeof(H5DT_UINT64), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in64 = swap_uint64(temp64);
- else
-*/
- *in64 = temp64;
+#ifdef H5_SIZEOF_LONG_LONG
+ case 64:
+ in64 = (H5DT_UINT64 *)in->data;
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ for (i = 0; i < len; i++, in64++) {
+ if (HDfscanf(strm, "%s", buffer) < 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ *in64 = (H5DT_UINT64)HDstrtoll(buffer, NULL, 10);
+ }
+ break;
+
+ case 7: /* UIN */
+ for (i = 0; i < len; i++, in64++) {
+ if (HDfread((char *)&temp64, sizeof(H5DT_UINT64), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in64 = swap_uint64(temp64);
+ else
+ */
+ *in64 = temp64;
#ifdef H5DEBUGIMPORT
- HDprintf("readUIntegerData %ld (0x%.8X = 0x%.8X)\n", *in64, *in64, temp64);
+ HDprintf("readUIntegerData %ld (0x%.8X = 0x%.8X)\n", *in64, *in64, temp64);
#endif
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
}
break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
#endif /* ifdef H5_SIZEOF_LONG_LONG */
- default:
- (void) HDfprintf(stderr, "%s", err3);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ break;
}
return (0);
}
-static int readFloatData(FILE *strm, struct Input *in)
+static int
+readFloatData(FILE *strm, struct Input *in)
{
H5DT_FLOAT32 *fp32;
- uint32_t *bfp32;
- uint32_t temp32;
+ uint32_t * bfp32;
+ uint32_t temp32;
H5DT_FLOAT64 *fp64;
- uint64_t *bfp64;
- uint64_t temp64;
+ uint64_t * bfp64;
+ uint64_t temp64;
hsize_t len = 1;
hsize_t i;
@@ -822,113 +827,113 @@ static int readFloatData(FILE *strm, struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 32:
- fp32 = (H5DT_FLOAT32 *) in->data;
- switch (in->inputClass) {
- case 1: /* TEXTFP */
- for (i = 0; i < len; i++, fp32++) {
- if (fscanf(strm, "%f", fp32) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- }
+ case 32:
+ fp32 = (H5DT_FLOAT32 *)in->data;
+ switch (in->inputClass) {
+ case 1: /* TEXTFP */
+ for (i = 0; i < len; i++, fp32++) {
+ if (HDfscanf(strm, "%f", fp32) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
- fp32 = (H5DT_FLOAT32 *) in->data;
- break;
+ fp32 = (H5DT_FLOAT32 *)in->data;
+ break;
- /* same as TEXTFP */
- case 2: /*TEXTFPE */
+ /* same as TEXTFP */
+ case 2: /*TEXTFPE */
- for (i = 0; i < len; i++, fp32++) {
- if (fscanf(strm, "%f", fp32) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- }
+ for (i = 0; i < len; i++, fp32++) {
+ if (HDfscanf(strm, "%f", fp32) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
- fp32 = (H5DT_FLOAT32 *) in->data;
- break;
+ fp32 = (H5DT_FLOAT32 *)in->data;
+ break;
- case 3: /* FP */
- bfp32 = (uint32_t *) in->data;
- for (i = 0; i < len; i++, bfp32++) {
- if (HDfread((char *)&temp32, sizeof(uint32_t), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *bfp32 = swap_uint32(temp32);
- else
-*/
- *bfp32 = temp32;
+ case 3: /* FP */
+ bfp32 = (uint32_t *)in->data;
+ for (i = 0; i < len; i++, bfp32++) {
+ if (HDfread((char *)&temp32, sizeof(uint32_t), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *bfp32 = swap_uint32(temp32);
+ else
+ */
+ *bfp32 = temp32;
#ifdef H5DEBUGIMPORT
- HDprintf("readFloatData %ld (0x%.8X = 0x%.8X)\n", *bfp32, *bfp32, temp32);
+ HDprintf("readFloatData %ld (0x%.8X = 0x%.8X)\n", *bfp32, *bfp32, temp32);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
- case 64:
- fp64 = (H5DT_FLOAT64 *) in->data;
- switch (in->inputClass) {
- case 1: /* TEXTFP */
- for (i = 0; i < len; i++, fp64++) {
- if (fscanf(strm, "%lf", fp64) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
}
-
- fp64 = (H5DT_FLOAT64 *) in->data;
break;
- /* same as TEXTFP */
- case 2: /*TEXTFPE */
+ case 64:
+ fp64 = (H5DT_FLOAT64 *)in->data;
+ switch (in->inputClass) {
+ case 1: /* TEXTFP */
+ for (i = 0; i < len; i++, fp64++) {
+ if (HDfscanf(strm, "%lf", fp64) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+
+ fp64 = (H5DT_FLOAT64 *)in->data;
+ break;
- for (i = 0; i < len; i++, fp64++) {
- if (fscanf(strm, "%lf", fp64) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- }
+ /* same as TEXTFP */
+ case 2: /*TEXTFPE */
- fp64 = (H5DT_FLOAT64 *) in->data;
- break;
+ for (i = 0; i < len; i++, fp64++) {
+ if (HDfscanf(strm, "%lf", fp64) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
- case 3: /* FP */
- bfp64 = (uint64_t *) in->data;
- for (i = 0; i < len; i++, bfp64++) {
- if (HDfread((char *)&temp64, sizeof(uint64_t), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *bfp64 = swap_uint64(temp64);
- else
-*/
- *bfp64 = temp64;
+ fp64 = (H5DT_FLOAT64 *)in->data;
+ break;
+
+ case 3: /* FP */
+ bfp64 = (uint64_t *)in->data;
+ for (i = 0; i < len; i++, bfp64++) {
+ if (HDfread((char *)&temp64, sizeof(uint64_t), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *bfp64 = swap_uint64(temp64);
+ else
+ */
+ *bfp64 = temp64;
#ifdef H5DEBUGIMPORT
- HDprintf("readFloatData %ld (0x%.16lX)\n", *bfp64, temp64);
+ HDprintf("readFloatData %ld (0x%.16lX)\n", *bfp64, temp64);
#endif
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
}
break;
default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
- break;
+ (void)HDfprintf(stderr, "%s", err3);
+ break;
}
return (0);
}
@@ -947,7 +952,8 @@ static int readFloatData(FILE *strm, struct Input *in)
*
*-------------------------------------------------------------------------
*/
-static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
+static int
+processStrData(FILE *strm, struct Input *in, hid_t file_id)
{
hid_t group_id;
hid_t dset_id;
@@ -968,8 +974,8 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
*-------------------------------------------------------------------------
*/
- while(EOF != (c = HDfgetc(strm)))
- if (c == 10) /* eol */
+ while (EOF != (c = HDfgetc(strm)))
+ if (c == 10) /* eol */
nlines++;
if (!nlines)
@@ -997,13 +1003,14 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
{
/* create parent groups */
if (in->path.count > 1) {
- j = 0;
+ 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);
+ group_id =
+ H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
handle = group_id;
break;
}
@@ -1013,7 +1020,7 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
}
else {
handle = file_id;
- j = 0;
+ j = 0;
}
/*enable error reporting */
@@ -1026,21 +1033,22 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
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)
+ if ((dset_id = H5Dcreate2(handle, in->path.group[j], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto out;
line = 0;
- while(EOF != (c = HDfgetc(strm))) {
+ while (EOF != (c = HDfgetc(strm))) {
str[i] = (char)c;
i++;
if (c == 10) { /* eol */
- char *str2 = str;
- hid_t fspace_id;
+ char * str2 = str;
+ hid_t fspace_id;
hsize_t start[1];
- hsize_t count[1] = { 1 };
+ hsize_t count[1] = {1};
str[i - 1] = '\0'; /* terminate string */
@@ -1058,9 +1066,8 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
if (H5Sclose(fspace_id) < 0)
goto out;
- i = 0;
+ i = 0;
str[0] = '\0';
-
}
}
@@ -1087,20 +1094,21 @@ out:
*
*-------------------------------------------------------------------------
*/
-static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
+static int
+processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
{
- hid_t group_id = H5I_INVALID_HID;
- hid_t dset_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- hid_t mspace_id = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- hid_t handle = H5I_INVALID_HID;
- char *str1 = NULL;
- char *str2 = NULL;
- char *str3 = NULL;
- char str[1024] = "";
+ hid_t group_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t mspace_id = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t handle = H5I_INVALID_HID;
+ char * str1 = NULL;
+ char * str2 = NULL;
+ char * str3 = NULL;
+ char str[1024] = "";
int j;
- hsize_t line;
+ hsize_t line;
/*-------------------------------------------------------------------------
* read file and generate an HDF5 dataset
@@ -1121,13 +1129,14 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
{
/* create parent groups */
if (in->path.count > 1) {
- j = 0;
+ 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);
+ group_id =
+ H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
handle = group_id;
break;
}
@@ -1137,7 +1146,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
}
else {
handle = file_id;
- j = 0;
+ j = 0;
}
/*enable error reporting */
@@ -1153,67 +1162,69 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
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)
+ if ((dset_id = H5Dcreate2(handle, in->path.group[j], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto out;
#ifdef H5DEBUGIMPORT
HDprintf("processStrHDFData DATATYPE STRING ready to process strings\n");
#endif
line = 0;
- j = 0;
+ j = 0;
- while (HDfgets(str,sizeof(str),strm)) {
+ while (HDfgets(str, sizeof(str), strm)) {
str1 = str;
str2 = NULL;
str3 = NULL;
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING[%llu]={%s}\n", (unsigned long long)line, str1);
+ HDprintf("processStrHDFData DATATYPE STRING[%llu]={%s}\n", (unsigned long long)line, str1);
#endif
- /* process string to remove the first and last quote char */
- str2 = strchr(str1, '"');
- if (str2 != NULL) {
+ /* process string to remove the first and last quote char */
+ str2 = strchr(str1, '"');
+ if (str2 != NULL) {
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
+ HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
#endif
- str2++;
+ str2++;
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
+ HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
#endif
- str3 = strrchr(str2, '"');
- if (str3 != NULL) {
+ str3 = strrchr(str2, '"');
+ if (str3 != NULL) {
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str3), str3);
+ HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str3), str3);
#endif
- *str3 = '\0';
+ *str3 = '\0';
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
+ HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
#endif
- if(HDstrlen(str2) > 0) {
- hid_t fspace_id;
- hsize_t start[1];
- hsize_t count[1] = { 1 };
+ if (HDstrlen(str2) > 0) {
+ hid_t fspace_id;
+ hsize_t start[1];
+ hsize_t count[1] = {1};
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING[%llu] store %s\n", (unsigned long long)line, str2);
+ HDprintf("processStrHDFData DATATYPE STRING[%llu] store %s\n", (unsigned long long)line,
+ str2);
#endif
- if ((fspace_id = H5Dget_space(dset_id)) < 0)
- goto out;
+ if ((fspace_id = H5Dget_space(dset_id)) < 0)
+ goto out;
- start[0] = line++;
+ start[0] = line++;
- if (H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
- goto out;
+ 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 (H5Dwrite(dset_id, type_id, mspace_id, fspace_id, H5P_DEFAULT, &str2) < 0)
+ goto out;
- if (H5Sclose(fspace_id) < 0)
- goto out;
- }
+ if (H5Sclose(fspace_id) < 0)
+ goto out;
}
}
+ }
str[0] = '\0';
j++;
}
@@ -1233,21 +1244,22 @@ out:
#ifdef H5DEBUGIMPORT
HDprintf("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;
+ /* 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)
+static int
+allocateIntegerStorage(struct Input *in)
{
hsize_t len = 1;
int j;
@@ -1258,44 +1270,45 @@ static int allocateIntegerStorage(struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 8:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT8))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 8:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT8))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 16:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT16))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 16:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT16))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 32:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT32))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 32:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT32))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 64:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT64))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 64:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT64))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ break;
}
return (0);
}
-static int allocateUIntegerStorage(struct Input *in)
+static int
+allocateUIntegerStorage(struct Input *in)
{
- hsize_t len = 1;
+ hsize_t len = 1;
const char *err1 = "Unable to allocate dynamic memory.\n";
const char *err2 = "Invalid storage size for unsigned integer input data.\n";
int j;
@@ -1304,42 +1317,43 @@ static int allocateUIntegerStorage(struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 8:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT8))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 8:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT8))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 16:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT16))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 16:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT16))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 32:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT32))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 32:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT32))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 64:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT64))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 64:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT64))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ break;
}
return (0);
}
-static int allocateFloatStorage(struct Input *in)
+static int
+allocateFloatStorage(struct Input *in)
{
hsize_t len = 1;
int j;
@@ -1350,54 +1364,55 @@ static int allocateFloatStorage(struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 32:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_FLOAT32))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 32:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_FLOAT32))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 64:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_FLOAT64))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 64:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_FLOAT64))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ break;
}
return (0);
}
-static int processConfigurationFile(char *infile, struct Input *in)
+static int
+processConfigurationFile(char *infile, struct Input *in)
{
- FILE *strm = NULL;
- char key[MAX_PATH_NAME_LENGTH];
- int kindex;
- char temp[MAX_PATH_NAME_LENGTH];
- int ival;
- int scanret;
- int retval = -1;
-
- const char *err1 = "Unable to open the configuration file: %s for reading.\n";
- const char *err2 = "Unknown keyword: %s in configuration file: %s\n";
- const char *err3a = "PATH keyword appears twice in %s.\n";
- const char *err3b = "Error in parsing the path information from %s.\n";
- const char *err4a = "INPUT-CLASS keyword appears twice in %s.\n";
- const char *err4b = "Error in retrieving the input class from %s.\n";
- const char *err5a = "INPUT-SIZE keyword appears twice in %s.\n";
- const char *err5b = "Error in retrieving the input size from %s.\n";
- const char *err6a = "RANK keyword appears twice in %s.\n";
- const char *err6b = "Error in retrieving the rank from %s.\n";
- const char *err7a = "DIMENSION-SIZES keyword appears twice in %s.\n";
- const char *err7b = "DIMENSION-SIZES cannot appear before RANK is provided.\n";
- const char *err7c = "Error in retrieving the dimension sizes from %s.\n";
- const char *err8a = "OUTPUT-CLASS keyword appears twice in %s.\n";
- const char *err8b = "Error in retrieving the output class from %s.\n";
- const char *err9a = "OUTPUT-SIZE keyword appears twice in %s.\n";
- const char *err9b = "Error in retrieving the output size from %s.\n";
+ FILE *strm = NULL;
+ char key[MAX_PATH_NAME_LENGTH];
+ int kindex;
+ char temp[MAX_PATH_NAME_LENGTH];
+ int ival;
+ int scanret;
+ int retval = -1;
+
+ const char *err1 = "Unable to open the configuration file: %s for reading.\n";
+ const char *err2 = "Unknown keyword: %s in configuration file: %s\n";
+ const char *err3a = "PATH keyword appears twice in %s.\n";
+ const char *err3b = "Error in parsing the path information from %s.\n";
+ const char *err4a = "INPUT-CLASS keyword appears twice in %s.\n";
+ const char *err4b = "Error in retrieving the input class from %s.\n";
+ const char *err5a = "INPUT-SIZE keyword appears twice in %s.\n";
+ const char *err5b = "Error in retrieving the input size from %s.\n";
+ const char *err6a = "RANK keyword appears twice in %s.\n";
+ const char *err6b = "Error in retrieving the rank from %s.\n";
+ const char *err7a = "DIMENSION-SIZES keyword appears twice in %s.\n";
+ const char *err7b = "DIMENSION-SIZES cannot appear before RANK is provided.\n";
+ const char *err7c = "Error in retrieving the dimension sizes from %s.\n";
+ const char *err8a = "OUTPUT-CLASS keyword appears twice in %s.\n";
+ const char *err8b = "Error in retrieving the output class from %s.\n";
+ const char *err9a = "OUTPUT-SIZE keyword appears twice in %s.\n";
+ const char *err9b = "Error in retrieving the output size from %s.\n";
const char *err10a = "OUTPUT-ARCHITECTURE keyword appears twice in %s.\n";
const char *err10b = "Error in retrieving the output architecture from %s.\n";
const char *err11a = "OUTPUT-BYTE-ORDER keyword appears twice in %s.\n";
@@ -1417,10 +1432,10 @@ static int processConfigurationFile(char *infile, struct Input *in)
const char *err16a = "MAXIMUM-DIMENSIONS keyword appears twice in %s.\n";
const char *err16b = "MAXIMUM-DIMENSIONS cannot appear before DIMENSION-SIZES are provided.\n";
const char *err16c = "Error in retrieving the maximum dimension sizes from %s.\n";
- const char *err17 = "Configuration parameters are invalid in %s.\n";
- const char *err18 = "Unable to get string value.\n";
- const char *err19 = "Unable to get integer value.\n";
- const char *err20 = "Unable to get subset values.\n";
+ const char *err17 = "Configuration parameters are invalid in %s.\n";
+ const char *err18 = "Unable to get string value.\n";
+ const char *err19 = "Unable to get integer value.\n";
+ const char *err20 = "Unable to get subset values.\n";
/* create vector to map which keywords have been found
check vector after each keyword to check for violation
@@ -1429,17 +1444,17 @@ static int processConfigurationFile(char *infile, struct Input *in)
*/
/* Initialize machine endian */
- volatile uint32_t ibyte=0x01234567;
+ volatile uint32_t ibyte = 0x01234567;
/* 0 for big endian, 1 for little endian. */
- if ((*((volatile uint8_t*)(&ibyte))) == 0x67) {
+ if ((*((volatile uint8_t *)(&ibyte))) == 0x67) {
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err11e);
+ (void)HDfprintf(stderr, "%s", err11e);
return (-1);
}
}
else {
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err11e);
+ (void)HDfprintf(stderr, "%s", err11e);
return (-1);
}
}
@@ -1450,64 +1465,64 @@ static int processConfigurationFile(char *infile, struct Input *in)
in->inputArchitecture = 0; /* default to NATIVE */
if ((strm = HDfopen(infile, "r")) == NULL) {
- (void) HDfprintf(stderr, err1, infile);
+ (void)HDfprintf(stderr, err1, infile);
goto error;
}
- scanret = fscanf(strm, "%254s", key);
- if((scanret == 1) && !HDstrcmp("HDF5", key)) {
+ scanret = HDfscanf(strm, "%254s", key);
+ if ((scanret == 1) && !HDstrcmp("HDF5", key)) {
#ifdef H5DEBUGIMPORT
int pndx;
HDprintf("\nh5dump file\n");
#endif
in->h5dumpInput = 1;
- scanret = fscanf(strm, "%254s", temp); /* filename */
- scanret = fscanf(strm, "%254s", temp); /* start bracket */
- scanret = fscanf(strm, "%254s", key); /* DATASET */
+ scanret = HDfscanf(strm, "%254s", temp); /* filename */
+ scanret = HDfscanf(strm, "%254s", temp); /* start bracket */
+ scanret = HDfscanf(strm, "%254s", key); /* DATASET */
while (scanret == 1) {
- if(!HDstrcmp("DATASET", key)) { /* PATH */
+ if (!HDstrcmp("DATASET", key)) { /* PATH */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASET key\n");
#endif
if (in->configOptionVector[PATH] == 1) {
- (void) HDfprintf(stderr, err3a, infile);
+ (void)HDfprintf(stderr, err3a, infile);
goto error;
}
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASET %s found\n", temp);
#endif
if (parsePathInfo(&in->path, temp) == -1) {
- (void) HDfprintf(stderr, err3b, infile);
+ (void)HDfprintf(stderr, err3b, infile);
goto error;
}
in->configOptionVector[PATH] = 1;
- scanret = fscanf(strm, "%254s", temp); /* start bracket */
+ scanret = HDfscanf(strm, "%254s", temp); /* start bracket */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASET %s found\n", temp);
#endif
- } /* if(!HDstrcmp("DATASET", key)) PATH */
- else if(!HDstrcmp("DATATYPE", key)) { /* INPUT-CLASS */
+ } /* if(!HDstrcmp("DATASET", key)) PATH */
+ else if (!HDstrcmp("DATATYPE", key)) { /* INPUT-CLASS */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE key\n");
#endif
if (in->configOptionVector[INPUT_CLASS] == 1) {
- (void) HDfprintf(stderr, err4a, infile);
+ (void)HDfprintf(stderr, err4a, infile);
goto error;
}
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE %s found\n", temp);
#endif
if ((kindex = getInputClassType(in, temp)) == -1) {
- (void) HDfprintf(stderr, err4b, infile);
+ (void)HDfprintf(stderr, err4b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1520,8 +1535,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
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)
+ if (in->inputClass == 1 || in->inputClass == 2 || in->inputClass == 3)
in->outputClass = 1;
if (in->inputClass == 6 || in->inputClass == 7)
in->outputClass = 2;
@@ -1530,37 +1544,37 @@ static int processConfigurationFile(char *infile, struct Input *in)
HDprintf("h5dump DATATYPE type %d outputClass\n", in->outputClass);
#endif
- if(in->inputClass == 5) { /* STRING */
+ if (in->inputClass == 5) { /* STRING */
int get_next_prop = 1;
- in->outputClass = -1;
+ in->outputClass = -1;
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING found\n");
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING %s found\n", temp);
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* string properties */
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* string properties */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
while (get_next_prop) {
- if(!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err19);
+ if (!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err19);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING STRSIZE %s found\n", temp);
#endif
- if (HDstrcmp("H5T_VARIABLE;", temp)) {
+ if (HDstrcmp("H5T_VARIABLE;", temp) != 0) {
char *more = temp;
- ival = (int)HDstrtol(more, &more, 10);
+ ival = (int)HDstrtol(more, &more, 10);
if (getInputSize(in, ival) == -1) {
- (void) HDfprintf(stderr, err5b, infile);
+ (void)HDfprintf(stderr, err5b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1568,119 +1582,119 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
}
}
- else if(!HDstrcmp("STRPAD", temp)) { /* STRPAD */
- if (fscanf(strm, "%254s", temp) != 1) { /* STRPAD type */
- (void) HDfprintf(stderr, "%s", err18);
+ else if (!HDstrcmp("STRPAD", temp)) { /* STRPAD */
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* STRPAD type */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING STRPAD %s found\n", temp);
#endif
}
- else if(!HDstrcmp("CSET", key)) { /* CSET */
- if (fscanf(strm, "%254s", temp) != 1) { /* CSET type */
- (void) HDfprintf(stderr, "%s", err18);
+ else if (!HDstrcmp("CSET", key)) { /* CSET */
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* CSET type */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING CSET %s found\n", temp);
#endif
-
}
- else if(!HDstrcmp("CTYPE", temp)) { /* CTYPE */
- if (fscanf(strm, "%254s", temp) != 1) { /* CTYPE type */
- (void) HDfprintf(stderr, "%s", err18);
+ else if (!HDstrcmp("CTYPE", temp)) { /* CTYPE */
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* CTYPE type */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING CTYPE %s found\n", temp);
#endif
} /* if(!HDstrcmp("CSET", key)) */
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING %s found\n", temp);
#endif
- if(!HDstrcmp("}", temp)) { /* end bracket */
+ 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];
+ } /* 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
HDprintf("h5dump DATASPACE key\n");
#endif
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
- if(!HDstrcmp("SCALAR", temp)) { /* SCALAR */
+ if (!HDstrcmp("SCALAR", temp)) { /* SCALAR */
in->rank = 0;
- } /* if(!HDstrcmp("SCALAR", key)) */
- else if(!HDstrcmp("NULL", temp)) { /* NULL */
- (void) HDfprintf(stderr, err6b, infile);
+ } /* if(!HDstrcmp("SCALAR", key)) */
+ else if (!HDstrcmp("NULL", temp)) { /* NULL */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
- } /* else if(!HDstrcmp("NULL", key)) */
- else if(!HDstrcmp("SIMPLE", temp)) { /* SIMPLE */
+ } /* else if(!HDstrcmp("NULL", key)) */
+ else if (!HDstrcmp("SIMPLE", temp)) { /* SIMPLE */
int icount = 0;
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE found\n");
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if(!HDstrcmp("(", temp)) { /* start paren */
+ if (!HDstrcmp("(", temp)) { /* start paren */
int get_next_dim = 1;
- int i = 0;
+ int i = 0;
- if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
- (void) HDfprintf(stderr, err16c, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
while (get_next_dim) {
- char *more = temp;
+ char *more = temp;
temp_dims[icount] = HDstrtoull(more, &more, 10);
- if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if(!HDstrcmp(")", temp)) { /* end paren */
- in->rank = ++icount;
+ if (!HDstrcmp(")", temp)) { /* end paren */
+ in->rank = ++icount;
in->configOptionVector[RANK] = 1;
- get_next_dim = 0;
+ get_next_dim = 0;
}
else { /* Dimension */
icount++;
if (icount > MAX_NUM_DIMENSION) {
- (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ (void)HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
}
} /* while (get_next_dim) */
- if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ if ((in->sizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) ==
+ NULL) {
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1699,36 +1713,37 @@ static int processConfigurationFile(char *infile, struct Input *in)
in->configOptionVector[DIM] = 1;
} /* if(!HDstrcmp("(", key)) start paren */
else {
- (void) HDfprintf(stderr, err5b, infile);
+ (void)HDfprintf(stderr, err5b, infile);
goto error;
}
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("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) {
+ if (!HDstrcmp("/", temp)) { /* / max dims */
+ if ((in->maxsizeOfDimension =
+ (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
goto error;
}
- if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if(!HDstrcmp("(", temp)) { /* start paren */
+ if (!HDstrcmp("(", temp)) { /* start paren */
int get_next_dim = 1;
- int i = 0;
+ int i = 0;
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE process max dim values\n");
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */
- (void) HDfprintf(stderr, err16c, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1738,28 +1753,29 @@ static int processConfigurationFile(char *infile, struct Input *in)
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE get max dim value\n");
#endif
- if(!HDstrcmp("H5S_UNLIMITED", temp) || !HDstrcmp("H5S_UNLIMITED,", temp)) { /* unlimited */
- in->maxsizeOfDimension[i] = H5S_UNLIMITED;
+ if (!HDstrcmp("H5S_UNLIMITED", temp) ||
+ !HDstrcmp("H5S_UNLIMITED,", temp)) { /* unlimited */
+ in->maxsizeOfDimension[i] = H5S_UNLIMITED;
in->configOptionVector[EXTEND] = 1;
}
else {
- char *more = temp;
+ char *more = temp;
in->maxsizeOfDimension[i] = HDstrtoull(more, &more, 10);
}
- if (fscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */
- (void) HDfprintf(stderr, err16c, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if(!HDstrcmp(")", temp)) { /* end paren */
+ 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");
+ (void)HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
}
@@ -1774,79 +1790,79 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
} /* if(!HDstrcmp("(", key)) start paren */
else {
- (void) HDfprintf(stderr, err16c, infile);
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
- scanret = fscanf(strm, "%254s", temp); /* end bracket */
+ scanret = HDfscanf(strm, "%254s", temp); /* end bracket */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
} /* if(!HDstrcmp("/", key)) max dims separator */
- } /* else if(!HDstrcmp("SIMPLE", key)) */
+ } /* else if(!HDstrcmp("SIMPLE", key)) */
else {
- (void) HDfprintf(stderr, err5b, infile);
+ (void)HDfprintf(stderr, err5b, infile);
goto error;
}
} /* else if(!HDstrcmp("DATASPACE", key)) RANK and DIMENSIONS */
- else if(!HDstrcmp("STORAGE_LAYOUT", key)) { /* CHUNKED-DIMENSION-SIZES */
+ else if (!HDstrcmp("STORAGE_LAYOUT", key)) { /* CHUNKED-DIMENSION-SIZES */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT key\n");
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp);
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* CHUNKED */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* CHUNKED */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("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");
+ 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");
goto error;
}
- if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
#endif
- if(!HDstrcmp("(", temp)) { /* start paren */
+ if (!HDstrcmp("(", temp)) { /* start paren */
int get_next_dim = 1;
- int icount = 0;
+ int icount = 0;
- if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
- (void) HDfprintf(stderr, err16c, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
#endif
while (get_next_dim) {
- char *more = temp;
+ char *more = temp;
in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10);
- if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
#endif
- if(!HDstrcmp(")", temp)) { /* end paren */
+ if (!HDstrcmp(")", temp)) { /* end paren */
in->configOptionVector[RANK] = 1;
- get_next_dim = 0;
+ get_next_dim = 0;
}
else { /* Dimension */
icount++;
if (icount > MAX_NUM_DIMENSION) {
- (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ (void)HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
}
@@ -1861,28 +1877,28 @@ static int processConfigurationFile(char *infile, struct Input *in)
in->configOptionVector[DIM] = 1;
} /* if(!HDstrcmp("(", key)) start paren */
else {
- (void) HDfprintf(stderr, err5b, infile);
+ (void)HDfprintf(stderr, err5b, infile);
goto error;
}
- if (fscanf(strm, "%254s", temp) != 1) { /* SIZE */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* SIZE */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("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);
+ if (!HDstrcmp("SIZE", temp)) { /* SIZE */
+ if (HDfscanf(strm, "%d", (&ival)) != 1) {
+ (void)HDfprintf(stderr, "%s", err19);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT CHUNKED SIZE %d found\n", ival);
#endif
}
- while (HDstrcmp("}", temp)) {
- if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */
- (void) HDfprintf(stderr, "%s", err18);
+ while (HDstrcmp("}", temp) != 0) {
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* end bracket */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1891,148 +1907,148 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
in->configOptionVector[CHUNK] = 1;
} /* if(!HDstrcmp("CHUNKED", key)) CHUNKED */
- } /* else if(!HDstrcmp("STORAGE_LAYOUT", key)) CHUNKED-DIMENSION-SIZES */
- else if(!HDstrcmp("FILTERS", key)) { /* FILTERS */
+ } /* else if(!HDstrcmp("STORAGE_LAYOUT", key)) CHUNKED-DIMENSION-SIZES */
+ else if (!HDstrcmp("FILTERS", key)) { /* FILTERS */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS key\n");
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS %s found\n", temp);
#endif
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS %s found\n", temp);
#endif
- if(!HDstrcmp("COMPRESSION", temp)) { /* COMPRESSION */
+ if (!HDstrcmp("COMPRESSION", temp)) { /* COMPRESSION */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION found\n");
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* DEFLATE */
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* DEFLATE */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* bgin bracket */
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* bgin bracket */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* LEVEL */
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* LEVEL */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
- if (fscanf(strm, "%d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err19);
+ if (HDfscanf(strm, "%d", (&ival)) != 1) {
+ (void)HDfprintf(stderr, "%s", err19);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival);
#endif
in->compressionParam = ival;
- if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* end bracket */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
- in->compressionType = 0; /* ONLY GZIP supported */
+ in->compressionType = 0; /* ONLY GZIP supported */
in->configOptionVector[COMPRESS] = 1;
}
- else if(!HDstrcmp("CONTIGUOUS", temp)) { /* CONTIGUOUS */
+ else if (!HDstrcmp("CONTIGUOUS", temp)) { /* CONTIGUOUS */
#ifdef H5DEBUGIMPORT
- HDprintf("h5dump FILTERS CONTIGUOUS found\n");
+ HDprintf("h5dump FILTERS CONTIGUOUS found\n");
#endif
in->configOptionVector[COMPRESS] = 0;
}
- else if(!HDstrcmp("NONE", temp)) { /* NONE */
+ else if (!HDstrcmp("NONE", temp)) { /* NONE */
#ifdef H5DEBUGIMPORT
- HDprintf("h5dump FILTERS NONE found\n");
+ HDprintf("h5dump FILTERS NONE found\n");
#endif
in->configOptionVector[COMPRESS] = 0;
}
- if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* end bracket */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS %s found\n", temp);
#endif
}
- else if(!HDstrcmp("SUBSET", key)) { /* reduce dimensions */
- hsize_t temp_dims[MAX_NUM_DIMENSION];
- int get_next_prop = 1;
+ else if (!HDstrcmp("SUBSET", key)) { /* reduce dimensions */
+ hsize_t temp_dims[MAX_NUM_DIMENSION];
+ int get_next_prop = 1;
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET key\n");
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
- (void) HDfprintf(stderr, err20, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */
+ (void)HDfprintf(stderr, err20, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
- if (fscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */
- (void) HDfprintf(stderr, "%s", err18);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
while (get_next_prop) {
- if(!HDstrcmp("COUNT", temp)) { /* COUNT */
+ if (!HDstrcmp("COUNT", temp)) { /* COUNT */
int icount = 0;
- if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
- if(!HDstrcmp("(", temp)) { /* start paren */
+ if (!HDstrcmp("(", temp)) { /* start paren */
int get_next_dim = 1;
- int i = 0;
+ int i = 0;
- if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
- (void) HDfprintf(stderr, err16c, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET COUNT [%s] found\n", temp);
#endif
while (get_next_dim) {
- char *more = temp;
+ char *more = temp;
temp_dims[icount] = HDstrtoull(more, &more, 10);
- if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET COUNT %s found\n", temp);
#endif
- if(!HDstrcmp(");", temp)) { /* end paren */
- in->rank = ++icount;
+ if (!HDstrcmp(");", temp)) { /* end paren */
+ in->rank = ++icount;
in->configOptionVector[RANK] = 1;
- get_next_dim = 0;
+ get_next_dim = 0;
}
else { /* Dimension */
icount++;
if (icount >= MAX_NUM_DIMENSION) {
- (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ (void)HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
}
@@ -2048,47 +2064,47 @@ static int processConfigurationFile(char *infile, struct Input *in)
HDprintf("\n");
#endif
in->configOptionVector[DIM] = 1;
- } /* if(!HDstrcmp("(", key)) start paren */
- } /* if(!HDstrcmp("COUNT", temp)) COUNT */
- if(!HDstrcmp("BLOCK", temp)) { /* BLOCK */
+ } /* if(!HDstrcmp("(", key)) start paren */
+ } /* if(!HDstrcmp("COUNT", temp)) COUNT */
+ if (!HDstrcmp("BLOCK", temp)) { /* BLOCK */
int icount = 0;
- if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
- if(!HDstrcmp("(", temp)) { /* start paren */
+ if (!HDstrcmp("(", temp)) { /* start paren */
int get_next_dim = 1;
- int i = 0;
+ int i = 0;
- if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
- (void) HDfprintf(stderr, err16c, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
- HDprintf("h5dump SUBSET BLOCK [%s] found\n", temp);
+ HDprintf("h5dump SUBSET BLOCK [%s] found\n", temp);
#endif
while (get_next_dim) {
- char *more = temp;
+ char *more = temp;
temp_dims[icount] = HDstrtoull(more, &more, 10);
- if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
- (void) HDfprintf(stderr, err6b, infile);
+ if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET BLOCK %s found\n", temp);
#endif
- if(!HDstrcmp(");", temp)) { /* end paren */
- in->rank = ++icount;
+ if (!HDstrcmp(");", temp)) { /* end paren */
+ in->rank = ++icount;
in->configOptionVector[RANK] = 1;
- get_next_dim = 0;
+ get_next_dim = 0;
}
else { /* Dimension */
icount++;
if (icount > MAX_NUM_DIMENSION) {
- (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ (void)HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
}
@@ -2105,27 +2121,27 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
in->configOptionVector[DIM] = 1;
} /* if(!HDstrcmp("(", key)) start paren */
- } /* if(!HDstrcmp("BLOCK", temp)) BLOCK */
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ } /* if(!HDstrcmp("BLOCK", temp)) BLOCK */
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
- if(!HDstrcmp("}", temp)) { /* end bracket */
+ if (!HDstrcmp("}", temp)) { /* end bracket */
get_next_prop = 0;
}
- } /* while (get_next_prop) */
- } /* else if(!HDstrcmp("SUBSET", key)) */
- else if(!HDstrcmp("DATA", key)) { /* FINSHED */
+ } /* while (get_next_prop) */
+ } /* else if(!HDstrcmp("SUBSET", key)) */
+ else if (!HDstrcmp("DATA", key)) { /* FINSHED */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATA key\n");
#endif
scanret = 0;
break;
}
- scanret = fscanf(strm, "%254s", key);
+ scanret = HDfscanf(strm, "%254s", key);
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump path");
@@ -2157,258 +2173,257 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
while (scanret == 1) {
if ((kindex = mapKeywordToIndex(key)) == -1) {
- (void) HDfprintf(stderr, err2, key, infile);
+ (void)HDfprintf(stderr, err2, key, infile);
goto error;
}
switch (kindex) {
- case 0: /* PATH */
- if (in->configOptionVector[PATH] == 1) {
- (void) HDfprintf(stderr, err3a, infile);
- goto error;
- }
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
- goto error;
- }
- if (parsePathInfo(&in->path, temp) == -1) {
- (void) HDfprintf(stderr, err3b, infile);
- goto error;
- }
- in->configOptionVector[PATH] = 1;
- break;
+ case 0: /* PATH */
+ if (in->configOptionVector[PATH] == 1) {
+ (void)HDfprintf(stderr, err3a, infile);
+ goto error;
+ }
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+ if (parsePathInfo(&in->path, temp) == -1) {
+ (void)HDfprintf(stderr, err3b, infile);
+ goto error;
+ }
+ in->configOptionVector[PATH] = 1;
+ break;
- case 1: /* INPUT-CLASS */
- if (in->configOptionVector[INPUT_CLASS] == 1) {
- (void) HDfprintf(stderr, err4a, infile);
- goto error;
- }
+ case 1: /* INPUT-CLASS */
+ if (in->configOptionVector[INPUT_CLASS] == 1) {
+ (void)HDfprintf(stderr, err4a, infile);
+ goto error;
+ }
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
- goto error;
- }
- if (getInputClass(in, temp) == -1) {
- (void) HDfprintf(stderr, err4b, infile);
- goto error;
- }
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+ if (getInputClass(in, temp) == -1) {
+ (void)HDfprintf(stderr, err4b, infile);
+ goto error;
+ }
- in->configOptionVector[INPUT_CLASS] = 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;
- }
- break;
+ /*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 2: /* INPUT-SIZE */
- if (in->configOptionVector[INPUT_SIZE] == 1) {
- (void) HDfprintf(stderr, err5a, infile);
- goto error;
- }
- if (fscanf(strm, "%254d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err19);
- goto error;
- }
- if (getInputSize(in, ival) == -1) {
- (void) HDfprintf(stderr, err5b, infile);
- goto error;
- }
- in->configOptionVector[INPUT_SIZE] = 1;
+ case 2: /* INPUT-SIZE */
+ if (in->configOptionVector[INPUT_SIZE] == 1) {
+ (void)HDfprintf(stderr, err5a, infile);
+ goto error;
+ }
+ if (HDfscanf(strm, "%254d", (&ival)) != 1) {
+ (void)HDfprintf(stderr, "%s", err19);
+ goto error;
+ }
+ if (getInputSize(in, ival) == -1) {
+ (void)HDfprintf(stderr, err5b, infile);
+ goto error;
+ }
+ in->configOptionVector[INPUT_SIZE] = 1;
- /*set default value for output-size */
- if (in->configOptionVector[OUTPUT_SIZE] == 0)
- in->outputSize = in->inputSize;
- break;
+ /*set default value for output-size */
+ if (in->configOptionVector[OUTPUT_SIZE] == 0)
+ in->outputSize = in->inputSize;
+ break;
- case 3: /* RANK */
- if (in->configOptionVector[RANK] == 1) {
- (void) HDfprintf(stderr, err6a, infile);
- goto error;
- }
+ case 3: /* RANK */
+ if (in->configOptionVector[RANK] == 1) {
+ (void)HDfprintf(stderr, err6a, infile);
+ goto error;
+ }
- if (getRank(in, strm) == -1) {
- (void) HDfprintf(stderr, err6b, infile);
- goto error;
- }
- in->configOptionVector[RANK] = 1;
- break;
+ if (getRank(in, strm) == -1) {
+ (void)HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+ in->configOptionVector[RANK] = 1;
+ break;
- case 4: /* DIMENSION-SIZES */
- if (in->configOptionVector[DIM] == 1) {
- (void) HDfprintf(stderr, err7a, infile);
- goto error;
- }
+ case 4: /* DIMENSION-SIZES */
+ if (in->configOptionVector[DIM] == 1) {
+ (void)HDfprintf(stderr, err7a, infile);
+ goto error;
+ }
- if (in->configOptionVector[RANK] == 0) {
- (void) HDfprintf(stderr, err7b, infile);
- goto error;
- }
- if (getDimensionSizes(in, strm) == -1) {
- (void) HDfprintf(stderr, err7c, infile);
- goto error;
- }
- in->configOptionVector[DIM] = 1;
- break;
+ if (in->configOptionVector[RANK] == 0) {
+ (void)HDfprintf(stderr, err7b, infile);
+ goto error;
+ }
+ if (getDimensionSizes(in, strm) == -1) {
+ (void)HDfprintf(stderr, err7c, infile);
+ goto error;
+ }
+ in->configOptionVector[DIM] = 1;
+ break;
- case 5: /* OUTPUT-CLASS */
- if (in->configOptionVector[OUTPUT_CLASS] == 1) {
- (void) HDfprintf(stderr, err8a, infile);
- goto error;
- }
+ case 5: /* OUTPUT-CLASS */
+ if (in->configOptionVector[OUTPUT_CLASS] == 1) {
+ (void)HDfprintf(stderr, err8a, infile);
+ goto error;
+ }
- if (getOutputClass(in, strm) == -1) {
- (void) HDfprintf(stderr, err8b, infile);
- goto error;
- }
- in->configOptionVector[OUTPUT_CLASS] = 1;
- break;
+ if (getOutputClass(in, strm) == -1) {
+ (void)HDfprintf(stderr, err8b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_CLASS] = 1;
+ break;
- case 6: /* OUTPUT-SIZE */
- if (in->configOptionVector[OUTPUT_SIZE] == 1) {
- (void) HDfprintf(stderr, err9a, infile);
- goto error;
- }
+ case 6: /* OUTPUT-SIZE */
+ if (in->configOptionVector[OUTPUT_SIZE] == 1) {
+ (void)HDfprintf(stderr, err9a, infile);
+ goto error;
+ }
- if (getOutputSize(in, strm) == -1) {
- (void) HDfprintf(stderr, err9b, infile);
- goto error;
- }
- in->configOptionVector[OUTPUT_SIZE] = 1;
- break;
+ if (getOutputSize(in, strm) == -1) {
+ (void)HDfprintf(stderr, err9b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_SIZE] = 1;
+ break;
- case 7: /* OUTPUT-ARCHITECTURE */
- if (in->configOptionVector[OUTPUT_ARCH] == 1) {
- (void) HDfprintf(stderr, err10a, infile);
- goto error;
- }
+ case 7: /* OUTPUT-ARCHITECTURE */
+ if (in->configOptionVector[OUTPUT_ARCH] == 1) {
+ (void)HDfprintf(stderr, err10a, infile);
+ goto error;
+ }
- if (getOutputArchitecture(in, strm) == -1) {
- (void) HDfprintf(stderr, err10b, infile);
- goto error;
- }
- in->configOptionVector[OUTPUT_ARCH] = 1;
- break;
+ if (getOutputArchitecture(in, strm) == -1) {
+ (void)HDfprintf(stderr, err10b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_ARCH] = 1;
+ break;
- case 8: /* OUTPUT-BYTE-ORDER */
- if (in->configOptionVector[OUTPUT_B_ORDER] == 1) {
- (void) HDfprintf(stderr, err11a, infile);
- goto error;
- }
+ case 8: /* OUTPUT-BYTE-ORDER */
+ if (in->configOptionVector[OUTPUT_B_ORDER] == 1) {
+ (void)HDfprintf(stderr, err11a, infile);
+ goto error;
+ }
- if (getOutputByteOrder(in, strm) == -1) {
- (void) HDfprintf(stderr, err11b, infile);
- goto error;
- }
- in->configOptionVector[OUTPUT_B_ORDER] = 1;
- break;
+ if (getOutputByteOrder(in, strm) == -1) {
+ (void)HDfprintf(stderr, err11b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_B_ORDER] = 1;
+ break;
- case 9: /* CHUNKED-DIMENSION-SIZES */
- if (in->configOptionVector[CHUNK] == 1) {
- (void) HDfprintf(stderr, err12a, infile);
- goto error;
- }
- /* cant appear before dimension sizes have been provided */
- if (in->configOptionVector[DIM] == 0) {
- (void) HDfprintf(stderr, err12b, infile);
- goto error;
- }
+ case 9: /* CHUNKED-DIMENSION-SIZES */
+ if (in->configOptionVector[CHUNK] == 1) {
+ (void)HDfprintf(stderr, err12a, infile);
+ goto error;
+ }
+ /* cant appear before dimension sizes have been provided */
+ if (in->configOptionVector[DIM] == 0) {
+ (void)HDfprintf(stderr, err12b, infile);
+ goto error;
+ }
- if (getChunkedDimensionSizes(in, strm) == -1) {
- (void) HDfprintf(stderr, err12c, infile);
- goto error;
- }
- in->configOptionVector[CHUNK] = 1;
- break;
+ if (getChunkedDimensionSizes(in, strm) == -1) {
+ (void)HDfprintf(stderr, err12c, infile);
+ goto error;
+ }
+ in->configOptionVector[CHUNK] = 1;
+ break;
- case 10: /* COMPRESSION-TYPE */
- if (in->configOptionVector[COMPRESS] == 1) {
- (void) HDfprintf(stderr, err13a, infile);
- goto error;
- }
+ case 10: /* COMPRESSION-TYPE */
+ if (in->configOptionVector[COMPRESS] == 1) {
+ (void)HDfprintf(stderr, err13a, infile);
+ goto error;
+ }
- if (getCompressionType(in, strm) == -1) {
- (void) HDfprintf(stderr, err13b, infile);
- goto error;
- }
- in->configOptionVector[COMPRESS] = 1;
+ if (getCompressionType(in, strm) == -1) {
+ (void)HDfprintf(stderr, err13b, infile);
+ goto error;
+ }
+ in->configOptionVector[COMPRESS] = 1;
- if (in->configOptionVector[COMPRESS_PARAM] == 0) {
- if (in->compressionType == 0)
- in->compressionParam = 6; /* default value if compressionType is GZIP */
- }
- break;
+ if (in->configOptionVector[COMPRESS_PARAM] == 0) {
+ if (in->compressionType == 0)
+ in->compressionParam = 6; /* default value if compressionType is GZIP */
+ }
+ break;
- case 11: /* COMPRESSION-PARAM */
- if (in->configOptionVector[COMPRESS_PARAM] == 1) {
- (void) HDfprintf(stderr, err14a, infile);
- goto error;
- }
+ case 11: /* COMPRESSION-PARAM */
+ if (in->configOptionVector[COMPRESS_PARAM] == 1) {
+ (void)HDfprintf(stderr, err14a, infile);
+ goto error;
+ }
- if (getCompressionParameter(in, strm) == -1) {
- (void) HDfprintf(stderr, err14b, infile);
- goto error;
- }
+ if (getCompressionParameter(in, strm) == -1) {
+ (void)HDfprintf(stderr, err14b, infile);
+ goto error;
+ }
- in->configOptionVector[COMPRESS_PARAM] = 1;
+ in->configOptionVector[COMPRESS_PARAM] = 1;
- if (in->configOptionVector[COMPRESS] == 0)
- in->compressionType = 0;
+ if (in->configOptionVector[COMPRESS] == 0)
+ in->compressionType = 0;
- break;
+ break;
- case 12: /* EXTERNAL-STORAGE */
- if (in->configOptionVector[EXTERNALSTORE] == 1) {
- (void) HDfprintf(stderr, err15a, infile);
- goto error;
- }
+ case 12: /* EXTERNAL-STORAGE */
+ if (in->configOptionVector[EXTERNALSTORE] == 1) {
+ (void)HDfprintf(stderr, err15a, infile);
+ goto error;
+ }
- if (getExternalFilename(in, strm) == -1) {
- (void) HDfprintf(stderr, err15b, infile);
- goto error;
- }
- in->configOptionVector[EXTERNALSTORE] = 1;
- break;
+ if (getExternalFilename(in, strm) == -1) {
+ (void)HDfprintf(stderr, err15b, infile);
+ goto error;
+ }
+ in->configOptionVector[EXTERNALSTORE] = 1;
+ break;
- case 13: /* MAXIMUM-DIMENSIONS */
- if (in->configOptionVector[EXTEND] == 1) {
- (void) HDfprintf(stderr, err16a, infile);
- goto error;
- }
- /* cant appear before dimension sizes have been provided */
- if (in->configOptionVector[DIM] == 0) {
- (void) HDfprintf(stderr, err16b, infile);
- goto error;
- }
- if (getMaximumDimensionSizes(in, strm) == -1) {
- (void) HDfprintf(stderr, err16c, infile);
- goto error;
- }
- in->configOptionVector[EXTEND] = 1;
- break;
+ case 13: /* MAXIMUM-DIMENSIONS */
+ if (in->configOptionVector[EXTEND] == 1) {
+ (void)HDfprintf(stderr, err16a, infile);
+ goto error;
+ }
+ /* cant appear before dimension sizes have been provided */
+ if (in->configOptionVector[DIM] == 0) {
+ (void)HDfprintf(stderr, err16b, infile);
+ goto error;
+ }
+ if (getMaximumDimensionSizes(in, strm) == -1) {
+ (void)HDfprintf(stderr, err16c, infile);
+ goto error;
+ }
+ in->configOptionVector[EXTEND] = 1;
+ break;
- case 14: /* INPUT-BYTE-ORDER */
- if (in->configOptionVector[INPUT_B_ORDER] == 1) {
- (void) HDfprintf(stderr, err11c, infile);
- goto error;
- }
+ case 14: /* INPUT-BYTE-ORDER */
+ if (in->configOptionVector[INPUT_B_ORDER] == 1) {
+ (void)HDfprintf(stderr, err11c, infile);
+ goto error;
+ }
- if (getInputByteOrder(in, strm) == -1) {
- (void) HDfprintf(stderr, err11d, infile);
- goto error;
- }
- in->configOptionVector[INPUT_B_ORDER] = 1;
- break;
+ if (getInputByteOrder(in, strm) == -1) {
+ (void)HDfprintf(stderr, err11d, infile);
+ goto error;
+ }
+ in->configOptionVector[INPUT_B_ORDER] = 1;
+ break;
- default:
- break;
+ default:
+ break;
}
- scanret = fscanf(strm, "%254s", key);
+ scanret = HDfscanf(strm, "%254s", key);
}
/*
@@ -2417,7 +2432,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
*/
if (validateConfigurationParameters(in) == -1) {
- (void) HDfprintf(stderr, err17, infile);
+ (void)HDfprintf(stderr, err17, infile);
goto error;
}
}
@@ -2426,19 +2441,22 @@ static int processConfigurationFile(char *infile, struct Input *in)
retval = 0;
error:
- if(strm)
+ if (strm)
HDfclose(strm);
- return(retval);
+ return (retval);
}
-static int validateConfigurationParameters(struct Input *in)
+static int
+validateConfigurationParameters(struct Input *in)
{
const char *err1 = "One or more of the required fields (RANK, DIMENSION-SIZES) missing.\n";
- const char *err2 = "Cannot specify chunking or compression or extendible data sets with the external file option.\n";
- const char *err3 = "Cannot specify the compression or the extendible data sets without the chunking option.\n";
+ const char *err2 =
+ "Cannot specify chunking or compression or extendible data sets with the external file option.\n";
+ const char *err3 =
+ "Cannot specify the compression or the extendible data sets without the chunking option.\n";
const char *err4a = "OUTPUT-ARCHITECTURE cannot be STD if OUTPUT-CLASS is floating point (FP).\n";
const char *err4b = "OUTPUT-ARCHITECTURE cannot be IEEE if OUTPUT-CLASS is integer (IN).\n";
- const char *err5 = "For OUTPUT-CLASS FP, valid values for OUTPUT-SIZE are (32, 64) .\n";
+ const char *err5 = "For OUTPUT-CLASS FP, valid values for OUTPUT-SIZE are (32, 64) .\n";
#ifndef H5_SIZEOF_LONG_LONG
const char *err6 = "No support for reading 64-bit integer (INPUT-CLASS: IN, TEXTIN, UIN, TEXTUIN files\n";
#endif
@@ -2448,20 +2466,21 @@ static int validateConfigurationParameters(struct Input *in)
return (0);
if ((in->configOptionVector[DIM] != 1) || (in->configOptionVector[RANK] != 1)) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if (in->configOptionVector[EXTERNALSTORE] == 1) {
- if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[CHUNK] == 1) || (in->configOptionVector[EXTEND] == 1)) {
- (void) HDfprintf(stderr, "%s", err2);
+ if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[CHUNK] == 1) ||
+ (in->configOptionVector[EXTEND] == 1)) {
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
}
if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[EXTEND] == 1)) {
if (in->configOptionVector[CHUNK] != 1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
}
@@ -2469,33 +2488,35 @@ static int validateConfigurationParameters(struct Input *in)
/* Arch cant be STD if O/p class is FP */
if (in->outputArchitecture == 1)
if (in->outputClass == 1) {
- (void) HDfprintf(stderr, "%s", err4a);
+ (void)HDfprintf(stderr, "%s", err4a);
return (-1);
}
/* Arch cant be IEEE if O/p class is IN */
if (in->outputArchitecture == 2)
if (in->outputClass == 0) {
- (void) HDfprintf(stderr, "%s", err4b);
+ (void)HDfprintf(stderr, "%s", err4b);
return (-1);
}
if (in->outputClass == 1)
if (in->outputSize != 32 && in->outputSize != 64) {
- (void) HDfprintf(stderr, "%s", err5);
+ (void)HDfprintf(stderr, "%s", err5);
return (-1);
}
#ifndef H5_SIZEOF_LONG_LONG
- if (in->inputSize == 64 && (in->inputClass == 0 || in->inputClass == 4 || in->inputClass == 6 || in->inputClass == 7) ) {
- (void) HDfprintf(stderr, "%s", err6);
+ if (in->inputSize == 64 &&
+ (in->inputClass == 0 || in->inputClass == 4 || in->inputClass == 6 || in->inputClass == 7)) {
+ (void)HDfprintf(stderr, "%s", err6);
return -1;
}
#endif
return (0);
}
-static int mapKeywordToIndex(char *key)
+static int
+mapKeywordToIndex(char *key)
{
int i;
@@ -2505,66 +2526,67 @@ static int mapKeywordToIndex(char *key)
return -1;
}
-static int parsePathInfo(struct path_info *path, char *temp)
+static int
+parsePathInfo(struct path_info *path, char *temp)
{
const char delimiter[] = "/\"";
- char *token;
- int i = 0;
+ char * token;
+ int i = 0;
const char *err1 = "Path string larger than MAX_PATH_NAME_LENGTH.\n";
- token = HDstrtok (temp, delimiter);
+ token = HDstrtok(temp, delimiter);
if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) {
- (void) HDfprintf(stderr, err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
- HDstrcpy(path->group[i++],token);
+ HDstrcpy(path->group[i++], token);
while (1) {
- token = HDstrtok (NULL, delimiter);
+ token = HDstrtok(NULL, delimiter);
if (token == NULL)
break;
if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) {
- (void) HDfprintf(stderr, err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
- HDstrcpy(path->group[i++],token);
+ HDstrcpy(path->group[i++], token);
}
path->count = i;
return (0);
}
-static int parseDimensions(struct Input *in, char *strm)
+static int
+parseDimensions(struct Input *in, char *strm)
{
const char delimiter[] = ",";
char temp[255];
- char *token;
- int i = 0;
+ char * token;
+ int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
HDstrncpy(temp, strm, sizeof(temp));
temp[sizeof(temp) - 1] = '\0';
- HDstrtok (temp, delimiter);
+ HDstrtok(temp, delimiter);
while (1) {
- token = HDstrtok (NULL, delimiter);
+ token = HDstrtok(NULL, delimiter);
if (token == NULL)
break;
i++;
}
in->rank = i + 1;
- if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
+ if ((in->sizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
i = 0;
HDstrncpy(temp, strm, sizeof(temp));
- temp[sizeof(temp) - 1] = '\0';
- in->sizeOfDimension[i++]
- = HDstrtoull(HDstrtok (temp, delimiter), NULL, BASE_10);
+ temp[sizeof(temp) - 1] = '\0';
+ in->sizeOfDimension[i++] = HDstrtoull(HDstrtok(temp, delimiter), NULL, BASE_10);
while (1) {
- token = HDstrtok (NULL, delimiter);
+ token = HDstrtok(NULL, delimiter);
if (token == NULL)
break;
in->sizeOfDimension[i++] = HDstrtoull(token, NULL, BASE_10);
@@ -2572,20 +2594,21 @@ static int parseDimensions(struct Input *in, char *strm)
return (0);
}
-static int getOutputClass(struct Input *in, FILE *strm)
+static int
+getOutputClass(struct Input *in, FILE *strm)
{
char temp[255];
int kindex;
const char *err1 = "Unable to get 'string' value.\n";
const char *err2 = "Invalid value for output class.\n";
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputClassStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
@@ -2593,10 +2616,11 @@ static int getOutputClass(struct Input *in, FILE *strm)
return (0);
}
-static int OutputClassStrToInt(char *temp)
+static int
+OutputClassStrToInt(char *temp)
{
- int i;
- char classKeywordTable[3][15] = { "IN", "FP", "UIN" };
+ int i;
+ char classKeywordTable[3][15] = {"IN", "FP", "UIN"};
for (i = 0; i < 3; i++)
if (!HDstrcmp(classKeywordTable[i], temp))
return i;
@@ -2604,16 +2628,17 @@ static int OutputClassStrToInt(char *temp)
return -1;
}
/* same as getInputSize. But defined separately for extensibility */
-static int getOutputSize(struct Input *in, FILE *strm)
+static int
+getOutputSize(struct Input *in, FILE *strm)
{
int ival;
int i;
- int outputSizeValidValues[4] = { 8, 16, 32, 64 };
- const char *err1 = "Unable to get integer value.\n";
- const char *err2 = "Invalid value for output size.\n";
+ int outputSizeValidValues[4] = {8, 16, 32, 64};
+ const char *err1 = "Unable to get integer value.\n";
+ const char *err2 = "Invalid value for output size.\n";
- if (fscanf(strm, "%d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ if (HDfscanf(strm, "%d", (&ival)) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -2622,17 +2647,18 @@ static int getOutputSize(struct Input *in, FILE *strm)
in->outputSize = ival;
return (0);
}
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
-static int getInputClass(struct Input *in, char * temp)
+static int
+getInputClass(struct Input *in, char *temp)
{
int kindex;
const char *err1 = "Invalid value for input class.\n";
if ((kindex = InputClassStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -2640,355 +2666,356 @@ static int getInputClass(struct Input *in, char * temp)
return (0);
}
-static int getInputClassType(struct Input *in, char * buffer)
+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 input byte-order.\n";
+ const char *err1 = "Invalid value for input class.\n";
+ const char *err2 = "Invalid value for output architecture.\n";
+ const char *err3 = "Invalid value for input byte-order.\n";
if (!HDstrcmp(buffer, "H5T_STD_I8BE")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I8LE")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I16BE")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I16LE")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I32BE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I32LE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I64BE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I64LE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_U8BE")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U8LE")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U16BE")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U16LE")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U32BE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U32LE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U64BE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U64LE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_SCHAR")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -2996,11 +3023,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_UCHAR")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3008,11 +3035,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_SHORT")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3020,11 +3047,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_USHORT")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3032,11 +3059,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_INT")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3044,11 +3071,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_UINT")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3056,11 +3083,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_LONG")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3068,11 +3095,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_ULONG")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3080,11 +3107,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_LLONG")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3092,11 +3119,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_ULLONG")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3104,107 +3131,107 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_IEEE_F32BE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_IEEE_F32LE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_IEEE_F64BE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_IEEE_F64LE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_VAX_F32")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_VAX_F64")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_FLOAT")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3212,24 +3239,24 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_DOUBLE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
kindex = 3;
}
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
else if (!HDstrcmp(buffer, "H5T_NATIVE_LDOUBLE")) {
- in->inputSize = H5_SIZEOF_LONG_DOUBLE;
+ in->inputSize = H5_SIZEOF_LONG_DOUBLE;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3237,192 +3264,192 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 3;
}
#endif
- else if(!HDstrcmp(buffer, "H5T_TIME: not yet implemented")) {
+ else if (!HDstrcmp(buffer, "H5T_TIME: not yet implemented")) {
kindex = -1;
}
- else if(!HDstrcmp(buffer, "H5T_STRING")) {
+ 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);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B8LE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B16BE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B16LE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B32BE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B32LE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B64BE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B64LE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
/* case H5T_OPAQUE: */
- else if(!HDstrcmp(buffer, "H5T_OPAQUE")) {
+ else if (!HDstrcmp(buffer, "H5T_OPAQUE")) {
kindex = -1;
}
/* case H5T_COMPOUND: */
- else if(!HDstrcmp(buffer, "H5T_COMPOUND")) {
+ else if (!HDstrcmp(buffer, "H5T_COMPOUND")) {
kindex = -1;
}
/* case H5T_REFERENCE: */
- else if(!HDstrcmp(buffer, "H5T_REFERENCE")) {
+ else if (!HDstrcmp(buffer, "H5T_REFERENCE")) {
kindex = -1;
}
/* case H5T_ENUM: */
- else if(!HDstrcmp(buffer, "H5T_ENUM")) {
+ else if (!HDstrcmp(buffer, "H5T_ENUM")) {
kindex = -1;
}
/* case H5T_VLEN: */
- else if(!HDstrcmp(buffer, "H5T_VLEN")) {
+ else if (!HDstrcmp(buffer, "H5T_VLEN")) {
kindex = -1;
}
/* case H5T_ARRAY: */
- else if(!HDstrcmp(buffer, "H5T_ARRAY")) {
+ else if (!HDstrcmp(buffer, "H5T_ARRAY")) {
kindex = -1;
}
if (kindex == -1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -3439,10 +3466,11 @@ static int getInputClassType(struct Input *in, char * buffer)
return (0);
}
-static int InputClassStrToInt(char *temp)
+static int
+InputClassStrToInt(char *temp)
{
- int i;
- char classKeywordTable[8][15] = { "TEXTIN", "TEXTFP", "TEXTFPE", "FP", "IN", "STR", "TEXTUIN", "UIN" };
+ int i;
+ char classKeywordTable[8][15] = {"TEXTIN", "TEXTFP", "TEXTFPE", "FP", "IN", "STR", "TEXTUIN", "UIN"};
for (i = 0; i < 8; i++)
if (!HDstrcmp(classKeywordTable[i], temp))
return i;
@@ -3450,35 +3478,37 @@ static int InputClassStrToInt(char *temp)
}
/* same as getOutputSize. But defined separately for extensibility */
-static int getInputSize(struct Input *in, int ival)
+static int
+getInputSize(struct Input *in, int ival)
{
int i;
- int inputSizeValidValues[4] = { 8, 16, 32, 64 };
- const char *err1 = "Invalid value for input size.\n";
+ int inputSizeValidValues[4] = {8, 16, 32, 64};
+ const char *err1 = "Invalid value for input size.\n";
for (i = 0; i < 4; i++)
if (inputSizeValidValues[i] == ival) {
in->inputSize = ival;
return (0);
}
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
-static int getInputByteOrder(struct Input *in, FILE *strm)
+static int
+getInputByteOrder(struct Input *in, FILE *strm)
{
char temp[255];
int kindex;
const char *err1 = "Unable to get 'string' value.\n";
const char *err2 = "Invalid value for input byte-order.\n";
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputByteOrderStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
@@ -3486,15 +3516,16 @@ static int getInputByteOrder(struct Input *in, FILE *strm)
return (0);
}
-static int getRank(struct Input *in, FILE *strm)
+static int
+getRank(struct Input *in, FILE *strm)
{
- int ival;
+ int ival;
const char *err1 = "Unable to get integer value.\n";
const char *err2 = "Invalid value for rank.\n";
- if (fscanf(strm, "%d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ if (HDfscanf(strm, "%d", (&ival)) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if (ival >= MIN_NUM_DIMENSION && ival <= MAX_NUM_DIMENSION) {
@@ -3502,79 +3533,86 @@ static int getRank(struct Input *in, FILE *strm)
return (0);
}
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
/* same as getChunkedDimensionSizes. But defined separately for extensibility */
-static int getDimensionSizes(struct Input *in, FILE *strm)
+static int
+getDimensionSizes(struct Input *in, FILE *strm)
{
unsigned long long ullval;
- int i = 0;
+ int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
- const char *err2 = "No. of dimensions for which dimension sizes provided is not equal to provided rank.\n";
+ const char *err2 =
+ "No. of dimensions for which dimension sizes provided is not equal to provided rank.\n";
- if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
+ if ((in->sizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
- while (fscanf(strm, "%llu", (&ullval)) == 1)
+ while (HDfscanf(strm, "%llu", (&ullval)) == 1)
in->sizeOfDimension[i++] = ullval;
if (in->rank != i) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
return (0);
}
/* same as getDimensionSizes. But defined separately for extensibility */
-static int getChunkedDimensionSizes(struct Input *in, FILE *strm)
+static int
+getChunkedDimensionSizes(struct Input *in, FILE *strm)
{
unsigned long long ullval;
- int i = 0;
+ int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
- const char *err2 = "No. of dimensions for which chunked dimension sizes provided is not equal to provided rank.\n";
+ const char *err2 =
+ "No. of dimensions for which chunked dimension sizes provided is not equal to provided rank.\n";
const char *err3 = "The CHUNKED-DIMENSION-SIZES cannot exceed the sizes of DIMENSION-SIZES\n";
- if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
+ if ((in->sizeOfChunk = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
- while (fscanf(strm, "%llu", (&ullval)) == 1)
+ while (HDfscanf(strm, "%llu", (&ullval)) == 1)
in->sizeOfChunk[i++] = ullval;
if (in->rank != i) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
for (i = 0; i < in->rank; i++)
if (in->sizeOfChunk[i] > in->sizeOfDimension[i]) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
return (0);
}
-static int getMaximumDimensionSizes(struct Input *in, FILE *strm)
+static int
+getMaximumDimensionSizes(struct Input *in, FILE *strm)
{
long long llval;
- int i = 0;
+ int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
- const char *err2 = "No. of dimensions for which maximum dimension sizes provided is not equal to provided rank.\n";
- const char *err3 = "The MAXIMUM-DIMENSIONS cannot be less than the sizes of DIMENSION-SIZES. Exception: can be -1 to indicate unlimited size\n";
+ const char *err2 =
+ "No. of dimensions for which maximum dimension sizes provided is not equal to provided rank.\n";
+ const char *err3 = "The MAXIMUM-DIMENSIONS cannot be less than the sizes of DIMENSION-SIZES. Exception: "
+ "can be -1 to indicate unlimited size\n";
- if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
+ if ((in->maxsizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
- while (fscanf(strm, "%lld", (&llval)) == 1) {
+ while (HDfscanf(strm, "%lld", (&llval)) == 1) {
if (llval == -1)
in->maxsizeOfDimension[i++] = H5S_UNLIMITED;
else
@@ -3582,34 +3620,35 @@ static int getMaximumDimensionSizes(struct Input *in, FILE *strm)
}
if (in->rank != i) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
for (i = 0; i < in->rank; i++) {
if (in->maxsizeOfDimension[i] != H5S_UNLIMITED)
if (in->maxsizeOfDimension[i] < in->sizeOfDimension[i]) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
}
return (0);
}
-static int getOutputArchitecture(struct Input *in, FILE *strm)
+static int
+getOutputArchitecture(struct Input *in, FILE *strm)
{
char temp[255];
int kindex;
const char *err1 = "Unable to get 'string' value.\n";
const char *err2 = "Invalid value for output architecture.\n";
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputArchStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
@@ -3617,31 +3656,32 @@ static int getOutputArchitecture(struct Input *in, FILE *strm)
return (0);
}
-static int OutputArchStrToInt(const char *temp)
+static int
+OutputArchStrToInt(const char *temp)
{
- int i;
- char outputArchKeywordTable[8][15] = { "NATIVE", "STD", "IEEE", "INTEL",
- "CRAY", "MIPS", "ALPHA", "UNIX" };
+ int i;
+ char outputArchKeywordTable[8][15] = {"NATIVE", "STD", "IEEE", "INTEL", "CRAY", "MIPS", "ALPHA", "UNIX"};
for (i = 0; i < 8; i++)
if (!HDstrcmp(outputArchKeywordTable[i], temp))
return i;
return -1;
}
-static int getOutputByteOrder(struct Input *in, FILE *strm)
+static int
+getOutputByteOrder(struct Input *in, FILE *strm)
{
char temp[255];
int kindex;
const char *err1 = "Unable to get 'string' value.\n";
const char *err2 = "Invalid value for output byte-order.\n";
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputByteOrderStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
@@ -3649,52 +3689,55 @@ static int getOutputByteOrder(struct Input *in, FILE *strm)
return (0);
}
-static int OutputByteOrderStrToInt(const char *temp)
+static int
+OutputByteOrderStrToInt(const char *temp)
{
- int i;
- char outputByteOrderKeywordTable[2][15] = { "BE", "LE" };
+ int i;
+ char outputByteOrderKeywordTable[2][15] = {"BE", "LE"};
for (i = 0; i < 2; i++)
if (!HDstrcmp(outputByteOrderKeywordTable[i], temp))
return i;
return -1;
}
-static int getCompressionType(struct Input *in, FILE *strm)
+static int
+getCompressionType(struct Input *in, FILE *strm)
{
char temp[255];
int kindex;
const char *err1 = "Unable to get 'string' value.\n";
const char *err2 = "Invalid value for compression.\n";
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = CompressionTypeStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->compressionType = kindex;
return (0);
-
}
-static int CompressionTypeStrToInt(char *temp)
+static int
+CompressionTypeStrToInt(char *temp)
{
/* currently supports only GZIP */
/* can be extended by adding fields to the table */
- int i;
- char CompressionTypeKeywordTable[1][15] = { "GZIP" };
+ int i;
+ char CompressionTypeKeywordTable[1][15] = {"GZIP"};
for (i = 0; i < 1; i++)
if (!HDstrcmp(CompressionTypeKeywordTable[i], temp))
return i;
return -1;
}
-static int getCompressionParameter(struct Input *in, FILE *strm)
+static int
+getCompressionParameter(struct Input *in, FILE *strm)
{
/* currently supports only GZIP */
/* can be extended by adding more values to COMPRESSION-TYPE and */
@@ -3706,883 +3749,889 @@ static int getCompressionParameter(struct Input *in, FILE *strm)
const char *err3 = "Unsupported Compression Type.\n";
switch (in->compressionType) {
- case 0: /* GZIP */
- if (fscanf(strm, "%d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
+ case 0: /* GZIP */
+ if (HDfscanf(strm, "%d", (&ival)) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
- if (ival < 0 || ival > 9) {
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- in->compressionParam = ival;
- return (0);
+ if (ival < 0 || ival > 9) {
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->compressionParam = ival;
+ return (0);
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
}
}
-static int getExternalFilename(struct Input *in, FILE *strm)
+static int
+getExternalFilename(struct Input *in, FILE *strm)
{
char temp[255];
const char *err1 = "Unable to get 'string' value.\n";
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ if (HDfscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
- in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp) + 1) * sizeof(char));
- (void) HDstrncpy(in->externFilename, temp, HDstrlen(temp) + 1);
+ in->externFilename = (char *)HDmalloc((size_t)(HDstrlen(temp) + 1) * sizeof(char));
+ (void)HDstrncpy(in->externFilename, temp, HDstrlen(temp) + 1);
return (0);
}
-void setDefaultValues(struct Input *in, int count)
+void
+setDefaultValues(struct Input *in, int count)
{
- int i;
- char temp[255];
- char num[255];
-
- in->h5dumpInput = 0;
- in->inputClass = 3; /* FP */
- in->inputSize = 32;
- in->outputClass = 1; /* FP */
- in->outputSize = 32;
+ int i;
+ char temp[255];
+ char num[255];
+
+ in->h5dumpInput = 0;
+ in->inputClass = 3; /* FP */
+ in->inputSize = 32;
+ in->outputClass = 1; /* FP */
+ in->outputSize = 32;
in->inputByteOrder = -1; /* use default */
- in->rank = 0;
- in->path.count = 1;
+ in->rank = 0;
+ in->path.count = 1;
HDstrcpy(temp, "dataset");
HDsprintf(num, "%d", count);
HDstrcat(temp, num);
HDstrcpy(in->path.group[0], temp);
- in->outputArchitecture = 0; /* NATIVE */
- in->outputByteOrder = -1; /* use default */
- in->compressionType = 0; /* GZIP */
+ in->outputArchitecture = 0; /* NATIVE */
+ in->outputByteOrder = -1; /* use default */
+ in->compressionType = 0; /* GZIP */
for (i = 0; i < NUM_KEYS; i++)
in->configOptionVector[i] = 0;
}
-hid_t createOutputDataType(struct Input *in)
+hid_t
+createOutputDataType(struct Input *in)
{
hid_t new_type = (-1);
- const char *err1 = "Invalid value for output class.\n";
- const char *err2 = "Invalid value for output size.\n";
- const char *err3 = "Invalid value for output byte order.\n";
- const char *err4 = "Invalid value for output architecture.\n";
- const char *err5 = "STD not supported for float.\n";
- const char *err6 = "IEEE not supported for INT.\n";
+ const char *err1 = "Invalid value for output class.\n";
+ const char *err2 = "Invalid value for output size.\n";
+ const char *err3 = "Invalid value for output byte order.\n";
+ const char *err4 = "Invalid value for output architecture.\n";
+ const char *err5 = "STD not supported for float.\n";
+ const char *err6 = "IEEE not supported for INT.\n";
switch (in->outputClass) {
- case 0:
- switch (in->outputArchitecture) {
- case 0: /* NATIVE */
- switch (in->outputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_CHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_SHORT);
- break;
+ case 0:
+ switch (in->outputArchitecture) {
+ case 0: /* NATIVE */
+ switch (in->outputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_CHAR);
+ break;
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_INT);
- break;
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_SHORT);
+ break;
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_LLONG);
- break;
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_INT);
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->outputByteOrder) {
- case -1: /* default */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_LLONG);
+ break;
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->outputByteOrder) {
+ case -1: /* default */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
- case 1: /* STD */
- switch (in->outputSize) {
- case 8:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I8BE);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I8LE);
- break;
+ case 1: /* STD */
+ switch (in->outputSize) {
+ case 8:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I8BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I8LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 16:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I16BE);
+ break;
- case 16:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I16BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I16LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I16LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 32:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I32BE);
+ break;
- case 32:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I32BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I32LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I32LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 64:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I64BE);
+ break;
- case 64:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I64BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I64LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I64LE);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err4);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
}
break;
- default:
- (void) HDfprintf(stderr, "%s", err4);
- return (-1);
- }
- break;
-
- case 1:
- switch (in->outputArchitecture) {
- case 0:
- switch (in->outputSize) {
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_FLOAT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->outputByteOrder) {
- case -1: /* DEFAULT */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
+ case 1:
+ switch (in->outputArchitecture) {
+ case 0:
+ switch (in->outputSize) {
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT);
+ break;
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->outputByteOrder) {
+ case -1: /* DEFAULT */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
- case 1:
- (void) HDfprintf(stderr, "%s", err5);
- return (-1);
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
- case 2:
- switch (in->outputSize) {
- case 32:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_IEEE_F32BE);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
break;
case 1:
- new_type = H5Tcopy(H5T_IEEE_F32LE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err5);
return (-1);
- }
- break;
- case 64:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_IEEE_F64BE);
- break;
+ case 2:
+ switch (in->outputSize) {
+ case 32:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F32LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- case 1:
- new_type = H5Tcopy(H5T_IEEE_F64LE);
+ case 64:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F64LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err4);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
}
break;
- default:
- (void) HDfprintf(stderr, "%s", err4);
- return (-1);
- }
- break;
-
- case 2:
- switch (in->outputArchitecture) {
- case 0:
- switch (in->outputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_UCHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_USHORT);
- break;
+ case 2:
+ switch (in->outputArchitecture) {
+ case 0:
+ switch (in->outputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_UCHAR);
+ break;
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_UINT);
- break;
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_USHORT);
+ break;
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_ULLONG);
- break;
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_UINT);
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->outputByteOrder) {
- case -1: /* Default */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_ULLONG);
+ break;
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->outputByteOrder) {
+ case -1: /* Default */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
- case 1:
- switch (in->outputSize) {
- case 8:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U8BE);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
break;
case 1:
- new_type = H5Tcopy(H5T_STD_U8LE);
- break;
+ switch (in->outputSize) {
+ case 8:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U8BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U8LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 16:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U16BE);
+ break;
- case 16:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U16BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U16LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U16LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 32:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U32BE);
+ break;
- case 32:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U32BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U32LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U32LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 64:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U64BE);
+ break;
- case 64:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U64BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U64LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U64LE);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
+ case 2:
+ (void)HDfprintf(stderr, "%s", err6);
return (-1);
- }
- break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
+ default:
+ (void)HDfprintf(stderr, "%s", err4);
+ return (-1);
}
break;
- case 2:
- (void) HDfprintf(stderr, "%s", err6);
- return (-1);
-
default:
- (void) HDfprintf(stderr, "%s", err4);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
}
return new_type;
}
-hid_t createInputDataType(struct Input *in)
+hid_t
+createInputDataType(struct Input *in)
{
hid_t new_type = (-1);
- const char *err1 = "Invalid value for input class.\n";
- const char *err2 = "Invalid value for input size.\n";
- const char *err3 = "Invalid value for input byte order.\n";
- const char *err4 = "Invalid value for output architecture.\n";
- const char *err5 = "STD not supported for float.\n";
- const char *err6 = "IEEE not supported for INT.\n";
+ const char *err1 = "Invalid value for input class.\n";
+ const char *err2 = "Invalid value for input size.\n";
+ const char *err3 = "Invalid value for input byte order.\n";
+ const char *err4 = "Invalid value for output architecture.\n";
+ const char *err5 = "STD not supported for float.\n";
+ const char *err6 = "IEEE not supported for INT.\n";
if (in->h5dumpInput) {
switch (in->inputClass) {
- case 4:
- switch (in->inputArchitecture) {
- case 0: /*NATIVE*/
- switch (in->inputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_CHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_SHORT);
- break;
-
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_INT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_LLONG);
- break;
+ case 4:
+ switch (in->inputArchitecture) {
+ case 0: /*NATIVE*/
+ switch (in->inputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_CHAR);
+ break;
+
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_SHORT);
+ break;
+
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_INT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_LLONG);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->inputByteOrder) {
+ case -1: /* default */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
+
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->inputByteOrder) {
- case -1: /* default */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
+ case 1: /*STD*/
+ switch (in->inputSize) {
+ case 8:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I8BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I8LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 16:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I16BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I16LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 32:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I32LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I64LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
+ default:
+ (void)HDfprintf(stderr, "%s", err4);
+ return (-1);
}
break;
- case 1: /*STD*/
- switch (in->inputSize) {
- case 8:
- switch (in->inputByteOrder) {
- case -1:
+ case 3:
+ switch (in->inputArchitecture) {
case 0:
- new_type = H5Tcopy(H5T_STD_I8BE);
+ switch (in->inputSize) {
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->inputByteOrder) {
+ case -1: /* DEFAULT */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
+
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
break;
case 1:
- new_type = H5Tcopy(H5T_STD_I8LE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err5);
return (-1);
- }
- break;
- case 16:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I16BE);
- break;
+ case 2:
+ switch (in->inputSize) {
+ case 32:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F32LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F64LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I16LE);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err4);
return (-1);
- }
- break;
+ }
+ break;
- case 32:
- switch (in->inputByteOrder) {
- case -1:
+ case 7:
+ switch (in->inputArchitecture) {
case 0:
- new_type = H5Tcopy(H5T_STD_I32BE);
+ switch (in->inputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_UCHAR);
+ break;
+
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_USHORT);
+ break;
+
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_UINT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_ULLONG);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->inputByteOrder) {
+ case -1: /* Default */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
+
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
break;
case 1:
- new_type = H5Tcopy(H5T_STD_I32LE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ switch (in->inputSize) {
+ case 8:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U8BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U8LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 16:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U16BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U16LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 32:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U32LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U64LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- case 64:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I64BE);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I64LE);
- break;
+ case 2:
+ (void)HDfprintf(stderr, "%s", err6);
+ return (-1);
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err4);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
}
break;
default:
- (void) HDfprintf(stderr, "%s", err4);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
- }
- break;
-
- case 3:
- switch (in->inputArchitecture) {
+ }
+ }
+ else {
+ switch (in->inputClass) {
case 0:
+ case 4:
switch (in->inputSize) {
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_FLOAT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->inputByteOrder) {
- case -1: /* DEFAULT */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
-
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
-
- case 1:
- (void) HDfprintf(stderr, "%s", err5);
- return (-1);
-
- case 2:
- switch (in->inputSize) {
- case 32:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_IEEE_F32BE);
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_CHAR);
break;
- case 1:
- new_type = H5Tcopy(H5T_IEEE_F32LE);
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_SHORT);
break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
-
- case 64:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_IEEE_F64BE);
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_INT);
break;
- case 1:
- new_type = H5Tcopy(H5T_IEEE_F64LE);
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_LLONG);
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err4);
- return (-1);
- }
- break;
-
- case 7:
- switch (in->inputArchitecture) {
- case 0:
- switch (in->inputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_UCHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_USHORT);
- break;
-
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_UINT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_ULLONG);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->inputByteOrder) {
- case -1: /* Default */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
-
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
}
break;
case 1:
+ case 2:
+ case 3:
switch (in->inputSize) {
- case 8:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U8BE);
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT);
break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U8LE);
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
- break;
-
- case 16:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U16BE);
- break;
-
- case 1:
- new_type = H5Tcopy(H5T_STD_U16LE);
- break;
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 5:
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ break;
- case 32:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U32BE);
+ case 6:
+ case 7:
+ switch (in->inputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_UCHAR);
break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U32LE);
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_USHORT);
break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
-
- case 64:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U64BE);
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_UINT);
break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U64LE);
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_ULLONG);
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
}
break;
- case 2:
- (void) HDfprintf(stderr, "%s", err6);
- return (-1);
-
default:
- (void) HDfprintf(stderr, "%s", err4);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- }
- else {
- switch (in->inputClass) {
- case 0:
- case 4:
- switch (in->inputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_CHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_SHORT);
- break;
-
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_INT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_LLONG);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
-
- case 1:
- case 2:
- case 3:
- switch (in->inputSize) {
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_FLOAT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
-
- case 5:
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- break;
-
- case 6:
- case 7:
- switch (in->inputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_UCHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_USHORT);
- break;
-
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_UINT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_ULLONG);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
}
}
return new_type;
}
-static int process(struct Options *opt)
+static int
+process(struct Options *opt)
{
- struct Input *in;
- FILE *extfile;
- hid_t file_id;
- hid_t group_id;
- hid_t handle;
- hid_t dataset;
- hid_t dataspace = (-1);
- hid_t intype;
- hid_t outtype;
- hid_t proplist;
- hsize_t numOfElements = 1;
- int j;
- int k;
+ struct Input *in;
+ FILE * extfile;
+ hid_t file_id;
+ hid_t group_id;
+ hid_t handle;
+ hid_t dataset;
+ hid_t dataspace = (-1);
+ hid_t intype;
+ hid_t outtype;
+ hid_t proplist;
+ hsize_t numOfElements = 1;
+ int j;
+ int k;
const char *err1 = "Error creating HDF output file: %s.\n";
const char *err2 = "Error in processing the configuration file: %s.\n";
const char *err3 = "Error in reading the input file: %s.\n";
const char *err4 = "Error in creating or opening external file.\n";
- const char *err5 = "Error in creating the output data set. Dataset with the same name may exist at the specified path\n";
+ const char *err5 =
+ "Error in creating the output data set. Dataset with the same name may exist at the specified path\n";
const char *err6 = "Error in writing the output data set.\n";
H5E_BEGIN_TRY
{
if ((file_id = H5Fopen(opt->outfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) {
if ((file_id = H5Fcreate(opt->outfile, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == FAIL) {
- (void) HDfprintf(stderr, err1, opt->outfile);
+ (void)HDfprintf(stderr, err1, opt->outfile);
return (-1);
}
}
@@ -4593,13 +4642,13 @@ static int process(struct Options *opt)
in = &(opt->infiles[k].in);
if (opt->infiles[k].config == 1) {
if (processConfigurationFile(opt->infiles[k].configfile, in) == -1) {
- (void) HDfprintf(stderr, err2, opt->infiles[k].configfile);
+ (void)HDfprintf(stderr, err2, opt->infiles[k].configfile);
return (-1);
}
}
if (processDataFile(opt->infiles[k].datafile, in, file_id) == -1) {
- (void) HDfprintf(stderr, err3, opt->infiles[k].datafile);
+ (void)HDfprintf(stderr, err3, opt->infiles[k].datafile);
return (-1);
}
@@ -4612,13 +4661,15 @@ static int process(struct Options *opt)
{
/* create parent groups */
if (in->path.count > 1) {
- j = 0;
+ 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);
+ 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);
+ group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
handle = group_id;
break;
}
@@ -4628,7 +4679,7 @@ static int process(struct Options *opt)
}
else {
handle = file_id;
- j = 0;
+ j = 0;
}
/*enable error reporting */
@@ -4636,7 +4687,7 @@ static int process(struct Options *opt)
H5E_END_TRY;
/*create data type */
- intype = createInputDataType(in);
+ intype = createInputDataType(in);
outtype = createOutputDataType(in);
#ifdef H5DEBUGIMPORT
HDprintf("process intype %ld outtype %ld\n", intype, outtype);
@@ -4651,20 +4702,21 @@ static int process(struct Options *opt)
}
if (in->configOptionVector[COMPRESS] == 1) {
- H5Pset_deflate(proplist, (unsigned) in->compressionParam);
+ H5Pset_deflate(proplist, (unsigned)in->compressionParam);
}
if (in->configOptionVector[EXTERNALSTORE] == 1) {
/* creating the external file if it doesnt exist */
if ((extfile = HDfopen(in->externFilename, "ab")) == NULL) {
- (void) HDfprintf(stderr, "%s", err4);
+ (void)HDfprintf(stderr, "%s", err4);
H5Pclose(proplist);
H5Sclose(dataspace);
H5Fclose(file_id);
return (-1);
}
HDfclose(extfile);
- H5Pset_external(proplist, in->externFilename, (off_t)0, numOfElements * (hsize_t)in->inputSize / 8);
+ H5Pset_external(proplist, in->externFilename, (off_t)0,
+ numOfElements * (hsize_t)in->inputSize / 8);
}
/* create dataspace */
@@ -4677,8 +4729,9 @@ static int process(struct Options *opt)
H5E_BEGIN_TRY
{
/* create data set */
- if ((dataset = H5Dcreate2(handle, in->path.group[j], outtype, dataspace, H5P_DEFAULT, proplist, H5P_DEFAULT)) < 0) {
- (void) HDfprintf(stderr, "%s", err5);
+ if ((dataset = H5Dcreate2(handle, in->path.group[j], outtype, dataspace, H5P_DEFAULT,
+ proplist, H5P_DEFAULT)) < 0) {
+ (void)HDfprintf(stderr, "%s", err5);
H5Pclose(proplist);
H5Sclose(dataspace);
H5Fclose(file_id);
@@ -4690,8 +4743,8 @@ static int process(struct Options *opt)
H5E_END_TRY;
/* write dataset */
- if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP) in->data) < 0) {
- (void) HDfprintf(stderr, "%s", err6);
+ if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP)in->data) < 0) {
+ (void)HDfprintf(stderr, "%s", err6);
H5Dclose(dataset);
H5Pclose(proplist);
H5Sclose(dataspace);
@@ -4710,36 +4763,44 @@ static int process(struct Options *opt)
return (0);
}
-uint16_t swap_uint16(uint16_t val)
+uint16_t
+swap_uint16(uint16_t val)
{
return (uint16_t)((val << 8) | (val >> 8));
}
-int16_t swap_int16(int16_t val)
+int16_t
+swap_int16(int16_t val)
{
return (int16_t)((val << 8) | ((val >> 8) & 0xFF));
}
-uint32_t swap_uint32(uint32_t val)
+uint32_t
+swap_uint32(uint32_t val)
{
val = ((val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF);
return (val << 16) | (val >> 16);
}
-int32_t swap_int32(int32_t val)
+int32_t
+swap_int32(int32_t val)
{
val = (int32_t)(((uint32_t)(val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF));
return (val << 16) | ((val >> 16) & 0xFFFF);
}
-int64_t swap_int64(int64_t val)
+int64_t
+swap_int64(int64_t val)
{
- val = (int64_t)(((uint64_t)(val << 8) & 0xFF00FF00FF00FF00ULL) | ((uint64_t)(val >> 8) & 0x00FF00FF00FF00FFULL));
- val = (int64_t)(((uint64_t)(val << 16) & 0xFFFF0000FFFF0000ULL) | ((uint64_t)(val >> 16) & 0x0000FFFF0000FFFFULL));
+ val = (int64_t)(((uint64_t)(val << 8) & 0xFF00FF00FF00FF00ULL) |
+ ((uint64_t)(val >> 8) & 0x00FF00FF00FF00FFULL));
+ val = (int64_t)(((uint64_t)(val << 16) & 0xFFFF0000FFFF0000ULL) |
+ ((uint64_t)(val >> 16) & 0x0000FFFF0000FFFFULL));
return (int64_t)((uint64_t)(val << 32) | ((uint64_t)(val >> 32) & 0xFFFFFFFFULL));
}
-uint64_t swap_uint64(uint64_t val)
+uint64_t
+swap_uint64(uint64_t val)
{
val = ((val << 8) & 0xFF00FF00FF00FF00ULL) | ((val >> 8) & 0x00FF00FF00FF00FFULL);
val = ((val << 16) & 0xFFFF0000FFFF0000ULL) | ((val >> 16) & 0x0000FFFF0000FFFFULL);
@@ -4754,414 +4815,295 @@ uint64_t swap_uint64(uint64_t val)
* Print a helpful summary of command usage and features.
*/
-void help(char *name)
+void
+help(char *name)
{
- (void) HDfprintf(stdout, "Name:\n\n");
- (void) HDfprintf(stdout, "\t%s\n\n", name);
- (void) HDfprintf(stdout, "\t TOOL NAME:\n");
- (void) HDfprintf(stdout, "\t %s\n", name);
- (void) HDfprintf(stdout, "\t SYNTAX:\n");
- (void) HDfprintf(stdout, "\t %s -h[elp], OR\n", name);
- (void) HDfprintf(stdout,
- "\t %s <infile> -c[onfig] <configfile> [<infile> -c[config] <configfile>...]", name);
- (void) HDfprintf(stdout, "\t\t\t\t -o[utfile] <outfile>\n\n");
- (void) HDfprintf(stdout, "\t PURPOSE:\n");
- (void) HDfprintf(stdout,
- "\t To convert data stored in one or more ASCII or binary files\n");
- (void) HDfprintf(stdout,
- "\t into one or more datasets (in accordance with the \n");
- (void) HDfprintf(stdout,
- "\t user-specified type and storage properties) in an existing \n");
- (void) HDfprintf(stdout, "\t or new HDF5 file.\n\n");
- (void) HDfprintf(stdout, "\t DESCRIPTION:\n");
- (void) HDfprintf(stdout,
- "\t The primary objective of the utility is to convert floating\n");
- (void) HDfprintf(stdout,
- "\t point or integer data stored in ASCII text or binary form \n");
- (void) HDfprintf(stdout,
- "\t into a data-set according to the type and storage properties\n");
- (void) HDfprintf(stdout,
- "\t specified by the user. The utility can also accept ASCII\n");
- (void) HDfprintf(stdout,
- "\t text files and store the contents in a compact form as an\n");
- (void) HDfprintf(stdout, "\t array of one-dimensional strings.\n\n");
- (void) HDfprintf(stdout,
- "\t The input data to be written as a data-set can be provided\n");
- (void) HDfprintf(stdout, "\t to the utility in one of the following forms:\n");
- (void) HDfprintf(stdout,
- "\t 1. ASCII text file with numeric data (floating point or \n");
- (void) HDfprintf(stdout, "\t integer data). \n");
- (void) HDfprintf(stdout,
- "\t 2. Binary file with native floating point data (32-bit or \n");
- (void) HDfprintf(stdout, "\t 64-bit) \n");
- (void) HDfprintf(stdout,
- "\t 3. Binary file with native integer (signed or unsigned)\n");
- (void) HDfprintf(stdout, "\t data (8-bit or 16-bit or 32-bit or 64-bit). \n");
- (void) HDfprintf(stdout,
- "\t 4. ASCII text file containing strings (text data).\n");
- (void) HDfprintf(stdout, "\t \n");
- (void) HDfprintf(stdout,
- "\t Every input file is associated with a configuration file \n");
- (void) HDfprintf(stdout,
- "\t also provided as an input to the utility. (See Section \n");
- (void) HDfprintf(stdout,
- "\t \"CONFIGURATION FILE\" to know how it is to be organized).\n");
- (void) HDfprintf(stdout,
- "\t The class, size and dimensions of the input data is \n");
- (void) HDfprintf(stdout,
- "\t specified in this configuration file. A point to note is\n");
- (void) HDfprintf(stdout,
- "\t that the floating point data in the ASCII text file may be\n");
- (void) HDfprintf(stdout,
- "\t organized in the fixed floating form (for example 323.56)\n");
- (void) HDfprintf(stdout,
- "\t or in a scientific notation (for example 3.23E+02). A \n");
- (void) HDfprintf(stdout,
- "\t different input-class specification is to be used for both\n");
- (void) HDfprintf(stdout, "\t forms.\n\n");
- (void) HDfprintf(stdout,
- "\t The utility extracts the input data from the input file \n");
- (void) HDfprintf(stdout,
- "\t according to the specified parameters and saves it into \n");
- (void) HDfprintf(stdout, "\t an H5 dataset. \n\n");
- (void) HDfprintf(stdout,
- "\t The user can specify output type and storage properties in \n");
- (void) HDfprintf(stdout,
- "\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,
- "\t the data-set do not exist, the groups will be created by the\n");
- (void) HDfprintf(stdout,
- "\t utility. If no group is specified, the dataset will be\n");
- (void) HDfprintf(stdout, "\t created under the root group.\n\n");
- (void) HDfprintf(stdout,
- "\t In addition to the name, the user is also required to \n");
- (void) 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-architecture,\n");
- (void) HDfprintf(stdout,
- "\t and the output-byte-order. If output-architecture is not \n");
- (void) HDfprintf(stdout,
- "\t specified the default is NATIVE. Output-byte-orders are fixed\n");
- (void) HDfprintf(stdout,
- "\t for some architectures and may be specified only if output-\n");
- (void) HDfprintf(stdout, "\t architecture is IEEE, UNIX or STD.\n\n");
- (void) HDfprintf(stdout,
- "\t Also, layout and other storage properties such as \n");
- (void) HDfprintf(stdout,
- "\t compression, external storage and extendible data-sets may be\n");
- (void) HDfprintf(stdout,
- "\t optionally specified. The layout and storage properties \n");
- (void) HDfprintf(stdout,
- "\t denote how raw data is to be organized on the disk. If these \n");
- (void) HDfprintf(stdout,
- "\t options are not specified the default is Contiguous layout \n");
- (void) HDfprintf(stdout, "\t and storage.\n\n");
- (void) HDfprintf(stdout,
- "\t The dataset can be organized in any of the following ways:\n");
- (void) HDfprintf(stdout, "\t 1. Contiguous.\n");
- (void) HDfprintf(stdout, "\t 2. Chunked.\n");
- (void) HDfprintf(stdout,
- "\t 3. External Storage File (has to be contiguous)\n");
- (void) HDfprintf(stdout,
- "\t 4. Extendible data sets (has to be chunked)\n");
- (void) HDfprintf(stdout, "\t 5. Compressed. (has to be chunked)\n");
- (void) HDfprintf(stdout,
- "\t 6. Compressed & Extendible (has to be chunked)\n\n");
- (void) HDfprintf(stdout,
- "\t If the user wants to store raw data in a non-HDF file then \n");
- (void) HDfprintf(stdout,
- "\t the external storage file option is to be used and the name \n");
- (void) HDfprintf(stdout, "\t of the file is to be specified. \n\n");
- (void) HDfprintf(stdout,
- "\t If the user wants the dimensions of the data-set to be\n");
- (void) HDfprintf(stdout,
- "\t unlimited, the extendible data set option can be chosen. \n\n");
- (void) HDfprintf(stdout,
- "\t The user may also specify the type of compression and the \n");
- (void) HDfprintf(stdout,
- "\t level to which the data set must be compresses by setting \n");
- (void) HDfprintf(stdout, "\t the compressed option.\n\n");
- (void) HDfprintf(stdout, "\t SYNOPSIS:\n");
- (void) HDfprintf(stdout, "\t h5import -h[elp], OR\n");
- (void) HDfprintf( stdout,
- "\t h5import <infile> -c[onfig] <configfile> \
+ (void)HDfprintf(stdout, "Name:\n\n");
+ (void)HDfprintf(stdout, "\t%s\n\n", name);
+ (void)HDfprintf(stdout, "\t TOOL NAME:\n");
+ (void)HDfprintf(stdout, "\t %s\n", name);
+ (void)HDfprintf(stdout, "\t SYNTAX:\n");
+ (void)HDfprintf(stdout, "\t %s -h[elp], OR\n", name);
+ (void)HDfprintf(stdout, "\t %s <infile> -c[onfig] <configfile> [<infile> -c[config] <configfile>...]",
+ name);
+ (void)HDfprintf(stdout, "\t\t\t\t -o[utfile] <outfile>\n\n");
+ (void)HDfprintf(stdout, "\t PURPOSE:\n");
+ (void)HDfprintf(stdout, "\t To convert data stored in one or more ASCII or binary files\n");
+ (void)HDfprintf(stdout, "\t into one or more datasets (in accordance with the \n");
+ (void)HDfprintf(stdout, "\t user-specified type and storage properties) in an existing \n");
+ (void)HDfprintf(stdout, "\t or new HDF5 file.\n\n");
+ (void)HDfprintf(stdout, "\t DESCRIPTION:\n");
+ (void)HDfprintf(stdout, "\t The primary objective of the utility is to convert floating\n");
+ (void)HDfprintf(stdout, "\t point or integer data stored in ASCII text or binary form \n");
+ (void)HDfprintf(stdout, "\t into a data-set according to the type and storage properties\n");
+ (void)HDfprintf(stdout, "\t specified by the user. The utility can also accept ASCII\n");
+ (void)HDfprintf(stdout, "\t text files and store the contents in a compact form as an\n");
+ (void)HDfprintf(stdout, "\t array of one-dimensional strings.\n\n");
+ (void)HDfprintf(stdout, "\t The input data to be written as a data-set can be provided\n");
+ (void)HDfprintf(stdout, "\t to the utility in one of the following forms:\n");
+ (void)HDfprintf(stdout, "\t 1. ASCII text file with numeric data (floating point or \n");
+ (void)HDfprintf(stdout, "\t integer data). \n");
+ (void)HDfprintf(stdout, "\t 2. Binary file with native floating point data (32-bit or \n");
+ (void)HDfprintf(stdout, "\t 64-bit) \n");
+ (void)HDfprintf(stdout, "\t 3. Binary file with native integer (signed or unsigned)\n");
+ (void)HDfprintf(stdout, "\t data (8-bit or 16-bit or 32-bit or 64-bit). \n");
+ (void)HDfprintf(stdout, "\t 4. ASCII text file containing strings (text data).\n");
+ (void)HDfprintf(stdout, "\t \n");
+ (void)HDfprintf(stdout, "\t Every input file is associated with a configuration file \n");
+ (void)HDfprintf(stdout, "\t also provided as an input to the utility. (See Section \n");
+ (void)HDfprintf(stdout, "\t \"CONFIGURATION FILE\" to know how it is to be organized).\n");
+ (void)HDfprintf(stdout, "\t The class, size and dimensions of the input data is \n");
+ (void)HDfprintf(stdout, "\t specified in this configuration file. A point to note is\n");
+ (void)HDfprintf(stdout, "\t that the floating point data in the ASCII text file may be\n");
+ (void)HDfprintf(stdout, "\t organized in the fixed floating form (for example 323.56)\n");
+ (void)HDfprintf(stdout, "\t or in a scientific notation (for example 3.23E+02). A \n");
+ (void)HDfprintf(stdout, "\t different input-class specification is to be used for both\n");
+ (void)HDfprintf(stdout, "\t forms.\n\n");
+ (void)HDfprintf(stdout, "\t The utility extracts the input data from the input file \n");
+ (void)HDfprintf(stdout, "\t according to the specified parameters and saves it into \n");
+ (void)HDfprintf(stdout, "\t an H5 dataset. \n\n");
+ (void)HDfprintf(stdout, "\t The user can specify output type and storage properties in \n");
+ (void)HDfprintf(stdout, "\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, "\t the data-set do not exist, the groups will be created by the\n");
+ (void)HDfprintf(stdout, "\t utility. If no group is specified, the dataset will be\n");
+ (void)HDfprintf(stdout, "\t created under the root group.\n\n");
+ (void)HDfprintf(stdout, "\t In addition to the name, the user is also required to \n");
+ (void)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-architecture,\n");
+ (void)HDfprintf(stdout, "\t and the output-byte-order. If output-architecture is not \n");
+ (void)HDfprintf(stdout, "\t specified the default is NATIVE. Output-byte-orders are fixed\n");
+ (void)HDfprintf(stdout, "\t for some architectures and may be specified only if output-\n");
+ (void)HDfprintf(stdout, "\t architecture is IEEE, UNIX or STD.\n\n");
+ (void)HDfprintf(stdout, "\t Also, layout and other storage properties such as \n");
+ (void)HDfprintf(stdout, "\t compression, external storage and extendible data-sets may be\n");
+ (void)HDfprintf(stdout, "\t optionally specified. The layout and storage properties \n");
+ (void)HDfprintf(stdout, "\t denote how raw data is to be organized on the disk. If these \n");
+ (void)HDfprintf(stdout, "\t options are not specified the default is Contiguous layout \n");
+ (void)HDfprintf(stdout, "\t and storage.\n\n");
+ (void)HDfprintf(stdout, "\t The dataset can be organized in any of the following ways:\n");
+ (void)HDfprintf(stdout, "\t 1. Contiguous.\n");
+ (void)HDfprintf(stdout, "\t 2. Chunked.\n");
+ (void)HDfprintf(stdout, "\t 3. External Storage File (has to be contiguous)\n");
+ (void)HDfprintf(stdout, "\t 4. Extendible data sets (has to be chunked)\n");
+ (void)HDfprintf(stdout, "\t 5. Compressed. (has to be chunked)\n");
+ (void)HDfprintf(stdout, "\t 6. Compressed & Extendible (has to be chunked)\n\n");
+ (void)HDfprintf(stdout, "\t If the user wants to store raw data in a non-HDF file then \n");
+ (void)HDfprintf(stdout, "\t the external storage file option is to be used and the name \n");
+ (void)HDfprintf(stdout, "\t of the file is to be specified. \n\n");
+ (void)HDfprintf(stdout, "\t If the user wants the dimensions of the data-set to be\n");
+ (void)HDfprintf(stdout, "\t unlimited, the extendible data set option can be chosen. \n\n");
+ (void)HDfprintf(stdout, "\t The user may also specify the type of compression and the \n");
+ (void)HDfprintf(stdout, "\t level to which the data set must be compresses by setting \n");
+ (void)HDfprintf(stdout, "\t the compressed option.\n\n");
+ (void)HDfprintf(stdout, "\t SYNOPSIS:\n");
+ (void)HDfprintf(stdout, "\t h5import -h[elp], OR\n");
+ (void)HDfprintf(stdout, "\t h5import <infile> -c[onfig] <configfile> \
[<infile> -c[config] <confile2>...] -o[utfile] <outfile>\n\n");
- (void) HDfprintf(stdout, "\t -h[elp]:\n");
- (void) HDfprintf(stdout,
- "\t Prints this summary of usage, and exits.\n\n");
- (void) HDfprintf(stdout, "\t <infile(s)>:\n");
- (void) HDfprintf(stdout,
- "\t Name of the Input file(s), containing a \n");
- (void) HDfprintf(stdout,
- "\t single n-dimensional floating point or integer array \n");
- (void) HDfprintf(stdout,
- "\t in either ASCII text, native floating point(32-bit \n");
- (void) HDfprintf(stdout,
- "\t or 64-bit) or native integer(8-bit or 16-bit or \n");
- (void) HDfprintf(stdout,
- "\t 32-bit or 64-bit). Data to be specified in the order\n");
- (void) HDfprintf(stdout, "\t of fastest changing dimensions first.\n\n");
- (void) HDfprintf(stdout, "\t -c[config] <configfile>:\n");
- (void) HDfprintf(stdout,
- "\t Every input file should be associated with a \n");
- (void) HDfprintf(stdout,
- "\t configuration file and this is done by the -c option.\n");
- (void) HDfprintf(stdout,
- "\t <configfile> is the name of the configuration file.\n");
- (void) HDfprintf(stdout, "\t (See Section \"CONFIGURATION FILE\")\n\n");
- (void) HDfprintf(stdout, "\t -o[utfile] <outfile>:\n");
- (void) HDfprintf(stdout,
- "\t Name of the HDF5 output file. Data from one or more \n");
- (void) HDfprintf(stdout,
- "\t input files are stored as one or more data sets in \n");
- (void) HDfprintf(stdout,
- "\t <outfile>. The output file may be an existing file or \n");
- (void) HDfprintf(stdout,
- "\t it maybe new in which case it will be created.\n\n\n");
- (void) HDfprintf(stdout, "\t CONFIGURATION FILE:\n");
- (void) HDfprintf(stdout,
- "\t The configuration file is an ASCII text file and must be \n");
- (void) HDfprintf(stdout,
- "\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");
- (void) HDfprintf(stdout, "\t followed by an acceptable value.\n\n");
- (void) HDfprintf(stdout, "\t Required KEYWORDS:\n");
- (void) HDfprintf(stdout, "\t PATH\n");
- (void) HDfprintf(stdout, "\t INPUT-CLASS\n");
- (void) HDfprintf(stdout, "\t INPUT-SIZE\n");
- (void) HDfprintf(stdout, "\t INPUT-BYTE-ORDER\n");
- (void) HDfprintf(stdout, "\t RANK\n");
- (void) HDfprintf(stdout, "\t DIMENSION-SIZES\n");
- (void) HDfprintf(stdout, "\t OUTPUT-CLASS\n");
- (void) HDfprintf(stdout, "\t OUTPUT-SIZE\n\n");
- (void) HDfprintf(stdout, "\t Optional KEYWORDS:\n");
- (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE\n");
- (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER\n");
- (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES\n");
- (void) HDfprintf(stdout, "\t COMPRESSION-TYPE\n");
- (void) HDfprintf(stdout, "\t COMPRESSION-PARAM\n");
- (void) HDfprintf(stdout, "\t EXTERNAL-STORAGE\n");
- (void) HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS\n\n\n");
- (void) HDfprintf(stdout, "\t Values for keywords:\n");
- (void) HDfprintf(stdout, "\t PATH:\n");
- (void) HDfprintf(stdout, "\t Strings separated by spaces to represent\n");
- (void) HDfprintf(stdout, "\t the path of the data-set. If the groups in\n");
- (void) HDfprintf(stdout,
- "\t the path do 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");
- (void) HDfprintf(stdout, "\t grp1: group under the root. If\n");
- (void) HDfprintf(stdout, "\t non-existent will be created.\n");
- (void) HDfprintf(stdout, "\t grp2: group under grp1. If \n");
- (void) HDfprintf(stdout, "\t non-existent will be created \n");
- (void) HDfprintf(stdout, "\t under grp1.\n");
- (void) HDfprintf(stdout, "\t dataset1: the name of the data-set \n");
- (void) HDfprintf(stdout, "\t to be created.\n\n");
- (void) HDfprintf(stdout, "\t INPUT-CLASS:\n");
- (void) HDfprintf(stdout, "\t String denoting the type of input data.\n");
- (void) HDfprintf(stdout, "\t (\"TEXTIN\", \"TEXTFP\", \"FP\", \"IN\", \n");
- (void) HDfprintf(stdout, "\t \"STR\", \"TEXTUIN\", \"UIN\"). \n");
- (void) HDfprintf(stdout,
- "\t INPUT-CLASS \"TEXTIN\" denotes an ASCII text \n");
- (void) HDfprintf(stdout,
- "\t file with signed integer data in ASCII form,\n");
- (void) HDfprintf(stdout,
- "\t INPUT-CLASS \"TEXTUIN\" denotes an ASCII text \n");
- (void) HDfprintf(stdout,
- "\t file with unsigned integer data in ASCII form,\n");
- (void) HDfprintf(stdout,
- "\t \"TEXTFP\" denotes an ASCII text file containing\n");
- (void) HDfprintf(stdout, "\t floating point data in the fixed notation\n");
- (void) HDfprintf(stdout, "\t (325.34),\n");
- (void) HDfprintf(stdout,
- "\t \"FP\" denotes a floating point binary file,\n");
- (void) HDfprintf(stdout,
- "\t \"IN\" denotes a signed integer binary file,\n");
- (void) HDfprintf(stdout,
- "\t \"UIN\" denotes an unsigned integer binary file,\n");
- (void) HDfprintf(stdout, "\t & \"STR\" denotes an ASCII text file the \n");
- (void) HDfprintf(stdout,
- "\t contents of which should be stored as an 1-D \n");
- (void) HDfprintf(stdout, "\t array of strings.\n");
- (void) HDfprintf(stdout, "\t If INPUT-CLASS is \"STR\", then RANK, \n");
- (void) HDfprintf(stdout,
- "\t DIMENSION-SIZES, OUTPUT-CLASS, OUTPUT-SIZE, \n");
- (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE and OUTPUT-BYTE-ORDER \n");
- (void) HDfprintf(stdout, "\t will be ignored.\n\n\n");
- (void) HDfprintf(stdout, "\t INPUT-SIZE:\n");
- (void) HDfprintf(stdout,
- "\t Integer denoting the size of the input data \n");
- (void) HDfprintf(stdout, "\t (8, 16, 32, 64). \n\n");
- (void) HDfprintf(stdout, "\t For floating point,\n");
- (void) HDfprintf(stdout, "\t INPUT-SIZE can be 32 or 64.\n");
- (void) HDfprintf(stdout, "\t For integers (signed and unsigned)\n");
- (void) HDfprintf(stdout, "\t INPUT-SIZE can be 8, 16, 32 or 64.\n\n");
- (void) HDfprintf(stdout, "\t RANK:\n");
- (void) HDfprintf(stdout,
- "\t Integer denoting the number of dimensions.\n\n");
- (void) HDfprintf(stdout, "\t DIMENSION-SIZES:\n");
- (void) HDfprintf(stdout,
- "\t Integers separated by spaces to denote the \n");
- (void) HDfprintf(stdout, "\t dimension sizes for the no. of dimensions \n");
- (void) HDfprintf(stdout, "\t determined by rank.\n\n");
- (void) HDfprintf(stdout, "\t OUTPUT-CLASS:\n");
- (void) HDfprintf(stdout,
- "\t String dentoting data type of the dataset to \n");
- (void) HDfprintf(stdout, "\t be written (\"IN\",\"FP\", \"UIN\")\n\n");
- (void) HDfprintf(stdout, "\t OUTPUT-SIZE:\n");
- (void) HDfprintf(stdout,
- "\t Integer denoting the size of the data in the \n");
- (void) HDfprintf(stdout, "\t output dataset to be written.\n");
- (void) HDfprintf(stdout,
- "\t If OUTPUT-CLASS is \"FP\", OUTPUT-SIZE can be \n");
- (void) HDfprintf(stdout, "\t 32 or 64.\n");
- (void) HDfprintf(stdout,
- "\t If OUTPUT-CLASS is \"IN\" or \"UIN\", OUTPUT-SIZE\n");
- (void) HDfprintf(stdout, "\t can be 8, 16, 32 or 64.\n\n");
- (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE:\n");
- (void) HDfprintf(stdout, "\t STRING denoting the type of output \n");
- (void) HDfprintf(stdout,
- "\t architecture. Can accept the following values\n");
- (void) HDfprintf(stdout, "\t STD\n");
- (void) HDfprintf(stdout, "\t IEEE\n");
- (void) HDfprintf(stdout, "\t INTEL\n");
- (void) HDfprintf(stdout, "\t CRAY\n");
- (void) HDfprintf(stdout, "\t MIPS\n");
- (void) HDfprintf(stdout, "\t ALPHA\n");
- (void) HDfprintf(stdout, "\t NATIVE (default)\n");
- (void) HDfprintf(stdout, "\t UNIX\n\n");
- (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER:\n");
- (void) HDfprintf(stdout,
- "\t String denoting the output-byte-order. Ignored\n");
- (void) HDfprintf(stdout,
- "\t if the OUTPUT-ARCHITECTURE is not specified or\n");
- (void) HDfprintf(stdout, "\t if it is IEEE, UNIX or STD. Can accept the \n");
- (void) HDfprintf(stdout, "\t following values.\n");
- (void) HDfprintf(stdout, "\t BE (default)\n");
- (void) HDfprintf(stdout, "\t LE\n\n");
- (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES:\n");
- (void) HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
- (void) HDfprintf(stdout,
- "\t dimension sizes of the chunk for the no. of \n");
- (void) HDfprintf(stdout,
- "\t dimensions determined by rank. Required field\n");
- (void) HDfprintf(stdout,
- "\t to denote that the dataset will be stored with\n");
- (void) HDfprintf(stdout,
- "\t chunked storage. If this field is absent the\n");
- (void) HDfprintf(stdout,
- "\t dataset will be stored with contiguous storage.\n\n");
- (void) HDfprintf(stdout, "\t COMPRESSION-TYPE:\n");
- (void) HDfprintf(stdout,
- "\t String denoting the type of compression to be\n");
- (void) HDfprintf(stdout, "\t used with the chunked storage. Requires the\n");
- (void) HDfprintf(stdout,
- "\t CHUNKED-DIMENSION-SIZES to be specified. The only \n");
- (void) HDfprintf(stdout,
- "\t currently supported compression method is GZIP. \n");
- (void) HDfprintf(stdout, "\t Will accept the following value\n");
- (void) HDfprintf(stdout, "\t GZIP\n\n");
- (void) HDfprintf(stdout, "\t COMPRESSION-PARAM:\n");
- (void) HDfprintf(stdout,
- "\t Integer used to denote compression level and \n");
- (void) HDfprintf(stdout, "\t this option is to be always specified when \n");
- (void) HDfprintf(stdout,
- "\t the COMPRESSION-TYPE option is specified. The\n");
- (void) HDfprintf(stdout, "\t values are applicable only to GZIP \n");
- (void) HDfprintf(stdout, "\t compression.\n");
- (void) HDfprintf(stdout, "\t Value 1-9: The level of Compression. \n");
- (void) HDfprintf(stdout, "\t 1 will result in the fastest \n");
- (void) HDfprintf(stdout, "\t compression while 9 will result in \n");
- (void) HDfprintf(stdout, "\t the best compression ratio. The default\n");
- (void) HDfprintf(stdout, "\t level of compression is 6.\n\n");
- (void) HDfprintf(stdout, "\t EXTERNAL-STORAGE:\n");
- (void) HDfprintf(stdout,
- "\t String to denote the name of the non-HDF5 file \n");
- (void) HDfprintf(stdout,
- "\t to store data to. Cannot be used if CHUNKED-\n");
- (void) HDfprintf(stdout,
- "\t DIMENSIONS or COMPRESSION-TYPE or EXTENDIBLE-\n");
- (void) HDfprintf(stdout, "\t DATASET is specified.\n");
- (void) HDfprintf(stdout, "\t Value <external-filename>: the name of the \n");
- (void) HDfprintf(stdout, "\t external file as a string to be used.\n\n");
- (void) HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS:\n");
- (void) HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
- (void) HDfprintf(stdout, "\t maximum dimension sizes of all the \n");
- (void) HDfprintf(stdout, "\t dimensions determined by rank. Requires the\n");
- (void) HDfprintf(stdout,
- "\t CHUNKED-DIMENSION-SIZES to be specified. A value of \n");
- (void) HDfprintf(stdout, "\t -1 for any dimension implies UNLIMITED \n");
- (void) HDfprintf(stdout,
- "\t DIMENSION size for that particular dimension.\n\n");
- (void) HDfprintf(stdout, "\t EXAMPLES:\n");
- (void) HDfprintf(stdout, "\t 1. Configuration File may look like:\n\n");
- (void) HDfprintf(stdout, "\t PATH work h5 pkamat First-set\n");
- (void) HDfprintf(stdout, "\t INPUT-CLASS TEXTFP\n");
- (void) HDfprintf(stdout, "\t RANK 3\n");
- (void) HDfprintf(stdout, "\t DIMENSION-SIZES 5 2 4\n");
- (void) HDfprintf(stdout, "\t OUTPUT-CLASS FP\n");
- (void) HDfprintf(stdout, "\t OUTPUT-SIZE 64\n");
- (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE IEEE\n");
- (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER LE\n");
- (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 \n\n");
- (void) HDfprintf(stdout,
- "\t The above configuration will accept a floating point array \n");
- (void) HDfprintf(stdout,
- "\t (5 x 2 x 4) in an ASCII file with the rank and dimension sizes \n");
- (void) HDfprintf(stdout,
- "\t specified and will save it in a chunked data-set (of pattern \n");
- (void) HDfprintf(stdout,
- "\t 2 X 2 X 2) of 64-bit floating point in the little-endian order \n");
- (void) HDfprintf(stdout,
- "\t and IEEE architecture. The dataset will be stored at\n");
- (void) HDfprintf(stdout, "\t \"/work/h5/pkamat/First-set\"\n\n");
- (void) HDfprintf(stdout, "\t 2. Another configuration could be:\n\n");
- (void) HDfprintf(stdout, "\t PATH Second-set\n");
- (void) HDfprintf(stdout, "\t INPUT-CLASS IN \n");
- (void) HDfprintf(stdout, "\t RANK 5\n");
- (void) HDfprintf(stdout, "\t DIMENSION-SIZES 6 3 5 2 4\n");
- (void) HDfprintf(stdout, "\t OUTPUT-CLASS IN\n");
- (void) HDfprintf(stdout, "\t OUTPUT-SIZE 32\n");
- (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 2 2\n");
- (void) HDfprintf(stdout, "\t EXTENDIBLE-DATASET 1 3 \n");
- (void) HDfprintf(stdout, "\t COMPRESSION-TYPE GZIP\n");
- (void) HDfprintf(stdout, "\t COMPRESSION-PARAM 7\n\n\n");
- (void) HDfprintf(stdout,
- "\t The above configuration will accept an integer array \n");
- (void) HDfprintf(stdout,
- "\t (6 X 3 X 5 x 2 x 4) in a binary file with the rank and \n");
- (void) HDfprintf(stdout,
- "\t dimension sizes specified and will save it in a chunked data-set\n");
- (void) HDfprintf(stdout,
- "\t (of pattern 2 X 2 X 2 X 2 X 2) of 32-bit floating point in \n");
- (void) HDfprintf(stdout,
- "\t native format (as output-architecture is not specified). The \n");
- (void) HDfprintf(stdout,
- "\t first and the third dimension will be defined as unlimited. The \n");
- (void) HDfprintf(stdout,
- "\t data-set will be compressed using GZIP and a compression level \n");
- (void) HDfprintf(stdout, "\t of 7.\n");
- (void) HDfprintf(stdout,
- "\t The dataset will be stored at \"/Second-set\"\n\n");
- return;
+ (void)HDfprintf(stdout, "\t -h[elp]:\n");
+ (void)HDfprintf(stdout, "\t Prints this summary of usage, and exits.\n\n");
+ (void)HDfprintf(stdout, "\t <infile(s)>:\n");
+ (void)HDfprintf(stdout, "\t Name of the Input file(s), containing a \n");
+ (void)HDfprintf(stdout, "\t single n-dimensional floating point or integer array \n");
+ (void)HDfprintf(stdout, "\t in either ASCII text, native floating point(32-bit \n");
+ (void)HDfprintf(stdout, "\t or 64-bit) or native integer(8-bit or 16-bit or \n");
+ (void)HDfprintf(stdout, "\t 32-bit or 64-bit). Data to be specified in the order\n");
+ (void)HDfprintf(stdout, "\t of fastest changing dimensions first.\n\n");
+ (void)HDfprintf(stdout, "\t -c[config] <configfile>:\n");
+ (void)HDfprintf(stdout, "\t Every input file should be associated with a \n");
+ (void)HDfprintf(stdout, "\t configuration file and this is done by the -c option.\n");
+ (void)HDfprintf(stdout, "\t <configfile> is the name of the configuration file.\n");
+ (void)HDfprintf(stdout, "\t (See Section \"CONFIGURATION FILE\")\n\n");
+ (void)HDfprintf(stdout, "\t -o[utfile] <outfile>:\n");
+ (void)HDfprintf(stdout, "\t Name of the HDF5 output file. Data from one or more \n");
+ (void)HDfprintf(stdout, "\t input files are stored as one or more data sets in \n");
+ (void)HDfprintf(stdout, "\t <outfile>. The output file may be an existing file or \n");
+ (void)HDfprintf(stdout, "\t it maybe new in which case it will be created.\n\n\n");
+ (void)HDfprintf(stdout, "\t CONFIGURATION FILE:\n");
+ (void)HDfprintf(stdout, "\t The configuration file is an ASCII text file and must be \n");
+ (void)HDfprintf(stdout, "\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");
+ (void)HDfprintf(stdout, "\t followed by an acceptable value.\n\n");
+ (void)HDfprintf(stdout, "\t Required KEYWORDS:\n");
+ (void)HDfprintf(stdout, "\t PATH\n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS\n");
+ (void)HDfprintf(stdout, "\t INPUT-SIZE\n");
+ (void)HDfprintf(stdout, "\t INPUT-BYTE-ORDER\n");
+ (void)HDfprintf(stdout, "\t RANK\n");
+ (void)HDfprintf(stdout, "\t DIMENSION-SIZES\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-CLASS\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-SIZE\n\n");
+ (void)HDfprintf(stdout, "\t Optional KEYWORDS:\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES\n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-TYPE\n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-PARAM\n");
+ (void)HDfprintf(stdout, "\t EXTERNAL-STORAGE\n");
+ (void)HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS\n\n\n");
+ (void)HDfprintf(stdout, "\t Values for keywords:\n");
+ (void)HDfprintf(stdout, "\t PATH:\n");
+ (void)HDfprintf(stdout, "\t Strings separated by spaces to represent\n");
+ (void)HDfprintf(stdout, "\t the path of the data-set. If the groups in\n");
+ (void)HDfprintf(stdout, "\t the path do 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");
+ (void)HDfprintf(stdout, "\t grp1: group under the root. If\n");
+ (void)HDfprintf(stdout, "\t non-existent will be created.\n");
+ (void)HDfprintf(stdout, "\t grp2: group under grp1. If \n");
+ (void)HDfprintf(stdout, "\t non-existent will be created \n");
+ (void)HDfprintf(stdout, "\t under grp1.\n");
+ (void)HDfprintf(stdout, "\t dataset1: the name of the data-set \n");
+ (void)HDfprintf(stdout, "\t to be created.\n\n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS:\n");
+ (void)HDfprintf(stdout, "\t String denoting the type of input data.\n");
+ (void)HDfprintf(stdout, "\t (\"TEXTIN\", \"TEXTFP\", \"FP\", \"IN\", \n");
+ (void)HDfprintf(stdout, "\t \"STR\", \"TEXTUIN\", \"UIN\"). \n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS \"TEXTIN\" denotes an ASCII text \n");
+ (void)HDfprintf(stdout, "\t file with signed integer data in ASCII form,\n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS \"TEXTUIN\" denotes an ASCII text \n");
+ (void)HDfprintf(stdout, "\t file with unsigned integer data in ASCII form,\n");
+ (void)HDfprintf(stdout, "\t \"TEXTFP\" denotes an ASCII text file containing\n");
+ (void)HDfprintf(stdout, "\t floating point data in the fixed notation\n");
+ (void)HDfprintf(stdout, "\t (325.34),\n");
+ (void)HDfprintf(stdout, "\t \"FP\" denotes a floating point binary file,\n");
+ (void)HDfprintf(stdout, "\t \"IN\" denotes a signed integer binary file,\n");
+ (void)HDfprintf(stdout, "\t \"UIN\" denotes an unsigned integer binary file,\n");
+ (void)HDfprintf(stdout, "\t & \"STR\" denotes an ASCII text file the \n");
+ (void)HDfprintf(stdout, "\t contents of which should be stored as an 1-D \n");
+ (void)HDfprintf(stdout, "\t array of strings.\n");
+ (void)HDfprintf(stdout, "\t If INPUT-CLASS is \"STR\", then RANK, \n");
+ (void)HDfprintf(stdout, "\t DIMENSION-SIZES, OUTPUT-CLASS, OUTPUT-SIZE, \n");
+ (void)HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE and OUTPUT-BYTE-ORDER \n");
+ (void)HDfprintf(stdout, "\t will be ignored.\n\n\n");
+ (void)HDfprintf(stdout, "\t INPUT-SIZE:\n");
+ (void)HDfprintf(stdout, "\t Integer denoting the size of the input data \n");
+ (void)HDfprintf(stdout, "\t (8, 16, 32, 64). \n\n");
+ (void)HDfprintf(stdout, "\t For floating point,\n");
+ (void)HDfprintf(stdout, "\t INPUT-SIZE can be 32 or 64.\n");
+ (void)HDfprintf(stdout, "\t For integers (signed and unsigned)\n");
+ (void)HDfprintf(stdout, "\t INPUT-SIZE can be 8, 16, 32 or 64.\n\n");
+ (void)HDfprintf(stdout, "\t RANK:\n");
+ (void)HDfprintf(stdout, "\t Integer denoting the number of dimensions.\n\n");
+ (void)HDfprintf(stdout, "\t DIMENSION-SIZES:\n");
+ (void)HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
+ (void)HDfprintf(stdout, "\t dimension sizes for the no. of dimensions \n");
+ (void)HDfprintf(stdout, "\t determined by rank.\n\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-CLASS:\n");
+ (void)HDfprintf(stdout, "\t String dentoting data type of the dataset to \n");
+ (void)HDfprintf(stdout, "\t be written (\"IN\",\"FP\", \"UIN\")\n\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-SIZE:\n");
+ (void)HDfprintf(stdout, "\t Integer denoting the size of the data in the \n");
+ (void)HDfprintf(stdout, "\t output dataset to be written.\n");
+ (void)HDfprintf(stdout, "\t If OUTPUT-CLASS is \"FP\", OUTPUT-SIZE can be \n");
+ (void)HDfprintf(stdout, "\t 32 or 64.\n");
+ (void)HDfprintf(stdout, "\t If OUTPUT-CLASS is \"IN\" or \"UIN\", OUTPUT-SIZE\n");
+ (void)HDfprintf(stdout, "\t can be 8, 16, 32 or 64.\n\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE:\n");
+ (void)HDfprintf(stdout, "\t STRING denoting the type of output \n");
+ (void)HDfprintf(stdout, "\t architecture. Can accept the following values\n");
+ (void)HDfprintf(stdout, "\t STD\n");
+ (void)HDfprintf(stdout, "\t IEEE\n");
+ (void)HDfprintf(stdout, "\t INTEL\n");
+ (void)HDfprintf(stdout, "\t CRAY\n");
+ (void)HDfprintf(stdout, "\t MIPS\n");
+ (void)HDfprintf(stdout, "\t ALPHA\n");
+ (void)HDfprintf(stdout, "\t NATIVE (default)\n");
+ (void)HDfprintf(stdout, "\t UNIX\n\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER:\n");
+ (void)HDfprintf(stdout, "\t String denoting the output-byte-order. Ignored\n");
+ (void)HDfprintf(stdout, "\t if the OUTPUT-ARCHITECTURE is not specified or\n");
+ (void)HDfprintf(stdout, "\t if it is IEEE, UNIX or STD. Can accept the \n");
+ (void)HDfprintf(stdout, "\t following values.\n");
+ (void)HDfprintf(stdout, "\t BE (default)\n");
+ (void)HDfprintf(stdout, "\t LE\n\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES:\n");
+ (void)HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
+ (void)HDfprintf(stdout, "\t dimension sizes of the chunk for the no. of \n");
+ (void)HDfprintf(stdout, "\t dimensions determined by rank. Required field\n");
+ (void)HDfprintf(stdout, "\t to denote that the dataset will be stored with\n");
+ (void)HDfprintf(stdout, "\t chunked storage. If this field is absent the\n");
+ (void)HDfprintf(stdout, "\t dataset will be stored with contiguous storage.\n\n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-TYPE:\n");
+ (void)HDfprintf(stdout, "\t String denoting the type of compression to be\n");
+ (void)HDfprintf(stdout, "\t used with the chunked storage. Requires the\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES to be specified. The only \n");
+ (void)HDfprintf(stdout, "\t currently supported compression method is GZIP. \n");
+ (void)HDfprintf(stdout, "\t Will accept the following value\n");
+ (void)HDfprintf(stdout, "\t GZIP\n\n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-PARAM:\n");
+ (void)HDfprintf(stdout, "\t Integer used to denote compression level and \n");
+ (void)HDfprintf(stdout, "\t this option is to be always specified when \n");
+ (void)HDfprintf(stdout, "\t the COMPRESSION-TYPE option is specified. The\n");
+ (void)HDfprintf(stdout, "\t values are applicable only to GZIP \n");
+ (void)HDfprintf(stdout, "\t compression.\n");
+ (void)HDfprintf(stdout, "\t Value 1-9: The level of Compression. \n");
+ (void)HDfprintf(stdout, "\t 1 will result in the fastest \n");
+ (void)HDfprintf(stdout, "\t compression while 9 will result in \n");
+ (void)HDfprintf(stdout, "\t the best compression ratio. The default\n");
+ (void)HDfprintf(stdout, "\t level of compression is 6.\n\n");
+ (void)HDfprintf(stdout, "\t EXTERNAL-STORAGE:\n");
+ (void)HDfprintf(stdout, "\t String to denote the name of the non-HDF5 file \n");
+ (void)HDfprintf(stdout, "\t to store data to. Cannot be used if CHUNKED-\n");
+ (void)HDfprintf(stdout, "\t DIMENSIONS or COMPRESSION-TYPE or EXTENDIBLE-\n");
+ (void)HDfprintf(stdout, "\t DATASET is specified.\n");
+ (void)HDfprintf(stdout, "\t Value <external-filename>: the name of the \n");
+ (void)HDfprintf(stdout, "\t external file as a string to be used.\n\n");
+ (void)HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS:\n");
+ (void)HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
+ (void)HDfprintf(stdout, "\t maximum dimension sizes of all the \n");
+ (void)HDfprintf(stdout, "\t dimensions determined by rank. Requires the\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES to be specified. A value of \n");
+ (void)HDfprintf(stdout, "\t -1 for any dimension implies UNLIMITED \n");
+ (void)HDfprintf(stdout, "\t DIMENSION size for that particular dimension.\n\n");
+ (void)HDfprintf(stdout, "\t EXAMPLES:\n");
+ (void)HDfprintf(stdout, "\t 1. Configuration File may look like:\n\n");
+ (void)HDfprintf(stdout, "\t PATH work h5 pkamat First-set\n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS TEXTFP\n");
+ (void)HDfprintf(stdout, "\t RANK 3\n");
+ (void)HDfprintf(stdout, "\t DIMENSION-SIZES 5 2 4\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-CLASS FP\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-SIZE 64\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE IEEE\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER LE\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 \n\n");
+ (void)HDfprintf(stdout, "\t The above configuration will accept a floating point array \n");
+ (void)HDfprintf(stdout, "\t (5 x 2 x 4) in an ASCII file with the rank and dimension sizes \n");
+ (void)HDfprintf(stdout, "\t specified and will save it in a chunked data-set (of pattern \n");
+ (void)HDfprintf(stdout, "\t 2 X 2 X 2) of 64-bit floating point in the little-endian order \n");
+ (void)HDfprintf(stdout, "\t and IEEE architecture. The dataset will be stored at\n");
+ (void)HDfprintf(stdout, "\t \"/work/h5/pkamat/First-set\"\n\n");
+ (void)HDfprintf(stdout, "\t 2. Another configuration could be:\n\n");
+ (void)HDfprintf(stdout, "\t PATH Second-set\n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS IN \n");
+ (void)HDfprintf(stdout, "\t RANK 5\n");
+ (void)HDfprintf(stdout, "\t DIMENSION-SIZES 6 3 5 2 4\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-CLASS IN\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-SIZE 32\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 2 2\n");
+ (void)HDfprintf(stdout, "\t EXTENDIBLE-DATASET 1 3 \n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-TYPE GZIP\n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-PARAM 7\n\n\n");
+ (void)HDfprintf(stdout, "\t The above configuration will accept an integer array \n");
+ (void)HDfprintf(stdout, "\t (6 X 3 X 5 x 2 x 4) in a binary file with the rank and \n");
+ (void)HDfprintf(stdout, "\t dimension sizes specified and will save it in a chunked data-set\n");
+ (void)HDfprintf(stdout, "\t (of pattern 2 X 2 X 2 X 2 X 2) of 32-bit floating point in \n");
+ (void)HDfprintf(stdout, "\t native format (as output-architecture is not specified). The \n");
+ (void)HDfprintf(stdout, "\t first and the third dimension will be defined as unlimited. The \n");
+ (void)HDfprintf(stdout, "\t data-set will be compressed using GZIP and a compression level \n");
+ (void)HDfprintf(stdout, "\t of 7.\n");
+ (void)HDfprintf(stdout, "\t The dataset will be stored at \"/Second-set\"\n\n");
}
-void usage(char *name)
+void
+usage(char *name)
{
- (void) HDfprintf(stdout, "\nUsage:\t%s -h[elp], OR\n", name);
- (void) HDfprintf(stdout,
- "\t%s <infile> -c[onfig] <configfile> \
- [<infile> -c[config] <configfile>...] -o[utfile] <outfile> \n\n", name);
- return;
+ (void)HDfprintf(stdout, "\nUsage:\t%s -h[elp], OR\n", name);
+ (void)HDfprintf(stdout, "\t%s <infile> -c[onfig] <configfile> \
+ [<infile> -c[config] <configfile>...] -o[utfile] <outfile> \n\n",
+ name);
}
-
diff --git a/tools/src/h5import/h5import.h b/tools/src/h5import/h5import.h
index 00c41f6..efd40e1 100644
--- a/tools/src/h5import/h5import.h
+++ b/tools/src/h5import/h5import.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,124 +17,117 @@
*
*/
-#ifndef H5IMPORT_H__
-#define H5IMPORT_H__
+#ifndef H5IMPORT_H
+#define H5IMPORT_H
/*
* state table tokens
*/
#define FILNAME 0
/* filename */
-#define OPT_o 1
+#define OPT_o 1
/* output filename */
-#define OPT_c 2 /* configuration filename */
-#define OPT_h 3 /* request for explanation */
-#define OPT_d 4 /* dimensions */
-#define OPT_p 5 /* pathname */
-#define OPT_t 6 /* data type */
-#define OPT_s 7 /* data size */
-#define ERR 20 /* invalid token */
-
-#define MAX_GROUPS_IN_PATH 20
+#define OPT_c 2 /* configuration filename */
+#define OPT_h 3 /* request for explanation */
+#define OPT_d 4 /* dimensions */
+#define OPT_p 5 /* pathname */
+#define OPT_t 6 /* data type */
+#define OPT_s 7 /* data size */
+#define ERR 20 /* invalid token */
+
+#define MAX_GROUPS_IN_PATH 20
#define MAX_PATH_NAME_LENGTH 255
-#define NUM_KEYS 15
-#define MIN_NUM_DIMENSION 1
-#define MAX_NUM_DIMENSION 32
-#define BASE_10 10
-
-#define PATH 0
-#define INPUT_CLASS 1
-#define INPUT_SIZE 2
-#define RANK 3
-#define DIM 4
-#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
-#define INPUT_B_ORDER 14
+#define NUM_KEYS 15
+#define MIN_NUM_DIMENSION 1
+#define MAX_NUM_DIMENSION 32
+#define BASE_10 10
+
+#define PATH 0
+#define INPUT_CLASS 1
+#define INPUT_SIZE 2
+#define RANK 3
+#define DIM 4
+#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
+#define INPUT_B_ORDER 14
/* data types */
-#define H5DT_INT8 signed char
-#define H5DT_INT16 short
-#define H5DT_INT32 int
-#define H5DT_FLOAT32 float
-#define H5DT_FLOAT64 double
-#define VOIDP void*
-#define H5DT_UINT8 unsigned char
-#define H5DT_UINT16 unsigned short
-#define H5DT_UINT32 unsigned int
-#define H5DT_INT64 long long
-#define H5DT_UINT64 unsigned H5DT_INT64
-
-struct path_info
-{
+#define H5DT_INT8 signed char
+#define H5DT_INT16 short
+#define H5DT_INT32 int
+#define H5DT_FLOAT32 float
+#define H5DT_FLOAT64 double
+#define VOIDP void *
+#define H5DT_UINT8 unsigned char
+#define H5DT_UINT16 unsigned short
+#define H5DT_UINT32 unsigned int
+#define H5DT_INT64 long long
+#define H5DT_UINT64 unsigned H5DT_INT64
+
+struct path_info {
char group[MAX_GROUPS_IN_PATH][MAX_PATH_NAME_LENGTH];
- int count;
+ int count;
};
-struct Input
-{
- int h5dumpInput;
+struct Input {
+ int h5dumpInput;
struct path_info path;
- int inputClass;
- int inputSize;
- int inputArchitecture;
- int inputByteOrder;
- int rank;
- hsize_t* sizeOfDimension;
- int outputClass;
- int outputSize;
- int outputArchitecture;
- int outputByteOrder;
- hsize_t* sizeOfChunk;
- hsize_t* maxsizeOfDimension;
- int compressionType;
- int compressionParam;
- char *externFilename;
- VOIDP data;
- int configOptionVector[NUM_KEYS];
+ int inputClass;
+ int inputSize;
+ int inputArchitecture;
+ int inputByteOrder;
+ int rank;
+ hsize_t * sizeOfDimension;
+ int outputClass;
+ int outputSize;
+ int outputArchitecture;
+ int outputByteOrder;
+ hsize_t * sizeOfChunk;
+ hsize_t * maxsizeOfDimension;
+ int compressionType;
+ int compressionParam;
+ char * externFilename;
+ VOIDP data;
+ int configOptionVector[NUM_KEYS];
};
-struct infilesformat
-{
- char datafile[MAX_PATH_NAME_LENGTH];
- char configfile[MAX_PATH_NAME_LENGTH];
+struct infilesformat {
+ char datafile[MAX_PATH_NAME_LENGTH];
+ char configfile[MAX_PATH_NAME_LENGTH];
struct Input in;
- int config; /* Configfile present? No - 0. Yes - 1 */
+ int config; /* Configfile present? No - 0. Yes - 1 */
};
-struct Options
-{
- struct infilesformat infiles[30]; /* structure to hold the list of input file names. Limited to 30*/
- char outfile[256]; /* output file name */
- int fcount; /* number of input files */
+struct Options {
+ struct infilesformat infiles[30]; /* structure to hold the list of input file names. Limited to 30*/
+ char outfile[256]; /* output file name */
+ int fcount; /* number of input files */
};
-char keytable[NUM_KEYS][30] = {
- "PATH",
- "INPUT-CLASS",
- "INPUT-SIZE",
- "RANK",
- "DIMENSION-SIZES",
- "OUTPUT-CLASS",
- "OUTPUT-SIZE",
- "OUTPUT-ARCHITECTURE",
- "OUTPUT-BYTE-ORDER",
- "CHUNKED-DIMENSION-SIZES",
- "COMPRESSION-TYPE",
- "COMPRESSION-PARAM",
- "EXTERNAL-STORAGE",
- "MAXIMUM-DIMENSIONS",
- "INPUT-BYTE-ORDER"
-};
-
-static int state_table[15][8] =
-{
+char keytable[NUM_KEYS][30] = {"PATH",
+ "INPUT-CLASS",
+ "INPUT-SIZE",
+ "RANK",
+ "DIMENSION-SIZES",
+ "OUTPUT-CLASS",
+ "OUTPUT-SIZE",
+ "OUTPUT-ARCHITECTURE",
+ "OUTPUT-BYTE-ORDER",
+ "CHUNKED-DIMENSION-SIZES",
+ "COMPRESSION-TYPE",
+ "COMPRESSION-PARAM",
+ "EXTERNAL-STORAGE",
+ "MAXIMUM-DIMENSIONS",
+ "INPUT-BYTE-ORDER"};
+
+static int state_table[15][8] = {
/* token ordering: FILNAME OPT_o OPT_c OPT_h OPT_d OPT_p OPT_t OPT_s */
/* state 0: start */
@@ -189,12 +182,11 @@ static int state_table[15][8] =
* Function declarations for h5import
*
*/
-void usage(char *);
-void setDefaultValues(struct Input *in, int count);
-void help(char *);
-
-hid_t createOutputDataType(struct Input *in);
-hid_t createInputDataType(struct Input *in);
+void usage(char *);
+void setDefaultValues(struct Input *in, int count);
+void help(char *);
-#endif /* H5IMPORT_H__ */
+hid_t createOutputDataType(struct Input *in);
+hid_t createInputDataType(struct Input *in);
+#endif /* H5IMPORT_H */
diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt
index 69d4c4d..0a31215 100644
--- a/tools/src/h5jam/CMakeLists.txt
+++ b/tools/src/h5jam/CMakeLists.txt
@@ -6,14 +6,14 @@ project (HDF5_TOOLS_SRC_H5JAM C)
# --------------------------------------------------------------------
if (NOT ONLY_SHARED_LIBS)
add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c)
- target_include_directories (h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5jam STATIC)
target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5jam PROPERTIES FOLDER tools)
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam")
add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c)
- target_include_directories (h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5unjam STATIC)
target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5unjam PROPERTIES FOLDER tools)
@@ -27,14 +27,14 @@ endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5jam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c)
- target_include_directories (h5jam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5jam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5jam-shared SHARED)
target_link_libraries (h5jam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5jam-shared PROPERTIES FOLDER tools)
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam-shared")
add_executable (h5unjam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c)
- target_include_directories (h5unjam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5unjam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5unjam-shared SHARED)
target_link_libraries (h5unjam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5unjam-shared PROPERTIES FOLDER tools)
@@ -46,6 +46,19 @@ if (BUILD_SHARED_LIBS)
)
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_H5JAM_SRC_FORMAT h5jam)
+ clang_format (HDF5_H5UNJAM_SRC_FORMAT h5unjam)
+ else ()
+ clang_format (HDF5_H5JAM_SRC_FORMAT h5jam-shared)
+ clang_format (HDF5_H5UNJAM_SRC_FORMAT h5unjam-shared)
+ endif ()
+endif ()
+
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
diff --git a/tools/src/h5jam/Makefile.am b/tools/src/h5jam/Makefile.am
index 4c44b08..2dd496d 100644
--- a/tools/src/h5jam/Makefile.am
+++ b/tools/src/h5jam/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/src/h5jam/Makefile.in b/tools/src/h5jam/Makefile.in
index 9e6c6dc..aea67c7 100644
--- a/tools/src/h5jam/Makefile.in
+++ b/tools/src/h5jam/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -426,12 +427,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -469,11 +470,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -505,8 +551,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -520,7 +564,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -530,6 +576,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -723,7 +770,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1272,8 +1319,9 @@ uninstall-am: uninstall-binPROGRAMS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 56ed66b..b5df5c6 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -19,36 +19,25 @@
/* Name of tool */
#define PROGRAMNAME "h5jam"
-herr_t write_pad(int ofile, hsize_t old_where, hsize_t *new_where);
-hsize_t compute_user_block_size (hsize_t);
-hsize_t copy_some_to_file (int, int, hsize_t, hsize_t, ssize_t);
-void parse_command_line (int, const char *[]);
+herr_t write_pad(int ofile, hsize_t old_where, hsize_t *new_where);
+hsize_t compute_user_block_size(hsize_t);
+hsize_t copy_some_to_file(int, int, hsize_t, hsize_t, ssize_t);
+void parse_command_line(int, const char *[]);
-int do_clobber = FALSE;
+int do_clobber = FALSE;
char *output_file = NULL;
-char *input_file = NULL;
-char *ub_file = NULL;
+char *input_file = NULL;
+char *ub_file = NULL;
/*
* Command-line options: The user can specify short or long-named
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
-static const char *s_opts = "hi:u:o:c:V"; /* add more later ? */
-static struct long_options l_opts[] = {
- {"help", no_arg, 'h'},
- {"hel", no_arg, 'h'},
- {"i", require_arg, 'i'}, /* input file */
- {"u", require_arg, 'u'}, /* user block file */
- {"o", require_arg, 'o'}, /* output file */
- {"clobber", no_arg, 'c'}, /* clobber existing UB */
- {"clobbe", no_arg, 'c'},
- {"clobb", no_arg, 'c'},
- {"clob", no_arg, 'c'},
- {"clo", no_arg, 'c'},
- {"cl", no_arg, 'c'},
- {NULL, 0, '\0'}
-};
+static const char * s_opts = "hi:u:o:c:V";
+static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"i", require_arg, 'i'},
+ {"u", require_arg, 'u'}, {"o", require_arg, 'o'},
+ {"clobber", no_arg, 'c'}, {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -59,56 +48,35 @@ static struct long_options l_opts[] = {
*-------------------------------------------------------------------------
*/
static void
-usage (const char *prog)
+usage(const char *prog)
{
- HDfflush (stdout);
- HDfprintf (stdout,
- "usage: %s -i <in_file.h5> -u <in_user_file> [-o <out_file.h5>] [--clobber]\n", prog);
- HDfprintf (stdout, "\n");
- HDfprintf (stdout,
- "Adds user block to front of an HDF5 file and creates a new concatenated file.\n");
- HDfprintf (stdout, "\n");
- HDfprintf (stdout,
- "OPTIONS\n");
- HDfprintf (stdout,
- " -i in_file.h5 Specifies the input HDF5 file.\n");
- HDfprintf (stdout,
- " -u in_user_file Specifies the file to be inserted into the user block.\n");
- HDfprintf (stdout,
- " Can be any file format except an HDF5 format.\n");
- HDfprintf (stdout,
- " -o out_file.h5 Specifies the output HDF5 file.\n");
- HDfprintf (stdout,
- " If not specified, the user block will be concatenated in\n");
- HDfprintf (stdout,
- " place to the input HDF5 file.\n");
- HDfprintf (stdout,
- " --clobber Wipes out any existing user block before concatenating\n");
- HDfprintf (stdout,
- " the given user block.\n");
- HDfprintf (stdout,
- " The size of the new user block will be the larger of;\n");
- HDfprintf (stdout,
- " - the size of existing user block in the input HDF5 file\n");
- HDfprintf (stdout,
- " - the size of user block required by new input user file\n");
- HDfprintf (stdout,
- " (size = 512 x 2N, N is positive integer.)\n");
- HDfprintf (stdout, "\n");
- HDfprintf (stdout,
- " -h Prints a usage message and exits.\n");
- HDfprintf (stdout,
- " -V Prints the HDF5 library version and exits.\n");
- HDfprintf (stdout, "\n");
- HDfprintf (stdout,
- "Exit Status:\n");
- HDfprintf (stdout,
- " 0 Succeeded.\n");
- HDfprintf (stdout,
- " >0 An error occurred.\n");
+ HDfflush(stdout);
+ HDfprintf(stdout, "usage: %s -i <in_file.h5> -u <in_user_file> [-o <out_file.h5>] [--clobber]\n", prog);
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "Adds user block to front of an HDF5 file and creates a new concatenated file.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "OPTIONS\n");
+ HDfprintf(stdout, " -i in_file.h5 Specifies the input HDF5 file.\n");
+ HDfprintf(stdout, " -u in_user_file Specifies the file to be inserted into the user block.\n");
+ HDfprintf(stdout, " Can be any file format except an HDF5 format.\n");
+ HDfprintf(stdout, " -o out_file.h5 Specifies the output HDF5 file.\n");
+ HDfprintf(stdout, " If not specified, the user block will be concatenated in\n");
+ HDfprintf(stdout, " place to the input HDF5 file.\n");
+ HDfprintf(stdout, " --clobber Wipes out any existing user block before concatenating\n");
+ HDfprintf(stdout, " the given user block.\n");
+ HDfprintf(stdout, " The size of the new user block will be the larger of;\n");
+ HDfprintf(stdout, " - the size of existing user block in the input HDF5 file\n");
+ HDfprintf(stdout, " - the size of user block required by new input user file\n");
+ HDfprintf(stdout, " (size = 512 x 2N, N is positive integer.)\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, " -h Prints a usage message and exits.\n");
+ HDfprintf(stdout, " -V Prints the HDF5 library version and exits.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "Exit Status:\n");
+ HDfprintf(stdout, " 0 Succeeded.\n");
+ HDfprintf(stdout, " >0 An error occurred.\n");
}
-
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -136,40 +104,38 @@ leave(int ret)
*/
void
-parse_command_line (int argc, const char *argv[])
+parse_command_line(int argc, const char *argv[])
{
- int opt = FALSE;
-
- /* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
- {
- switch ((char) opt)
- {
- case 'o':
- output_file = HDstrdup (opt_arg);
- break;
- case 'i':
- input_file = HDstrdup (opt_arg);
- break;
- case 'u':
- ub_file = HDstrdup (opt_arg);
- break;
- case 'c':
- do_clobber = TRUE;
- break;
- case 'h':
- usage (h5tools_getprogname());
- leave (EXIT_SUCCESS);
- break;
- case 'V':
- print_version (h5tools_getprogname());
- leave (EXIT_SUCCESS);
- break;
- case '?':
- default:
- usage (h5tools_getprogname());
- leave (EXIT_FAILURE);
- }
+ int opt = FALSE;
+
+ /* parse command line options */
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
+ case 'o':
+ output_file = HDstrdup(H5_optarg);
+ break;
+ case 'i':
+ input_file = HDstrdup(H5_optarg);
+ break;
+ case 'u':
+ ub_file = HDstrdup(H5_optarg);
+ break;
+ case 'c':
+ do_clobber = TRUE;
+ break;
+ case 'h':
+ usage(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ break;
+ case 'V':
+ print_version(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ break;
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ leave(EXIT_FAILURE);
+ }
}
}
@@ -183,24 +149,24 @@ parse_command_line (int argc, const char *argv[])
*-------------------------------------------------------------------------
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- int ufid = -1;
- int h5fid = -1;
- int ofid = -1;
- hid_t ifile = H5I_INVALID_HID;
- hid_t plist = H5I_INVALID_HID;
- herr_t status;
- htri_t testval;
- hsize_t usize;
- hsize_t h5fsize;
- hsize_t startub;
- hsize_t where;
- hsize_t newubsize;
- off_t fsize;
- h5_stat_t sbuf;
- h5_stat_t sbuf2;
- int res;
+ int ufid = -1;
+ int h5fid = -1;
+ int ofid = -1;
+ hid_t ifile = H5I_INVALID_HID;
+ hid_t plist = H5I_INVALID_HID;
+ herr_t status;
+ htri_t testval;
+ hsize_t usize;
+ hsize_t h5fsize;
+ hsize_t startub;
+ hsize_t where;
+ hsize_t newubsize;
+ off_t fsize;
+ h5_stat_t sbuf;
+ h5_stat_t sbuf2;
+ int res;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -221,7 +187,7 @@ main (int argc, const char *argv[])
goto done;
}
- testval = H5Fis_hdf5 (ub_file);
+ testval = H5Fis_hdf5(ub_file);
if (testval > 0) {
error_msg("-u <user_file> cannot be HDF5 file, but it appears to be an HDF5 file.\n");
@@ -237,7 +203,7 @@ main (int argc, const char *argv[])
goto done;
}
- testval = H5Fis_hdf5 (input_file);
+ testval = H5Fis_hdf5(input_file);
if (testval <= 0) {
error_msg("Input HDF5 file \"%s\" is not HDF5 format.\n", input_file);
@@ -274,14 +240,14 @@ main (int argc, const char *argv[])
ifile = H5I_INVALID_HID;
ufid = HDopen(ub_file, O_RDONLY);
- if(ufid < 0) {
+ if (ufid < 0) {
error_msg("unable to open user block file \"%s\"\n", ub_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
res = HDfstat(ufid, &sbuf);
- if(res < 0) {
+ if (res < 0) {
error_msg("Can't stat file \"%s\"\n", ub_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -290,14 +256,14 @@ main (int argc, const char *argv[])
fsize = (off_t)sbuf.st_size;
h5fid = HDopen(input_file, O_RDONLY);
- if(h5fid < 0) {
+ if (h5fid < 0) {
error_msg("unable to open HDF5 file for read \"%s\"\n", input_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
res = HDfstat(h5fid, &sbuf2);
- if(res < 0) {
+ if (res < 0) {
error_msg("Can't stat file \"%s\"\n", input_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -324,7 +290,7 @@ main (int argc, const char *argv[])
}
}
- newubsize = compute_user_block_size((hsize_t) fsize);
+ newubsize = compute_user_block_size((hsize_t)fsize);
startub = usize;
@@ -334,53 +300,53 @@ main (int argc, const char *argv[])
if (usize > newubsize) {
newubsize = usize;
}
- startub = 0; /*blast the old */
+ startub = 0; /*blast the old */
}
else {
/* add new ub to current ublock, pad to new offset */
newubsize += usize;
- newubsize = compute_user_block_size((hsize_t) newubsize);
+ newubsize = compute_user_block_size((hsize_t)newubsize);
}
}
/* copy the HDF5 from starting at usize to starting at newubsize:
* makes room at 'from' for new ub */
/* if no current ub, usize is 0 */
- copy_some_to_file(h5fid, ofid, usize, newubsize, (ssize_t) (h5fsize - usize));
+ copy_some_to_file(h5fid, ofid, usize, newubsize, (ssize_t)(h5fsize - usize));
/* copy the old ub to the beginning of the new file */
if (!do_clobber) {
- where = copy_some_to_file(h5fid, ofid, (hsize_t) 0, (hsize_t) 0, (ssize_t) usize);
+ where = copy_some_to_file(h5fid, ofid, (hsize_t)0, (hsize_t)0, (ssize_t)usize);
}
/* copy the new ub to the end of the ub */
- where = copy_some_to_file(ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1);
+ where = copy_some_to_file(ufid, ofid, (hsize_t)0, startub, (ssize_t)-1);
/* pad the ub */
- if(write_pad(ofid, where, &where) < 0) {
+ if (write_pad(ofid, where, &where) < 0) {
error_msg("Can't pad file \"%s\"\n", output_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
} /* end if */
done:
- if(ub_file)
+ if (ub_file)
HDfree(ub_file);
- if(input_file)
+ if (input_file)
HDfree(input_file);
- if(output_file)
+ if (output_file)
HDfree(output_file);
- if(plist >= 0)
+ if (plist >= 0)
H5Pclose(plist);
- if(ifile >= 0)
+ if (ifile >= 0)
H5Fclose(ifile);
- if(ufid >= 0)
+ if (ufid >= 0)
HDclose(ufid);
- if(h5fid >= 0)
+ if (h5fid >= 0)
HDclose(h5fid);
- if(ofid >= 0)
+ if (ofid >= 0)
HDclose(ofid);
leave(h5tools_getstatus());
@@ -407,29 +373,28 @@ done:
*-------------------------------------------------------------------------
*/
hsize_t
-copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout,
- ssize_t limit)
+copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, ssize_t limit)
{
- char buf[1024];
+ char buf[1024];
h5_stat_t sbuf;
- int res;
- ssize_t tot = 0;
- ssize_t howmuch = 0;
- ssize_t nchars = -1;
- ssize_t to;
- ssize_t from;
- ssize_t toend;
- ssize_t fromend;
-
- if(startin > startout) {
+ int res;
+ ssize_t tot = 0;
+ ssize_t howmuch = 0;
+ ssize_t nchars = -1;
+ ssize_t to;
+ ssize_t from;
+ ssize_t toend;
+ ssize_t fromend;
+
+ if (startin > startout) {
/* this case is prohibited */
error_msg("copy_some_to_file: panic: startin > startout?\n");
- exit (EXIT_FAILURE);
+ exit(EXIT_FAILURE);
} /* end if */
- if(limit < 0) {
+ if (limit < 0) {
res = HDfstat(infid, &sbuf);
- if(res < 0) {
+ if (res < 0) {
error_msg("Can't stat file \n");
HDexit(EXIT_FAILURE);
} /* end if */
@@ -440,27 +405,27 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout,
howmuch = limit;
} /* end if */
- if(0 == howmuch)
+ if (0 == howmuch)
return 0;
- toend = (ssize_t) startout + howmuch;
- fromend = (ssize_t) startin + howmuch;
+ toend = (ssize_t)startout + howmuch;
+ fromend = (ssize_t)startin + howmuch;
if (howmuch > 512) {
- to = toend - 512;
+ to = toend - 512;
from = fromend - 512;
}
else {
- to = toend - howmuch;
+ to = toend - howmuch;
from = fromend - howmuch;
} /* end if */
while (howmuch > 0) {
- HDlseek(outfid, (off_t) to, SEEK_SET);
- HDlseek(infid, (off_t) from, SEEK_SET);
+ HDlseek(outfid, (off_t)to, SEEK_SET);
+ HDlseek(infid, (off_t)from, SEEK_SET);
if (howmuch > 512) {
- nchars = HDread(infid, buf, (unsigned) 512);
+ nchars = HDread(infid, buf, (unsigned)512);
}
else {
nchars = HDread(infid, buf, (unsigned)howmuch);
@@ -471,14 +436,14 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout,
HDexit(EXIT_FAILURE);
} /* end if */
- if(HDwrite (outfid, buf, (unsigned) nchars) < 0) {
+ if (HDwrite(outfid, buf, (unsigned)nchars) < 0) {
error_msg("Write error \n");
HDexit(EXIT_FAILURE);
}
tot += nchars;
howmuch -= nchars;
- if(howmuch > 512) {
+ if (howmuch > 512) {
to -= nchars;
from -= nchars;
}
@@ -486,12 +451,11 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout,
to -= howmuch;
from -= howmuch;
} /* end if */
- } /* end while */
+ } /* end while */
return (hsize_t)tot + (hsize_t)startout;
} /* end copy_some_to_file() */
-
/*-------------------------------------------------------------------------
* Function: compute_user_block_size
*
@@ -508,10 +472,10 @@ compute_user_block_size(hsize_t ublock_size)
{
hsize_t where = 512;
- if(0 == ublock_size)
+ if (0 == ublock_size)
return 0;
- while(where < ublock_size)
+ while (where < ublock_size)
where *= 2;
return where;
@@ -528,10 +492,10 @@ herr_t
write_pad(int ofile, hsize_t old_where, hsize_t *new_where)
{
unsigned int i;
- char buf[1];
- hsize_t psize;
+ char buf[1];
+ hsize_t psize;
- if(new_where == NULL)
+ if (new_where == NULL)
return FAIL;
buf[0] = '\0';
@@ -541,8 +505,8 @@ write_pad(int ofile, hsize_t old_where, hsize_t *new_where)
psize = compute_user_block_size(old_where);
psize -= old_where;
- for(i = 0; i < psize; i++)
- if(HDwrite(ofile, buf, 1) < 0)
+ for (i = 0; i < psize; i++)
+ if (HDwrite(ofile, buf, 1) < 0)
return FAIL;
/* Set the new size of the file. */
@@ -550,4 +514,3 @@ write_pad(int ofile, hsize_t old_where, hsize_t *new_where)
return SUCCEED;
} /* end write_pad() */
-
diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c
index c6bf498..fc675ba 100644
--- a/tools/src/h5jam/h5unjam.c
+++ b/tools/src/h5jam/h5unjam.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,34 +21,24 @@
#define COPY_BUF_SIZE 1024
-hsize_t write_pad( int , hsize_t );
-hsize_t compute_pad( hsize_t );
-herr_t copy_to_file( FILE *, FILE * , ssize_t, ssize_t );
+hsize_t write_pad(int, hsize_t);
+hsize_t compute_pad(hsize_t);
+herr_t copy_to_file(FILE *, FILE *, ssize_t, ssize_t);
-int do_delete = FALSE;
+int do_delete = FALSE;
char *output_file = NULL;
-char *input_file = NULL;
-char *ub_file = NULL;
+char *input_file = NULL;
+char *ub_file = NULL;
/*
* Command-line options: The user can specify short or long-named
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
-static const char *s_opts = "hu:i:o:d:V";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h' },
- {"i", require_arg, 'i'}, /* input file */
- {"u", require_arg, 'u'}, /* user block file */
- {"o", require_arg, 'o'}, /* output file */
- {"delete", no_arg, 'd'}, /* delete ub */
- {"delet", no_arg, 'd'},
- {"dele", no_arg, 'd'},
- {"del", no_arg, 'd'},
- {"de", no_arg, 'd'},
- { NULL, 0, '\0' }
-};
+static const char * s_opts = "hu:i:o:d:V";
+static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"i", require_arg, 'i'},
+ {"u", require_arg, 'u'}, {"o", require_arg, 'o'},
+ {"delete", no_arg, 'd'}, {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -62,55 +52,34 @@ static void
usage(const char *prog)
{
HDfflush(stdout);
- HDfprintf(stdout,
- "usage: %s -i <in_file.h5> [-o <out_file.h5> ] [-u <out_user_file> | --delete]\n", prog);
+ HDfprintf(stdout, "usage: %s -i <in_file.h5> [-o <out_file.h5> ] [-u <out_user_file> | --delete]\n",
+ prog);
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- "Splits user file and HDF5 file into two files: user block data and HDF5 data.\n");
+ HDfprintf(stdout, "Splits user file and HDF5 file into two files: user block data and HDF5 data.\n");
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- "OPTIONS\n");
- HDfprintf(stdout,
- " -i in_file.h5 Specifies the HDF5 as input. If the input HDF5 file\n");
- HDfprintf(stdout,
- " contains no user block, exit with an error message.\n");
- HDfprintf(stdout,
- " -o out_file.h5 Specifies output HDF5 file without a user block.\n");
- HDfprintf(stdout,
- " If not specified, the user block will be removed from the\n");
- HDfprintf(stdout,
- " input HDF5 file.\n");
- HDfprintf(stdout,
- " -u out_user_file\n");
- HDfprintf(stdout,
- " Specifies the output file containing the data from the\n");
- HDfprintf(stdout,
- " user block.\n");
- HDfprintf(stdout,
- " Cannot be used with --delete option.\n");
- HDfprintf(stdout,
- " --delete Remove the user block from the input HDF5 file. The content\n");
- HDfprintf(stdout,
- " of the user block is discarded.\n");
- HDfprintf(stdout,
- " Cannot be used with the -u option.\n");
+ HDfprintf(stdout, "OPTIONS\n");
+ HDfprintf(stdout, " -i in_file.h5 Specifies the HDF5 as input. If the input HDF5 file\n");
+ HDfprintf(stdout, " contains no user block, exit with an error message.\n");
+ HDfprintf(stdout, " -o out_file.h5 Specifies output HDF5 file without a user block.\n");
+ HDfprintf(stdout, " If not specified, the user block will be removed from the\n");
+ HDfprintf(stdout, " input HDF5 file.\n");
+ HDfprintf(stdout, " -u out_user_file\n");
+ HDfprintf(stdout, " Specifies the output file containing the data from the\n");
+ HDfprintf(stdout, " user block.\n");
+ HDfprintf(stdout, " Cannot be used with --delete option.\n");
+ HDfprintf(stdout, " --delete Remove the user block from the input HDF5 file. The content\n");
+ HDfprintf(stdout, " of the user block is discarded.\n");
+ HDfprintf(stdout, " Cannot be used with the -u option.\n");
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- " -h Prints a usage message and exits.\n");
- HDfprintf(stdout,
- " -V Prints the HDF5 library version and exits.\n");
+ HDfprintf(stdout, " -h Prints a usage message and exits.\n");
+ HDfprintf(stdout, " -V Prints the HDF5 library version and exits.\n");
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- " If neither --delete nor -u is specified, the user block from the input file\n");
- HDfprintf(stdout,
- " will be displayed to stdout.\n");
+ HDfprintf(stdout, " If neither --delete nor -u is specified, the user block from the input file\n");
+ HDfprintf(stdout, " will be displayed to stdout.\n");
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- "Exit Status:\n");
- HDfprintf(stdout,
- " 0 Succeeded.\n");
- HDfprintf(stdout,
- " >0 An error occurred.\n");
+ HDfprintf(stdout, "Exit Status:\n");
+ HDfprintf(stdout, " 0 Succeeded.\n");
+ HDfprintf(stdout, " >0 An error occurred.\n");
}
/*-------------------------------------------------------------------------
@@ -127,23 +96,24 @@ parse_command_line(int argc, const char *argv[])
{
int opt = FALSE;
- /* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char)opt) {
+ /* parse command line options */
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
case 'o':
- output_file = HDstrdup(opt_arg);
+ output_file = HDstrdup(H5_optarg);
if (output_file)
h5tools_set_data_output_file(output_file, 1);
break;
case 'i':
- input_file = HDstrdup(opt_arg);
+ input_file = HDstrdup(H5_optarg);
if (input_file)
h5tools_set_input_file(input_file, 1);
- break;;
+ break;
+ ;
case 'u':
- ub_file = HDstrdup(opt_arg);
+ ub_file = HDstrdup(H5_optarg);
if (ub_file)
h5tools_set_output_file(ub_file, 1);
else
@@ -160,7 +130,7 @@ parse_command_line(int argc, const char *argv[])
goto done;
case 'V':
- print_version (h5tools_getprogname());
+ print_version(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
goto done;
@@ -175,11 +145,11 @@ parse_command_line(int argc, const char *argv[])
return EXIT_SUCCESS;
done:
- if(input_file)
+ if (input_file)
HDfree(input_file);
- if(output_file)
+ if (output_file)
HDfree(output_file);
- if(ub_file)
+ if (ub_file)
HDfree(ub_file);
return EXIT_FAILURE;
@@ -188,8 +158,8 @@ done:
static void
leave(int ret)
{
- h5tools_close();
- HDexit(ret);
+ h5tools_close();
+ HDexit(ret);
}
/*-------------------------------------------------------------------------
@@ -204,14 +174,14 @@ leave(int ret)
int
main(int argc, const char *argv[])
{
- hid_t ifile = H5I_INVALID_HID;
- hid_t plist = H5I_INVALID_HID;
- off_t fsize;
- hsize_t usize;
- htri_t testval;
- herr_t status;
- int res;
- h5_stat_t sbuf;
+ hid_t ifile = H5I_INVALID_HID;
+ hid_t plist = H5I_INVALID_HID;
+ off_t fsize;
+ hsize_t usize;
+ htri_t testval;
+ herr_t status;
+ int res;
+ h5_stat_t sbuf;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -219,7 +189,7 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
- if(EXIT_FAILURE == parse_command_line(argc, argv))
+ if (EXIT_FAILURE == parse_command_line(argc, argv))
goto done;
/* enable error reporting if command line option */
@@ -237,12 +207,12 @@ main(int argc, const char *argv[])
if (testval <= 0) {
error_msg("Input HDF5 file \"%s\" is not HDF\n", input_file);
- help_ref_msg (stderr);
+ help_ref_msg(stderr);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- ifile = H5Fopen(input_file, H5F_ACC_RDONLY , H5P_DEFAULT);
+ ifile = H5Fopen(input_file, H5F_ACC_RDONLY, H5P_DEFAULT);
if (ifile < 0) {
error_msg("Can't open input HDF5 file \"%s\"\n", input_file);
@@ -257,7 +227,7 @@ main(int argc, const char *argv[])
goto done;
}
- status = H5Pget_userblock(plist, & usize);
+ status = H5Pget_userblock(plist, &usize);
if (status < 0) {
error_msg("Can't get user block for file \"%s\"\n", input_file);
h5tools_setstatus(EXIT_FAILURE);
@@ -268,14 +238,14 @@ main(int argc, const char *argv[])
H5Fclose(ifile);
if (usize == 0) {
- /* no user block to remove: message? */
+ /* no user block to remove: message? */
error_msg("\"%s\" has no user block: no change to file\n", input_file);
h5tools_setstatus(EXIT_SUCCESS);
goto done;
}
res = HDfstat(HDfileno(rawinstream), &sbuf);
- if(res < 0) {
+ if (res < 0) {
error_msg("Can't stat file \"%s\"\n", input_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -290,14 +260,14 @@ main(int argc, const char *argv[])
}
if (output_file == NULL) {
- error_msg("unable to open output HDF5 file \"%s\"\n", input_file);
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
+ error_msg("unable to open output HDF5 file \"%s\"\n", input_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
/* copy from 0 to 'usize - 1' into ufid */
if (!do_delete) {
- if(copy_to_file(rawinstream, rawoutstream, 0, (ssize_t) usize) < 0) {
+ if (copy_to_file(rawinstream, rawoutstream, 0, (ssize_t)usize) < 0) {
error_msg("unable to copy user block to output file \"%s\"\n", ub_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -306,20 +276,20 @@ main(int argc, const char *argv[])
/* copy from usize to end of file into h5fid,
* starting at end of user block if present */
- if(copy_to_file(rawinstream, rawdatastream, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) {
+ if (copy_to_file(rawinstream, rawdatastream, (ssize_t)usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) {
error_msg("unable to copy hdf5 data to output file \"%s\"\n", output_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
done:
- if(input_file)
+ if (input_file)
HDfree(input_file);
- if(output_file)
+ if (output_file)
HDfree(output_file);
- if(ub_file) {
+ if (ub_file) {
HDfree(ub_file);
}
@@ -334,17 +304,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
+copy_to_file(FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much)
{
static char buf[COPY_BUF_SIZE];
- size_t how_much;
- off_t where = (off_t)_where;
- off_t to;
- off_t from;
- herr_t ret_value = 0;
+ size_t how_much;
+ off_t where = (off_t)_where;
+ off_t to;
+ off_t from;
+ herr_t ret_value = 0;
/* nothing to copy */
- if(show_much <= 0)
+ if (show_much <= 0)
goto done;
how_much = (size_t)show_much;
@@ -352,27 +322,27 @@ copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
HDfseek(infid, 0L, 0);
from = where;
- to = 0;
- while(how_much > 0) {
- size_t bytes_in = 0; /* # of bytes to read */
- size_t bytes_read = 0; /* # of bytes actually read */
- size_t bytes_wrote = 0; /* # of bytes written */
+ to = 0;
+ while (how_much > 0) {
+ size_t bytes_in = 0; /* # of bytes to read */
+ size_t bytes_read = 0; /* # of bytes actually read */
+ size_t bytes_wrote = 0; /* # of bytes written */
if (how_much > COPY_BUF_SIZE)
bytes_in = COPY_BUF_SIZE;
else
bytes_in = how_much;
- /* Seek to correct position in input file */
+ /* Seek to correct position in input file */
HDfseek(infid, from, SEEK_SET);
/* Read data to buffer */
bytes_read = HDfread(buf, (size_t)1, bytes_in, infid);
- if(0 == bytes_read && HDferror(infid)) {
+ if (0 == bytes_read && HDferror(infid)) {
ret_value = -1;
goto done;
} /* end if */
- if(0 == bytes_read && HDfeof(infid)) {
+ if (0 == bytes_read && HDfeof(infid)) {
goto done;
} /* end if */
@@ -384,15 +354,14 @@ copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
from += (off_t)bytes_read;
to += (off_t)bytes_read;
- /* Write nchars bytes to output file */
+ /* Write nchars bytes to output file */
bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid);
- if(bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */
+ if (bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */
ret_value = -1;
goto done;
} /* end if */
- } /* end while */
+ } /* end while */
done:
return ret_value;
-} /* end copy_to_file */
-
+} /* end copy_to_file */
diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt
index c1ce006..80b9b0c 100644
--- a/tools/src/h5ls/CMakeLists.txt
+++ b/tools/src/h5ls/CMakeLists.txt
@@ -6,7 +6,7 @@ project (HDF5_TOOLS_SRC_H5LS C)
#-----------------------------------------------------------------------------
if (NOT ONLY_SHARED_LIBS)
add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c)
- target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5ls PRIVATE "${HDF5_CMAKE_C_FLAGS}")
#target_compile_definitions(h5ls PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5ls STATIC)
@@ -19,7 +19,7 @@ endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c)
- target_include_directories (h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5ls-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
#target_compile_definitions(h5ls-shared PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5ls-shared SHARED)
@@ -30,6 +30,17 @@ if (BUILD_SHARED_LIBS)
set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5ls-shared)
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_H5LS_SRC_FORMAT h5ls)
+ else ()
+ clang_format (HDF5_H5LS_SRC_FORMAT h5ls-shared)
+ endif ()
+endif ()
+
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
diff --git a/tools/src/h5ls/Makefile.am b/tools/src/h5ls/Makefile.am
index 07279c1..9a4466d 100644
--- a/tools/src/h5ls/Makefile.am
+++ b/tools/src/h5ls/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/src/h5ls/Makefile.in b/tools/src/h5ls/Makefile.in
index 7f08576..27c0f41 100644
--- a/tools/src/h5ls/Makefile.in
+++ b/tools/src/h5ls/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -419,12 +420,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -462,11 +463,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -498,8 +544,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -513,7 +557,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -523,6 +569,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -716,7 +763,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1259,8 +1306,9 @@ uninstall-am: uninstall-binPROGRAMS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index c4c3122..bb164a8 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -16,7 +16,6 @@
* Monday, March 23, 1998
*/
-
/*
* We include the private header file so we can get to the uniform
* programming environment it declares. Other than that, h5ls only calls
@@ -31,111 +30,112 @@
/* Name of tool */
#define PROGRAMNAME "h5ls"
-#define NAME_BUF_SIZE 2048
+#define NAME_BUF_SIZE 2048
/*
* Alternative formating for data dumped by H5LS
*
* This table only affects H5LS output.
*/
-static h5tool_format_t ls_dataformat = {
- 0, /*raw */
-
- "", /*fmt_raw */
- "%d", /*fmt_int */
- "%u", /*fmt_uint */
- "%hhd", /*fmt_schar */
- "%u", /*fmt_uchar */
- "%d", /*fmt_short */
- "%u", /*fmt_ushort */
- "%ld", /*fmt_long */
- "%lu", /*fmt_ulong */
- NULL, /*fmt_llong */
- NULL, /*fmt_ullong */
- "%g", /*fmt_double */
- "%g", /*fmt_float */
-
- 0, /*ascii */
- 0, /*str_locale */
- 0, /*str_repeat */
-
- "[", /*arr_pre */
- ",", /*arr_sep */
- "]", /*arr_suf */
- 1, /*arr_linebreak */
-
- "", /*cmpd_name */
- ",", /*cmpd_sep */
- "{", /*cmpd_pre */
- "}", /*cmpd_suf */
- "", /*cmpd_end */
- NULL, /* cmpd_listv */
-
- ",", /*vlen_sep */
- "(", /*vlen_pre */
- ")", /*vlen_suf */
- "", /*vlen_end */
-
- "%s", /*elmt_fmt */
- ",", /*elmt_suf1 */
- " ", /*elmt_suf2 */
-
- HSIZE_T_FORMAT, /*idx_n_fmt */
- ",", /*idx_sep */
- "(%s)", /*idx_fmt */
-
- 65535, /*line_ncols *//*standard default columns */
- 0, /*line_per_line */
- "", /*line_pre */
- "%s", /*line_1st */
- "%s", /*line_cont */
- "", /*line_suf */
- "", /*line_sep */
- 1, /*line_multi_new */
- " ", /*line_indent */
-
- 0, /*skip_first */
-
- 0, /*obj_hidefileno */
- "-%lu:"H5_PRINTF_HADDR_FMT, /*obj_format */
-
- 0, /*dset_hidefileno */
- "DSET-%s ", /*dset_format */
- "%sBlk%lu: ", /*dset_blockformat_pre */
- "%sPt%lu: ", /*dset_ptformat_pre */
- "%s", /*dset_ptformat */
- 1, /*array indices */
- 1 /*escape non printable characters */
+static h5tool_format_t ls_dataformat = {
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%hhd", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ "[", /*arr_pre */
+ ",", /*arr_sep */
+ "]", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ ",", /*cmpd_sep */
+ "{", /*cmpd_pre */
+ "}", /*cmpd_suf */
+ "", /*cmpd_end */
+ NULL, /* cmpd_listv */
+
+ ",", /*vlen_sep */
+ "(", /*vlen_pre */
+ ")", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ ",", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ HSIZE_T_FORMAT, /*idx_n_fmt */
+ ",", /*idx_sep */
+ "(%s)", /*idx_fmt */
+
+ 65535,
+ /*line_ncols */ /*standard default columns */
+ 0, /*line_per_line */
+ "", /*line_pre */
+ "%s", /*line_1st */
+ "%s", /*line_cont */
+ "", /*line_suf */
+ "", /*line_sep */
+ 1, /*line_multi_new */
+ " ", /*line_indent */
+
+ 0, /*skip_first */
+
+ 0, /*obj_hidefileno */
+ "-%lu:%" PRIuHADDR, /*obj_format */
+
+ 0, /*dset_hidefileno */
+ "DSET-%s ", /*dset_format */
+ "%sBlk%lu: ", /*dset_blockformat_pre */
+ "%sPt%lu: ", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
+ 1, /*array indices */
+ 1 /*escape non printable characters */
};
/* Struct to pass through to visitors */
typedef struct {
- const char *fname; /* Filename */
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
- hbool_t symlink_target; /* Whether this is the target of an symbolic link */
- symlink_trav_t *symlink_list; /* List of visited symbolic links */
- size_t base_len; /* Length of base path name, if not root */
- size_t name_start; /* # of leading characters to strip off path names on output */
-}iter_t;
+ const char * fname; /* Filename */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ hbool_t symlink_target; /* Whether this is the target of an symbolic link */
+ symlink_trav_t *symlink_list; /* List of visited symbolic links */
+ size_t base_len; /* Length of base path name, if not root */
+ size_t name_start; /* # of leading characters to strip off path names on output */
+} iter_t;
/* Command-line switches */
-static int verbose_g = 0; /* lots of extra output */
-static int width_g = 80; /* output width in characters */
-static hbool_t address_g = FALSE; /* print raw data addresses */
-static hbool_t data_g = FALSE; /* display dataset values? */
-static hbool_t label_g = FALSE; /* label compound values? */
-static hbool_t string_g = FALSE; /* print 1-byte numbers as ASCII? */
-static hbool_t fullname_g = FALSE; /* print full path names */
-static hbool_t recursive_g = FALSE; /* recursive descent listing */
-static hbool_t follow_symlink_g = FALSE; /* follow symbolic links */
-static hbool_t no_dangling_link_g = FALSE; /* treat dangling link is error */
-static hbool_t follow_elink_g = FALSE; /* follow external links */
-static hbool_t grp_literal_g = FALSE; /* list group, not contents */
-static hbool_t hexdump_g = FALSE; /* show data as raw hexadecimal */
-static hbool_t simple_output_g = FALSE; /* make output more machine-readable */
-static hbool_t show_file_name_g = FALSE; /* show file name for full names */
-static hbool_t no_line_wrap_g = FALSE; /* show data content without line wrap */
-static hbool_t display_root_g = FALSE; /* show root group in output? */
+static int verbose_g = 0; /* lots of extra output */
+static int width_g = 80; /* output width in characters */
+static hbool_t address_g = FALSE; /* print raw data addresses */
+static hbool_t data_g = FALSE; /* display dataset values? */
+static hbool_t label_g = FALSE; /* label compound values? */
+static hbool_t string_g = FALSE; /* print 1-byte numbers as ASCII? */
+static hbool_t fullname_g = FALSE; /* print full path names */
+static hbool_t recursive_g = FALSE; /* recursive descent listing */
+static hbool_t follow_symlink_g = FALSE; /* follow symbolic links */
+static hbool_t no_dangling_link_g = FALSE; /* treat dangling link is error */
+static hbool_t follow_elink_g = FALSE; /* follow external links */
+static hbool_t grp_literal_g = FALSE; /* list group, not contents */
+static hbool_t hexdump_g = FALSE; /* show data as raw hexadecimal */
+static hbool_t simple_output_g = FALSE; /* make output more machine-readable */
+static hbool_t show_file_name_g = FALSE; /* show file name for full names */
+static hbool_t no_line_wrap_g = FALSE; /* show data content without line wrap */
+static hbool_t display_root_g = FALSE; /* show root group in output? */
/* Information about how to display each type of object */
static struct dispatch_t {
@@ -146,17 +146,17 @@ static struct dispatch_t {
herr_t (*list2)(hid_t obj, const char *name);
} dispatch_g[H5O_TYPE_NTYPES];
-#define DISPATCH(TYPE, NAME, LIST1, LIST2) { \
- dispatch_g[TYPE].name = (NAME); \
- dispatch_g[TYPE].list1 = (LIST1); \
- dispatch_g[TYPE].list2 = (LIST2); \
-}
+#define DISPATCH(TYPE, NAME, LIST1, LIST2) \
+ { \
+ dispatch_g[TYPE].name = (NAME); \
+ dispatch_g[TYPE].list1 = (LIST1); \
+ dispatch_g[TYPE].list2 = (LIST2); \
+ }
-static void print_type(h5tools_str_t *buffer, hid_t type, int ind);
+static void print_type(h5tools_str_t *buffer, hid_t type, int ind);
static hbool_t print_int_type(h5tools_str_t *buffer, hid_t type, int ind);
static hbool_t print_float_type(h5tools_str_t *buffer, hid_t type, int ind);
-static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
-
+static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
/*-------------------------------------------------------------------------
* Function: usage
@@ -167,36 +167,46 @@ static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
*-------------------------------------------------------------------------
*/
static void
-usage (void)
+usage(void)
{
FLUSHSTREAM(rawoutstream);
PRINTVALSTREAM(rawoutstream, "usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n");
PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -h, -?, --help Print a usage message and exit\n");
- PRINTVALSTREAM(rawoutstream, " -a, --address Print raw data address. If dataset is contiguous, address\n");
- PRINTVALSTREAM(rawoutstream, " is offset in file of beginning of raw data. If chunked,\n");
- PRINTVALSTREAM(rawoutstream, " returned list of addresses indicates offset of each chunk.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -a, --address Print raw data address. If dataset is contiguous, address\n");
+ PRINTVALSTREAM(rawoutstream,
+ " is offset in file of beginning of raw data. If chunked,\n");
+ PRINTVALSTREAM(rawoutstream,
+ " returned list of addresses indicates offset of each chunk.\n");
PRINTVALSTREAM(rawoutstream, " Must be used with -v, --verbose option.\n");
PRINTVALSTREAM(rawoutstream, " Provides no information for non-dataset objects.\n");
PRINTVALSTREAM(rawoutstream, " -d, --data Print the values of datasets\n");
PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
- PRINTVALSTREAM(rawoutstream, " Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Prints messages from the HDF5 error stack as they occur.\n");
PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
- PRINTVALSTREAM(rawoutstream, " Follow symbolic links (soft links and external links)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Follow symbolic links (soft links and external links)\n");
PRINTVALSTREAM(rawoutstream, " to display target object information.\n");
PRINTVALSTREAM(rawoutstream, " Without this option, h5ls identifies a symbolic link\n");
PRINTVALSTREAM(rawoutstream, " as a soft link or external link and prints the value\n");
- PRINTVALSTREAM(rawoutstream, " assigned to the symbolic link; it does not provide any\n");
+ PRINTVALSTREAM(rawoutstream,
+ " assigned to the symbolic link; it does not provide any\n");
PRINTVALSTREAM(rawoutstream, " information regarding the target object or determine\n");
PRINTVALSTREAM(rawoutstream, " whether the link is a dangling link.\n");
PRINTVALSTREAM(rawoutstream, " --no-dangling-links\n");
PRINTVALSTREAM(rawoutstream, " Must be used with --follow-symlinks option;\n");
- PRINTVALSTREAM(rawoutstream, " otherwise, h5ls shows error message and returns an exit\n");
+ PRINTVALSTREAM(rawoutstream,
+ " otherwise, h5ls shows error message and returns an exit\n");
PRINTVALSTREAM(rawoutstream, " code of 1.\n");
- PRINTVALSTREAM(rawoutstream, " Check for any symbolic links (soft links or external links)\n");
- PRINTVALSTREAM(rawoutstream, " that do not resolve to an existing object (dataset, group,\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Check for any symbolic links (soft links or external links)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " that do not resolve to an existing object (dataset, group,\n");
PRINTVALSTREAM(rawoutstream, " or named datatype).\n");
- PRINTVALSTREAM(rawoutstream, " If any dangling link is found, this situation is treated\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If any dangling link is found, this situation is treated\n");
PRINTVALSTREAM(rawoutstream, " as an error and h5ls returns an exit code of 1.\n");
PRINTVALSTREAM(rawoutstream, " -f, --full Print full path names instead of base names\n");
PRINTVALSTREAM(rawoutstream, " -g, --group Show information about a group, not its contents\n");
@@ -209,14 +219,18 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " --vfd=DRIVER Use the specified virtual file driver\n");
PRINTVALSTREAM(rawoutstream, " -x, --hexdump Show raw data in hexadecimal format\n");
- PRINTVALSTREAM(rawoutstream, " --s3-cred=C Supply S3 authentication information to \"ros3\" vfd.\n");
- PRINTVALSTREAM(rawoutstream, " Accepts tuple of \"(<aws-region>,<access-id>,<access-key>)\".\n");
- PRINTVALSTREAM(rawoutstream, " If absent or C->\"(,,)\", defaults to no-authentication.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --s3-cred=C Supply S3 authentication information to \"ros3\" vfd.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Accepts tuple of \"(<aws-region>,<access-id>,<access-key>)\".\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If absent or C->\"(,,)\", defaults to no-authentication.\n");
PRINTVALSTREAM(rawoutstream, " Has no effect if vfd flag not set to \"ros3\".\n");
PRINTVALSTREAM(rawoutstream, " --hdfs-attrs=A Supply configuration information to Hadoop VFD.\n");
PRINTVALSTREAM(rawoutstream, " Accepts tuple of (<namenode name>,<namenode port>,\n");
PRINTVALSTREAM(rawoutstream, " ...<kerberos cache path>,<username>,<buffer size>)\n");
- PRINTVALSTREAM(rawoutstream, " If absent or A == '(,,,,)', all default values are used.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If absent or A == '(,,,,)', all default values are used.\n");
PRINTVALSTREAM(rawoutstream, " Has no effect if vfd flag is not 'hdfs'.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " file/OBJECT\n");
@@ -227,10 +241,14 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " \"%%05d\" to open a file family.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Deprecated Options\n");
- PRINTVALSTREAM(rawoutstream, " The following options have been deprecated in HDF5. While they remain\n");
- PRINTVALSTREAM(rawoutstream, " available, they have been superseded as indicated and may be removed\n");
- PRINTVALSTREAM(rawoutstream, " from HDF5 in the future. Use the indicated replacement option in all\n");
- PRINTVALSTREAM(rawoutstream, " new work; where possible, existing scripts, et cetera, should also be\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The following options have been deprecated in HDF5. While they remain\n");
+ PRINTVALSTREAM(rawoutstream,
+ " available, they have been superseded as indicated and may be removed\n");
+ PRINTVALSTREAM(rawoutstream,
+ " from HDF5 in the future. Use the indicated replacement option in all\n");
+ PRINTVALSTREAM(rawoutstream,
+ " new work; where possible, existing scripts, et cetera, should also be\n");
PRINTVALSTREAM(rawoutstream, " updated to use the replacement option.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " -E or --external Follow external links.\n");
@@ -239,7 +257,6 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " Replaced by --enable-error-stack.\n");
}
-
/*-------------------------------------------------------------------------
* Function: print_string
*
@@ -252,7 +269,7 @@ usage (void)
static int
print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
{
- int nprint=0;
+ int nprint = 0;
for (/*void*/; s && *s; s++) {
switch (*s) {
@@ -311,7 +328,7 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
}
else {
if (buffer)
- h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s));
+ h5tools_str_append(buffer, "\\%03o", *((const unsigned char *)s));
nprint += 4;
}
break;
@@ -320,7 +337,6 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
return nprint;
}
-
/*-------------------------------------------------------------------------
* Function: print_obj_name
*
@@ -333,9 +349,9 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
static int
print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, const char *s)
{
- static char fullname[NAME_BUF_SIZE]; /* Buffer for file and/or object name */
- const char *name = fullname; /* Pointer to buffer for printing */
- int n;
+ static char fullname[NAME_BUF_SIZE]; /* Buffer for file and/or object name */
+ const char *name = fullname; /* Pointer to buffer for printing */
+ int n;
if (show_file_name_g)
HDsnprintf(fullname, sizeof(fullname), "%s/%s", iter->fname, oname + iter->name_start);
@@ -346,7 +362,7 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, con
if (fullname_g)
n = print_string(buffer, name, TRUE);
else {
- const char *last_sep; /* The location of the last group separator */
+ const char *last_sep; /* The location of the last group separator */
/* Find the last component of the path name */
if (NULL == (last_sep = HDstrrchr(name, '/')))
@@ -361,7 +377,6 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, con
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_native_type
*
@@ -411,11 +426,6 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind)
else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) {
h5tools_str_append(buffer, "native double");
}
-#if H5_SIZEOF_LONG_DOUBLE !=0
- else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) {
- h5tools_str_append(buffer, "native long double");
- }
-#endif
else if (H5Tequal(type, H5T_NATIVE_INT8) == TRUE) {
h5tools_str_append(buffer, "native int8_t");
}
@@ -522,7 +532,6 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_ieee_type
*
@@ -553,7 +562,6 @@ print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_precision
*
@@ -567,22 +575,22 @@ print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind)
static void
print_precision(h5tools_str_t *buffer, hid_t type, int ind)
{
- size_t prec; /* precision */
- H5T_pad_t plsb, pmsb; /* lsb and msb padding */
- const char *plsb_s=NULL; /* lsb padding string */
- const char *pmsb_s=NULL; /* msb padding string */
- size_t nbits; /* number of bits */
+ size_t prec; /* precision */
+ H5T_pad_t plsb, pmsb; /* lsb and msb padding */
+ const char *plsb_s = NULL; /* lsb padding string */
+ const char *pmsb_s = NULL; /* msb padding string */
+ size_t nbits; /* number of bits */
/* If the precision is less than the total size then show the precision
* and offset on the following line. Also display the padding
* information. */
if (8 * H5Tget_size(type) != (prec = H5Tget_precision(type))) {
- h5tools_str_append(buffer, "\n%*s(%lu bit%s of precision beginning at bit %lu)",
- ind, "", (unsigned long)prec, 1 == prec ? "" : "s", (unsigned long)H5Tget_offset(type));
+ h5tools_str_append(buffer, "\n%*s(%lu bit%s of precision beginning at bit %lu)", ind, "",
+ (unsigned long)prec, 1 == prec ? "" : "s", (unsigned long)H5Tget_offset(type));
H5Tget_pad(type, &plsb, &pmsb);
if (H5Tget_offset(type) > 0) {
- switch(plsb) {
+ switch (plsb) {
case H5T_PAD_ZERO:
plsb_s = "zero";
break;
@@ -601,7 +609,7 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
}
}
if ((unsigned)H5Tget_offset(type) + prec < 8 * H5Tget_size(type)) {
- switch(pmsb) {
+ switch (pmsb) {
case H5T_PAD_ZERO:
pmsb_s = "zero";
break;
@@ -623,20 +631,21 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
h5tools_str_append(buffer, "\n%*s(", ind, "");
if (plsb_s) {
nbits = (unsigned)H5Tget_offset(type);
- h5tools_str_append(buffer, "%lu %s bit%s at bit 0", (unsigned long)nbits, plsb_s, 1 == nbits ? "" : "s");
+ h5tools_str_append(buffer, "%lu %s bit%s at bit 0", (unsigned long)nbits, plsb_s,
+ 1 == nbits ? "" : "s");
}
if (plsb_s && pmsb_s)
h5tools_str_append(buffer, ", ");
if (pmsb_s) {
nbits = (8 * H5Tget_size(type)) - ((unsigned)H5Tget_offset(type) + prec);
- h5tools_str_append(buffer, "%lu %s bit%s at bit %lu", (unsigned long)nbits, pmsb_s, 1 == nbits ? "" : "s", (unsigned long)(8 * H5Tget_size(type) - nbits));
+ h5tools_str_append(buffer, "%lu %s bit%s at bit %lu", (unsigned long)nbits, pmsb_s,
+ 1 == nbits ? "" : "s", (unsigned long)(8 * H5Tget_size(type) - nbits));
}
h5tools_str_append(buffer, ")");
}
}
}
-
/*-------------------------------------------------------------------------
* Function: print_int_type
*
@@ -652,10 +661,10 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_int_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- H5T_order_t order; /* byte order value */
- const char *order_s = NULL; /* byte order string */
- H5T_sign_t sign; /* sign scheme value */
- const char *sign_s = NULL; /* sign scheme string */
+ H5T_order_t order; /* byte order value */
+ const char *order_s = NULL; /* byte order string */
+ H5T_sign_t sign; /* sign scheme value */
+ const char *sign_s = NULL; /* sign scheme string */
if (H5T_INTEGER != H5Tget_class(type))
return FALSE;
@@ -698,12 +707,12 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print size, order, and sign on first line, precision and padding
* information on the subsequent lines */
- h5tools_str_append(buffer, "%lu-bit%s%s integer", (unsigned long)(8*H5Tget_size(type)), order_s, sign_s);
+ h5tools_str_append(buffer, "%lu-bit%s%s integer", (unsigned long)(8 * H5Tget_size(type)), order_s,
+ sign_s);
print_precision(buffer, type, ind);
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_float_type
*
@@ -717,15 +726,15 @@ static hbool_t
print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
{
H5T_order_t order; /* byte order value */
- const char *order_s=NULL; /* byte order string */
+ const char *order_s = NULL; /* byte order string */
size_t spos; /* sign bit position */
size_t esize, epos; /* exponent size and position */
size_t msize, mpos; /* significand size and position */
size_t ebias; /* exponent bias */
H5T_norm_t norm; /* significand normalization */
- const char *norm_s=NULL; /* normalization string */
+ const char *norm_s = NULL; /* normalization string */
H5T_pad_t pad; /* internal padding value */
- const char *pad_s=NULL; /* internal padding string */
+ const char *pad_s = NULL; /* internal padding string */
if (H5T_FLOAT != H5Tget_class(type))
return FALSE;
@@ -752,13 +761,13 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print size and byte order on first line, precision and padding on
* subsequent lines. */
- h5tools_str_append(buffer, "%lu-bit%s floating-point", (unsigned long)(8*H5Tget_size(type)), order_s);
+ h5tools_str_append(buffer, "%lu-bit%s floating-point", (unsigned long)(8 * H5Tget_size(type)), order_s);
print_precision(buffer, type, ind);
/* Print sizes, locations, and other information about each field */
- H5Tget_fields (type, &spos, &epos, &esize, &mpos, &msize);
+ H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
ebias = H5Tget_ebias(type);
- norm = H5Tget_norm(type);
+ norm = H5Tget_norm(type);
switch (norm) {
case H5T_NORM_IMPLIED:
norm_s = ", msb implied";
@@ -772,14 +781,14 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
case H5T_NORM_ERROR:
norm_s = ", unknown normalization";
break;
- default:
- ;
- break;
+ default:;
+ break;
}
- h5tools_str_append(buffer, "\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "",
- (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, norm_s);
- h5tools_str_append(buffer, "\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)",
- ind, "", (unsigned long)esize, 1==esize?"":"s", (unsigned long)epos, (unsigned long)ebias);
+ h5tools_str_append(buffer, "\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "", (unsigned long)msize,
+ 1 == msize ? "" : "s", (unsigned long)mpos, norm_s);
+ h5tools_str_append(buffer, "\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", ind, "",
+ (unsigned long)esize, 1 == esize ? "" : "s", (unsigned long)epos,
+ (unsigned long)ebias);
h5tools_str_append(buffer, "\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos);
/* Display internal padding */
@@ -799,16 +808,14 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
case H5T_NPAD:
pad_s = "unknown";
break;
- default:
- ;
- break;
+ default:;
+ break;
}
h5tools_str_append(buffer, "\n%*s(internal padding bits are %s)", ind, "", pad_s);
}
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_cmpd_type
*
@@ -821,39 +828,39 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- char *name = NULL; /* member name */
- size_t size; /* total size of type in bytes */
- hid_t subtype; /* member data type */
- int nmembs; /* number of members */
- int n; /* miscellaneous counters */
- unsigned i; /* miscellaneous counters */
-
- if(H5T_COMPOUND != H5Tget_class(type))
+ char * name = NULL; /* member name */
+ size_t size; /* total size of type in bytes */
+ hid_t subtype; /* member data type */
+ int nmembs; /* number of members */
+ int n; /* miscellaneous counters */
+ unsigned i; /* miscellaneous counters */
+
+ if (H5T_COMPOUND != H5Tget_class(type))
return FALSE;
- if((nmembs = H5Tget_nmembers(type)) < 0)
+ if ((nmembs = H5Tget_nmembers(type)) < 0)
return FALSE;
h5tools_str_append(buffer, "struct {");
for (i = 0; i < (unsigned)nmembs; i++) {
/* Name and offset */
name = H5Tget_member_name(type, i);
- h5tools_str_append(buffer, "\n%*s\"", ind+4, "");
+ h5tools_str_append(buffer, "\n%*s\"", ind + 4, "");
n = print_string(buffer, name, FALSE);
- h5tools_str_append(buffer, "\"%*s +%-4lu ", MAX(0, 16-n), "", (unsigned long)H5Tget_member_offset(type, i));
+ h5tools_str_append(buffer, "\"%*s +%-4lu ", MAX(0, 16 - n), "",
+ (unsigned long)H5Tget_member_offset(type, i));
H5free_memory(name);
/* Member's type */
subtype = H5Tget_member_type(type, i);
- print_type(buffer, subtype, ind+4);
+ print_type(buffer, subtype, ind + 4);
H5Tclose(subtype);
}
size = H5Tget_size(type);
- h5tools_str_append(buffer, "\n%*s} %lu byte%s", ind, "", (unsigned long)size, 1==size?"":"s");
+ h5tools_str_append(buffer, "\n%*s} %lu byte%s", ind, "", (unsigned long)size, 1 == size ? "" : "s");
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_enum_type
*
@@ -866,8 +873,8 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- int nmembs; /* number of members */
- hid_t super; /* enum base integer type */
+ int nmembs; /* number of members */
+ hid_t super; /* enum base integer type */
if (H5T_ENUM != H5Tget_class(type))
return FALSE;
@@ -880,11 +887,11 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
h5tools_str_append(buffer, " {");
if (nmembs > 0) {
- char **name; /* member names */
- unsigned char *value; /* value array */
- hid_t native = H5I_INVALID_HID; /* native integer data type */
- size_t dst_size; /* destination value type size */
- unsigned i; /* miscellaneous counters */
+ char ** name; /* member names */
+ unsigned char *value; /* value array */
+ hid_t native = H5I_INVALID_HID; /* native integer data type */
+ size_t dst_size; /* destination value type size */
+ unsigned i; /* miscellaneous counters */
/* Determine what data type to use for the native values. To simplify
* things we entertain three possibilities:
@@ -902,7 +909,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
dst_size = H5Tget_size(type);
/* Get the names and raw values of all members */
- name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
+ name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < (unsigned)nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
@@ -927,10 +934,10 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print members */
for (i = 0; i < (unsigned)nmembs; i++) {
- unsigned char *copy; /* a pointer to value array */
- int nchars; /* number of output characters */
+ unsigned char *copy; /* a pointer to value array */
+ int nchars; /* number of output characters */
- h5tools_str_append(buffer, "\n%*s", ind+4, "");
+ h5tools_str_append(buffer, "\n%*s", ind + 4, "");
nchars = print_string(buffer, name[i], TRUE);
h5tools_str_append(buffer, "%*s = ", MAX(0, 16 - nchars), "");
@@ -939,30 +946,30 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
h5tools_str_append(buffer, "0x");
for (j = 0; j < dst_size; j++)
- h5tools_str_append(buffer, "%02x", value[i*dst_size+j]);
+ h5tools_str_append(buffer, "%02x", value[i * dst_size + j]);
}
else if (H5T_SGN_NONE == H5Tget_sign(native)) {
/*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
*strangely, unless use another pointer "copy".*/
copy = value + i * dst_size;
- h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long*)((void*)copy)));
+ h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long *)((void *)copy)));
}
else {
/*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
*strangely, unless use another pointer "copy".*/
copy = value + i * dst_size;
- h5tools_str_append(buffer, "%"H5_PRINTF_LL_WIDTH"d", *((long long*)((void*)copy)));
+ h5tools_str_append(buffer, "%lld", *((long long *)((void *)copy)));
}
}
/* Release resources */
- for(i = 0; i < (unsigned)nmembs; i++)
+ for (i = 0; i < (unsigned)nmembs; i++)
H5free_memory(name[i]);
HDfree(name);
HDfree(value);
}
else
- h5tools_str_append(buffer, "\n%*s <empty>", ind+4, "");
+ h5tools_str_append(buffer, "\n%*s <empty>", ind + 4, "");
h5tools_str_append(buffer, "\n%*s}", ind, "");
@@ -971,7 +978,6 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_string_type
*
@@ -984,10 +990,10 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
{
- H5T_str_t pad;
- const char *pad_s=NULL;
+ H5T_str_t pad;
+ const char *pad_s = NULL;
H5T_cset_t cset;
- const char *cset_s=NULL;
+ const char *cset_s = NULL;
if (H5T_STRING != H5Tget_class(type))
return FALSE;
@@ -1020,9 +1026,8 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
case H5T_STR_ERROR:
pad_s = "unknown-format";
break;
- default:
- ;
- break;
+ default:;
+ break;
}
/* Character set */
@@ -1051,9 +1056,8 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
case H5T_CSET_ERROR:
cset_s = "unknown-character-set";
break;
- default:
- ;
- break;
+ default:;
+ break;
}
if (H5Tis_variable_str(type)) {
@@ -1066,7 +1070,6 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_reference_type
*
@@ -1095,7 +1098,6 @@ print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_opaque_type
*
@@ -1108,7 +1110,7 @@ print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
static hbool_t
print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- char *tag;
+ char * tag;
size_t size;
if (H5T_OPAQUE != H5Tget_class(type))
@@ -1125,7 +1127,6 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_vlen_type
*
@@ -1138,7 +1139,7 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- hid_t super;
+ hid_t super;
if (H5T_VLEN != H5Tget_class(type))
return FALSE;
@@ -1150,7 +1151,6 @@ print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind)
return TRUE;
}
-
/*---------------------------------------------------------------------------
* Purpose: Print information about an array type
*
@@ -1161,9 +1161,9 @@ print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- hid_t super;
- int ndims, i;
- hsize_t *dims=NULL;
+ hid_t super;
+ int ndims, i;
+ hsize_t *dims = NULL;
if (H5T_ARRAY != H5Tget_class(type))
return FALSE;
@@ -1174,7 +1174,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print dimensions */
for (i = 0; i < ndims; i++)
- h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT , i?",":"[", dims[i]);
+ h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, i ? "," : "[", dims[i]);
h5tools_str_append(buffer, "]");
HDfree(dims);
@@ -1182,16 +1182,14 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
else
h5tools_str_append(buffer, " [SCALAR]\n", rawoutstream);
-
/* Print parent type */
h5tools_str_append(buffer, " ");
super = H5Tget_super(type);
- print_type(buffer, super, ind+4);
+ print_type(buffer, super, ind + 4);
H5Tclose(super);
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_bitfield_type
*
@@ -1204,12 +1202,12 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- H5T_order_t order; /* byte order value */
- const char *order_s = NULL; /* byte order string */
+ H5T_order_t order; /* byte order value */
+ const char *order_s = NULL; /* byte order string */
if (H5T_BITFIELD != H5Tget_class(type))
return FALSE;
- if (H5Tget_size(type)>1) {
+ if (H5Tget_size(type) > 1) {
order = H5Tget_order(type);
if (H5T_ORDER_LE == order) {
order_s = " little-endian";
@@ -1228,12 +1226,11 @@ print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind)
order_s = "";
}
- h5tools_str_append(buffer, "%lu-bit%s bitfield", (unsigned long)(8*H5Tget_size(type)), order_s);
+ h5tools_str_append(buffer, "%lu-bit%s bitfield", (unsigned long)(8 * H5Tget_size(type)), order_s);
print_precision(buffer, type, ind);
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_type
*
@@ -1250,39 +1247,35 @@ print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind)
static void
print_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- H5T_class_t data_class = H5Tget_class(type);
+ H5T_class_t data_class = H5Tget_class(type);
/* Bad data type */
if (type < 0) {
- h5tools_str_append(buffer,"<ERROR>");
+ h5tools_str_append(buffer, "<ERROR>");
return;
}
/* Shared? If so then print the type's OID */
if (H5Tcommitted(type)) {
- H5O_info_t oi;
+ H5O_info_t oi;
if (H5Oget_info2(type, &oi, H5O_INFO_BASIC) >= 0)
- h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr);
+ h5tools_str_append(buffer, "shared-%lu:" H5_PRINTF_HADDR_FMT " ", oi.fileno, oi.addr);
else
- h5tools_str_append(buffer,"shared ");
+ h5tools_str_append(buffer, "shared ");
} /* end if */
/* Print the type */
- if (print_native_type(buffer, type, ind) ||
- print_ieee_type(buffer, type, ind) ||
- print_cmpd_type(buffer, type, ind) ||
- print_enum_type(buffer, type, ind) ||
- print_string_type(buffer, type, ind) ||
- print_reference_type(buffer, type, ind) ||
- print_vlen_type(buffer, type, ind) ||
- print_array_type(buffer, type, ind) ||
- print_opaque_type(buffer, type, ind) ||
- print_bitfield_type(buffer, type, ind))
+ if (print_native_type(buffer, type, ind) || print_ieee_type(buffer, type, ind) ||
+ print_cmpd_type(buffer, type, ind) || print_enum_type(buffer, type, ind) ||
+ print_string_type(buffer, type, ind) || print_reference_type(buffer, type, ind) ||
+ print_vlen_type(buffer, type, ind) || print_array_type(buffer, type, ind) ||
+ print_opaque_type(buffer, type, ind) || print_bitfield_type(buffer, type, ind))
return;
/* Unknown type */
- h5tools_str_append(buffer,"%lu-byte class-%u unknown", (unsigned long)H5Tget_size(type), (unsigned)data_class);
+ h5tools_str_append(buffer, "%lu-byte class-%u unknown", (unsigned long)H5Tget_size(type),
+ (unsigned)data_class);
}
/*-------------------------------------------------------------------------
@@ -1296,39 +1289,39 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind)
static void
dump_dataset_values(hid_t dset)
{
- hid_t f_type = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hsize_t total_size[H5S_MAX_RANK];
- int ndims;
- size_t nsize;
- char string_prefix[64];
- static char fmt_double[16];
- static char fmt_float[16];
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t outputformat;
- h5tool_format_t *info = &ls_dataformat;
- unsigned char *region_buf = NULL;
-
- H5TOOLS_START_DEBUG("");
+ hid_t f_type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hsize_t total_size[H5S_MAX_RANK];
+ int ndims;
+ size_t nsize;
+ char string_prefix[64];
+ static char fmt_double[16];
+ static char fmt_float[16];
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t outputformat;
+ h5tool_format_t * info = &ls_dataformat;
+ unsigned char * region_buf = NULL;
+
+ H5TOOLS_START_DEBUG(" ");
f_type = H5Dget_type(dset);
- space = H5Dget_space(dset);
- nsize = H5Tget_size(f_type);
+ space = H5Dget_space(dset);
+ nsize = H5Tget_size(f_type);
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
- outputformat = *info;
- outputformat.line_1st = NULL;
- outputformat.idx_fmt = "";
+ outputformat = *info;
+ outputformat.line_1st = NULL;
+ outputformat.idx_fmt = "";
if (simple_output_g) {
- outputformat.idx_fmt = "";
- outputformat.line_per_line = 1;
+ outputformat.idx_fmt = "";
+ outputformat.line_per_line = 1;
outputformat.line_multi_new = 0;
- outputformat.line_pre = " ";
- outputformat.line_cont = " ";
+ outputformat.line_pre = " ";
+ outputformat.line_cont = " ";
outputformat.arr_pre = "";
outputformat.arr_suf = "";
@@ -1343,9 +1336,8 @@ dump_dataset_values(hid_t dset)
if (label_g)
outputformat.cmpd_name = "%s=";
- outputformat.elmt_suf1 = " ";
+ outputformat.elmt_suf1 = " ";
outputformat.str_locale = ESCAPE_HTML;
-
}
else {
if (no_line_wrap_g) {
@@ -1356,8 +1348,8 @@ dump_dataset_values(hid_t dset)
}
if (label_g)
outputformat.cmpd_name = "%s=";
- outputformat.line_pre = " %s ";
- outputformat.line_cont = " %s ";
+ outputformat.line_pre = " %s ";
+ outputformat.line_cont = " %s ";
outputformat.str_repeat = 8;
outputformat.arr_pre = NULL;
@@ -1388,7 +1380,7 @@ dump_dataset_values(hid_t dset)
else if (string_g && H5Tget_size(f_type) == 1 && (H5Tget_class(f_type) == H5T_INTEGER)) {
/* Print 1-byte integer data as an ASCI character string instead of
* integers if the `-s' or `--string' command-line option was given. */
- outputformat.ascii = TRUE;
+ outputformat.ascii = TRUE;
outputformat.elmt_suf1 = "";
outputformat.elmt_suf2 = "";
HDsnprintf(string_prefix, sizeof(string_prefix), "%s\"", outputformat.line_pre);
@@ -1398,15 +1390,16 @@ dump_dataset_values(hid_t dset)
info = &outputformat;
ctx.indent_level = 1;
- ctx.cur_column = (size_t)curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
/* Print all the values. */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Data:\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0,
+ (hsize_t)0);
ctx.need_prefix = TRUE;
- ctx.cur_column = (size_t)curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
if (H5Tget_class(f_type) == H5T_REFERENCE) {
H5TOOLS_DEBUG("reference class type");
if (!H5Tequal(f_type, H5T_STD_REF_DSETREG) && !H5Tequal(f_type, H5T_STD_REF_OBJ)) {
@@ -1439,7 +1432,8 @@ dump_dataset_values(hid_t dset)
if (h5tools_dump_dset(rawoutstream, info, &ctx, dset) < 0) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Unable to print data.");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
}
}
done:
@@ -1450,10 +1444,9 @@ done:
PRINTVALSTREAM(rawoutstream, "\n");
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
}
-
/*-------------------------------------------------------------------------
* Function: dump_attribute_values
*
@@ -1465,39 +1458,39 @@ done:
static void
dump_attribute_values(hid_t attr)
{
- hid_t f_type = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hsize_t total_size[H5S_MAX_RANK];
- int ndims;
- size_t nsize;
- char string_prefix[64];
- static char fmt_double[16];
- static char fmt_float[16];
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t outputformat;
- h5tool_format_t *info = &ls_dataformat;
- unsigned char *region_buf = NULL;
-
- H5TOOLS_START_DEBUG("");
+ hid_t f_type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hsize_t total_size[H5S_MAX_RANK];
+ int ndims;
+ size_t nsize;
+ char string_prefix[64];
+ static char fmt_double[16];
+ static char fmt_float[16];
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t outputformat;
+ h5tool_format_t * info = &ls_dataformat;
+ unsigned char * region_buf = NULL;
+
+ H5TOOLS_START_DEBUG(" ");
f_type = H5Aget_type(attr);
- space = H5Aget_space(attr);
- nsize = H5Tget_size(f_type);
+ space = H5Aget_space(attr);
+ nsize = H5Tget_size(f_type);
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
- outputformat = *info;
- outputformat.line_1st = NULL;
- outputformat.idx_fmt = "";
+ outputformat = *info;
+ outputformat.line_1st = NULL;
+ outputformat.idx_fmt = "";
if (simple_output_g) {
- outputformat.idx_fmt = "";
- outputformat.line_per_line = 1;
+ outputformat.idx_fmt = "";
+ outputformat.line_per_line = 1;
outputformat.line_multi_new = 0;
- outputformat.line_pre = " ";
- outputformat.line_cont = " ";
+ outputformat.line_pre = " ";
+ outputformat.line_cont = " ";
outputformat.arr_pre = "";
outputformat.arr_suf = "";
@@ -1512,9 +1505,8 @@ dump_attribute_values(hid_t attr)
if (label_g)
outputformat.cmpd_name = "%s=";
- outputformat.elmt_suf1 = " ";
+ outputformat.elmt_suf1 = " ";
outputformat.str_locale = ESCAPE_HTML;
-
}
else {
if (no_line_wrap_g) {
@@ -1525,8 +1517,8 @@ dump_attribute_values(hid_t attr)
}
if (label_g)
outputformat.cmpd_name = "%s=";
- outputformat.line_pre = " %s ";
- outputformat.line_cont = " %s ";
+ outputformat.line_pre = " %s ";
+ outputformat.line_cont = " %s ";
outputformat.str_repeat = 8;
outputformat.arr_pre = NULL;
@@ -1557,7 +1549,7 @@ dump_attribute_values(hid_t attr)
else if (string_g && H5Tget_size(f_type) == 1 && (H5Tget_class(f_type) == H5T_INTEGER)) {
/* Print 1-byte integer data as an ASCI character string instead of
* integers if the `-s' or `--string' command-line option was given. */
- outputformat.ascii = TRUE;
+ outputformat.ascii = TRUE;
outputformat.elmt_suf1 = "";
outputformat.elmt_suf2 = "";
HDsnprintf(string_prefix, sizeof(string_prefix), "%s\"", outputformat.line_pre);
@@ -1567,16 +1559,17 @@ dump_attribute_values(hid_t attr)
info = &outputformat;
ctx.indent_level = 2;
- ctx.cur_column = (size_t)curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
/* Print all the values. */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Data:\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0,
+ (hsize_t)0);
ctx.need_prefix = TRUE;
- ctx.cur_column = (size_t)curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
if (H5Tget_class(f_type) == H5T_REFERENCE) {
H5TOOLS_DEBUG("reference class type");
if (!H5Tequal(f_type, H5T_STD_REF_DSETREG) && !H5Tequal(f_type, H5T_STD_REF_OBJ)) {
@@ -1613,7 +1606,8 @@ dump_attribute_values(hid_t attr)
if (h5tools_dump_mem(rawoutstream, info, &ctx, attr) < 0) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Unable to print data.");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
H5TOOLS_DEBUG("Attribute data read complete");
@@ -1626,7 +1620,7 @@ done:
PRINTVALSTREAM(rawoutstream, "\n");
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
}
/*-------------------------------------------------------------------------
@@ -1640,28 +1634,28 @@ done:
*/
static herr_t
list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo,
- void H5_ATTR_UNUSED *op_data)
+ void H5_ATTR_UNUSED *op_data)
{
- hid_t attr = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t type = H5I_INVALID_HID;
- hsize_t size[H5S_MAX_RANK];
- hsize_t nelmts = 1;
- int ndims;
- int i;
- H5S_class_t space_type;
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
-
- H5TOOLS_START_DEBUG("");
+ hid_t attr = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
+ hsize_t size[H5S_MAX_RANK];
+ hsize_t nelmts = 1;
+ int ndims;
+ int i;
+ H5S_class_t space_type;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * info = &ls_dataformat;
+
+ H5TOOLS_START_DEBUG(" ");
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
ctx.indent_level = 2;
- ctx.cur_column = (size_t)curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Attribute: ");
@@ -1671,41 +1665,45 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
H5TOOLS_DEBUG("Attribute name:%s", attr_name);
if ((attr = H5Aopen(obj, attr_name, H5P_DEFAULT)) >= 0) {
space = H5Aget_space(attr);
- type = H5Aget_type(attr);
+ type = H5Aget_type(attr);
/* Data space */
- ndims = H5Sget_simple_extent_dims(space, size, NULL);
+ ndims = H5Sget_simple_extent_dims(space, size, NULL);
space_type = H5Sget_simple_extent_type(space);
H5TOOLS_DEBUG("Attribute ndims:%d", ndims);
- switch(space_type) {
+ switch (space_type) {
case H5S_SCALAR:
/* scalar dataspace */
h5tools_str_append(&buffer, " scalar\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5S_SIMPLE:
/* simple dataspace */
h5tools_str_append(&buffer, " {");
for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i?", ":"", size[i]);
+ h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", size[i]);
nelmts *= size[i];
}
h5tools_str_append(&buffer, "}\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5S_NULL:
/* null dataspace */
h5tools_str_append(&buffer, " null\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5S_NO_CLASS:
default:
/* Unknown dataspace type */
h5tools_str_append(&buffer, " unknown\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
break;
} /* end switch */
@@ -1714,7 +1712,8 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
h5tools_str_append(&buffer, " %-10s ", "Type:");
print_type(&buffer, type, 15);
h5tools_str_append(&buffer, "\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
H5Sclose(space);
H5Tclose(type);
@@ -1729,12 +1728,11 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
H5TOOLS_DEBUG("Attribute open failed");
h5tools_str_close(&buffer);
}
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: dataset_list1
*
@@ -1750,16 +1748,16 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
static herr_t
dataset_list1(hid_t dset)
{
- hsize_t cur_size[H5S_MAX_RANK]; /* current dataset dimensions */
- hsize_t max_size[H5S_MAX_RANK]; /* maximum dataset dimensions */
- hid_t space; /* data space */
- int ndims; /* dimensionality */
- H5S_class_t space_type; /* type of dataspace */
- int i;
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ hsize_t cur_size[H5S_MAX_RANK]; /* current dataset dimensions */
+ hsize_t max_size[H5S_MAX_RANK]; /* maximum dataset dimensions */
+ hid_t space; /* data space */
+ int ndims; /* dimensionality */
+ H5S_class_t space_type; /* type of dataspace */
+ int i;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * info = &ls_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1768,17 +1766,17 @@ dataset_list1(hid_t dset)
/* Information that goes on the same row as the name. The name has
* already been printed. */
- space = H5Dget_space(dset);
+ space = H5Dget_space(dset);
space_type = H5Sget_simple_extent_type(space);
- ndims = H5Sget_simple_extent_dims(space, cur_size, max_size);
+ ndims = H5Sget_simple_extent_dims(space, cur_size, max_size);
h5tools_str_append(&buffer, " {");
for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s"HSIZE_T_FORMAT, i?", ":"", cur_size[i]);
- if (max_size[i]==H5S_UNLIMITED) {
+ h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", cur_size[i]);
+ if (max_size[i] == H5S_UNLIMITED) {
h5tools_str_append(&buffer, "/%s", "Inf");
}
else if (max_size[i] != cur_size[i] || verbose_g > 0) {
- h5tools_str_append(&buffer, "/"HSIZE_T_FORMAT, max_size[i]);
+ h5tools_str_append(&buffer, "/" HSIZE_T_FORMAT, max_size[i]);
}
}
if (space_type == H5S_SCALAR)
@@ -1786,15 +1784,15 @@ dataset_list1(hid_t dset)
else if (space_type == H5S_NULL)
h5tools_str_append(&buffer, "NULL");
h5tools_str_append(&buffer, "}");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
- H5Sclose (space);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0,
+ (hsize_t)0);
+ H5Sclose(space);
h5tools_str_close(&buffer);
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: dataset_list2
*
@@ -1808,30 +1806,30 @@ dataset_list1(hid_t dset)
static herr_t
dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t type; /* data type of dataset */
- hid_t space; /* data space of dataset */
- int nf; /* number of filters */
- unsigned filt_flags; /* filter flags */
- H5Z_filter_t filt_id; /* filter identification number */
- unsigned cd_values[20]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
- size_t cd_num; /* filter client data counter */
- char f_name[256]; /* filter/file name */
- char s[64]; /* temporary string buffer */
- off_t f_offset; /* offset in external file */
- hsize_t f_size; /* bytes used in external file */
- hsize_t total, used; /* total size or offset */
- int ndims; /* dimensionality */
- int n, max_len; /* max extern file name length */
- double utilization; /* percent utilization of storage */
- H5T_class_t tclass; /* datatype class identifier */
- int i;
- H5D_layout_t stl;
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ hid_t dcpl; /* dataset creation property list */
+ hid_t type; /* data type of dataset */
+ hid_t space; /* data space of dataset */
+ int nf; /* number of filters */
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filt_id; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ size_t cd_num; /* filter client data counter */
+ char f_name[256]; /* filter/file name */
+ char s[64]; /* temporary string buffer */
+ off_t f_offset; /* offset in external file */
+ hsize_t f_size; /* bytes used in external file */
+ hsize_t total, used; /* total size or offset */
+ int ndims; /* dimensionality */
+ int n, max_len; /* max extern file name length */
+ double utilization; /* percent utilization of storage */
+ H5T_class_t tclass; /* datatype class identifier */
+ int i;
+ H5D_layout_t stl;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * info = &ls_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1839,26 +1837,24 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
h5tools_str_reset(&buffer);
if (verbose_g > 0) {
- dcpl = H5Dget_create_plist(dset);
+ dcpl = H5Dget_create_plist(dset);
space = H5Dget_space(dset);
- type = H5Dget_type(dset);
+ type = H5Dget_type(dset);
stl = H5Pget_layout(dcpl);
switch (stl) {
- case H5D_CHUNKED:
- {
- hsize_t chsize[64]; /* chunk size in elements */
-
- ndims = H5Pget_chunk(dcpl, (int)NELMTS(chsize), chsize/*out*/);
- h5tools_str_append(&buffer, " %-10s {", "Chunks:");
- total = H5Tget_size(type);
- for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s"HSIZE_T_FORMAT, i?", ":"", chsize[i]);
- total *= chsize[i];
- }
- h5tools_str_append(&buffer, "} "HSIZE_T_FORMAT" bytes\n", total);
+ case H5D_CHUNKED: {
+ hsize_t chsize[64]; /* chunk size in elements */
+
+ ndims = H5Pget_chunk(dcpl, (int)NELMTS(chsize), chsize /*out*/);
+ h5tools_str_append(&buffer, " %-10s {", "Chunks:");
+ total = H5Tget_size(type);
+ for (i = 0; i < ndims; i++) {
+ h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", chsize[i]);
+ total *= chsize[i];
}
- break;
+ h5tools_str_append(&buffer, "} " HSIZE_T_FORMAT " bytes\n", total);
+ } break;
case H5D_COMPACT:
break;
case H5D_CONTIGUOUS:
@@ -1867,64 +1863,73 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
for (i = 0, max_len = 0; i < nf; i++) {
if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL) < 0)
continue;
- n = print_string(NULL, f_name, TRUE);
+ n = print_string(NULL, f_name, TRUE);
max_len = MAX(max_len, n);
} /* end for */
- h5tools_str_append(&buffer, " %-10s %d external file%s\n", "Extern:", nf, 1==nf?"":"s");
- h5tools_str_append(&buffer, " %4s %10s %10s %10s %s\n", "ID", "DSet-Addr", "File-Addr", "Bytes", "File");
- h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------", "----------", "----------");
+ h5tools_str_append(&buffer, " %-10s %d external file%s\n", "Extern:", nf,
+ 1 == nf ? "" : "s");
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s %s\n", "ID", "DSet-Addr",
+ "File-Addr", "Bytes", "File");
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------",
+ "----------", "----------");
for (i = 0; i < max_len; i++)
h5tools_str_append(&buffer, "-");
h5tools_str_append(&buffer, "\n");
- for (i = 0, total=0; i < nf; i++) {
- if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset, &f_size)<0) {
- h5tools_str_append(&buffer, " #%03d %10"H5_PRINTF_LL_WIDTH"u %10s %10s ***ERROR*** %s\n",
- i, total, "", "", i+1<nf?"Following addresses are incorrect":"");
+ for (i = 0, total = 0; i < nf; i++) {
+ if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset, &f_size) <
+ 0) {
+ h5tools_str_append(
+ &buffer,
+ " #%03d %10" H5_PRINTF_LL_WIDTH "u %10s %10s ***ERROR*** %s\n", i,
+ total, "", "", i + 1 < nf ? "Following addresses are incorrect" : "");
}
else if (H5S_UNLIMITED == f_size) {
- h5tools_str_append(&buffer, " #%03d %10"H5_PRINTF_LL_WIDTH"u %10"H5_PRINTF_LL_WIDTH"u %10s ",
- i, total, (hsize_t)f_offset, "INF");
+ h5tools_str_append(&buffer,
+ " #%03d %10" H5_PRINTF_LL_WIDTH
+ "u %10" H5_PRINTF_LL_WIDTH "u %10s ",
+ i, total, (hsize_t)f_offset, "INF");
print_string(&buffer, f_name, TRUE);
}
else {
- h5tools_str_append(&buffer, " #%03d %10"H5_PRINTF_LL_WIDTH"u %10"H5_PRINTF_LL_WIDTH"u %10"H5_PRINTF_LL_WIDTH"u ",
- i, total, (hsize_t)f_offset, f_size);
+ h5tools_str_append(&buffer,
+ " #%03d %10" H5_PRINTF_LL_WIDTH
+ "u %10" H5_PRINTF_LL_WIDTH "u %10" H5_PRINTF_LL_WIDTH "u ",
+ i, total, (hsize_t)f_offset, f_size);
print_string(&buffer, f_name, TRUE);
}
h5tools_str_append(&buffer, "\n");
total += f_size;
}
- h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------", "----------", "----------");
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------",
+ "----------", "----------");
for (i = 0; i < max_len; i++)
h5tools_str_append(&buffer, "-");
h5tools_str_append(&buffer, "\n");
} /* end if */
break;
- case H5D_VIRTUAL:
- {
- char dset_name[256]; /* Dataset name */
- size_t vmaps;
+ case H5D_VIRTUAL: {
+ char dset_name[256]; /* Dataset name */
+ size_t vmaps;
- H5Pget_virtual_count(dcpl, &vmaps);
+ H5Pget_virtual_count(dcpl, &vmaps);
- if (vmaps) {
- size_t next;
+ if (vmaps) {
+ size_t next;
- h5tools_str_append(&buffer, " %-10s {%ld} Source {\n", "Maps:", vmaps);
- for (next = 0; next < (unsigned) vmaps; next++) {
- H5Pget_virtual_filename(dcpl, next, f_name, sizeof(f_name));
- H5Pget_virtual_dsetname(dcpl, next, dset_name, sizeof(dset_name));
- h5tools_str_append(&buffer, " %-10s ", " ");
- print_string(&buffer, f_name, TRUE);
- h5tools_str_append(&buffer, " ");
- print_string(&buffer, dset_name, TRUE);
- h5tools_str_append(&buffer, "\n");
- }
- h5tools_str_append(&buffer, " %-10s}\n", " ");
+ h5tools_str_append(&buffer, " %-10s {%ld} Source {\n", "Maps:", vmaps);
+ for (next = 0; next < (unsigned)vmaps; next++) {
+ H5Pget_virtual_filename(dcpl, next, f_name, sizeof(f_name));
+ H5Pget_virtual_dsetname(dcpl, next, dset_name, sizeof(dset_name));
+ h5tools_str_append(&buffer, " %-10s ", " ");
+ print_string(&buffer, f_name, TRUE);
+ h5tools_str_append(&buffer, " ");
+ print_string(&buffer, dset_name, TRUE);
+ h5tools_str_append(&buffer, "\n");
}
+ h5tools_str_append(&buffer, " %-10s}\n", " ");
}
- break;
+ } break;
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
@@ -1933,38 +1938,40 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
break;
}
/* Print total raw storage size */
- total = (hsize_t)H5Sget_simple_extent_npoints(space) * H5Tget_size(type);
- used = H5Dget_storage_size(dset);
+ total = (hsize_t)H5Sget_simple_extent_npoints(space) * H5Tget_size(type);
+ used = H5Dget_storage_size(dset);
tclass = H5Tget_class(type);
h5tools_str_append(&buffer, " %-10s ", "Storage:");
switch (tclass) {
- case H5T_VLEN:
- h5tools_str_append(&buffer, "information not available");
- break;
-
- case H5T_REFERENCE:
- if (H5Tequal(dset, H5T_STD_REF_DSETREG)) {
+ case H5T_VLEN:
h5tools_str_append(&buffer, "information not available");
- }
- break;
+ break;
- case H5T_NO_CLASS:
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_TIME:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_COMPOUND:
- case H5T_ENUM:
- case H5T_ARRAY:
- case H5T_NCLASSES:
- default:
- h5tools_str_append(&buffer, HSIZE_T_FORMAT" logical byte%s, "HSIZE_T_FORMAT" allocated byte%s", total, 1==total?"":"s", used, 1==used?"":"s");
- if (used > 0) {
- utilization = ((double)total * (double)100.0f) / (double)used;
- h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization);
- }
+ case H5T_REFERENCE:
+ if (H5Tequal(dset, H5T_STD_REF_DSETREG)) {
+ h5tools_str_append(&buffer, "information not available");
+ }
+ break;
+
+ case H5T_NO_CLASS:
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ case H5T_NCLASSES:
+ default:
+ h5tools_str_append(&buffer,
+ HSIZE_T_FORMAT " logical byte%s, " HSIZE_T_FORMAT " allocated byte%s",
+ total, 1 == total ? "" : "s", used, 1 == used ? "" : "s");
+ if (used > 0) {
+ utilization = ((double)total * 100.0) / (double)used;
+ h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization);
+ }
}
h5tools_str_append(&buffer, "\n");
@@ -1973,23 +1980,27 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
if ((nf = H5Pget_nfilters(dcpl)) > 0) {
for (i = 0; i < nf; i++) {
cd_nelmts = NELMTS(cd_values);
- filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name, NULL);
+ filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts, cd_values,
+ sizeof(f_name), f_name, NULL);
f_name[sizeof(f_name) - 1] = '\0';
HDsnprintf(s, sizeof(s), "Filter-%d:", i);
- h5tools_str_append(&buffer, " %-10s %s-%u %s {", s, (f_name[0] ? f_name : "method"), (unsigned)filt_id, ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : ""));
+ h5tools_str_append(&buffer, " %-10s %s-%u %s {", s, (f_name[0] ? f_name : "method"),
+ (unsigned)filt_id, ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : ""));
for (cd_num = 0; cd_num < cd_nelmts; cd_num++)
h5tools_str_append(&buffer, "%s%u", (cd_num ? ", " : ""), cd_values[cd_num]);
h5tools_str_append(&buffer, "}\n");
} /* end for */
- } /* end if */
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ } /* end if */
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Print data type */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " %-10s ", "Type:");
print_type(&buffer, type, 15);
h5tools_str_append(&buffer, "\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Print address information */
if (address_g)
@@ -2009,7 +2020,6 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
return 0;
} /* end dataset_list2() */
-
/*-------------------------------------------------------------------------
* Function: datatype_list2
*
@@ -2024,10 +2034,10 @@ static herr_t
datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
{
if (verbose_g > 0) {
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * info = &ls_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2037,14 +2047,14 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
h5tools_str_append(&buffer, " %-10s ", "Type:");
print_type(&buffer, type, 15);
h5tools_str_append(&buffer, "\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: list_obj
*
@@ -2057,14 +2067,14 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
static herr_t
list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void *_iter)
{
- H5O_type_t obj_type = oinfo->type; /* Type of the object */
- iter_t *iter = (iter_t*)_iter;
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ H5O_type_t obj_type = oinfo->type; /* Type of the object */
+ iter_t * iter = (iter_t *)_iter;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * info = &ls_dataformat;
- H5TOOLS_START_DEBUG("");
+ H5TOOLS_START_DEBUG(" ");
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2085,7 +2095,8 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
h5tools_str_append(&buffer, "{");
if (obj_type >= 0 && dispatch_g[obj_type].name)
h5tools_str_append(&buffer, "%s", dispatch_g[obj_type].name);
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0,
+ (hsize_t)0);
/* Check if we've seen this object before */
if (first_seen) {
@@ -2095,10 +2106,11 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if (!iter->symlink_target) {
h5tools_str_append(&buffer, "\n");
}
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
} /* end if */
else {
- hid_t obj_id = H5I_INVALID_HID; /* ID of object opened */
+ hid_t obj_id = H5I_INVALID_HID; /* ID of object opened */
/* Open the object. Not all objects can be opened. If this is the case
* then return right away.
@@ -2107,7 +2119,8 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if (obj_type >= 0 && (obj_id = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " *ERROR*\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
goto done;
} /* end if */
@@ -2118,14 +2131,15 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if (!iter->symlink_target || (verbose_g > 0)) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
}
/* Show detailed information about the object, beginning with information
* which is common to all objects. */
if (verbose_g > 0) {
- size_t buf_size = 0;
- char* comment = NULL;
+ size_t buf_size = 0;
+ char * comment = NULL;
ssize_t cmt_bufsize = -1;
/* Display attributes */
@@ -2135,16 +2149,18 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
/* Object location & reference count */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr);
+ h5tools_str_append(&buffer, " %-10s %lu:" H5_PRINTF_HADDR_FMT "\n", "Location:", oinfo->fileno,
+ oinfo->addr);
h5tools_str_append(&buffer, " %-10s %u\n", "Links:", (unsigned)oinfo->rc);
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Modification time */
if (oinfo->mtime > 0) {
- char buf[256];
+ char buf[256];
struct tm *tm;
- if(simple_output_g)
+ if (simple_output_g)
tm = HDgmtime(&(oinfo->mtime));
else
tm = HDlocaltime(&(oinfo->mtime));
@@ -2152,9 +2168,10 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " %-10s %s\n", "Modified:", buf);
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos,
+ (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
} /* end if */
- } /* end if */
+ } /* end if */
/* Object comment */
cmt_bufsize = H5Oget_comment(obj_id, comment, buf_size);
@@ -2172,7 +2189,8 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
h5tools_str_append(&buffer, " %-10s \"", "Comment:");
print_string(&buffer, comment, FALSE);
h5tools_str_append(&buffer, "\"\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos,
+ (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
} /* end if */
HDfree(comment);
}
@@ -2192,17 +2210,17 @@ done:
if (iter->symlink_target) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "}\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
iter->symlink_target = FALSE;
}
h5tools_str_close(&buffer);
- H5TOOLS_ENDDEBUG("");
+ H5TOOLS_ENDDEBUG(" ");
return 0;
} /* end list_obj() */
-
/*-------------------------------------------------------------------------
* Function: list_lnk
*
@@ -2215,14 +2233,14 @@ done:
static herr_t
list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
{
- char *buf = NULL;
- iter_t *iter = (iter_t*)_iter;
- int ret;
- hsize_t curr_pos = 0; /* total data element position */
- h5tool_link_info_t lnk_info;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ char * buf = NULL;
+ iter_t * iter = (iter_t *)_iter;
+ int ret;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tool_link_info_t lnk_info;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * info = &ls_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2234,17 +2252,17 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* if verbose, make H5tools_get_symlink_info() display more */
if (verbose_g)
- lnk_info.opt.msg_mode=1;
+ lnk_info.opt.msg_mode = 1;
/* Print the link's name, either full name or base name */
print_obj_name(&buffer, iter, name, "");
- switch(linfo->type) {
+ switch (linfo->type) {
case H5L_TYPE_SOFT:
ret = H5tools_get_symlink_info(iter->fid, name, &lnk_info, follow_symlink_g);
/* lnk_info.trg_path is malloced in H5tools_get_symlink_info()
* so it will be freed via buf later */
- buf = (char*)lnk_info.trg_path;
+ buf = (char *)lnk_info.trg_path;
/* error */
if (ret < 0)
goto done;
@@ -2255,7 +2273,8 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
h5tools_str_append(&buffer, "Soft Link {");
h5tools_str_append(&buffer, buf);
h5tools_str_append(&buffer, "}");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
if (follow_symlink_g) {
hbool_t orig_grp_literal = grp_literal_g;
h5tools_str_reset(&buffer);
@@ -2264,10 +2283,12 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* Check if we have already seen this softlink */
if (symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf)) {
h5tools_str_append(&buffer, "{Already Visited}\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos,
+ (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
goto done;
}
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Add this link to the list of seen softlinks */
if (symlink_visit_add(iter->symlink_list, linfo->type, NULL, buf) < 0)
@@ -2292,21 +2313,21 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
else {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
}
break;
- case H5L_TYPE_EXTERNAL:
- {
+ case H5L_TYPE_EXTERNAL: {
const char *filename;
const char *path;
- hbool_t follow_link = follow_symlink_g || follow_elink_g;
+ hbool_t follow_link = follow_symlink_g || follow_elink_g;
ret = H5tools_get_symlink_info(iter->fid, name, &lnk_info, follow_link);
/* lnk_info.trg_path is malloced in H5tools_get_symlink_info()
* so it will be freed via buf later */
- buf = (char*)lnk_info.trg_path;
+ buf = (char *)lnk_info.trg_path;
/* error */
if (ret < 0)
goto done;
@@ -2320,11 +2341,12 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
h5tools_str_append(&buffer, "External Link {");
h5tools_str_append(&buffer, filename);
h5tools_str_append(&buffer, "/");
- if(*path != '/')
+ if (*path != '/')
h5tools_str_append(&buffer, "/");
h5tools_str_append(&buffer, path);
h5tools_str_append(&buffer, "}");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Recurse through the external link */
/* keep the follow_elink_g for backward compatibility with -E */
@@ -2336,10 +2358,12 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* Check if we have already seen this elink */
if (symlink_is_visited(iter->symlink_list, linfo->type, filename, path)) {
h5tools_str_append(&buffer, "{Already Visited}\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos,
+ (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
goto done;
}
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Add this link to the list of seen elinks */
if (symlink_visit_add(iter->symlink_list, linfo->type, filename, path) < 0) {
@@ -2365,15 +2389,15 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
}
else
PRINTVALSTREAM(rawoutstream, "\n");
- }
- break;
+ } break;
case H5L_TYPE_ERROR:
case H5L_TYPE_HARD:
case H5L_TYPE_MAX:
default:
h5tools_str_append(&buffer, "UD Link {cannot follow UD links}\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
break;
} /* end switch */
@@ -2385,7 +2409,6 @@ done:
return 0;
} /* end list_lnk() */
-
/*-------------------------------------------------------------------------
* Function: visit_obj
*
@@ -2398,12 +2421,12 @@ done:
static herr_t
visit_obj(hid_t file, const char *oname, iter_t *iter)
{
- int retval = 0;
- H5O_info_t oi; /* Information for object */
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ int retval = 0;
+ H5O_info_t oi; /* Information for object */
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * info = &ls_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2411,14 +2434,15 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
h5tools_str_reset(&buffer);
/* Retrieve info for object to list */
- if (H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC | H5O_INFO_TIME, H5P_DEFAULT) < 0) {
if (iter->symlink_target) {
h5tools_str_append(&buffer, "{**NOT FOUND**}\n");
iter->symlink_target = FALSE;
}
else
print_obj_name(&buffer, iter, oname, "**NOT FOUND**");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
retval = -1;
goto done;
} /* end if */
@@ -2428,18 +2452,20 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
/* Get ID for group */
if (!iter->symlink_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) {
h5tools_str_append(&buffer, "%s: unable to open '%s' as group\n", iter->fname, oname);
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
- goto done; /* Previously "continue", when this code was in main().
- * We don't "continue" here in order to close the file
- * and free the file name properly. */
- } /* end if */
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
+ goto done; /* Previously "continue", when this code was in main().
+ * We don't "continue" here in order to close the file
+ * and free the file name properly. */
+ } /* end if */
/* Delay specifying the name start point so the original object name is
* displayed if it is a link or non-group object */
iter->name_start = iter->base_len;
/* Specified name is a group. List the complete contents of the group. */
- h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->symlink_target), recursive_g, list_obj, list_lnk, iter, H5O_INFO_BASIC|H5O_INFO_TIME);
+ h5trav_visit(file, oname, (hbool_t)(display_root_g || iter->symlink_target), recursive_g, list_obj,
+ list_lnk, iter, H5O_INFO_BASIC | H5O_INFO_TIME);
/* Close group */
if (!iter->symlink_target)
@@ -2459,7 +2485,6 @@ done:
return retval;
}
-
/*-------------------------------------------------------------------------
* Function: get_width
*
@@ -2475,7 +2500,7 @@ done:
static int
get_width(void)
{
- int width = 80; /*the default */
+ int width = 80; /*the default */
char *s;
/* Try to get it from the COLUMNS environment variable first since it's
@@ -2515,14 +2540,14 @@ get_width(void)
{
/* Unix with ioctl(TIOCGWINSZ) */
struct winsize w;
- if (ioctl(2, (int)TIOCGWINSZ, &w)>=0 && w.ws_col>0)
+ if (ioctl(2, (int)TIOCGWINSZ, &w) >= 0 && w.ws_col > 0)
width = w.ws_col;
}
#elif defined(H5_HAVE_TIOCGETD) && defined(H5_HAVE_IOCTL)
{
/* Unix with ioctl(TIOCGETD) */
struct uwdata w;
- if (ioctl(2, WIOCGETD, &w)>=0 && w.uw_width>0)
+ if (ioctl(2, WIOCGETD, &w) >= 0 && w.uw_width > 0)
width = w.uw_width / w.uw_hs;
}
#endif
@@ -2553,7 +2578,8 @@ is_valid_args(void)
}
if (no_dangling_link_g && !follow_symlink_g) {
- HDfprintf(rawerrorstream, "Error: --no-dangling-links must be used along with --follow-symlinks option!\n\n");
+ HDfprintf(rawerrorstream,
+ "Error: --no-dangling-links must be used along with --follow-symlinks option!\n\n");
ret = FALSE;
goto out;
}
@@ -2562,7 +2588,6 @@ out:
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -2579,7 +2604,6 @@ leave(int ret)
HDexit(ret);
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -2592,16 +2616,16 @@ leave(int ret)
int
main(int argc, const char *argv[])
{
- hid_t file_id = H5I_INVALID_HID;
- char *fname = NULL, *oname = NULL, *x;
- const char *s = NULL;
- char *rest;
- int argno;
- static char root_name[] = "/";
- char drivername[50];
- const char *preferred_driver = NULL;
- int err_exit = 0;
- hid_t fapl_id = H5P_DEFAULT;
+ hid_t file_id = H5I_INVALID_HID;
+ char * fname = NULL, *oname = NULL, *x = NULL;
+ const char *s = NULL;
+ char * rest;
+ int argno;
+ static char root_name[] = "/";
+ char drivername[50];
+ const char *preferred_driver = NULL;
+ int err_exit = 0;
+ hid_t fapl_id = H5P_DEFAULT;
#ifdef H5_HAVE_ROS3_VFD
/* Default "anonymous" S3 configuration */
@@ -2654,12 +2678,12 @@ main(int argc, const char *argv[])
else if (!HDstrcmp(argv[argno], "--address")) {
address_g = TRUE;
}
- else if(!HDstrcmp(argv[argno], "--data")) {
+ else if (!HDstrcmp(argv[argno], "--data")) {
data_g = TRUE;
}
else if (!HDstrcmp(argv[argno], "--enable-error-stack")) {
enable_error_stack = 1;
- /* deprecated --errors */
+ /* deprecated --errors */
}
else if (!HDstrcmp(argv[argno], "--errors")) {
enable_error_stack = 1;
@@ -2684,7 +2708,7 @@ main(int argc, const char *argv[])
}
else if (!HDstrcmp(argv[argno], "--recursive")) {
recursive_g = TRUE;
- fullname_g = TRUE;
+ fullname_g = TRUE;
}
else if (!HDstrcmp(argv[argno], "--simple")) {
simple_output_g = TRUE;
@@ -2693,10 +2717,10 @@ main(int argc, const char *argv[])
string_g = TRUE;
}
else if (!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) {
- preferred_driver = argv[argno]+6;
+ preferred_driver = argv[argno] + 6;
}
else if (!HDstrncmp(argv[argno], "--width=", (size_t)8)) {
- width_g = (int)HDstrtol(argv[argno]+8, &rest, 0);
+ width_g = (int)HDstrtol(argv[argno] + 8, &rest, 0);
if (0 == width_g)
no_line_wrap_g = TRUE;
@@ -2742,14 +2766,13 @@ main(int argc, const char *argv[])
}
width_g = (int)HDstrtol(s, &rest, 0);
- if(0 == width_g) {
+ if (0 == width_g) {
no_line_wrap_g = TRUE;
}
- else if(width_g < 0 || *rest) {
+ else if (width_g < 0 || *rest) {
usage();
leave(EXIT_FAILURE);
}
-
}
else if (!HDstrncmp(argv[argno], "--s3-cred=", (size_t)10)) {
#ifdef H5_HAVE_ROS3_VFD
@@ -2757,7 +2780,8 @@ main(int argc, const char *argv[])
start = strchr(argv[argno], '=');
if (start == NULL) {
- HDfprintf(rawerrorstream, "Error: Unable to parse null credentials tuple\n"
+ HDfprintf(rawerrorstream,
+ "Error: Unable to parse null credentials tuple\n"
" For anonymous access, omit \"--s3-cred\" and use only \"--vfd=ros3\"\n\n");
usage();
leave(EXIT_FAILURE);
@@ -2779,8 +2803,8 @@ main(int argc, const char *argv[])
#ifdef H5_HAVE_LIBHDFS
char const *start = NULL;
- start = argv[argno]+13; /* should never segfault: worst case of */
- if (*start != '(') { /* null-termintor after '='. */
+ start = argv[argno] + 13; /* should never segfault: worst case of */
+ if (*start != '(') { /* null-termintor after '='. */
usage();
leave(EXIT_FAILURE);
}
@@ -2796,10 +2820,10 @@ main(int argc, const char *argv[])
leave(EXIT_FAILURE);
#endif
}
- else if('-'!=argv[argno][1]) {
+ else if ('-' != argv[argno][1]) {
/* Single-letter switches */
- for(s = argv[argno] + 1; *s; s++) {
- switch(*s) {
+ for (s = argv[argno] + 1; *s; s++) {
+ switch (*s) {
case '?':
case 'h': /* --help */
usage();
@@ -2837,7 +2861,7 @@ main(int argc, const char *argv[])
case 'r': /* --recursive */
recursive_g = TRUE;
- fullname_g = TRUE;
+ fullname_g = TRUE;
break;
case 'S': /* --simple */
@@ -2865,7 +2889,7 @@ main(int argc, const char *argv[])
usage();
leave(EXIT_FAILURE);
} /* end switch */
- } /* end for */
+ } /* end for */
}
else {
HDfprintf(stderr, "Unknown argument: %s\n", argv[argno]);
@@ -2893,8 +2917,8 @@ main(int argc, const char *argv[])
if (preferred_driver) {
h5tools_vfd_info_t vfd_info;
- vfd_info.info = NULL;
- vfd_info.name = preferred_driver;
+ vfd_info.info = NULL;
+ vfd_info.name = preferred_driver;
if (!HDstrcmp(preferred_driver, drivernames[ROS3_VFD_IDX])) {
#ifdef H5_HAVE_ROS3_VFD
@@ -2931,29 +2955,29 @@ main(int argc, const char *argv[])
* chops off the last component. If we reach the beginning of the name
* then there must have been something wrong with the file (perhaps it
* doesn't exist). */
- show_file_name_g = (argc-argno > 1); /*show file names if more than one*/
- while(argno < argc) {
- H5L_info_t li;
- iter_t iter;
+ show_file_name_g = (argc - argno > 1); /*show file names if more than one*/
+ while (argno < argc) {
+ H5L_info_t li;
+ iter_t iter;
symlink_trav_t symlink_list;
- size_t u;
+ size_t u;
- fname = HDstrdup(argv[argno++]);
- oname = NULL;
+ fname = HDstrdup(argv[argno++]);
+ oname = NULL;
file_id = H5I_INVALID_HID;
while (fname && *fname) {
- file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id,
- (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, drivername, sizeof drivername);
+ file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE,
+ drivername, sizeof drivername);
if (file_id >= 0) {
if (verbose_g)
PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername);
break; /*success*/
- } /* end if */
+ } /* end if */
/* Shorten the file name; lengthen the object name */
- x = oname;
+ x = oname;
oname = HDstrrchr(fname, '/');
if (x)
*x = '/';
@@ -2963,7 +2987,7 @@ main(int argc, const char *argv[])
} /* end while */
if (file_id < 0) {
- HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno-1]);
+ HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno - 1]);
HDfree(fname);
err_exit = 1;
continue;
@@ -2971,9 +2995,9 @@ main(int argc, const char *argv[])
if (oname) {
/* Always use absolute paths to avoid confusion, keep track of where
* to begin path name output */
- *oname = '/';
+ *oname = '/';
iter.base_len = HDstrlen(oname);
- iter.base_len -= oname[iter.base_len-1] == '/';
+ iter.base_len -= oname[iter.base_len - 1] == '/';
x = oname;
if (NULL == (oname = HDstrdup(oname))) {
HDfprintf(rawerrorstream, "memory allocation failed\n");
@@ -2988,42 +3012,43 @@ main(int argc, const char *argv[])
oname = root_name;
if (recursive_g)
display_root_g = TRUE;
- iter.base_len = 0;
+ iter.base_len = 0;
iter.name_start = 0;
/* Use x to remember if we have allocated space in oname */
x = NULL;
} /* end if */
/* Remember the file information for later */
- iter.fname = fname;
- iter.fid = file_id;
- iter.gid = H5I_INVALID_HID;
- iter.symlink_target = FALSE;
- iter.symlink_list = &symlink_list;
+ iter.fname = fname;
+ iter.fid = file_id;
+ iter.gid = H5I_INVALID_HID;
+ iter.symlink_target = FALSE;
+ iter.symlink_list = &symlink_list;
iter.symlink_list->dangle_link = FALSE;
/* Initialize list of visited symbolic links */
symlink_list.nused = symlink_list.nalloc = 0;
- symlink_list.objs = NULL;
+ symlink_list.objs = NULL;
/* Check for root group as object name */
- if (HDstrcmp(oname, root_name)) {
+ if (HDstrcmp(oname, root_name) != 0) {
/* Check the type of link given */
if (H5Lget_info(file_id, oname, &li, H5P_DEFAULT) < 0) {
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * info = &ls_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
h5tools_str_reset(&buffer);
print_obj_name(&buffer, &iter, oname, "**NOT FOUND**");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
leave(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else
li.type = H5L_TYPE_HARD;
@@ -3069,4 +3094,3 @@ main(int argc, const char *argv[])
else
leave(EXIT_SUCCESS);
} /* end main() */
-
diff --git a/tools/src/h5perf/CMakeLists.txt b/tools/src/h5perf/CMakeLists.txt
new file mode 100644
index 0000000..36b0b2f
--- /dev/null
+++ b/tools/src/h5perf/CMakeLists.txt
@@ -0,0 +1,103 @@
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_TOOLS_SRC_H5PERF C)
+
+# --------------------------------------------------------------------
+# Add the executables
+# --------------------------------------------------------------------
+#-- Adding test for h5perf_serial
+set (h5perf_serial_SOURCES
+ ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_perf.c
+ ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_engine.c
+)
+add_executable (h5perf_serial ${h5perf_serial_SOURCES})
+target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5perf_serial STATIC)
+ target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (h5perf_serial SHARED)
+ target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
+set_target_properties (h5perf_serial PROPERTIES FOLDER perform)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5perf_serial")
+
+set (H5_DEP_EXECUTABLES h5perf_serial)
+
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_SRC_H5PERF_h5perf_serial_FORMAT h5perf_serial)
+endif ()
+
+if (H5_HAVE_PARALLEL)
+ if (UNIX)
+ #-- Adding test for perf - only on unix systems
+ set (perf_SOURCES
+ ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/perf.c
+ )
+ add_executable (perf ${perf_SOURCES})
+ target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (perf STATIC)
+ target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
+ else ()
+ TARGET_C_PROPERTIES (perf SHARED)
+ target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
+ endif ()
+ set_target_properties (perf PROPERTIES FOLDER perform)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};perf")
+
+ set (H5_DEP_EXECUTABLES perf)
+
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_SRC_H5PERF_perf_FORMAT perf)
+ endif ()
+ endif ()
+
+ #-- Adding test for h5perf
+ set (h5perf_SOURCES
+ ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_perf.c
+ ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_engine.c
+ )
+ add_executable (h5perf ${h5perf_SOURCES})
+ target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5perf STATIC)
+ target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
+ else ()
+ TARGET_C_PROPERTIES (h5perf SHARED)
+ target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
+ endif ()
+ set_target_properties (h5perf PROPERTIES FOLDER perform)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5perf")
+
+ set (H5_DEP_EXECUTABLES h5perf)
+
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_SRC_H5PERF_h5perf_FORMAT h5perf)
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+if (HDF5_EXPORTED_TARGETS)
+ foreach (exec ${H5_DEP_EXECUTABLES})
+ INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+ endforeach ()
+
+ install (
+ TARGETS
+ ${H5_DEP_EXECUTABLES}
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+ )
+endif ()
diff --git a/tools/src/h5perf/Makefile.am b/tools/src/h5perf/Makefile.am
new file mode 100644
index 0000000..e8a9fdd
--- /dev/null
+++ b/tools/src/h5perf/Makefile.am
@@ -0,0 +1,63 @@
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://www.hdfgroup.org/licenses.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+##
+#
+# HDF5 Library Performance Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
+
+# bin_PROGRAMS will be installed.
+if BUILD_PARALLEL_CONDITIONAL
+ bin_PROGRAMS=h5perf_serial perf h5perf
+else
+ bin_PROGRAMS=h5perf_serial
+endif
+
+# Add h5perf and h5perf_serial specific linker flags here
+h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# Some programs are not built or run by default, but can be built by hand or by
+# specifying --enable-build-all at configure time.
+# Also, some of these programs should only be built in parallel.
+# Currently there is no such program.
+if BUILD_PARALLEL_CONDITIONAL
+ PARA_BUILD_ALL=
+endif
+if BUILD_ALL_CONDITIONAL
+ BUILD_ALL_PROGS=$(PARA_BUILD_ALL)
+endif
+
+# Define programs that will be run in 'make check'
+# List them in the order they should be run.
+# Parallel test programs.
+if BUILD_PARALLEL_CONDITIONAL
+ TEST_PROG_PARA=h5perf perf
+endif
+
+h5perf_SOURCES=pio_perf.c pio_engine.c
+h5perf_serial_SOURCES=sio_perf.c sio_engine.c
+
+# All of the programs depend on the main hdf5 library, and some of them
+# depend on test or tools library.
+LDADD=$(LIBHDF5)
+h5perf_LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+h5perf_serial_LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+perf_LDADD=$(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/h5perf/Makefile.in b/tools/src/h5perf/Makefile.in
new file mode 100644
index 0000000..194baaa
--- /dev/null
+++ b/tools/src/h5perf/Makefile.in
@@ -0,0 +1,1597 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://www.hdfgroup.org/licenses.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
+# HDF5 Library Performance Makefile(.in)
+#
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_PARALLEL_CONDITIONAL_FALSE@bin_PROGRAMS = \
+@BUILD_PARALLEL_CONDITIONAL_FALSE@ h5perf_serial$(EXEEXT)
+@BUILD_PARALLEL_CONDITIONAL_TRUE@bin_PROGRAMS = \
+@BUILD_PARALLEL_CONDITIONAL_TRUE@ h5perf_serial$(EXEEXT) \
+@BUILD_PARALLEL_CONDITIONAL_TRUE@ perf$(EXEEXT) h5perf$(EXEEXT)
+TESTS =
+subdir = tools/src/h5perf
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
+ $(top_srcdir)/m4/aclocal_fc.m4 \
+ $(top_srcdir)/m4/ax_check_class.m4 \
+ $(top_srcdir)/m4/ax_check_classpath.m4 \
+ $(top_srcdir)/m4/ax_check_java_home.m4 \
+ $(top_srcdir)/m4/ax_check_junit.m4 \
+ $(top_srcdir)/m4/ax_java_options.m4 \
+ $(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
+ $(top_srcdir)/m4/ax_prog_jar.m4 \
+ $(top_srcdir)/m4/ax_prog_java.m4 \
+ $(top_srcdir)/m4/ax_prog_java_works.m4 \
+ $(top_srcdir)/m4/ax_prog_javac.m4 \
+ $(top_srcdir)/m4/ax_prog_javac_works.m4 \
+ $(top_srcdir)/m4/ax_prog_javadoc.m4 \
+ $(top_srcdir)/m4/ax_try_compile_java.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/H5config.h \
+ $(top_builddir)/fortran/src/H5config_f.inc
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_h5perf_OBJECTS = pio_perf.$(OBJEXT) pio_engine.$(OBJEXT)
+h5perf_OBJECTS = $(am_h5perf_OBJECTS)
+h5perf_DEPENDENCIES = $(LIBH5TOOLS) $(LIBHDF5)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+h5perf_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(h5perf_LDFLAGS) $(LDFLAGS) -o $@
+am_h5perf_serial_OBJECTS = sio_perf.$(OBJEXT) sio_engine.$(OBJEXT)
+h5perf_serial_OBJECTS = $(am_h5perf_serial_OBJECTS)
+h5perf_serial_DEPENDENCIES = $(LIBH5TOOLS) $(LIBHDF5)
+h5perf_serial_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(h5perf_serial_LDFLAGS) $(LDFLAGS) -o $@
+perf_SOURCES = perf.c
+perf_OBJECTS = perf.$(OBJEXT)
+perf_DEPENDENCIES = $(LIBHDF5)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src -I$(top_builddir)/fortran/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(h5perf_SOURCES) $(h5perf_serial_SOURCES) perf.c
+DIST_SOURCES = $(h5perf_SOURCES) $(h5perf_serial_SOURCES) perf.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.sh.log=.log)
+SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
+SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/bin/depcomp \
+ $(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \
+ $(top_srcdir)/config/conclude.am
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
+AMTAR = @AMTAR@
+
+# H5_CFLAGS holds flags that should be used when building hdf5,
+# but which should not be exported to h5cc for building other programs.
+# AM_CFLAGS is an automake construct which should be used by Makefiles
+# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
+# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
+AM_JAVACFLAGS = @AM_JAVACFLAGS@
+AM_JAVAFLAGS = @AM_JAVAFLAGS@
+AM_JNIFLAGS = @AM_JNIFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@
+AR = @AR@
+AR_FLAGS = @AR_FLAGS@
+ASSERTS = @ASSERTS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_MODE = @BUILD_MODE@
+BYTESEX = @BYTESEX@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CLANG_SANITIZE_CHECKS = @CLANG_SANITIZE_CHECKS@
+CODESTACK = @CODESTACK@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CXX_VERSION = @CXX_VERSION@
+CYGPATH_W = @CYGPATH_W@
+DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
+DIAGS = @DIAGS@
+DIRECT_VFD = @DIRECT_VFD@
+DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXTERNAL_FILTERS = @EXTERNAL_FILTERS@
+
+# Make sure that these variables are exported to the Makefiles
+F9XMODEXT = @F9XMODEXT@
+F9XMODFLAG = @F9XMODFLAG@
+F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FCFLAGS_f90 = @FCFLAGS_f90@
+FCLIBS = @FCLIBS@
+FC_VERSION = @FC_VERSION@
+FGREP = @FGREP@
+FORTRAN_C_LONG_DOUBLE_IS_UNIQUE = @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@
+FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@
+FSEARCH_DIRS = @FSEARCH_DIRS@
+Fortran_COMPILER_ID = @Fortran_COMPILER_ID@
+GREP = @GREP@
+H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@
+H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@
+H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@
+H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@
+H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@
+H5_CFLAGS = @H5_CFLAGS@
+H5_CLASSPATH = @H5_CLASSPATH@
+H5_CPPFLAGS = @H5_CPPFLAGS@
+H5_CXXFLAGS = @H5_CXXFLAGS@
+H5_FCFLAGS = @H5_FCFLAGS@
+H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
+H5_IS_DARWIN = @H5_IS_DARWIN@
+H5_JAVACFLAGS = @H5_JAVACFLAGS@
+H5_JAVAFLAGS = @H5_JAVAFLAGS@
+H5_JNIFLAGS = @H5_JNIFLAGS@
+H5_LDFLAGS = @H5_LDFLAGS@
+H5_VERSION = @H5_VERSION@
+HADDR_T = @HADDR_T@
+HAVE_DMALLOC = @HAVE_DMALLOC@
+HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
+HAVE_LIBHDFS = @HAVE_LIBHDFS@
+HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
+HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
+HDF5_INTERFACES = @HDF5_INTERFACES@
+HDF5_TESTS = @HDF5_TESTS@
+HDF5_TOOLS = @HDF5_TOOLS@
+HDF_CXX = @HDF_CXX@
+HDF_FORTRAN = @HDF_FORTRAN@
+HDF_JAVA = @HDF_JAVA@
+HID_T = @HID_T@
+HL = @HL@
+HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
+HSIZE_T = @HSIZE_T@
+HSSIZE_T = @HSSIZE_T@
+IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+INTERNAL_DEBUG_OUTPUT = @INTERNAL_DEBUG_OUTPUT@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JAVA_VERSION = @JAVA_VERSION@
+JNIFLAGS = @JNIFLAGS@
+JNI_LDFLAGS = @JNI_LDFLAGS@
+JUNIT = @JUNIT@
+LARGE_PARALLEL_IO = @LARGE_PARALLEL_IO@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
+MIRROR_VFD = @MIRROR_VFD@
+MKDIR_P = @MKDIR_P@
+MPE = @MPE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJECT_NAMELEN_DEFAULT_F = @OBJECT_NAMELEN_DEFAULT_F@
+OBJEXT = @OBJEXT@
+OPTIMIZATION = @OPTIMIZATION@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PAC_C_MAX_REAL_PRECISION = @PAC_C_MAX_REAL_PRECISION@
+PAC_FC_ALL_INTEGER_KINDS = @PAC_FC_ALL_INTEGER_KINDS@
+PAC_FC_ALL_INTEGER_KINDS_SIZEOF = @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@
+PAC_FC_ALL_REAL_KINDS = @PAC_FC_ALL_REAL_KINDS@
+PAC_FC_ALL_REAL_KINDS_SIZEOF = @PAC_FC_ALL_REAL_KINDS_SIZEOF@
+PAC_FC_MAX_REAL_PRECISION = @PAC_FC_MAX_REAL_PRECISION@
+PAC_FORTRAN_NATIVE_DOUBLE_KIND = @PAC_FORTRAN_NATIVE_DOUBLE_KIND@
+PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF = @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@
+PAC_FORTRAN_NATIVE_INTEGER_KIND = @PAC_FORTRAN_NATIVE_INTEGER_KIND@
+PAC_FORTRAN_NATIVE_INTEGER_SIZEOF = @PAC_FORTRAN_NATIVE_INTEGER_SIZEOF@
+PAC_FORTRAN_NATIVE_REAL_KIND = @PAC_FORTRAN_NATIVE_REAL_KIND@
+PAC_FORTRAN_NATIVE_REAL_SIZEOF = @PAC_FORTRAN_NATIVE_REAL_SIZEOF@
+PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
+PARALLEL = @PARALLEL@
+PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
+PROFILING = @PROFILING@
+RANLIB = @RANLIB@
+ROOT = @ROOT@
+ROS3_VFD = @ROS3_VFD@
+RUNPARALLEL = @RUNPARALLEL@
+RUNSERIAL = @RUNSERIAL@
+R_INTEGER = @R_INTEGER@
+R_LARGE = @R_LARGE@
+SEARCH = @SEARCH@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIZE_T = @SIZE_T@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRICT_FORMAT_CHECKS = @STRICT_FORMAT_CHECKS@
+STRIP = @STRIP@
+SYMBOLS = @SYMBOLS@
+TESTPARALLEL = @TESTPARALLEL@
+TESTS_JUNIT = @TESTS_JUNIT@
+THREADSAFE = @THREADSAFE@
+TIME = @TIME@
+TR = @TR@
+TRACE_API = @TRACE_API@
+UNAME_INFO = @UNAME_INFO@
+USE_FILE_LOCKING = @USE_FILE_LOCKING@
+USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@
+USE_FILTER_SZIP = @USE_FILTER_SZIP@
+USINGMEMCHECKER = @USINGMEMCHECKER@
+VERSION = @VERSION@
+WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_FC = @ac_ct_FC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+
+# Install directories that automake doesn't know about
+docdir = $(exec_prefix)/doc
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+examplesdir = @examplesdir@
+exec_prefix = @exec_prefix@
+fortran_linux_linker_option = @fortran_linux_linker_option@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Some machines need a command to run executables; this is that command
+# so that our tests will run.
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
+# some tests need to be run with a different command. Older versions
+# of the makefiles used the command
+# $(LIBTOOL) --mode=execute
+# in some directories, for instance.
+RUNEXEC = $(RUNSERIAL)
+
+# Libraries to link to while building
+LIBHDF5 = $(top_builddir)/src/libhdf5.la
+LIBH5TEST = $(top_builddir)/test/libh5test.la
+LIBH5F = $(top_builddir)/fortran/src/libhdf5_fortran.la
+LIBH5FTEST = $(top_builddir)/fortran/test/libh5test_fortran.la
+LIBH5CPP = $(top_builddir)/c++/src/libhdf5_cpp.la
+LIBH5JNI = $(top_builddir)/java/src/jni/libhdf5_java.la
+LIBH5TOOLS = $(top_builddir)/tools/lib/libh5tools.la
+LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la
+LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
+LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
+
+# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
+# has been removed. According to the official description of DESTDIR by GNU at
+# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
+# prepended to the normal and complete install path that it precedes for the
+# purpose of installing in a temporary directory which is useful for building
+# rpms and other packages. The '/' after ${DESTDIR} will be followed by another
+# '/' at the beginning of the normal install path. When DESTDIR is empty the
+# path then begins with '//', which is incorrect and causes problems at least for
+# Cygwin.
+
+# Scripts used to build examples
+# If only shared libraries have been installed, have h5cc build examples with
+# shared libraries instead of static libraries
+H5CC = ${DESTDIR}$(bindir)/h5cc
+H5CC_PP = ${DESTDIR}$(bindir)/h5pcc
+H5FC = ${DESTDIR}$(bindir)/h5fc
+H5FC_PP = ${DESTDIR}$(bindir)/h5pfc
+H5CPP = ${DESTDIR}$(bindir)/h5c++
+ACLOCAL_AMFLAGS = "-I m4"
+
+# The trace script; this is used on source files from the C library to
+# insert tracing macros.
+TRACE = perl $(top_srcdir)/bin/trace
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+# *.clog and *.clog2 are from the MPE option.
+CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
+
+# Add h5perf and h5perf_serial specific linker flags here
+h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# Some programs are not built or run by default, but can be built by hand or by
+# specifying --enable-build-all at configure time.
+# Also, some of these programs should only be built in parallel.
+# Currently there is no such program.
+@BUILD_PARALLEL_CONDITIONAL_TRUE@PARA_BUILD_ALL =
+@BUILD_ALL_CONDITIONAL_TRUE@BUILD_ALL_PROGS = $(PARA_BUILD_ALL)
+
+# Define programs that will be run in 'make check'
+# List them in the order they should be run.
+# Parallel test programs.
+@BUILD_PARALLEL_CONDITIONAL_TRUE@TEST_PROG_PARA = h5perf perf
+h5perf_SOURCES = pio_perf.c pio_engine.c
+h5perf_serial_SOURCES = sio_perf.c sio_engine.c
+
+# All of the programs depend on the main hdf5 library, and some of them
+# depend on test or tools library.
+LDADD = $(LIBHDF5)
+h5perf_LDADD = $(LIBH5TOOLS) $(LIBHDF5)
+h5perf_serial_LDADD = $(LIBH5TOOLS) $(LIBHDF5)
+perf_LDADD = $(LIBHDF5)
+
+# Automake needs to be taught how to build lib, progs and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and
+# EXTRA_TEST variables are supplied to allow the user to force targets to
+# be built at certain times.
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \
+ $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \
+ $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS =
+REALTIMEOUTPUT = $(realtimeOutput)
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_PROG_PARA_CHKEXE = $(TEST_PROG_PARA:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+TEST_SCRIPT_PARA_CHKSH = $(TEST_SCRIPT_PARA:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .sh .sh$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/src/h5perf/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tools/src/h5perf/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__empty):
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+h5perf$(EXEEXT): $(h5perf_OBJECTS) $(h5perf_DEPENDENCIES) $(EXTRA_h5perf_DEPENDENCIES)
+ @rm -f h5perf$(EXEEXT)
+ $(AM_V_CCLD)$(h5perf_LINK) $(h5perf_OBJECTS) $(h5perf_LDADD) $(LIBS)
+
+h5perf_serial$(EXEEXT): $(h5perf_serial_OBJECTS) $(h5perf_serial_DEPENDENCIES) $(EXTRA_h5perf_serial_DEPENDENCIES)
+ @rm -f h5perf_serial$(EXEEXT)
+ $(AM_V_CCLD)$(h5perf_serial_LINK) $(h5perf_serial_OBJECTS) $(h5perf_serial_LDADD) $(LIBS)
+
+perf$(EXEEXT): $(perf_OBJECTS) $(perf_DEPENDENCIES) $(EXTRA_perf_DEPENDENCIES)
+ @rm -f perf$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(perf_OBJECTS) $(perf_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_engine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_perf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio_engine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio_perf.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+recheck: all
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+.sh.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.sh$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS) all-local
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \
+ check-am clean clean-binPROGRAMS clean-generic clean-libtool \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-local pdf pdf-am ps ps-am recheck tags tags-am \
+ uninstall uninstall-am uninstall-binPROGRAMS
+
+.PRECIOUS: Makefile
+
+
+# List all build rules defined by HDF5 Makefiles as "PHONY" targets here.
+# This tells the Makefiles that these targets are not files to be built but
+# commands that should be executed even if a file with the same name already
+# exists.
+.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
+
+help:
+ @$(top_srcdir)/bin/makehelp
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s check-p :: $(BUILT_SOURCES)
+ @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+ @for d in X $(SUBDIRS); do \
+ if test $$d != X && test $$d != .; then \
+ (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+ fi; \
+ done
+
+# General rule for recursive cleaning targets. Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+ @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+ @for d in X $(SUBDIRS); do \
+ if test $$d != X && test $$d != .; then \
+ (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+ fi; \
+ done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior). Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is deprecated.
+install-doc uninstall-doc:
+ @echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+ $(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+# Set HDF5_Make_Ignore to a non-blank string to ignore errors inside the loop.
+# The timestamps give a rough idea how much time the tests use.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# TEST_PROG_PARA, or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+ @$(MAKE) build-check-s
+ @$(MAKE) build-check-p
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+ @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \
+ echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+ fi
+ @$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+ @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \
+ echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+ fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
+ @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+ tname=$(@:.chkexe_=)$(EXEEXT);\
+ log=$(@:.chkexe_=.chklog); \
+ echo "============================"; \
+ if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+ echo "No need to test $${tname} again."; \
+ else \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "============================" | tee $${log}; \
+ else \
+ echo "============================" > $${log}; \
+ fi; \
+ if test "X$(FORTRAN_API)" = "Xyes"; then \
+ echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "Fortran API: Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log}; \
+ else \
+ echo "Fortran API: Test log for $${tname} $(TEST_FLAGS)" >> $${log}; \
+ fi; \
+ elif test "X$(CXX_API)" = "Xyes"; then \
+ echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "C++ API: Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log};\
+ else \
+ echo "C++ API: Test log for $${tname} $(TEST_FLAGS)" >> $${log};\
+ fi; \
+ else \
+ echo "Testing: $${tname} $(TEST_FLAGS)"; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log}; \
+ else \
+ echo "Test log for $${tname} $(TEST_FLAGS)" >> $${log}; \
+ fi; \
+ fi; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ if test -n "$(HDF5_DRIVER)"; then \
+ echo "Virtual file driver (VFD): $(HDF5_DRIVER)" | tee -a $${log}; \
+ fi; \
+ else \
+ if test -n "$(HDF5_DRIVER)"; then \
+ echo "Virtual file driver (VFD): $(HDF5_DRIVER)" >> $${log}; \
+ fi; \
+ fi; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "============================" | tee -a $${log}; \
+ else \
+ echo "============================" >> $${log}; \
+ fi; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ srcdir="$(srcdir)" \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) | tee -a $${log} 2>&1 \
+ && touch $(@:.chkexe_=.chkexe) || \
+ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
+ (cat $${log} && false) || exit 1; \
+ else \
+ srcdir="$(srcdir)" \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ && touch $(@:.chkexe_=.chkexe) || \
+ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
+ (cat $${log} && false) || exit 1; \
+ fi; \
+ echo "" >> $${log}; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "Finished testing $${tname} $(TEST_FLAGS)" | tee -a $${log}; \
+ echo "============================" | tee -a $${log}; \
+ else \
+ echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+ echo "============================" >> $${log}; \
+ fi; \
+ if test -z "$(REALTIMEOUTPUT)"; then \
+ cat $${log}; \
+ fi; \
+ fi; \
+ fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) $(TEST_SCRIPT_PARA_CHKSH) dummysh.chkexe_:
+ @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+ cmd=$(@:.chkexe_=);\
+ tname=`basename $$cmd`;\
+ chkname=`basename $(@:.chkexe_=.chkexe)`;\
+ log=`basename $(@:.chkexe_=.chklog)`; \
+ echo "============================"; \
+ if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+ echo "No need to test $${tname} again."; \
+ else \
+ echo "============================" > $${log}; \
+ if test "X$(FORTRAN_API)" = "Xyes"; then \
+ echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+ echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+ elif test "X$(CXX_API)" = "Xyes"; then \
+ echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \
+ echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+ else \
+ echo "Testing $${tname} $(TEST_FLAGS)"; \
+ echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+ fi; \
+ echo "============================" >> $${log}; \
+ RUNSERIAL="$(RUNSERIAL)" RUNPARALLEL="$(RUNPARALLEL)" \
+ srcdir="$(srcdir)" \
+ $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+ && touch $${chkname} || \
+ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
+ (cat $${log} && false) || exit 1; \
+ echo "" >> $${log}; \
+ echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+ echo "============================" >> $${log}; \
+ echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+ cat $${log}; \
+ fi; \
+ echo "============================"; \
+ fi
+
+# Actual execution of check-p.
+build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
+ @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \
+ echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+ fi
+ @if test -n "$(TEST_PROG_PARA)"; then \
+ echo "**** Hint ****"; \
+ echo "Parallel test files reside in the current directory" \
+ "by default."; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
+ echo " HDF5_PARAPREFIX=/PFS/user/me"; \
+ echo " export HDF5_PARAPREFIX"; \
+ echo " make check"; \
+ echo "**** end of Hint ****"; \
+ fi
+ @for test in $(TEST_PROG_PARA) dummy; do \
+ if test $$test != dummy; then \
+ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
+ fi; \
+ done
+ @for test in $(TEST_SCRIPT_PARA) dummy; do \
+ if test $$test != dummy; then \
+ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ || exit 1; \
+ fi; \
+ done
+ @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \
+ echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+ fi
+
+# Run test with different Virtual File Driver
+check-vfd: $(LIB) $(PROGS) $(chk_TESTS)
+ @for vfd in $(VFD_LIST) dummy; do \
+ if test $$vfd != dummy; then \
+ echo "============================"; \
+ echo "Testing Virtual File Driver $$vfd"; \
+ echo "============================"; \
+ $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \
+ HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \
+ fi; \
+ done
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tools/src/h5perf/perf.c b/tools/src/h5perf/perf.c
new file mode 100644
index 0000000..e8c03d8
--- /dev/null
+++ b/tools/src/h5perf/perf.c
@@ -0,0 +1,803 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Author: Albert Cheng of NCSA, May 1, 2001.
+ * This is derived from code given to me by Robert Ross.
+ *
+ * NOTE: This code assumes that all command line arguments make it out to all
+ * the processes that make up the parallel job, which isn't always the case.
+ * So if it doesn't work on some platform, that might be why.
+ */
+
+#include "hdf5.h"
+#include "H5private.h"
+
+#ifdef H5_HAVE_PARALLEL
+
+#ifdef H5_STDC_HEADERS
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#endif
+
+#ifdef H5_HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#if defined(H5_TIME_WITH_SYS_TIME)
+#include <sys/time.h>
+#include <time.h>
+#elif defined(H5_HAVE_SYS_TIME_H)
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+
+#ifdef H5_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef H5_HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <mpi.h>
+#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
+#include <mpio.h>
+#endif
+
+/* Macro definitions */
+/* Verify:
+ * if val is false (0), print mesg and if fatal is true (non-zero), die.
+ */
+#define H5FATAL 1
+#define VRFY(val, mesg, fatal) \
+ do { \
+ if (!val) { \
+ printf("Proc %d: ", mynod); \
+ printf("*** Assertion failed (%s) at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \
+ if (fatal) { \
+ fflush(stdout); \
+ goto die_jar_jar_die; \
+ } \
+ } \
+ } while (0)
+#define RANK 1
+#define MAX_PATH 1024
+
+hsize_t dims[RANK]; /* dataset dim sizes */
+hsize_t block[RANK], stride[RANK], count[RANK];
+hsize_t start[RANK];
+hid_t fid; /* HDF5 file ID */
+hid_t acc_tpl; /* File access templates */
+hid_t sid; /* Dataspace ID */
+hid_t file_dataspace; /* File dataspace ID */
+hid_t mem_dataspace; /* memory dataspace ID */
+hid_t dataset; /* Dataset ID */
+hsize_t opt_alignment = 1;
+hsize_t opt_threshold = 1;
+int opt_split_vfd = 0;
+char * meta_ext, *raw_ext; /* holds the meta and raw file extension if */
+ /* opt_split_vfd is set */
+
+/* DEFAULT VALUES FOR OPTIONS */
+int64_t opt_block = 1048576 * 16;
+int opt_iter = 1;
+int opt_stripe = -1;
+int opt_correct = 0;
+int amode = O_RDWR | O_CREAT;
+char opt_file[256] = "perftest.out";
+char opt_pvfstab[256] = "notset";
+int opt_pvfstab_set = 0;
+
+const char *FILENAME[] = {opt_file, NULL};
+
+/* function prototypes */
+static int parse_args(int argc, char **argv);
+
+#ifndef H5_HAVE_UNISTD_H
+/* globals needed for getopt */
+extern char *optarg;
+#endif
+
+#ifndef HDF5_PARAPREFIX
+#define HDF5_PARAPREFIX ""
+#endif
+char * paraprefix = NULL; /* for command line option para-prefix */
+MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */
+
+static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname,
+ size_t size, hbool_t nest_printf, hbool_t subst_for_superblock);
+
+int
+main(int argc, char **argv)
+{
+ char * buf, *tmp, *buf2 = NULL, *tmp2 = NULL, *check;
+ int i, j, mynod = 0, nprocs = 1, my_correct = 1, correct, myerrno;
+ double stim, etim;
+ double write_tim = 0;
+ double read_tim = 0;
+ double read_bw, write_bw;
+ double max_read_tim, max_write_tim;
+ double min_read_tim, min_write_tim;
+ double ave_read_tim, ave_write_tim;
+ int64_t iter_jump = 0;
+ char filename[MAX_PATH];
+ herr_t ret; /* Generic return value */
+
+ /* startup MPI and determine the rank of this process */
+ MPI_Init(&argc, &argv);
+ MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mynod);
+
+ /* parse the command line arguments */
+ parse_args(argc, argv);
+
+ if (mynod == 0)
+ printf("# Using hdf5-io calls.\n");
+
+#ifdef H5_HAVE_UNISTD_H
+ /* Kind of a weird hack- if the location of the pvfstab file was
+ * specified on the command line, then spit out this location into
+ * the appropriate environment variable.
+ */
+ if (opt_pvfstab_set) {
+ if ((setenv("PVFSTAB_FILE", opt_pvfstab, 1)) < 0) {
+ perror("setenv");
+ goto die_jar_jar_die;
+ }
+ }
+#endif
+
+ /* this is how much of the file data is covered on each iteration of
+ * the test. used to help determine the seek offset on each
+ * iteration */
+ iter_jump = nprocs * opt_block;
+
+ /* setup a buffer of data to write */
+ if (!(tmp = (char *)malloc((size_t)opt_block + 256))) {
+ perror("malloc");
+ goto die_jar_jar_die;
+ }
+ buf = tmp + 128 - (((long)tmp) % 128); /* align buffer */
+
+ if (opt_correct) {
+ /* do the same buffer setup for verifiable data */
+ if (!(tmp2 = (char *)malloc((size_t)opt_block + 256))) {
+ perror("malloc2");
+ goto die_jar_jar_die;
+ }
+ buf2 = tmp + 128 - (((long)tmp) % 128);
+ }
+
+ /* setup file access template with parallel IO access. */
+ if (opt_split_vfd) {
+ hid_t mpio_pl;
+
+ mpio_pl = H5Pcreate(H5P_FILE_ACCESS);
+ VRFY((acc_tpl >= 0), "", H5FATAL);
+ ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL);
+ VRFY((ret >= 0), "", H5FATAL);
+
+ /* set optional allocation alignment */
+ if (opt_alignment * opt_threshold != 1) {
+ ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment);
+ VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
+ }
+
+ /* setup file access template */
+ acc_tpl = H5Pcreate(H5P_FILE_ACCESS);
+ VRFY((acc_tpl >= 0), "", H5FATAL);
+ ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl);
+ VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL);
+ ret = H5Pclose(mpio_pl);
+ VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL);
+ }
+ else {
+ /* setup file access template */
+ acc_tpl = H5Pcreate(H5P_FILE_ACCESS);
+ VRFY((acc_tpl >= 0), "", H5FATAL);
+ ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL);
+ VRFY((ret >= 0), "", H5FATAL);
+
+ /* set optional allocation alignment */
+ if (opt_alignment * opt_threshold != 1) {
+ ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment);
+ VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
+ }
+ }
+
+ h5_fixname_real(FILENAME[0], acc_tpl, NULL, filename, sizeof filename, FALSE, FALSE);
+
+ /* create the parallel file */
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
+ VRFY((fid >= 0), "H5Fcreate succeeded", H5FATAL);
+
+ /* define a contiquous dataset of opt_iter*nprocs*opt_block chars */
+ dims[0] = (hsize_t)opt_iter * (hsize_t)nprocs * (hsize_t)opt_block;
+ sid = H5Screate_simple(RANK, dims, NULL);
+ VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL);
+ dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL);
+
+ /* create the memory dataspace and the file dataspace */
+ dims[0] = (hsize_t)opt_block;
+ mem_dataspace = H5Screate_simple(RANK, dims, NULL);
+ VRFY((mem_dataspace >= 0), "", H5FATAL);
+ file_dataspace = H5Dget_space(dataset);
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded", H5FATAL);
+
+ /* now each process writes a block of opt_block chars in round robbin
+ * fashion until the whole dataset is covered.
+ */
+ for (j = 0; j < opt_iter; j++) {
+ /* setup a file dataspace selection */
+ start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block));
+ stride[0] = block[0] = (hsize_t)opt_block;
+ count[0] = 1;
+ ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL);
+
+ if (opt_correct) /* fill in buffer for iteration */ {
+ for (i = mynod + j, check = buf; i < opt_block; i++, check++)
+ *check = (char)i;
+ }
+
+ /* discover the starting time of the operation */
+ MPI_Barrier(MPI_COMM_WORLD);
+ stim = MPI_Wtime();
+
+ /* write data */
+ ret = H5Dwrite(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf);
+ VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL);
+
+ /* discover the ending time of the operation */
+ etim = MPI_Wtime();
+
+ write_tim += (etim - stim);
+
+ /* we are done with this "write" iteration */
+ }
+
+ /* close dataset and file */
+ ret = H5Dclose(dataset);
+ VRFY((ret >= 0), "H5Dclose succeeded", H5FATAL);
+ ret = H5Fclose(fid);
+ VRFY((ret >= 0), "H5Fclose succeeded", H5FATAL);
+
+ /* wait for everyone to synchronize at this point */
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ /* reopen the file for reading */
+ fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl);
+ VRFY((fid >= 0), "", H5FATAL);
+
+ /* open the dataset */
+ dataset = H5Dopen2(fid, "Dataset1", H5P_DEFAULT);
+ VRFY((dataset >= 0), "H5Dopen succeeded", H5FATAL);
+
+ /* we can re-use the same mem_dataspace and file_dataspace
+ * the H5Dwrite used since the dimension size is the same.
+ */
+
+ /* we are going to repeat the read the same pattern the write used */
+ for (j = 0; j < opt_iter; j++) {
+ /* setup a file dataspace selection */
+ start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block));
+ stride[0] = block[0] = (hsize_t)opt_block;
+ count[0] = 1;
+ ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL);
+ /* seek to the appropriate spot give the current iteration and
+ * rank within the MPI processes */
+
+ /* discover the start time */
+ MPI_Barrier(MPI_COMM_WORLD);
+ stim = MPI_Wtime();
+
+ /* read in the file data */
+ if (!opt_correct) {
+ ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf);
+ }
+ else {
+ ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf2);
+ }
+ myerrno = errno;
+
+ /* discover the end time */
+ etim = MPI_Wtime();
+ read_tim += (etim - stim);
+ VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL);
+
+ if (ret < 0)
+ HDfprintf(stderr, "node %d, read error, loc = %" PRId64 ": %s\n", mynod, mynod * opt_block,
+ strerror(myerrno));
+
+ /* if the user wanted to check correctness, compare the write
+ * buffer to the read buffer */
+ if (opt_correct && memcmp(buf, buf2, (size_t)opt_block)) {
+ HDfprintf(stderr, "node %d, correctness test failed\n", mynod);
+ my_correct = 0;
+ MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
+ }
+
+ /* we are done with this read iteration */
+ }
+
+ /* close dataset and file */
+ ret = H5Dclose(dataset);
+ VRFY((ret >= 0), "H5Dclose succeeded", H5FATAL);
+ ret = H5Fclose(fid);
+ VRFY((ret >= 0), "H5Fclose succeeded", H5FATAL);
+ ret = H5Pclose(acc_tpl);
+ VRFY((ret >= 0), "H5Pclose succeeded", H5FATAL);
+
+ /* compute the read and write times */
+ MPI_Allreduce(&read_tim, &max_read_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
+ MPI_Allreduce(&read_tim, &min_read_tim, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
+ MPI_Allreduce(&read_tim, &ave_read_tim, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
+
+ /* calculate the average from the sum */
+ ave_read_tim = ave_read_tim / nprocs;
+
+ MPI_Allreduce(&write_tim, &max_write_tim, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
+ MPI_Allreduce(&write_tim, &min_write_tim, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
+ MPI_Allreduce(&write_tim, &ave_write_tim, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
+
+ /* calculate the average from the sum */
+ ave_write_tim = ave_write_tim / nprocs;
+
+ /* print out the results on one node */
+ if (mynod == 0) {
+ read_bw = (double)((int64_t)(opt_block * nprocs * opt_iter)) / (max_read_tim * 1000000.0);
+ write_bw = (double)((int64_t)(opt_block * nprocs * opt_iter)) / (max_write_tim * 1000000.0);
+
+ printf("nr_procs = %d, nr_iter = %d, blk_sz = %ld\n", nprocs, opt_iter, (long)opt_block);
+
+ printf("# total_size = %ld\n", (long)(opt_block * nprocs * opt_iter));
+
+ printf("# Write: min_time = %f, max_time = %f, mean_time = %f\n", min_write_tim, max_write_tim,
+ ave_write_tim);
+ printf("# Read: min_time = %f, max_time = %f, mean_time = %f\n", min_read_tim, max_read_tim,
+ ave_read_tim);
+
+ printf("Write bandwidth = %f Mbytes/sec\n", write_bw);
+ printf("Read bandwidth = %f Mbytes/sec\n", read_bw);
+
+ if (opt_correct) {
+ printf("Correctness test %s.\n", correct ? "passed" : "failed");
+ }
+ }
+
+die_jar_jar_die:
+
+#ifdef H5_HAVE_UNISTD
+ /* Clear the environment variable if it was set earlier */
+ if (opt_pvfstab_set) {
+ unsetenv("PVFSTAB_FILE");
+ }
+#endif
+
+ free(tmp);
+ if (opt_correct)
+ free(tmp2);
+
+ MPI_Finalize();
+
+ return (0);
+}
+
+static int
+parse_args(int argc, char **argv)
+{
+ int c;
+
+ while ((c = getopt(argc, argv, "s:b:i:f:p:a:2:c")) != EOF) {
+ switch (c) {
+ case 's': /* stripe */
+ opt_stripe = atoi(optarg);
+ break;
+ case 'b': /* block size */
+ opt_block = atoi(optarg);
+ break;
+ case 'i': /* iterations */
+ opt_iter = atoi(optarg);
+ break;
+ case 'f': /* filename */
+ strncpy(opt_file, optarg, 255);
+ FILENAME[0] = opt_file;
+ break;
+ case 'p': /* pvfstab file */
+ strncpy(opt_pvfstab, optarg, 255);
+ opt_pvfstab_set = 1;
+ break;
+ case 'a': /* aligned allocation.
+ * syntax: -a<alignment>/<threshold>
+ * e.g., -a4096/512 allocate at 4096 bytes
+ * boundary if request size >= 512.
+ */
+ {
+ char *p;
+
+ opt_alignment = (hsize_t)HDatoi(optarg);
+ if (NULL != (p = (char *)HDstrchr(optarg, '/')))
+ opt_threshold = (hsize_t)HDatoi(p + 1);
+ }
+ HDfprintf(stdout, "alignment/threshold=%" PRIuHSIZE "/%" PRIuHSIZE "\n", opt_alignment,
+ opt_threshold);
+ break;
+ case '2': /* use 2-files, i.e., split file driver */
+ opt_split_vfd = 1;
+ /* get meta and raw file extension. */
+ /* syntax is <raw_ext>,<meta_ext> */
+ meta_ext = raw_ext = optarg;
+ while (*raw_ext != '\0') {
+ if (*raw_ext == ',') {
+ *raw_ext = '\0';
+ raw_ext++;
+ break;
+ }
+ raw_ext++;
+ }
+ printf("split-file-vfd used: %s,%s\n", meta_ext, raw_ext);
+ break;
+ case 'c': /* correctness */
+ opt_correct = 1;
+ break;
+ case '?': /* unknown */
+ default:
+ break;
+ }
+ }
+
+ return (0);
+}
+/*-------------------------------------------------------------------------
+ * Function: getenv_all
+ *
+ * Purpose: Used to get the environment that the root MPI task has.
+ * name specifies which environment variable to look for
+ * val is the string to which the value of that environment
+ * variable will be copied.
+ *
+ * NOTE: The pointer returned by this function is only
+ * valid until the next call to getenv_all and the data
+ * stored there must be copied somewhere else before any
+ * further calls to getenv_all take place.
+ *
+ * Return: pointer to a string containing the value of the environment variable
+ * NULL if the varialbe doesn't exist in task 'root's environment.
+ *
+ * Programmer: Leon Arber
+ * 4/4/05
+ *
+ * Modifications:
+ * Use original getenv if MPI is not initialized. This happens
+ * one uses the PHDF5 library to build a serial nature code.
+ * Albert 2006/04/07
+ *
+ *-------------------------------------------------------------------------
+ */
+char *
+getenv_all(MPI_Comm comm, int root, const char *name)
+{
+ int mpi_size, mpi_rank, mpi_initialized, mpi_finalized;
+ int len;
+ static char *env = NULL;
+
+ HDassert(name);
+
+ MPI_Initialized(&mpi_initialized);
+ MPI_Finalized(&mpi_finalized);
+
+ if (mpi_initialized && !mpi_finalized) {
+ MPI_Comm_rank(comm, &mpi_rank);
+ MPI_Comm_size(comm, &mpi_size);
+ HDassert(root < mpi_size);
+
+ /* The root task does the getenv call
+ * and sends the result to the other tasks */
+ if (mpi_rank == root) {
+ env = HDgetenv(name);
+ if (env) {
+ len = (int)HDstrlen(env);
+ MPI_Bcast(&len, 1, MPI_INT, root, comm);
+ MPI_Bcast(env, len, MPI_CHAR, root, comm);
+ }
+ else {
+ /* len -1 indicates that the variable was not in the environment */
+ len = -1;
+ MPI_Bcast(&len, 1, MPI_INT, root, comm);
+ }
+ }
+ else {
+ MPI_Bcast(&len, 1, MPI_INT, root, comm);
+ if (len >= 0) {
+ if (env == NULL)
+ env = (char *)HDmalloc((size_t)len + 1);
+ else if (HDstrlen(env) < (size_t)len)
+ env = (char *)HDrealloc(env, (size_t)len + 1);
+
+ MPI_Bcast(env, len, MPI_CHAR, root, comm);
+ env[len] = '\0';
+ }
+ else {
+ if (env)
+ HDfree(env);
+ env = NULL;
+ }
+ }
+#ifndef NDEBUG
+ MPI_Barrier(comm);
+#endif
+ }
+ else {
+ /* use original getenv */
+ if (env)
+ HDfree(env);
+ env = HDgetenv(name);
+ } /* end if */
+
+ return env;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5_fixname_real
+ *
+ * Purpose: Create a file name from a file base name like `test' and
+ * return it through the FULLNAME (at most SIZE characters
+ * counting the null terminator). The full name is created by
+ * prepending the contents of HDF5_PREFIX (separated from the
+ * base name by a slash) and appending a file extension based on
+ * the driver supplied, resulting in something like
+ * `ufs:/u/matzke/test.h5'.
+ *
+ * Return: Success: The FULLNAME pointer.
+ *
+ * Failure: NULL if BASENAME or FULLNAME is the null
+ * pointer or if FULLNAME isn't large enough for
+ * the result.
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 19, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+static char *
+h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size,
+ hbool_t nest_printf, hbool_t subst_for_superblock)
+{
+ const char *prefix = NULL;
+ const char *env = NULL; /* HDF5_DRIVER environment variable */
+ char * ptr, last = '\0';
+ const char *suffix = _suffix;
+ size_t i, j;
+ hid_t driver = -1;
+ int isppdriver = 0; /* if the driver is MPI parallel */
+
+ if (!base_name || !fullname || size < 1)
+ return NULL;
+
+ HDmemset(fullname, 0, size);
+
+ /* figure out the suffix */
+ if (H5P_DEFAULT != fapl) {
+ if ((driver = H5Pget_driver(fapl)) < 0)
+ return NULL;
+
+ if (suffix) {
+ if (H5FD_FAMILY == driver) {
+ if (subst_for_superblock)
+ suffix = "00000.h5";
+ else
+ suffix = nest_printf ? "%%05d.h5" : "%05d.h5";
+ }
+ else if (H5FD_MULTI == driver) {
+
+ /* Get the environment variable, if it exists, in case
+ * we are using the split driver since both of those
+ * use the multi VFD under the hood.
+ */
+ env = HDgetenv("HDF5_DRIVER");
+#ifdef HDF5_DRIVER
+ /* Use the environment variable, then the compile-time constant */
+ if (!env)
+ env = HDF5_DRIVER;
+#endif
+ if (env && !HDstrcmp(env, "split")) {
+ /* split VFD */
+ if (subst_for_superblock)
+ suffix = "-m.h5";
+ else
+ suffix = NULL;
+ }
+ else {
+ /* multi VFD */
+ if (subst_for_superblock)
+ suffix = "-s.h5";
+ else
+ suffix = NULL;
+ }
+ }
+ }
+ }
+
+ /* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX
+ * could be of value -1 if it is not defined.
+ */
+ isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO == driver);
+
+ /* Check what prefix to use for test files. Process HDF5_PARAPREFIX and
+ * HDF5_PREFIX.
+ * Use different ones depending on parallel or serial driver used.
+ * (The #ifdef is needed to prevent compile failure in case MPI is not
+ * configured.)
+ */
+ if (isppdriver) {
+ /*
+ * For parallel:
+ * First use command line option, then the environment
+ * variable, then try the constant
+ */
+ static int explained = 0;
+
+ prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX"));
+
+ if (!prefix && !explained) {
+ /* print hint by process 0 once. */
+ int mpi_rank;
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+
+ if (mpi_rank == 0)
+ HDprintf("*** Hint ***\n"
+ "You can use environment variable HDF5_PARAPREFIX to "
+ "run parallel test files in a\n"
+ "different directory or to add file type prefix. e.g.,\n"
+ " HDF5_PARAPREFIX=pfs:/PFS/user/me\n"
+ " export HDF5_PARAPREFIX\n"
+ "*** End of Hint ***\n");
+
+ explained = TRUE;
+#ifdef HDF5_PARAPREFIX
+ prefix = HDF5_PARAPREFIX;
+#endif /* HDF5_PARAPREFIX */
+ }
+ }
+ else {
+ /*
+ * For serial:
+ * First use the environment variable, then try the constant
+ */
+ prefix = HDgetenv("HDF5_PREFIX");
+
+#ifdef HDF5_PREFIX
+ if (!prefix)
+ prefix = HDF5_PREFIX;
+#endif /* HDF5_PREFIX */
+ }
+
+ /* Prepend the prefix value to the base name */
+ if (prefix && *prefix) {
+ if (isppdriver) {
+ /* This is a parallel system */
+ char *subdir;
+
+ if (!HDstrcmp(prefix, HDF5_PARAPREFIX)) {
+ /*
+ * If the prefix specifies the HDF5_PARAPREFIX directory, then
+ * default to using the "/tmp/$USER" or "/tmp/$LOGIN"
+ * directory instead.
+ */
+ char *user, *login;
+
+ user = HDgetenv("USER");
+ login = HDgetenv("LOGIN");
+ subdir = (user ? user : login);
+
+ if (subdir) {
+ for (i = 0; i < size && prefix[i]; i++)
+ fullname[i] = prefix[i];
+
+ fullname[i++] = '/';
+
+ for (j = 0; i < size && subdir[j]; ++i, ++j)
+ fullname[i] = subdir[j];
+ }
+ }
+
+ if (!fullname[0]) {
+ /* We didn't append the prefix yet */
+ HDstrncpy(fullname, prefix, size);
+ fullname[size - 1] = '\0';
+ }
+
+ if (HDstrlen(fullname) + HDstrlen(base_name) + 1 < size) {
+ /*
+ * Append the base_name with a slash first. Multiple
+ * slashes are handled below.
+ */
+ h5_stat_t buf;
+
+ if (HDstat(fullname, &buf) < 0)
+ /* The directory doesn't exist just yet */
+ if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST)
+ /*
+ * We couldn't make the "/tmp/${USER,LOGIN}"
+ * subdirectory. Default to PREFIX's original
+ * prefix value.
+ */
+ HDstrcpy(fullname, prefix);
+
+ HDstrcat(fullname, "/");
+ HDstrcat(fullname, base_name);
+ }
+ else {
+ /* Buffer is too small */
+ return NULL;
+ }
+ }
+ else {
+ if (HDsnprintf(fullname, size, "%s/%s", prefix, base_name) == (int)size)
+ /* Buffer is too small */
+ return NULL;
+ }
+ }
+ else if (HDstrlen(base_name) >= size) {
+ /* Buffer is too small */
+ return NULL;
+ }
+ else {
+ HDstrcpy(fullname, base_name);
+ }
+
+ /* Append a suffix */
+ if (suffix) {
+ if (HDstrlen(fullname) + HDstrlen(suffix) >= size)
+ return NULL;
+
+ HDstrcat(fullname, suffix);
+ }
+
+ /* Remove any double slashes in the filename */
+ for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) {
+ if (*ptr != '/' || last != '/')
+ fullname[j++] = *ptr;
+
+ last = *ptr;
+ }
+
+ return fullname;
+}
+
+/*
+ * Local variables:
+ * c-indent-level: 3
+ * c-basic-offset: 3
+ * tab-width: 3
+ * End:
+ */
+
+#else /* H5_HAVE_PARALLEL */
+/* dummy program since H5_HAVE_PARALLEL is not configured in */
+int
+main(int H5_ATTR_UNUSED argc, char H5_ATTR_UNUSED **argv)
+{
+ printf("No parallel performance because parallel is not configured in\n");
+ return (0);
+}
+#endif /* H5_HAVE_PARALLEL */
diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c
new file mode 100644
index 0000000..65194b0
--- /dev/null
+++ b/tools/src/h5perf/pio_engine.c
@@ -0,0 +1,2747 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Author: Albert Cheng of NCSA, Oct 24, 2001.
+ */
+
+#include "hdf5.h"
+
+#ifdef H5_STDC_HEADERS
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+#ifdef H5_HAVE_UNISTD_H
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#ifdef H5_HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#ifdef H5_HAVE_PARALLEL
+
+#include <mpi.h>
+
+#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
+#include <mpio.h>
+#endif /* !MPI_FILE_NULL */
+
+#include "pio_perf.h"
+
+/* Macro definitions */
+
+#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 6
+#define H5DCREATE(fd, name, type, space, dcpl) H5Dcreate(fd, name, type, space, dcpl)
+#define H5DOPEN(fd, name) H5Dopen(fd, name)
+#else
+#define H5DCREATE(fd, name, type, space, dcpl) \
+ H5Dcreate2(fd, name, type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)
+#define H5DOPEN(fd, name) H5Dopen2(fd, name, H5P_DEFAULT)
+#endif
+
+/* sizes of various items. these sizes won't change during program execution */
+/* The following three must have the same type */
+#define ELMT_H5_TYPE H5T_NATIVE_UCHAR
+
+#define GOTOERROR(errcode) \
+ { \
+ ret_code = errcode; \
+ goto done; \
+ }
+#define ERRMSG(mesg) \
+ { \
+ HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \
+ HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \
+ }
+
+/* verify: if val is false (0), print mesg. */
+#define VRFY(val, mesg) \
+ do { \
+ if (!val) { \
+ ERRMSG(mesg); \
+ GOTOERROR(FAIL); \
+ } \
+ } while (0)
+
+/* POSIX I/O macros */
+#ifdef H5_HAVE_WIN32_API
+/* Can't link against the library, so this test will use the older, non-Unicode
+ * _open() call on Windows.
+ */
+#define HDopen(S, F, ...) _open(S, F | _O_BINARY, __VA_ARGS__)
+#endif /* H5_HAVE_WIN32_API */
+#define POSIXCREATE(fn) HDopen(fn, O_CREAT | O_TRUNC | O_RDWR, 0600)
+#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
+#define POSIXCLOSE(F) HDclose(F)
+#define POSIXSEEK(F, L) HDlseek(F, L, SEEK_SET)
+#define POSIXWRITE(F, B, S) HDwrite(F, B, S)
+#define POSIXREAD(F, B, S) HDread(F, B, S)
+
+enum { PIO_CREATE = 1, PIO_WRITE = 2, PIO_READ = 4 };
+
+/* Global variables */
+static int clean_file_g = -1; /*whether to cleanup temporary test */
+/*files. -1 is not defined; */
+/*0 is no cleanup; 1 is do cleanup */
+
+/*
+ * In a parallel machine, the filesystem suitable for compiling is
+ * unlikely a parallel file system that is suitable for parallel I/O.
+ * There is no standard pathname for the parallel file system. /tmp
+ * is about the best guess.
+ */
+#ifndef HDF5_PARAPREFIX
+#define HDF5_PARAPREFIX ""
+#endif /* !HDF5_PARAPREFIX */
+
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif /* !MIN */
+
+/* the different types of file descriptors we can expect */
+typedef union _file_descr {
+ int posixfd; /* POSIX file handle*/
+ MPI_File mpifd; /* MPI file */
+ hid_t h5fd; /* HDF5 file */
+} file_descr;
+
+/* local functions */
+static char * pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size);
+static herr_t do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts,
+ size_t buf_size, void *buffer);
+static herr_t do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts,
+ size_t buf_size, void *buffer /*out*/);
+static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags);
+static herr_t do_fclose(iotype iot, file_descr *fd);
+static void do_cleanupfile(iotype iot, char *fname);
+static off_t sqrto(off_t);
+
+/*
+ * Function: do_pio
+ * Purpose: PIO Engine where Parallel IO are executed.
+ * Return: results
+ * Programmer: Albert Cheng, Bill Wendling 2001/12/12
+ * Modifications:
+ * Added 2D testing (Christian Chilan, 10. August 2005)
+ */
+results
+do_pio(parameters param)
+{
+ /* return codes */
+ herr_t ret_code = 0; /*return code */
+ results res;
+
+ file_descr fd;
+ iotype iot;
+
+ char fname[FILENAME_MAX];
+ long nf;
+ long ndsets;
+ off_t nbytes; /*number of bytes per dataset */
+ off_t snbytes; /*general dataset size */
+ /*for 1D, it is the actual dataset size */
+ /*for 2D, it is the size of a side of the dataset square */
+ char * buffer = NULL; /*data buffer pointer */
+ size_t buf_size; /*general buffer size in bytes */
+ /*for 1D, it is the actual buffer size */
+ /*for 2D, it is the length of the buffer rectangle */
+ size_t blk_size; /*data block size in bytes */
+ size_t bsize; /*actual buffer size */
+
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+
+ /* Sanity check parameters */
+
+ /* IO type */
+ iot = param.io_type;
+
+ switch (iot) {
+ case MPIO:
+ fd.mpifd = MPI_FILE_NULL;
+ res.timers = io_time_new(MPI_CLOCK);
+ break;
+ case POSIXIO:
+ fd.posixfd = -1;
+ res.timers = io_time_new(MPI_CLOCK);
+ break;
+ case PHDF5:
+ fd.h5fd = -1;
+ res.timers = io_time_new(MPI_CLOCK);
+ break;
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", iot);
+ GOTOERROR(FAIL);
+ }
+
+ ndsets = param.num_dsets; /* number of datasets per file */
+ nbytes = param.num_bytes; /* number of bytes per dataset */
+ buf_size = param.buf_size;
+ blk_size = param.blk_size;
+
+ if (!param.dim2d) {
+ snbytes = nbytes; /* General dataset size */
+ bsize = buf_size; /* Actual buffer size */
+ }
+ else {
+ snbytes = sqrto(nbytes); /* General dataset size */
+ bsize = buf_size * blk_size; /* Actual buffer size */
+ }
+
+ if (param.num_files < 0) {
+ HDfprintf(stderr, "number of files must be >= 0 (%ld)\n", param.num_files);
+ GOTOERROR(FAIL);
+ }
+
+ if (ndsets < 0) {
+ HDfprintf(stderr, "number of datasets per file must be >= 0 (%ld)\n", ndsets);
+ GOTOERROR(FAIL);
+ }
+
+ if (param.num_procs <= 0) {
+ HDfprintf(stderr, "maximum number of process to use must be > 0 (%d)\n", param.num_procs);
+ GOTOERROR(FAIL);
+ }
+
+ /* Validate transfer buffer size & block size*/
+ if (blk_size <= 0) {
+ HDfprintf(stderr, "Transfer block size (%zu) must be > 0\n", blk_size);
+ GOTOERROR(FAIL);
+ }
+ if (buf_size <= 0) {
+ HDfprintf(stderr, "Transfer buffer size (%zu) must be > 0\n", buf_size);
+ GOTOERROR(FAIL);
+ }
+ if ((buf_size % blk_size) != 0) {
+ HDfprintf(stderr,
+ "Transfer buffer size (%zu) must be a multiple of the "
+ "interleaved I/O block size (%zu)\n",
+ buf_size, blk_size);
+ GOTOERROR(FAIL);
+ }
+ if ((snbytes % pio_mpi_nprocs_g) != 0) {
+ HDfprintf(stderr,
+ "Dataset size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "number of processes (%d)\n",
+ (long long)snbytes, pio_mpi_nprocs_g);
+ GOTOERROR(FAIL);
+ }
+
+ if (!param.dim2d) {
+ if (((size_t)(snbytes / pio_mpi_nprocs_g) % buf_size) != 0) {
+ HDfprintf(stderr,
+ "Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "trasfer buffer size (%zu)\n",
+ (long long)(snbytes / pio_mpi_nprocs_g), buf_size);
+ GOTOERROR(FAIL);
+ }
+ }
+ else {
+ if (((size_t)snbytes % buf_size) != 0) {
+ HDfprintf(stderr,
+ "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "trasfer buffer size (%zu)\n",
+ (long long)snbytes, buf_size);
+ GOTOERROR(FAIL);
+ }
+ }
+
+ /* Allocate transfer buffer */
+ if ((buffer = malloc(bsize)) == NULL) {
+ HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", bsize);
+ GOTOERROR(FAIL);
+ }
+
+ if (pio_debug_level >= 4) {
+ int myrank;
+
+ MPI_Comm_rank(pio_comm_g, &myrank);
+
+ /* output all of the times for all iterations */
+ if (myrank == 0)
+ HDfprintf(output, "Timer details:\n");
+ }
+
+ for (nf = 1; nf <= param.num_files; nf++) {
+ /*
+ * Write performance measurement
+ */
+ /* Open file for write */
+ char base_name[256];
+
+ HDsprintf(base_name, "#pio_tmp_%lu", nf);
+ pio_create_filename(iot, base_name, fname, sizeof(fname));
+ if (pio_debug_level > 0)
+ HDfprintf(output, "rank %d: data filename=%s\n", pio_mpi_rank_g, fname);
+
+ /* Need barrier to make sure everyone starts at the same time */
+ MPI_Barrier(pio_comm_g);
+
+ io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_fopen(&param, fname, &fd, PIO_CREATE | PIO_WRITE);
+
+ VRFY((hrc == SUCCESS), "do_fopen failed");
+
+ io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_write(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
+ io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
+
+ VRFY((hrc == SUCCESS), "do_write failed");
+
+ /* Close file for write */
+ hrc = do_fclose(iot, &fd);
+
+ io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_fclose failed");
+
+ if (!param.h5_write_only) {
+ /*
+ * Read performance measurement
+ */
+ /* Need barrier to make sure everyone is done writing and has
+ * closed the file. Also to make sure everyone starts reading
+ * at the same time.
+ */
+ MPI_Barrier(pio_comm_g);
+
+ /* Open file for read */
+ io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
+ hrc = do_fopen(&param, fname, &fd, PIO_READ);
+
+ VRFY((hrc == SUCCESS), "do_fopen failed");
+
+ io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
+ hrc = do_read(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
+ io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_read failed");
+
+ /* Close file for read */
+ hrc = do_fclose(iot, &fd);
+
+ io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_fclose failed");
+ }
+
+ /* Need barrier to make sure everyone is done with the file */
+ /* before it may be removed by do_cleanupfile */
+ MPI_Barrier(pio_comm_g);
+ do_cleanupfile(iot, fname);
+ }
+
+done:
+ /* clean up */
+ /* release HDF5 objects */
+
+ /* close any opened files */
+ /* no remove(fname) because that should have happened normally. */
+ switch (iot) {
+ case POSIXIO:
+ if (fd.posixfd != -1)
+ hrc = do_fclose(iot, &fd);
+ break;
+ case MPIO:
+ if (fd.mpifd != MPI_FILE_NULL)
+ hrc = do_fclose(iot, &fd);
+ break;
+ case PHDF5:
+ if (fd.h5fd != -1)
+ hrc = do_fclose(iot, &fd);
+ break;
+ default:
+ break;
+ }
+
+ /* release generic resources */
+ if (buffer)
+ HDfree(buffer);
+ res.ret_code = ret_code;
+ return res;
+}
+
+/*
+ * Function: pio_create_filename
+ * Purpose: Create a new filename to write to. Determine the correct
+ * suffix to append to the filename by the type of I/O we're
+ * doing. Also, place in the /tmp/{$USER,$LOGIN} directory if
+ * USER or LOGIN are specified in the environment.
+ * Return: Pointer to filename or NULL
+ * Programmer: Bill Wendling, 21. November 2001
+ * Modifications:
+ */
+static char *
+pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size)
+{
+ const char *prefix, *suffix = "";
+ char * ptr, last = '\0';
+ size_t i, j;
+
+ if (!base_name || !fullname || size < 1)
+ return NULL;
+
+ HDmemset(fullname, 0, size);
+
+ switch (iot) {
+ case POSIXIO:
+ suffix = ".posix";
+ break;
+ case MPIO:
+ suffix = ".mpio";
+ break;
+ case PHDF5:
+ suffix = ".h5";
+ break;
+ default:
+ break;
+ }
+
+ /* First use the environment variable and then try the constant */
+ prefix = HDgetenv("HDF5_PARAPREFIX");
+
+#ifdef HDF5_PARAPREFIX
+ if (!prefix)
+ prefix = HDF5_PARAPREFIX;
+#endif /* HDF5_PARAPREFIX */
+
+ /* Prepend the prefix value to the base name */
+ if (prefix && *prefix) {
+ /* If the prefix specifies the HDF5_PARAPREFIX directory, then
+ * default to using the "/tmp/$USER" or "/tmp/$LOGIN"
+ * directory instead. */
+ register char *user, *login, *subdir;
+
+ user = HDgetenv("USER");
+ login = HDgetenv("LOGIN");
+ subdir = (user ? user : login);
+
+ if (subdir) {
+ for (i = 0; i < size - 1 && prefix[i]; i++)
+ fullname[i] = prefix[i];
+
+ fullname[i++] = '/';
+
+ for (j = 0; i < size && subdir[j]; i++, j++)
+ fullname[i] = subdir[j];
+ }
+ else {
+ /* We didn't append the prefix yet */
+ HDstrncpy(fullname, prefix, size);
+ fullname[size - 1] = '\0';
+ }
+
+ if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) {
+ /* Append the base_name with a slash first. Multiple slashes are
+ * handled below. */
+ h5_stat_t buf;
+
+ if (HDstat(fullname, &buf) < 0)
+ /* The directory doesn't exist just yet */
+ if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST) {
+ /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory.
+ * Default to PREFIX's original prefix value. */
+ HDstrcpy(fullname, prefix);
+ }
+
+ HDstrcat(fullname, "/");
+ HDstrcat(fullname, base_name);
+ }
+ else {
+ /* Buffer is too small */
+ return NULL;
+ }
+ }
+ else if (HDstrlen(base_name) >= size) {
+ /* Buffer is too small */
+ return NULL;
+ }
+ else {
+ HDstrcpy(fullname, base_name);
+ }
+
+ /* Append a suffix */
+ if (suffix) {
+ if (HDstrlen(fullname) + HDstrlen(suffix) >= size)
+ return NULL;
+
+ HDstrcat(fullname, suffix);
+ }
+
+ /* Remove any double slashes in the filename */
+ for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) {
+ if (*ptr != '/' || last != '/')
+ fullname[j++] = *ptr;
+
+ last = *ptr;
+ }
+
+ return fullname;
+}
+
+/*
+ * Function: do_write
+ * Purpose: Write the required amount of data to the file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
+ * Modifications:
+ * Added 2D testing (Christian Chilan, 10. August 2005)
+ */
+static herr_t
+do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbytes, size_t buf_size,
+ void *buffer)
+{
+ int ret_code = SUCCESS;
+ int rc; /*routine return code */
+ long ndset;
+ size_t blk_size; /* The block size to subdivide the xfer buffer into */
+ off_t nbytes_xfer; /* Total number of bytes transferred so far */
+ size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */
+ size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */
+ char dname[64];
+ off_t dset_offset = 0; /*dataset offset in a file */
+ off_t bytes_begin[2]; /*first elmt this process transfer */
+ off_t bytes_count; /*number of elmts this process transfer */
+ off_t snbytes = 0; /*size of a side of the dataset square */
+ unsigned char *buf_p; /* Current buffer pointer */
+
+ /* POSIX variables */
+ off_t file_offset; /* File offset of the next transfer */
+ off_t file_offset_advance; /* File offset advance after each I/O operation */
+ off_t posix_file_offset; /* Base file offset of the next transfer */
+
+ /* MPI variables */
+ MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/
+ MPI_Offset mpi_offset; /* Offset in MPI file */
+ MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */
+ MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */
+ MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */
+ MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */
+ MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */
+ MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */
+ MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */
+ MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */
+ MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */
+ MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */
+ MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */
+ MPI_Status mpi_status;
+ int mrc; /* MPI return code */
+
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+ hsize_t h5dims[2]; /*dataset dim sizes */
+ hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+ hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+ hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
+ hsize_t h5block[2]; /*dataspace selection */
+ hsize_t h5stride[2];
+ hsize_t h5count[2];
+ hsize_t h5start[2];
+ hssize_t h5offset[2]; /* Selection offset within dataspace */
+ hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+ hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
+
+ /* Get the parameters from the parameter block */
+ blk_size = parms->blk_size;
+
+ /* There are two kinds of transfer patterns, contiguous and interleaved.
+ * Let 0,1,2,...,n be data accessed by process 0,1,2,...,n
+ * where n is rank of the last process.
+ * In contiguous pattern, data are accessed as
+ * 000...111...222...nnn...
+ * In interleaved pattern, data are accessed as
+ * 012...n012...n...
+ * These are all in the scope of one dataset.
+ */
+
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Contiguous Pattern: */
+ if (!parms->interleaved) {
+ bytes_begin[0] = (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g);
+ } /* end if */
+ /* Interleaved Pattern: */
+ else {
+ bytes_begin[0] = (off_t)(blk_size * (size_t)pio_mpi_rank_g);
+ } /* end else */
+
+ /* Prepare buffer for verifying data */
+ if (parms->verify)
+ memset(buffer, pio_mpi_rank_g + 1, buf_size);
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* nbytes is always the number of bytes per dataset (1D or 2D). If the
+ dataspace is 2D, snbytes is the size of a side of the dataset square.
+ */
+ snbytes = sqrto(nbytes);
+
+ /* Contiguous Pattern: */
+ if (!parms->interleaved) {
+ bytes_begin[0] = (off_t)((double)snbytes * pio_mpi_rank_g / pio_mpi_nprocs_g);
+ bytes_begin[1] = 0;
+ } /* end if */
+ /* Interleaved Pattern: */
+ else {
+ bytes_begin[0] = 0;
+
+ if (!parms->h5_use_chunks || parms->io_type == PHDF5)
+ bytes_begin[1] = (off_t)(blk_size * (size_t)pio_mpi_rank_g);
+ else
+ bytes_begin[1] = (off_t)(blk_size * blk_size * (size_t)pio_mpi_rank_g);
+ } /* end else */
+
+ /* Prepare buffer for verifying data */
+ if (parms->verify)
+ HDmemset(buffer, pio_mpi_rank_g + 1, buf_size * blk_size);
+ } /* end else */
+
+ /* Calculate the total number of bytes (bytes_count) to be
+ * transferred by this process. It may be different for different
+ * transfer pattern due to rounding to integral values.
+ */
+ /*
+ * Calculate the beginning bytes of this process and the next.
+ * bytes_count is the difference between these two beginnings.
+ * This way, it eliminates any rounding errors.
+ * (This is tricky, don't mess with the formula, rounding errors
+ * can easily get introduced) */
+ bytes_count = (off_t)(((double)nbytes * (pio_mpi_rank_g + 1)) / pio_mpi_nprocs_g) -
+ (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g);
+
+ /* debug */
+ if (pio_debug_level >= 4) {
+ HDprint_rank(output);
+ if (!parms->dim2d) {
+ HDfprintf(output,
+ "Debug(do_write): "
+ "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH
+ "d\n",
+ buf_size, (long long)bytes_begin[0], (long long)bytes_count);
+ }
+ else {
+ HDfprintf(output,
+ "Debug(do_write): "
+ "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH
+ "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
+ buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1],
+ (long long)bytes_count);
+ }
+ }
+
+ /* I/O Access specific setup */
+ switch (parms->io_type) {
+ case POSIXIO:
+ /* No extra setup */
+ break;
+
+ case MPIO: /* MPI-I/O setup */
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Build block's derived type */
+ mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Build file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)pio_mpi_nprocs_g, mpi_blk_type,
+ &mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit file type */
+ mrc = MPI_Type_commit(&mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Commit buffer type */
+ mrc = MPI_Type_commit(&mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Build partial buffer derived type for contiguous access */
+
+ mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE, &mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build contiguous file's derived type */
+ mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes / buf_size),
+ mpi_partial_buffer_cont, &mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit contiguous file type */
+ mrc = MPI_Type_commit(&mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build partial buffer derived type for interleaved access */
+ mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build interleaved file's derived type */
+ mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes / blk_size),
+ mpi_partial_buffer_inter, &mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit interleaved file type */
+ mrc = MPI_Type_commit(&mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build full buffer derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size * buf_size), MPI_BYTE, &mpi_full_buffer);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit full buffer derived type */
+ mrc = MPI_Type_commit(&mpi_full_buffer);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build full chunk derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size * blk_size), MPI_BYTE, &mpi_full_chunk);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit full chunk derived type */
+ mrc = MPI_Type_commit(&mpi_full_chunk);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build chunk interleaved file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)((size_t)snbytes / blk_size),
+ mpi_full_chunk, &mpi_chunk_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit chunk interleaved file type */
+ mrc = MPI_Type_commit(&mpi_chunk_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ } /* end else */
+ break;
+
+ case PHDF5: /* HDF5 setup */
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ if (nbytes > 0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = (hsize_t)nbytes;
+ h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5stride[0] = h5block[0] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5stride[0] = blk_size * (size_t)pio_mpi_nprocs_g;
+ h5block[0] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ } /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count,
+ h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+ } /* end if */
+ else {
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if (buf_size > 0) {
+ h5dims[0] = buf_size;
+ h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ if (nbytes > 0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = (hsize_t)snbytes;
+ h5dims[1] = (hsize_t)snbytes;
+ h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
+ h5stride[0] = 1;
+ h5stride[1] = h5block[0] = h5block[1] = blk_size;
+ h5count[0] = 1;
+ h5count[1] = buf_size / blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
+ h5stride[0] = blk_size;
+ h5stride[1] = blk_size * (size_t)pio_mpi_nprocs_g;
+ h5block[0] = h5block[1] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ h5count[1] = 1;
+ } /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count,
+ h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+ } /* end if */
+ else {
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if (buf_size > 0) {
+ if (!parms->interleaved) {
+ h5dims[0] = blk_size;
+ h5dims[1] = buf_size;
+ }
+ else {
+ h5dims[0] = buf_size;
+ h5dims[1] = blk_size;
+ }
+ h5mem_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
+ } /* end else */
+ } /* end else */
+
+ /* Create the dataset transfer property list */
+ h5dxpl = H5Pcreate(H5P_DATASET_XFER);
+ if (h5dxpl < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Change to collective I/O, if asked */
+ if (parms->collective) {
+ hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ break;
+
+ default:
+ break;
+ } /* end switch */
+
+ for (ndset = 1; ndset <= ndsets; ++ndset) {
+
+ /* Calculate dataset offset within a file */
+
+ /* create dataset */
+ switch (parms->io_type) {
+ case POSIXIO:
+ case MPIO:
+ /* both posix and mpi io just need dataset offset in file*/
+ dset_offset = (ndset - 1) * nbytes;
+ break;
+
+ case PHDF5:
+ h5dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ if (h5dcpl < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Make the dataset chunked if asked */
+ if (parms->h5_use_chunks) {
+ /* Set the chunk size to be the same as the buffer size */
+ h5dims[0] = blk_size;
+ hrc = H5Pset_chunk(h5dcpl, 1, h5dims);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ } /* end if */
+ else {
+ /* 2D dataspace */
+ if (parms->h5_use_chunks) {
+ /* Set the chunk size to be the same as the block size */
+ h5dims[0] = blk_size;
+ h5dims[1] = blk_size;
+ hrc = H5Pset_chunk(h5dcpl, 2, h5dims);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ } /* end else */
+
+ HDsprintf(dname, "Dataset_%ld", ndset);
+ h5ds_id = H5DCREATE(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, h5dcpl);
+
+ if (h5ds_id < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ hrc = H5Pclose(h5dcpl);
+ /* verifying the close of the dcpl */
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Close failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ /* The task is to transfer bytes_count bytes, starting at
+ * bytes_begin position, using transfer buffer of buf_size bytes.
+ * If interleaved, select buf_size at a time, in round robin
+ * fashion, according to number of process. Otherwise, select
+ * all bytes_count in contiguous.
+ */
+ nbytes_xfer = 0;
+
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset = dset_offset + bytes_begin[0];
+
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]);
+ } /* end if */
+ else {
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset = dset_offset + bytes_begin[0] * snbytes + bytes_begin[1];
+
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]);
+ } /* end else */
+
+ /* Start "raw data" write timer */
+ io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
+
+ while (nbytes_xfer < bytes_count) {
+ /* Write */
+ /* Calculate offset of write within a dataset/file */
+ switch (parms->io_type) {
+ case POSIXIO:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Contiguous pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset + (off_t)nbytes_xfer;
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+
+ /* check if all bytes are written */
+ rc = ((ssize_t)buf_size == POSIXWRITE(fd->posixfd, buffer, buf_size));
+ VRFY((rc != 0), "POSIXWRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to write */
+ while (nbytes_toxfer > 0) {
+ /* Skip offset over blocks of other processes */
+ file_offset = posix_file_offset + (off_t)(nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+
+ /* check if all bytes are written */
+ rc = ((ssize_t)blk_size == POSIXWRITE(fd->posixfd, buf_p, blk_size));
+ VRFY((rc != 0), "POSIXWRITE");
+
+ /* Advance location in buffer */
+ buf_p += blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset +
+ (off_t)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) *
+ (blk_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / blk_size) % (size_t)snbytes));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ file_offset =
+ posix_file_offset +
+ (off_t)(((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) /
+ (size_t)snbytes) *
+ (buf_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) %
+ (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset + (off_t)nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = 0;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ /* Before simplification */
+ /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size
+ *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
+ *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
+
+ file_offset = posix_file_offset +
+ (off_t)((((size_t)nbytes_xfer / (buf_size / blk_size) *
+ (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * blk_size)) *
+ (buf_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / (buf_size / blk_size)) *
+ (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * blk_size));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
+ file_offset_advance = (off_t)snbytes * (off_t)blk_size;
+ } /* end else */
+ } /* end else */
+
+ /* Common code for file access */
+
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size * blk_size;
+
+ /* Loop over portions of the buffer to write */
+ while (nbytes_toxfer > 0) {
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+
+ /* check if all bytes are written */
+ rc = ((ssize_t)nbytes_xfer_advance ==
+ POSIXWRITE(fd->posixfd, buf_p, nbytes_xfer_advance));
+ VRFY((rc != 0), "POSIXWRITE");
+
+ /* Advance location in buffer */
+ buf_p += nbytes_xfer_advance;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)nbytes_xfer_advance;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= nbytes_xfer_advance;
+
+ /* Partially advance file offset */
+ file_offset += file_offset_advance;
+ } /* end while */
+
+ } /* end else */
+
+ break;
+
+ case MPIO:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Independent file access */
+ if (!parms->collective) {
+ /* Contiguous pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Perform independent write */
+ mrc =
+ MPI_File_write_at(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size / blk_size), mpi_blk_type, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to write */
+ while (nbytes_toxfer > 0) {
+ /* Skip offset over blocks of other processes */
+ mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* Perform independent write */
+ mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p, (int)1,
+ mpi_blk_type, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance location in buffer */
+ buf_p += blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* Collective file access */
+ else {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Perform independent write */
+ mrc = MPI_File_write_at_all(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size / blk_size), mpi_blk_type,
+ &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type,
+ (char *)"native", h5_io_info_g);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform write */
+ mrc = MPI_File_write_at_all(fd->mpifd, 0, buffer, (int)(buf_size / blk_size),
+ mpi_blk_type, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)buf_size;
+ } /* end else */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset =
+ mpi_file_offset +
+ (MPI_Offset)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) *
+ (blk_size * (size_t)snbytes)) +
+ (MPI_Offset)(((size_t)nbytes_xfer / blk_size) % (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_cont_type;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset =
+ mpi_file_offset +
+ (MPI_Offset)(
+ ((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) /
+ (size_t)snbytes) *
+ (buf_size * (size_t)snbytes)) +
+ (MPI_Offset)(
+ (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) %
+ (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_inter_type;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = 0;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_full_buffer;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ /* Before simplification */
+ /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*
+ (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
+ ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
+ /blk_size*(blk_size*blk_size)); */
+ mpi_offset = mpi_file_offset +
+ (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size) *
+ (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * blk_size)) *
+ (buf_size * (size_t)snbytes)) +
+ (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size)) *
+ (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * blk_size));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
+ mpi_offset_advance = (MPI_Offset)((size_t)snbytes * blk_size);
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_chunk_inter_type;
+ } /* end else */
+ } /* end else */
+
+ /* Common code for independent file access */
+ if (!parms->collective) {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size * blk_size;
+
+ /* Loop over portions of the buffer to write */
+ while (nbytes_toxfer > 0) {
+ /* Perform independent write */
+ mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p,
+ (int)nbytes_xfer_advance, MPI_BYTE, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance location in buffer */
+ buf_p += nbytes_xfer_advance;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)nbytes_xfer_advance;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= nbytes_xfer_advance;
+
+ /* Partially advance global offset in dataset */
+ mpi_offset += mpi_offset_advance;
+ } /* end while */
+ } /* end if */
+
+ /* Common code for collective file access */
+ else {
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type,
+ (char *)"native", h5_io_info_g);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform write */
+ MPI_File_write_at_all(fd->mpifd, 0, buffer, (int)(buf_size * blk_size), MPI_BYTE,
+ &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size * (off_t)blk_size;
+ } /* end else */
+
+ } /* end else */
+
+ break;
+
+ case PHDF5:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5offset[0] = nbytes_xfer;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = (nbytes_xfer * pio_mpi_nprocs_g);
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Write the buffer out */
+ hrc =
+ H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
+
+ /* Increment number of bytes transferred */
+ nbytes_xfer += (ssize_t)buf_size;
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5offset[0] =
+ (hssize_t)(((size_t)nbytes_xfer / ((size_t)snbytes * blk_size)) * blk_size);
+ h5offset[1] =
+ (hssize_t)(((size_t)nbytes_xfer % ((size_t)snbytes * blk_size)) / blk_size);
+
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * buf_size)) *
+ buf_size);
+ h5offset[1] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * buf_size)) /
+ buf_size);
+
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Write the buffer out */
+ hrc =
+ H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
+
+ /* Increment number of bytes transferred */
+ nbytes_xfer += (off_t)buf_size * (off_t)blk_size;
+
+ } /* end else */
+
+ break;
+
+ default:
+ break;
+ } /* switch (parms->io_type) */
+ } /* end while */
+
+ /* Stop "raw data" write timer */
+ io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
+
+ /* Calculate write time */
+
+ /* Close dataset. Only HDF5 needs to do an explicit close. */
+ if (parms->io_type == PHDF5) {
+ hrc = H5Dclose(h5ds_id);
+
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ h5ds_id = H5I_INVALID_HID;
+ } /* end if */
+ } /* end for */
+
+done:
+ /* release MPI-I/O objects */
+ if (parms->io_type == MPIO) {
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Free file type */
+ mrc = MPI_Type_free(&mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free buffer type */
+ mrc = MPI_Type_free(&mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Free partial buffer type for contiguous access */
+ mrc = MPI_Type_free(&mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free contiguous file type */
+ mrc = MPI_Type_free(&mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free partial buffer type for interleaved access */
+ mrc = MPI_Type_free(&mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free interleaved file type */
+ mrc = MPI_Type_free(&mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free full buffer type */
+ mrc = MPI_Type_free(&mpi_full_buffer);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free full chunk type */
+ mrc = MPI_Type_free(&mpi_full_chunk);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free chunk interleaved file type */
+ mrc = MPI_Type_free(&mpi_chunk_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+ } /* end else */
+ } /* end if */
+
+ /* release HDF5 objects */
+ if (h5dset_space_id != -1) {
+ hrc = H5Sclose(h5dset_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dset_space_id = H5I_INVALID_HID;
+ }
+ }
+
+ if (h5mem_space_id != -1) {
+ hrc = H5Sclose(h5mem_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5mem_space_id = H5I_INVALID_HID;
+ }
+ }
+
+ if (h5dxpl != -1) {
+ hrc = H5Pclose(h5dxpl);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dxpl = H5I_INVALID_HID;
+ }
+ }
+
+ return ret_code;
+}
+
+static off_t
+sqrto(off_t x)
+{
+ double root_x = sqrt((double)x);
+ return (off_t)root_x;
+}
+
+/*
+ * Function: do_read
+ * Purpose: read the required amount of data from the file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng 2001/12/13
+ * Modifications:
+ * Added 2D testing (Christian Chilan, 10. August 2005)
+ */
+static herr_t
+do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbytes, size_t buf_size,
+ void *buffer /*out*/)
+{
+ int ret_code = SUCCESS;
+ int rc; /*routine return code */
+ long ndset;
+ size_t blk_size; /* The block size to subdivide the xfer buffer into */
+ size_t bsize; /* Size of the actual buffer */
+ off_t nbytes_xfer; /* Total number of bytes transferred so far */
+ size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */
+ size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */
+ char dname[64];
+ off_t dset_offset = 0; /*dataset offset in a file */
+ off_t bytes_begin[2]; /*first elmt this process transfer */
+ off_t bytes_count; /*number of elmts this process transfer */
+ off_t snbytes = 0; /*size of a side of the dataset square */
+ unsigned char *buf_p; /* Current buffer pointer */
+
+ /* POSIX variables */
+ off_t file_offset; /* File offset of the next transfer */
+ off_t file_offset_advance; /* File offset advance after each I/O operation */
+ off_t posix_file_offset; /* Base file offset of the next transfer */
+
+ /* MPI variables */
+ MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/
+ MPI_Offset mpi_offset; /* Offset in MPI file */
+ MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */
+ MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */
+ MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */
+ MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */
+ MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */
+ MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */
+ MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */
+ MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */
+ MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */
+ MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */
+ MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */
+ MPI_Status mpi_status;
+ int mrc; /* MPI return code */
+
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+ hsize_t h5dims[2]; /*dataset dim sizes */
+ hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+ hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+ hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
+ hsize_t h5block[2]; /*dataspace selection */
+ hsize_t h5stride[2];
+ hsize_t h5count[2];
+ hsize_t h5start[2];
+ hssize_t h5offset[2]; /* Selection offset within dataspace */
+ hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
+
+ /* Get the parameters from the parameter block */
+ blk_size = parms->blk_size;
+
+ /* There are two kinds of transfer patterns, contiguous and interleaved.
+ * Let 0,1,2,...,n be data accessed by process 0,1,2,...,n
+ * where n is rank of the last process.
+ * In contiguous pattern, data are accessed as
+ * 000...111...222...nnn...
+ * In interleaved pattern, data are accessed as
+ * 012...n012...n...
+ * These are all in the scope of one dataset.
+ */
+
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ bsize = buf_size;
+ /* Contiguous Pattern: */
+ if (!parms->interleaved) {
+ bytes_begin[0] = (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g);
+ } /* end if */
+ /* Interleaved Pattern: */
+ else {
+ bytes_begin[0] = (off_t)blk_size * (off_t)pio_mpi_rank_g;
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* nbytes is always the number of bytes per dataset (1D or 2D). If the
+ dataspace is 2D, snbytes is the size of a side of the 'dataset square'.
+ */
+ snbytes = sqrto(nbytes);
+
+ bsize = buf_size * blk_size;
+
+ /* Contiguous Pattern: */
+ if (!parms->interleaved) {
+ bytes_begin[0] = (off_t)((double)snbytes * pio_mpi_rank_g / pio_mpi_nprocs_g);
+ bytes_begin[1] = 0;
+ } /* end if */
+ /* Interleaved Pattern: */
+ else {
+ bytes_begin[0] = 0;
+
+ if (!parms->h5_use_chunks || parms->io_type == PHDF5)
+ bytes_begin[1] = (off_t)blk_size * (off_t)pio_mpi_rank_g;
+ else
+ bytes_begin[1] = (off_t)blk_size * (off_t)blk_size * (off_t)pio_mpi_rank_g;
+ } /* end else */
+ } /* end else */
+
+ /* Calculate the total number of bytes (bytes_count) to be
+ * transferred by this process. It may be different for different
+ * transfer pattern due to rounding to integral values.
+ */
+ /*
+ * Calculate the beginning bytes of this process and the next.
+ * bytes_count is the difference between these two beginnings.
+ * This way, it eliminates any rounding errors.
+ * (This is tricky, don't mess with the formula, rounding errors
+ * can easily get introduced) */
+ bytes_count = (off_t)(((double)nbytes * (pio_mpi_rank_g + 1)) / pio_mpi_nprocs_g) -
+ (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g);
+
+ /* debug */
+ if (pio_debug_level >= 4) {
+ HDprint_rank(output);
+ if (!parms->dim2d) {
+ HDfprintf(output,
+ "Debug(do_write): "
+ "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH
+ "d\n",
+ buf_size, (long long)bytes_begin[0], (long long)bytes_count);
+ }
+ else {
+ HDfprintf(output,
+ "Debug(do_write): "
+ "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH
+ "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
+ buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1],
+ (long long)bytes_count);
+ }
+ }
+
+ /* I/O Access specific setup */
+ switch (parms->io_type) {
+ case POSIXIO:
+ /* No extra setup */
+ break;
+
+ case MPIO: /* MPI-I/O setup */
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Build block's derived type */
+ mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Build file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)pio_mpi_nprocs_g, mpi_blk_type,
+ &mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit file type */
+ mrc = MPI_Type_commit(&mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Commit buffer type */
+ mrc = MPI_Type_commit(&mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Build partial buffer derived type for contiguous access */
+ mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE, &mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build contiguous file's derived type */
+ mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes / buf_size),
+ mpi_partial_buffer_cont, &mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit contiguous file type */
+ mrc = MPI_Type_commit(&mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build partial buffer derived type for interleaved access */
+ mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build interleaved file's derived type */
+ mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes / blk_size),
+ mpi_partial_buffer_inter, &mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit interleaved file type */
+ mrc = MPI_Type_commit(&mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build full buffer derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size * buf_size), MPI_BYTE, &mpi_full_buffer);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit full buffer derived type */
+ mrc = MPI_Type_commit(&mpi_full_buffer);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build full chunk derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size * blk_size), MPI_BYTE, &mpi_full_chunk);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit full chunk derived type */
+ mrc = MPI_Type_commit(&mpi_full_chunk);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build chunk interleaved file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)((size_t)snbytes / blk_size),
+ mpi_full_chunk, &mpi_chunk_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit chunk interleaved file type */
+ mrc = MPI_Type_commit(&mpi_chunk_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+ } /* end else */
+ break;
+
+ case PHDF5: /* HDF5 setup */
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ if (nbytes > 0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = (hsize_t)nbytes;
+ h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5stride[0] = h5block[0] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5stride[0] = blk_size * (size_t)pio_mpi_nprocs_g;
+ h5block[0] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ } /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count,
+ h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+ } /* end if */
+ else {
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if (buf_size > 0) {
+ h5dims[0] = buf_size;
+ h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ if (nbytes > 0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = (hsize_t)snbytes;
+ h5dims[1] = (hsize_t)snbytes;
+ h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
+ h5stride[0] = 1;
+ h5stride[1] = h5block[0] = h5block[1] = blk_size;
+ h5count[0] = 1;
+ h5count[1] = buf_size / blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
+ h5stride[0] = blk_size;
+ h5stride[1] = blk_size * (size_t)pio_mpi_nprocs_g;
+ h5block[0] = h5block[1] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ h5count[1] = 1;
+ } /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count,
+ h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+ } /* end if */
+ else {
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if (buf_size > 0) {
+ if (!parms->interleaved) {
+ h5dims[0] = blk_size;
+ h5dims[1] = buf_size;
+ }
+ else {
+ h5dims[0] = buf_size;
+ h5dims[1] = blk_size;
+ }
+ h5mem_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
+ } /* end else */
+ } /* end else */
+
+ /* Create the dataset transfer property list */
+ h5dxpl = H5Pcreate(H5P_DATASET_XFER);
+ if (h5dxpl < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Change to collective I/O, if asked */
+ if (parms->collective) {
+ hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ break;
+
+ default:
+ break;
+ } /* end switch */
+
+ for (ndset = 1; ndset <= ndsets; ++ndset) {
+
+ /* Calculate dataset offset within a file */
+
+ /* create dataset */
+ switch (parms->io_type) {
+ case POSIXIO:
+ case MPIO:
+ /* both posix and mpi io just need dataset offset in file*/
+ dset_offset = (ndset - 1) * nbytes;
+ break;
+
+ case PHDF5:
+ HDsprintf(dname, "Dataset_%ld", ndset);
+ h5ds_id = H5DOPEN(fd->h5fd, dname);
+ if (h5ds_id < 0) {
+ HDfprintf(stderr, "HDF5 Dataset open failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ /* The task is to transfer bytes_count bytes, starting at
+ * bytes_begin position, using transfer buffer of buf_size bytes.
+ * If interleaved, select buf_size at a time, in round robin
+ * fashion, according to number of process. Otherwise, select
+ * all bytes_count in contiguous.
+ */
+ nbytes_xfer = 0;
+
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset = dset_offset + bytes_begin[0];
+
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]);
+ } /* end if */
+ else {
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset = dset_offset + bytes_begin[0] * snbytes + bytes_begin[1];
+
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]);
+ } /* end else */
+
+ /* Start "raw data" read timer */
+ io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
+
+ while (nbytes_xfer < bytes_count) {
+ /* Read */
+ /* Calculate offset of read within a dataset/file */
+ switch (parms->io_type) {
+ case POSIXIO:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Contiguous pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset + (off_t)nbytes_xfer;
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+
+ /* check if all bytes are read */
+ rc = ((ssize_t)buf_size == POSIXREAD(fd->posixfd, buffer, buf_size));
+ VRFY((rc != 0), "POSIXREAD");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to read */
+ while (nbytes_toxfer > 0) {
+ /* Skip offset over blocks of other processes */
+ file_offset = posix_file_offset + (off_t)(nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+
+ /* check if all bytes are read */
+ rc = ((ssize_t)blk_size == POSIXREAD(fd->posixfd, buf_p, blk_size));
+ VRFY((rc != 0), "POSIXREAD");
+
+ /* Advance location in buffer */
+ buf_p += blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset +
+ (off_t)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) *
+ (blk_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / blk_size) % (size_t)snbytes));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ file_offset =
+ posix_file_offset +
+ (off_t)(((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) /
+ (size_t)snbytes) *
+ (buf_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) %
+ (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset + (off_t)nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = 0;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ /* Before simplification */
+ /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size
+ *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
+ *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
+
+ file_offset = posix_file_offset +
+ (off_t)((((size_t)nbytes_xfer / (buf_size / blk_size) *
+ (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * blk_size)) *
+ (buf_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / (buf_size / blk_size)) *
+ (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * blk_size));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
+ file_offset_advance = (off_t)((size_t)snbytes * blk_size);
+ } /* end else */
+ } /* end else */
+
+ /* Common code for file access */
+
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size * blk_size;
+
+ /* Loop over portions of the buffer to read */
+ while (nbytes_toxfer > 0) {
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+
+ /* check if all bytes are read */
+ rc = ((ssize_t)nbytes_xfer_advance ==
+ POSIXREAD(fd->posixfd, buf_p, nbytes_xfer_advance));
+ VRFY((rc != 0), "POSIXREAD");
+
+ /* Advance location in buffer */
+ buf_p += nbytes_xfer_advance;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)nbytes_xfer_advance;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= nbytes_xfer_advance;
+
+ /* Partially advance file offset */
+ file_offset += file_offset_advance;
+ } /* end while */
+
+ } /* end else */
+ break;
+
+ case MPIO:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Independent file access */
+ if (!parms->collective) {
+ /* Contiguous pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Perform independent read */
+ mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size / blk_size), mpi_blk_type, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to read */
+ while (nbytes_toxfer > 0) {
+ /* Skip offset over blocks of other processes */
+ mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* Perform independent read */
+ mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p, (int)1, mpi_blk_type,
+ &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance location in buffer */
+ buf_p += blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* Collective file access */
+ else {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Perform collective read */
+ mrc = MPI_File_read_at_all(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size / blk_size), mpi_blk_type,
+ &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type,
+ (char *)"native", h5_io_info_g);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform collective read */
+ mrc = MPI_File_read_at_all(fd->mpifd, 0, buffer, (int)(buf_size / blk_size),
+ mpi_blk_type, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size;
+ } /* end else */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset =
+ mpi_file_offset +
+ (MPI_Offset)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) *
+ (blk_size * (size_t)snbytes)) +
+ (MPI_Offset)(((size_t)nbytes_xfer / blk_size) % (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_cont_type;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset =
+ mpi_file_offset +
+ (MPI_Offset)(
+ ((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) /
+ (size_t)snbytes) *
+ (buf_size * (size_t)snbytes)) +
+ (MPI_Offset)(
+ (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) %
+ (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_inter_type;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = 0;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_full_buffer;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ /* Before simplification */
+ /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*
+ (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
+ ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
+ /blk_size*(blk_size*blk_size)); */
+ mpi_offset = mpi_file_offset +
+ (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size) *
+ (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * blk_size)) *
+ (buf_size * (size_t)snbytes)) +
+ (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size)) *
+ (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * blk_size));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
+ mpi_offset_advance = (MPI_Offset)((size_t)snbytes * blk_size);
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_chunk_inter_type;
+ } /* end else */
+ } /* end else */
+
+ /* Common code for independent file access */
+ if (!parms->collective) {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size * blk_size;
+
+ /* Loop over portions of the buffer to read */
+ while (nbytes_toxfer > 0) {
+ /* Perform independent read */
+ mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p, (int)nbytes_xfer_advance,
+ MPI_BYTE, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance location in buffer */
+ buf_p += nbytes_xfer_advance;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)nbytes_xfer_advance;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= nbytes_xfer_advance;
+
+ /* Partially advance global offset in dataset */
+ mpi_offset += mpi_offset_advance;
+ } /* end while */
+ } /* end if */
+
+ /* Common code for collective file access */
+ else {
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type,
+ (char *)"native", h5_io_info_g);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform read */
+ MPI_File_read_at_all(fd->mpifd, 0, buffer, (int)(buf_size * blk_size), MPI_BYTE,
+ &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size * (off_t)blk_size;
+ } /* end else */
+
+ } /* end else */
+ break;
+
+ case PHDF5:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5offset[0] = nbytes_xfer;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = (nbytes_xfer * pio_mpi_nprocs_g);
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Read the buffer in */
+ hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dread");
+
+ /* Increment number of bytes transferred */
+ nbytes_xfer += (off_t)buf_size;
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5offset[0] =
+ (hssize_t)(((size_t)nbytes_xfer / ((size_t)snbytes * blk_size)) * blk_size);
+ h5offset[1] =
+ (hssize_t)(((size_t)nbytes_xfer % ((size_t)snbytes * blk_size)) / blk_size);
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * buf_size)) *
+ buf_size);
+ h5offset[1] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * buf_size)) /
+ buf_size);
+
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Write the buffer out */
+ hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dread");
+
+ /* Increment number of bytes transferred */
+ nbytes_xfer += (off_t)buf_size * (off_t)blk_size;
+
+ } /* end else */
+ break;
+
+ default:
+ break;
+ } /* switch (parms->io_type) */
+
+ /* Verify raw data, if asked */
+ if (parms->verify) {
+ /* Verify data read */
+ unsigned char *ucharptr = (unsigned char *)buffer;
+ size_t i;
+ int nerror = 0;
+
+ for (i = 0; i < bsize; ++i) {
+ if (*ucharptr++ != pio_mpi_rank_g + 1) {
+ if (++nerror < 20) {
+ /* report at most 20 errors */
+ HDprint_rank(output);
+ HDfprintf(output,
+ "read data error, expected (%d), "
+ "got (%d)\n",
+ pio_mpi_rank_g + 1, (int)*(ucharptr - 1));
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ if (nerror >= 20) {
+ HDprint_rank(output);
+ HDfprintf(output, "...");
+ HDfprintf(output, "total read data errors=%d\n", nerror);
+ } /* end if */
+ } /* if (parms->verify) */
+
+ } /* end while */
+
+ /* Stop "raw data" read timer */
+ io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
+
+ /* Calculate read time */
+
+ /* Close dataset. Only HDF5 needs to do an explicit close. */
+ if (parms->io_type == PHDF5) {
+ hrc = H5Dclose(h5ds_id);
+
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ h5ds_id = H5I_INVALID_HID;
+ } /* end if */
+ } /* end for */
+
+done:
+ /* release MPI-I/O objects */
+ if (parms->io_type == MPIO) {
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Free file type */
+ mrc = MPI_Type_free(&mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free buffer type */
+ mrc = MPI_Type_free(&mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Free partial buffer type for contiguous access */
+ mrc = MPI_Type_free(&mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free contiguous file type */
+ mrc = MPI_Type_free(&mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free partial buffer type for interleaved access */
+ mrc = MPI_Type_free(&mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free interleaved file type */
+ mrc = MPI_Type_free(&mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free full buffer type */
+ mrc = MPI_Type_free(&mpi_full_buffer);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free full chunk type */
+ mrc = MPI_Type_free(&mpi_full_chunk);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free chunk interleaved file type */
+ mrc = MPI_Type_free(&mpi_chunk_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
+ } /* end else */
+ } /* end if */
+
+ /* release HDF5 objects */
+ if (h5dset_space_id != -1) {
+ hrc = H5Sclose(h5dset_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dset_space_id = H5I_INVALID_HID;
+ }
+ }
+
+ if (h5mem_space_id != -1) {
+ hrc = H5Sclose(h5mem_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5mem_space_id = H5I_INVALID_HID;
+ }
+ }
+
+ if (h5dxpl != -1) {
+ hrc = H5Pclose(h5dxpl);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dxpl = H5I_INVALID_HID;
+ }
+ }
+
+ return ret_code;
+}
+
+/*
+ * Function: do_fopen
+ * Purpose: Open the specified file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
+ * Modifications:
+ */
+static herr_t
+do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
+{
+ int ret_code = SUCCESS, mrc;
+ hid_t acc_tpl = H5I_INVALID_HID; /* file access templates */
+
+ switch (param->io_type) {
+ case POSIXIO:
+ if (flags & (PIO_CREATE | PIO_WRITE))
+ fd->posixfd = POSIXCREATE(fname);
+ else
+ fd->posixfd = POSIXOPEN(fname, O_RDONLY);
+
+ if (fd->posixfd < 0) {
+ HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+
+ /* The perils of POSIX I/O in a parallel environment. The problem is:
+ *
+ * - Process n opens a file with truncation and then starts
+ * writing to the file.
+ * - Process m also opens the file with truncation, but after
+ * process n has already started to write to the file. Thus,
+ * all of the stuff process n wrote is now lost.
+ */
+ MPI_Barrier(pio_comm_g);
+
+ break;
+
+ case MPIO:
+ if (flags & (PIO_CREATE | PIO_WRITE)) {
+ MPI_File_delete(fname, h5_io_info_g);
+ mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_CREATE | MPI_MODE_RDWR, h5_io_info_g,
+ &fd->mpifd);
+
+ if (mrc != MPI_SUCCESS) {
+ HDfprintf(stderr, "MPI File Open failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+
+ /*since MPI_File_open with MPI_MODE_CREATE does not truncate */
+ /*filesize , set size to 0 explicitedly. */
+ mrc = MPI_File_set_size(fd->mpifd, (MPI_Offset)0);
+ if (mrc != MPI_SUCCESS) {
+ HDfprintf(stderr, "MPI_File_set_size failed\n");
+ GOTOERROR(FAIL);
+ }
+ }
+ else {
+ mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_RDONLY, h5_io_info_g, &fd->mpifd);
+ if (mrc != MPI_SUCCESS) {
+ HDfprintf(stderr, "MPI File Open failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+ }
+
+ break;
+
+ case PHDF5:
+ if ((acc_tpl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Set the file driver to the MPI-IO driver */
+ if (H5Pset_fapl_mpio(acc_tpl, pio_comm_g, h5_io_info_g) < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Set the alignment of objects in HDF5 file */
+ if (H5Pset_alignment(acc_tpl, param->h5_thresh, param->h5_align) < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* create the parallel file */
+ if (flags & (PIO_CREATE | PIO_WRITE))
+ fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
+ else
+ fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, acc_tpl);
+ if (fd->h5fd < 0) {
+ HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+
+ /* verifying the close of the acc_tpl */
+ if (H5Pclose(acc_tpl) < 0) {
+ HDfprintf(stderr, "HDF5 Property List Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+done:
+ return ret_code;
+}
+
+/*
+ * Function: do_fclose
+ * Purpose: Close the specified file descriptor.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
+ * Modifications:
+ */
+static herr_t
+do_fclose(iotype iot, file_descr *fd /*out*/)
+{
+ herr_t ret_code = SUCCESS, hrc;
+ int mrc = 0, rc = 0;
+
+ switch (iot) {
+ case POSIXIO:
+ rc = POSIXCLOSE(fd->posixfd);
+
+ if (rc != 0) {
+ HDfprintf(stderr, "POSIX File Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->posixfd = -1;
+ break;
+
+ case MPIO:
+ mrc = MPI_File_close(&fd->mpifd);
+
+ if (mrc != MPI_SUCCESS) {
+ HDfprintf(stderr, "MPI File close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->mpifd = MPI_FILE_NULL;
+ break;
+
+ case PHDF5:
+ hrc = H5Fclose(fd->h5fd);
+
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 File Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->h5fd = -1;
+ break;
+
+ default:
+ break;
+ }
+
+done:
+ return ret_code;
+}
+
+/*
+ * Function: do_fclose
+ * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set.
+ * Only Proc 0 of the PIO communicator will do the cleanup.
+ * Other processes just return.
+ * Return: void
+ * Programmer: Albert Cheng 2001/12/12
+ * Modifications:
+ */
+static void
+do_cleanupfile(iotype iot, char *fname)
+{
+ if (pio_mpi_rank_g != 0)
+ return;
+
+ if (clean_file_g == -1)
+ clean_file_g = (getenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0;
+
+ if (clean_file_g) {
+ switch (iot) {
+ case POSIXIO:
+ HDremove(fname);
+ break;
+ case MPIO:
+ case PHDF5:
+ MPI_File_delete(fname, h5_io_info_g);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+#ifdef TIME_MPI
+/* instrument the MPI_File_wrirte_xxx and read_xxx calls to measure
+ * pure time spent in MPI_File code.
+ */
+int
+MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype,
+ MPI_Status *status)
+{
+ int err;
+ io_time_set(timer_g, HDF5_MPI_READ, TSTART);
+ err = PMPI_File_read_at(fh, offset, buf, count, datatype, status);
+ io_time_set(timer_g, HDF5_MPI_READ, TSTOP);
+ return err;
+}
+
+int
+MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype,
+ MPI_Status *status)
+{
+ int err;
+ io_time_set(timer_g, HDF5_MPI_READ, TSTART);
+ err = PMPI_File_read_at_all(fh, offset, buf, count, datatype, status);
+ io_time_set(timer_g, HDF5_MPI_READ, TSTOP);
+ return err;
+}
+
+int
+MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype,
+ MPI_Status *status)
+{
+ int err;
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTART);
+ err = PMPI_File_write_at(fh, offset, buf, count, datatype, status);
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP);
+ return err;
+}
+
+int
+MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype,
+ MPI_Status *status)
+{
+ int err;
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTART);
+ err = PMPI_File_write_at_all(fh, offset, buf, count, datatype, status);
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP);
+ return err;
+}
+
+#endif /* TIME_MPI */
+#endif /* H5_HAVE_PARALLEL */
diff --git a/tools/test/perform/pio_perf.c b/tools/src/h5perf/pio_perf.c
index cb15f64..41245d9 100644
--- a/tools/test/perform/pio_perf.c
+++ b/tools/src/h5perf/pio_perf.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -70,48 +70,54 @@
#include "pio_perf.h"
/* useful macros */
-#define TAB_SPACE 4
+#define TAB_SPACE 4
-#define ONE_KB 1024
-#define ONE_MB (ONE_KB * ONE_KB)
-#define ONE_GB (ONE_MB * ONE_KB)
+#define ONE_KB 1024
+#define ONE_MB (ONE_KB * ONE_KB)
+#define ONE_GB (ONE_MB * ONE_KB)
-#define PIO_POSIX 0x1
-#define PIO_MPI 0x2
-#define PIO_HDF5 0x4
+#define PIO_POSIX 0x1
+#define PIO_MPI 0x2
+#define PIO_HDF5 0x4
#ifdef STANDALONE
-#define DBL_EPSILON 2.2204460492503131e-16
-#define H5_DBL_ABS_EQUAL(X,Y) (fabs((X)-(Y)) < DBL_EPSILON)
+#define DBL_EPSILON 2.2204460492503131e-16
+#define H5_DBL_ABS_EQUAL(X, Y) (fabs((X) - (Y)) < DBL_EPSILON)
#endif
/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) (H5_DBL_ABS_EQUAL((t), 0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t)))
+#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL((t), 0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t)))
#ifndef TRUE
-#define TRUE 1
-#endif /* TRUE */
+#define TRUE 1
+#endif /* TRUE */
#ifndef FALSE
-#define FALSE (!TRUE)
-#endif /* FALSE */
+#define FALSE (!TRUE)
+#endif /* FALSE */
/* global variables */
-FILE *output; /* output file */
-int comm_world_rank_g; /* my rank in MPI_COMM_RANK */
-int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */
-MPI_Comm pio_comm_g; /* Communicator to run the PIO */
-int pio_mpi_rank_g; /* MPI rank of pio_comm_g */
-int pio_mpi_nprocs_g; /* Number of processes of pio_comm_g */
-int pio_debug_level = 0;/* The debug level:
- * 0 - Off
- * 1 - Minimal
- * 2 - Some more
- * 3 - Maximal
- * 4 - Maximal & then some
- */
+FILE * output; /* output file */
+int comm_world_rank_g; /* my rank in MPI_COMM_RANK */
+int comm_world_nprocs_g; /* num. of processes of MPI_COMM_WORLD */
+MPI_Comm pio_comm_g; /* Communicator to run the PIO */
+int pio_mpi_rank_g; /* MPI rank of pio_comm_g */
+int pio_mpi_nprocs_g; /* Number of processes of pio_comm_g */
+int pio_debug_level = 0; /* The debug level:
+ * 0 - Off
+ * 1 - Minimal
+ * 2 - Some more
+ * 3 - Maximal
+ * 4 - Maximal & then some
+ */
/* local variables */
-static const char *progname = "h5perf";
+static const char *progname = "h5perf";
+
+#ifndef HDF5_PARAPREFIX
+#define HDF5_PARAPREFIX ""
+#endif
+char * paraprefix = NULL; /* for command line option para-prefix */
+MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */
/*
* Command-line options: The user can specify short or long-named
@@ -122,200 +128,81 @@ static const char *progname = "h5perf";
static const char *s_opts = "a:A:B:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:";
#else
static const char *s_opts = "a:A:bB:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:";
-#endif /* 1 */
-static struct long_options l_opts[] = {
- { "align", require_arg, 'a' },
- { "alig", require_arg, 'a' },
- { "ali", require_arg, 'a' },
- { "al", require_arg, 'a' },
- { "api", require_arg, 'A' },
- { "ap", require_arg, 'A' },
+#endif /* 1 */
+static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'},
+ {"api", require_arg, 'A'},
#if 0
/* a sighting of the elusive binary option */
{ "binary", no_arg, 'b' },
- { "binar", no_arg, 'b' },
- { "bina", no_arg, 'b' },
- { "bin", no_arg, 'b' },
- { "bi", no_arg, 'b' },
-#endif /* 0 */
- { "block-size", require_arg, 'B' },
- { "block-siz", require_arg, 'B' },
- { "block-si", require_arg, 'B' },
- { "block-s", require_arg, 'B' },
- { "block-", require_arg, 'B' },
- { "block", require_arg, 'B' },
- { "bloc", require_arg, 'B' },
- { "blo", require_arg, 'B' },
- { "bl", require_arg, 'B' },
- { "chunk", no_arg, 'c' },
- { "chun", no_arg, 'c' },
- { "chu", no_arg, 'c' },
- { "ch", no_arg, 'c' },
- { "collective", no_arg, 'C' },
- { "collectiv", no_arg, 'C' },
- { "collecti", no_arg, 'C' },
- { "collect", no_arg, 'C' },
- { "collec", no_arg, 'C' },
- { "colle", no_arg, 'C' },
- { "coll", no_arg, 'C' },
- { "col", no_arg, 'C' },
- { "co", no_arg, 'C' },
- { "debug", require_arg, 'D' },
- { "debu", require_arg, 'D' },
- { "deb", require_arg, 'D' },
- { "de", require_arg, 'D' },
- { "geometry", no_arg, 'g' },
- { "geometr", no_arg, 'g' },
- { "geomet", no_arg, 'g' },
- { "geome", no_arg, 'g' },
- { "geom", no_arg, 'g' },
- { "geo", no_arg, 'g' },
- { "ge", no_arg, 'g' },
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h' },
- { "he", no_arg, 'h' },
- { "interleaved", require_arg, 'I' },
- { "interleave", require_arg, 'I' },
- { "interleav", require_arg, 'I' },
- { "interlea", require_arg, 'I' },
- { "interle", require_arg, 'I' },
- { "interl", require_arg, 'I' },
- { "inter", require_arg, 'I' },
- { "inte", require_arg, 'I' },
- { "int", require_arg, 'I' },
- { "in", require_arg, 'I' },
- { "max-num-processes", require_arg, 'P' },
- { "max-num-processe", require_arg, 'P' },
- { "max-num-process", require_arg, 'P' },
- { "max-num-proces", require_arg, 'P' },
- { "max-num-proce", require_arg, 'P' },
- { "max-num-proc", require_arg, 'P' },
- { "max-num-pro", require_arg, 'P' },
- { "max-num-pr", require_arg, 'P' },
- { "max-num-p", require_arg, 'P' },
- { "min-num-processes", require_arg, 'p' },
- { "min-num-processe", require_arg, 'p' },
- { "min-num-process", require_arg, 'p' },
- { "min-num-proces", require_arg, 'p' },
- { "min-num-proce", require_arg, 'p' },
- { "min-num-proc", require_arg, 'p' },
- { "min-num-pro", require_arg, 'p' },
- { "min-num-pr", require_arg, 'p' },
- { "min-num-p", require_arg, 'p' },
- { "max-xfer-size", require_arg, 'X' },
- { "max-xfer-siz", require_arg, 'X' },
- { "max-xfer-si", require_arg, 'X' },
- { "max-xfer-s", require_arg, 'X' },
- { "max-xfer", require_arg, 'X' },
- { "max-xfe", require_arg, 'X' },
- { "max-xf", require_arg, 'X' },
- { "max-x", require_arg, 'X' },
- { "min-xfer-size", require_arg, 'x' },
- { "min-xfer-siz", require_arg, 'x' },
- { "min-xfer-si", require_arg, 'x' },
- { "min-xfer-s", require_arg, 'x' },
- { "min-xfer", require_arg, 'x' },
- { "min-xfe", require_arg, 'x' },
- { "min-xf", require_arg, 'x' },
- { "min-x", require_arg, 'x' },
- { "num-bytes", require_arg, 'e' },
- { "num-byte", require_arg, 'e' },
- { "num-byt", require_arg, 'e' },
- { "num-by", require_arg, 'e' },
- { "num-b", require_arg, 'e' },
- { "num-dsets", require_arg, 'd' },
- { "num-dset", require_arg, 'd' },
- { "num-dse", require_arg, 'd' },
- { "num-ds", require_arg, 'd' },
- { "num-d", require_arg, 'd' },
- { "num-files", require_arg, 'F' },
- { "num-file", require_arg, 'F' },
- { "num-fil", require_arg, 'F' },
- { "num-fi", require_arg, 'F' },
- { "num-f", require_arg, 'F' },
- { "num-iterations", require_arg, 'i' },
- { "num-iteration", require_arg, 'i' },
- { "num-iteratio", require_arg, 'i' },
- { "num-iterati", require_arg, 'i' },
- { "num-iterat", require_arg, 'i' },
- { "num-itera", require_arg, 'i' },
- { "num-iter", require_arg, 'i' },
- { "num-ite", require_arg, 'i' },
- { "num-it", require_arg, 'i' },
- { "num-i", require_arg, 'i' },
- { "output", require_arg, 'o' },
- { "outpu", require_arg, 'o' },
- { "outp", require_arg, 'o' },
- { "out", require_arg, 'o' },
- { "ou", require_arg, 'o' },
- { "threshold", require_arg, 'T' },
- { "threshol", require_arg, 'T' },
- { "thresho", require_arg, 'T' },
- { "thresh", require_arg, 'T' },
- { "thres", require_arg, 'T' },
- { "thre", require_arg, 'T' },
- { "thr", require_arg, 'T' },
- { "th", require_arg, 'T' },
- { "write-only", require_arg, 'w' },
- { "write-onl", require_arg, 'w' },
- { "write-on", require_arg, 'w' },
- { "write-o", require_arg, 'w' },
- { "write", require_arg, 'w' },
- { "writ", require_arg, 'w' },
- { "wri", require_arg, 'w' },
- { "wr", require_arg, 'w' },
- { NULL, 0, '\0' }
-};
+#endif /* 0 */
+ {"block-size", require_arg, 'B'},
+ {"chunk", no_arg, 'c'},
+ {"collective", no_arg, 'C'},
+ {"debug", require_arg, 'D'},
+ {"geometry", no_arg, 'g'},
+ {"help", no_arg, 'h'},
+ {"interleaved", require_arg, 'I'},
+ {"max-num-processes", require_arg, 'P'},
+ {"min-num-processes", require_arg, 'p'},
+ {"max-xfer-size", require_arg, 'X'},
+ {"min-xfer-size", require_arg, 'x'},
+ {"num-bytes", require_arg, 'e'},
+ {"num-dsets", require_arg, 'd'},
+ {"num-files", require_arg, 'F'},
+ {"num-iterations", require_arg, 'i'},
+ {"output", require_arg, 'o'},
+ {"threshold", require_arg, 'T'},
+ {"write-only", require_arg, 'w'},
+ {NULL, 0, '\0'}};
struct options {
- long io_types; /* bitmask of which I/O types to test */
- const char *output_file; /* file to print report to */
- long num_dsets; /* number of datasets */
- long num_files; /* number of files */
- off_t num_bpp; /* number of bytes per proc per dset */
- int num_iters; /* number of iterations */
- int max_num_procs; /* maximum number of processes to use */
- int min_num_procs; /* minimum number of processes to use */
- size_t max_xfer_size; /* maximum transfer buffer size */
- size_t min_xfer_size; /* minimum transfer buffer size */
- size_t blk_size; /* Block size */
- unsigned interleaved; /* Interleaved vs. contiguous blocks */
- unsigned collective; /* Collective vs. independent I/O */
- unsigned dim2d; /* 1D vs. 2D geometry */
- int print_times; /* print times as well as throughputs */
- int print_raw; /* print raw data throughput info */
- off_t h5_alignment; /* alignment in HDF5 file */
- off_t h5_threshold; /* threshold for alignment in HDF5 file */
- int h5_use_chunks; /* Make HDF5 dataset chunked */
- int h5_write_only; /* Perform the write tests only */
- int verify; /* Verify data correctness */
+ long io_types; /* bitmask of which I/O types to test */
+ const char *output_file; /* file to print report to */
+ long num_dsets; /* number of datasets */
+ long num_files; /* number of files */
+ off_t num_bpp; /* number of bytes per proc per dset */
+ int num_iters; /* number of iterations */
+ int max_num_procs; /* maximum number of processes to use */
+ int min_num_procs; /* minimum number of processes to use */
+ size_t max_xfer_size; /* maximum transfer buffer size */
+ size_t min_xfer_size; /* minimum transfer buffer size */
+ size_t blk_size; /* Block size */
+ unsigned interleaved; /* Interleaved vs. contiguous blocks */
+ unsigned collective; /* Collective vs. independent I/O */
+ unsigned dim2d; /* 1D vs. 2D geometry */
+ int print_times; /* print times as well as throughputs */
+ int print_raw; /* print raw data throughput info */
+ off_t h5_alignment; /* alignment in HDF5 file */
+ off_t h5_threshold; /* threshold for alignment in HDF5 file */
+ int h5_use_chunks; /* Make HDF5 dataset chunked */
+ int h5_write_only; /* Perform the write tests only */
+ int verify; /* Verify data correctness */
};
typedef struct _minmax {
double min;
double max;
double sum;
- int num;
+ int num;
} minmax;
/* local functions */
-static off_t parse_size_directive(const char *size);
+static off_t parse_size_directive(const char *size);
static struct options *parse_command_line(int argc, char *argv[]);
-static void run_test_loop(struct options *options);
-static int run_test(iotype iot, parameters parms, struct options *opts);
-static void output_all_info(minmax *mm, int count, int indent_level);
-static void get_minmax(minmax *mm, double val);
-static minmax accumulate_minmax_stuff(minmax *mm, int count);
-static int create_comm_world(int num_procs, int *doing_pio);
-static int destroy_comm_world(void);
-static void output_results(const struct options *options, const char *name,
- minmax *table, int table_size, off_t data_size);
-static void output_times(const struct options *options, const char *name,
- minmax *table, int table_size);
-static void output_report(const char *fmt, ...);
-static void print_indent(register int indent);
-static void usage(const char *prog);
-static void report_parameters(struct options *opts);
+static void run_test_loop(struct options *options);
+static int run_test(iotype iot, parameters parms, struct options *opts);
+static void output_all_info(minmax *mm, int count, int indent_level);
+static void get_minmax(minmax *mm, double val);
+static minmax accumulate_minmax_stuff(minmax *mm, int count);
+static int create_comm_world(int num_procs, int *doing_pio);
+static int destroy_comm_world(void);
+static void output_results(const struct options *options, const char *name, minmax *table, int table_size,
+ off_t data_size);
+static void output_times(const struct options *options, const char *name, minmax *table, int table_size);
+static void output_report(const char *fmt, ...);
+static void print_indent(register int indent);
+static void usage(const char *prog);
+static void report_parameters(struct options *opts);
static off_t squareo(off_t);
/*
@@ -329,9 +216,9 @@ static off_t squareo(off_t);
int
main(int argc, char *argv[])
{
- int ret;
- int exit_value = EXIT_SUCCESS;
- struct options *opts = NULL;
+ int ret;
+ int exit_value = EXIT_SUCCESS;
+ struct options *opts = NULL;
#ifndef STANDALONE
/* Initialize h5tools lib */
@@ -430,26 +317,25 @@ static void
run_test_loop(struct options *opts)
{
parameters parms;
- int num_procs;
- int doing_pio; /* if this process is doing PIO */
-
- parms.num_files = opts->num_files;
- parms.num_dsets = opts->num_dsets;
- parms.num_iters = opts->num_iters;
- parms.blk_size = opts->blk_size;
- parms.interleaved = opts->interleaved;
- parms.collective = opts->collective;
- parms.dim2d = opts->dim2d;
- parms.h5_align = (hsize_t)opts->h5_alignment;
- parms.h5_thresh = (hsize_t)opts->h5_threshold;
+ int num_procs;
+ int doing_pio; /* if this process is doing PIO */
+
+ parms.num_files = opts->num_files;
+ parms.num_dsets = opts->num_dsets;
+ parms.num_iters = opts->num_iters;
+ parms.blk_size = opts->blk_size;
+ parms.interleaved = opts->interleaved;
+ parms.collective = opts->collective;
+ parms.dim2d = opts->dim2d;
+ parms.h5_align = (hsize_t)opts->h5_alignment;
+ parms.h5_thresh = (hsize_t)opts->h5_threshold;
parms.h5_use_chunks = opts->h5_use_chunks;
parms.h5_write_only = opts->h5_write_only;
- parms.verify = opts->verify;
+ parms.verify = opts->verify;
/* start with max_num_procs and decrement it by half for each loop. */
/* if performance needs restart, fewer processes may be needed. */
- for (num_procs = opts->max_num_procs;
- num_procs >= opts->min_num_procs; num_procs >>= 1) {
+ for (num_procs = opts->max_num_procs; num_procs >= opts->min_num_procs; num_procs >>= 1) {
register size_t buf_size;
parms.num_procs = num_procs;
@@ -458,42 +344,41 @@ run_test_loop(struct options *opts)
/* do something harsh */
}
- /* only processes doing PIO will run the tests */
- if (doing_pio){
+ /* only processes doing PIO will run the tests */
+ if (doing_pio) {
output_report("Number of processors = %ld\n", parms.num_procs);
/* multiply the xfer buffer size by 2 for each loop iteration */
- for (buf_size = opts->min_xfer_size;
- buf_size <= opts->max_xfer_size; buf_size <<= 1) {
+ for (buf_size = opts->min_xfer_size; buf_size <= opts->max_xfer_size; buf_size <<= 1) {
parms.buf_size = buf_size;
- if (parms.dim2d){
- parms.num_bytes = squareo(opts->num_bpp * parms.num_procs);
- if (parms.interleaved)
- output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n",
- buf_size, opts->blk_size,
- ((double)parms.num_dsets * (double)parms.num_bytes)
- / ONE_MB);
- else
- output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n",
- opts->blk_size, buf_size,
- ((double)parms.num_dsets * (double)parms.num_bytes)
- / ONE_MB);
-
- print_indent(1);
- output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2fx%.2f KB\n",
- parms.num_files, parms.num_dsets, (double)(opts->num_bpp*parms.num_procs)/ONE_KB,
- (double)(opts->num_bpp*parms.num_procs)/ONE_KB);
- }
- else{
- parms.num_bytes = (off_t)opts->num_bpp*parms.num_procs;
- output_report("Transfer Buffer Size: %ld bytes, File size: %.2f MB\n",
- buf_size,((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB);
-
- print_indent(1);
- output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2f MB\n",
- parms.num_files, parms.num_dsets, (double)(opts->num_bpp*parms.num_procs)/ONE_MB);
- }
+ if (parms.dim2d) {
+ parms.num_bytes = squareo(opts->num_bpp * parms.num_procs);
+ if (parms.interleaved)
+ output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n", buf_size,
+ opts->blk_size,
+ ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB);
+ else
+ output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n",
+ opts->blk_size, buf_size,
+ ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB);
+
+ print_indent(1);
+ output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2fx%.2f KB\n",
+ parms.num_files, parms.num_dsets,
+ (double)(opts->num_bpp * parms.num_procs) / ONE_KB,
+ (double)(opts->num_bpp * parms.num_procs) / ONE_KB);
+ }
+ else {
+ parms.num_bytes = (off_t)opts->num_bpp * parms.num_procs;
+ output_report("Transfer Buffer Size: %ld bytes, File size: %.2f MB\n", buf_size,
+ ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB);
+
+ print_indent(1);
+ output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2f MB\n",
+ parms.num_files, parms.num_dsets,
+ (double)(opts->num_bpp * parms.num_procs) / ONE_MB);
+ }
if (opts->io_types & PIO_POSIX)
run_test(POSIXIO, parms, opts);
@@ -505,14 +390,14 @@ run_test_loop(struct options *opts)
run_test(PHDF5, parms, opts);
/* Run the tests once if buf_size==0, but then break out */
- if(buf_size==0)
+ if (buf_size == 0)
break;
}
if (destroy_comm_world() != SUCCESS) {
/* do something harsh */
}
- }
+ }
}
}
@@ -526,36 +411,36 @@ run_test_loop(struct options *opts)
static int
run_test(iotype iot, parameters parms, struct options *opts)
{
- results res;
- register int i, ret_value = SUCCESS;
- int comm_size;
- off_t raw_size;
- minmax *write_mpi_mm_table=NULL;
- minmax *write_mm_table=NULL;
- minmax *write_gross_mm_table=NULL;
- minmax *write_raw_mm_table=NULL;
- minmax *read_mpi_mm_table=NULL;
- minmax *read_mm_table=NULL;
- minmax *read_gross_mm_table=NULL;
- minmax *read_raw_mm_table=NULL;
- minmax *read_open_mm_table=NULL;
- minmax *read_close_mm_table=NULL;
- minmax *write_open_mm_table=NULL;
- minmax *write_close_mm_table=NULL;
- minmax write_mpi_mm = {0.0, 0.0, 0.0, 0};
- minmax write_mm = {0.0, 0.0, 0.0, 0};
- minmax write_gross_mm = {0.0, 0.0, 0.0, 0};
- minmax write_raw_mm = {0.0, 0.0, 0.0, 0};
- minmax read_mpi_mm = {0.0, 0.0, 0.0, 0};
- minmax read_mm = {0.0, 0.0, 0.0, 0};
- minmax read_gross_mm = {0.0, 0.0, 0.0, 0};
- minmax read_raw_mm = {0.0, 0.0, 0.0, 0};
- minmax read_open_mm = {0.0, 0.0, 0.0, 0};
- minmax read_close_mm = {0.0, 0.0, 0.0, 0};
- minmax write_open_mm = {0.0, 0.0, 0.0, 0};
- minmax write_close_mm = {0.0, 0.0, 0.0, 0};
-
- raw_size = parms.num_files * (off_t)parms.num_dsets * (off_t)parms.num_bytes;
+ results res;
+ register int i, ret_value = SUCCESS;
+ int comm_size;
+ off_t raw_size;
+ minmax * write_mpi_mm_table = NULL;
+ minmax * write_mm_table = NULL;
+ minmax * write_gross_mm_table = NULL;
+ minmax * write_raw_mm_table = NULL;
+ minmax * read_mpi_mm_table = NULL;
+ minmax * read_mm_table = NULL;
+ minmax * read_gross_mm_table = NULL;
+ minmax * read_raw_mm_table = NULL;
+ minmax * read_open_mm_table = NULL;
+ minmax * read_close_mm_table = NULL;
+ minmax * write_open_mm_table = NULL;
+ minmax * write_close_mm_table = NULL;
+ minmax write_mpi_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_gross_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_raw_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_mpi_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_gross_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_raw_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_open_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_close_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_open_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_close_mm = {0.0, 0.0, 0.0, 0};
+
+ raw_size = parms.num_files * (off_t)parms.num_dsets * (off_t)parms.num_bytes;
parms.io_type = iot;
print_indent(2);
output_report("IO API = ");
@@ -578,19 +463,19 @@ run_test(iotype iot, parameters parms, struct options *opts)
/* allocate space for tables minmax and that it is sufficient */
/* to initialize all elements to zeros by calloc. */
- write_mpi_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
- write_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
- write_gross_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
- write_raw_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
- write_open_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
- write_close_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ write_mpi_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
+ write_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
+ write_gross_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
+ write_raw_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
+ write_open_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
+ write_close_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
if (!parms.h5_write_only) {
- read_mpi_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
- read_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
- read_gross_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
- read_raw_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
- read_open_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
- read_close_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ read_mpi_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
+ read_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
+ read_gross_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
+ read_raw_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
+ read_open_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
+ read_close_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax));
}
/* Do IO iteration times, collecting statistics each time */
@@ -672,10 +557,9 @@ run_test(iotype iot, parameters parms, struct options *opts)
get_minmax(&read_close_mm, t);
read_close_mm_table[i] = read_close_mm;
+ }
- }
-
- io_time_destroy(res.timers);
+ io_time_destroy(res.timers);
}
/*
@@ -692,7 +576,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_all_info(write_raw_mm_table, parms.num_iters, 4);
}
- output_results(opts,"Raw Data Write",write_raw_mm_table,parms.num_iters,raw_size);
+ output_results(opts, "Raw Data Write", write_raw_mm_table, parms.num_iters, raw_size);
} /* end if */
/* show mpi write statics */
@@ -713,7 +597,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_all_info(write_mm_table, parms.num_iters, 4);
}
- output_results(opts,"Write",write_mm_table,parms.num_iters,raw_size);
+ output_results(opts, "Write", write_mm_table, parms.num_iters, raw_size);
/* accumulate and output the max, min, and average "gross write" times */
if (pio_debug_level >= 3) {
@@ -723,27 +607,27 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_all_info(write_gross_mm_table, parms.num_iters, 4);
}
- output_results(opts,"Write Open-Close",write_gross_mm_table,parms.num_iters,raw_size);
+ output_results(opts, "Write Open-Close", write_gross_mm_table, parms.num_iters, raw_size);
if (opts->print_times) {
- output_times(opts,"Write File Open",write_open_mm_table,parms.num_iters);
- output_times(opts,"Write File Close",write_close_mm_table,parms.num_iters);
+ output_times(opts, "Write File Open", write_open_mm_table, parms.num_iters);
+ output_times(opts, "Write File Close", write_close_mm_table, parms.num_iters);
}
/* Print out time from open to first write */
if (pio_debug_level >= 3) {
- /* output all of the times for all iterations */
- print_indent(3);
- output_report("Write file open details:\n");
- output_all_info(write_open_mm_table, parms.num_iters, 4);
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Write file open details:\n");
+ output_all_info(write_open_mm_table, parms.num_iters, 4);
}
/* Print out time from last write to close */
if (pio_debug_level >= 3) {
- /* output all of the times for all iterations */
- print_indent(3);
- output_report("Write file close details:\n");
- output_all_info(write_close_mm_table, parms.num_iters, 4);
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Write file close details:\n");
+ output_all_info(write_close_mm_table, parms.num_iters, 4);
}
if (!parms.h5_write_only) {
@@ -758,8 +642,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_all_info(read_raw_mm_table, parms.num_iters, 4);
}
- output_results(opts, "Raw Data Read", read_raw_mm_table,
- parms.num_iters, raw_size);
+ output_results(opts, "Raw Data Read", read_raw_mm_table, parms.num_iters, raw_size);
} /* end if */
/* show mpi read statics */
@@ -790,11 +673,11 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_all_info(read_gross_mm_table, parms.num_iters, 4);
}
- output_results(opts, "Read Open-Close", read_gross_mm_table,parms.num_iters, raw_size);
+ output_results(opts, "Read Open-Close", read_gross_mm_table, parms.num_iters, raw_size);
if (opts->print_times) {
- output_times(opts,"Read File Open",read_open_mm_table,parms.num_iters);
- output_times(opts,"Read File Close",read_close_mm_table,parms.num_iters);
+ output_times(opts, "Read File Open", read_open_mm_table, parms.num_iters);
+ output_times(opts, "Read File Close", read_close_mm_table, parms.num_iters);
}
/* Print out time from open to first read */
@@ -812,7 +695,6 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_report("Read file close details:\n");
output_all_info(read_close_mm_table, parms.num_iters, 4);
}
-
}
/* clean up our mess */
@@ -858,6 +740,135 @@ output_all_info(minmax *mm, int count, int indent_level)
}
/*
+ * Function: h5_set_info_object
+ * Purpose: Process environment variables setting to set up MPI Info
+ * object.
+ * Return: 0 if all is fine; otherwise non-zero.
+ * Programmer: Albert Cheng, 2002/05/21.
+ * Modifications:
+ * Bill Wendling, 2002/05/31
+ * Modified so that the HDF5_MPI_INFO environment variable can
+ * be a semicolon separated list of "key=value" pairings. Most
+ * of the code is to remove any whitespaces which might be
+ * surrounding the "key=value" pairs.
+ */
+int
+h5_set_info_object(void)
+{
+ char *envp; /* environment pointer */
+ int ret_value = 0;
+
+ /* handle any MPI INFO hints via $HDF5_MPI_INFO */
+ if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL) {
+ char *next, *valp;
+
+ valp = envp = next = HDstrdup(envp);
+
+ if (!valp)
+ return 0;
+
+ /* create an INFO object if not created yet */
+ if (h5_io_info_g == MPI_INFO_NULL)
+ MPI_Info_create(&h5_io_info_g);
+
+ do {
+ size_t len;
+ char * key_val, *endp, *namep;
+
+ if (*valp == ';')
+ valp++;
+
+ /* copy key/value pair into temporary buffer */
+ len = strcspn(valp, ";");
+ next = &valp[len];
+ key_val = (char *)HDcalloc(1, len + 1);
+
+ /* increment the next pointer past the terminating semicolon */
+ if (*next == ';')
+ ++next;
+
+ namep = HDstrncpy(key_val, valp, len);
+
+ /* pass up any beginning whitespaces */
+ while (*namep && (*namep == ' ' || *namep == '\t'))
+ namep++;
+
+ if (!*namep)
+ continue; /* was all white space, so move to next k/v pair */
+
+ /* eat up any ending white spaces */
+ endp = &namep[HDstrlen(namep) - 1];
+
+ while (endp && (*endp == ' ' || *endp == '\t'))
+ *endp-- = '\0';
+
+ /* find the '=' */
+ valp = HDstrchr(namep, '=');
+
+ if (valp != NULL) { /* it's a valid key/value pairing */
+ char *tmp_val = valp + 1;
+
+ /* change '=' to \0, move valp down one */
+ *valp-- = '\0';
+
+ /* eat up ending whitespace on the "key" part */
+ while (*valp == ' ' || *valp == '\t')
+ *valp-- = '\0';
+
+ valp = tmp_val;
+
+ /* eat up beginning whitespace on the "value" part */
+ while (*valp == ' ' || *valp == '\t')
+ *valp++ = '\0';
+
+ /* actually set the darned thing */
+ if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) {
+ HDprintf("MPI_Info_set failed\n");
+ ret_value = -1;
+ }
+ }
+
+ valp = next;
+ HDfree(key_val);
+ } while (next && *next);
+
+ HDfree(envp);
+ }
+
+ return ret_value;
+}
+
+/*
+ * Function: h5_dump_info_object
+ * Purpose: Display content of an MPI Info object
+ * Return: void
+ * Programmer: Albert Cheng 2002/05/21
+ * Modifications:
+ */
+void
+h5_dump_info_object(MPI_Info info)
+{
+ char key[MPI_MAX_INFO_KEY + 1];
+ char value[MPI_MAX_INFO_VAL + 1];
+ int flag;
+ int i, nkeys;
+
+ HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL);
+ if (info == MPI_INFO_NULL) {
+ HDprintf("object is MPI_INFO_NULL\n");
+ }
+ else {
+ MPI_Info_get_nkeys(info, &nkeys);
+ HDprintf("object has %d items\n", nkeys);
+ for (i = 0; i < nkeys; i++) {
+ MPI_Info_get_nthkey(info, i, key);
+ MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+ HDprintf("%s=%s\n", key, value);
+ }
+ }
+}
+
+/*
* Function: get_minmax
* Purpose: Gather all the min, max and total of val.
* Return: Nothing
@@ -890,7 +901,7 @@ get_minmax(minmax *mm, double val)
static minmax
accumulate_minmax_stuff(minmax *mm, int count)
{
- int i;
+ int i;
minmax total_mm;
total_mm.sum = 0.0f;
@@ -926,9 +937,9 @@ static int
create_comm_world(int num_procs, int *doing_pio)
{
/* MPI variables */
- int mrc; /* return values */
- int color; /* for communicator creation */
- int myrank, nprocs;
+ int mrc; /* return values */
+ int color; /* for communicator creation */
+ int myrank, nprocs;
pio_comm_g = MPI_COMM_NULL;
@@ -939,15 +950,14 @@ create_comm_world(int num_procs, int *doing_pio)
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
if (num_procs > nprocs) {
- HDfprintf(stderr,
- "number of process(%d) must be <= number of processes in MPI_COMM_WORLD(%d)\n",
- num_procs, nprocs);
+ HDfprintf(stderr, "number of process(%d) must be <= number of processes in MPI_COMM_WORLD(%d)\n",
+ num_procs, nprocs);
goto error_done;
}
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
color = (myrank < num_procs);
- mrc = MPI_Comm_split(MPI_COMM_WORLD, color, myrank, &pio_comm_g);
+ mrc = MPI_Comm_split(MPI_COMM_WORLD, color, myrank, &pio_comm_g);
if (mrc != MPI_SUCCESS) {
HDfprintf(stderr, "MPI_Comm_split failed\n");
@@ -985,7 +995,7 @@ error_done:
static int
destroy_comm_world(void)
{
- int mrc = SUCCESS; /* return code */
+ int mrc = SUCCESS; /* return code */
/* release MPI resources */
if (pio_comm_g != MPI_COMM_NULL)
@@ -1003,63 +1013,60 @@ destroy_comm_world(void)
* Modifications:
*/
static void
-output_results(const struct options *opts, const char *name, minmax *table,
- int table_size,off_t data_size)
+output_results(const struct options *opts, const char *name, minmax *table, int table_size, off_t data_size)
{
- minmax total_mm;
+ minmax total_mm;
total_mm = accumulate_minmax_stuff(table, table_size);
print_indent(3);
- output_report("%s (%d iteration(s)):\n", name,table_size);
+ output_report("%s (%d iteration(s)):\n", name, table_size);
/* Note: The maximum throughput uses the minimum amount of time & vice versa */
print_indent(4);
- output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size,total_mm.min));
- if(opts->print_times)
+ output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.min));
+ if (opts->print_times)
output_report(" (%7.3f s)\n", total_mm.min);
else
output_report("\n");
print_indent(4);
- output_report("Average Throughput: %6.2f MB/s",
- MB_PER_SEC(data_size,total_mm.sum / total_mm.num));
- if(opts->print_times)
+ output_report("Average Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.sum / total_mm.num));
+ if (opts->print_times)
output_report(" (%7.3f s)\n", (total_mm.sum / total_mm.num));
else
output_report("\n");
print_indent(4);
- output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size,total_mm.max));
- if(opts->print_times)
+ output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.max));
+ if (opts->print_times)
output_report(" (%7.3f s)\n", total_mm.max);
else
output_report("\n");
-
}
static void
-output_times(const struct options *opts, const char *name, minmax *table,
- int table_size)
+output_times(const struct options *opts, const char *name, minmax *table, int table_size)
{
- minmax total_mm;
+ minmax total_mm;
total_mm = accumulate_minmax_stuff(table, table_size);
print_indent(3);
- output_report("%s (%d iteration(s)):\n", name,table_size);
+ output_report("%s (%d iteration(s)):\n", name, table_size);
/* Note: The maximum throughput uses the minimum amount of time & vice versa */
print_indent(4);
- output_report("Minimum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files,(total_mm.min));
+ output_report("Minimum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, (total_mm.min));
print_indent(4);
- output_report("Average Accumulated Time using %d file(s): %7.5f s\n", opts->num_files,(total_mm.sum / total_mm.num));
+ output_report("Average Accumulated Time using %d file(s): %7.5f s\n", opts->num_files,
+ (total_mm.sum / total_mm.num));
print_indent(4);
- output_report("Maximum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files,(total_mm.max));
+ output_report("Maximum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, (total_mm.max));
}
/*
@@ -1101,10 +1108,10 @@ print_indent(register int indent)
MPI_Comm_rank(pio_comm_g, &myrank);
if (myrank == 0) {
- indent *= TAB_SPACE;
+ indent *= TAB_SPACE;
- for (; indent > 0; --indent)
- HDfputc(' ', output);
+ for (; indent > 0; --indent)
+ HDfputc(' ', output);
}
}
@@ -1114,14 +1121,28 @@ recover_size_and_print(long long val, const char *end)
if (val >= ONE_KB && (val % ONE_KB) == 0) {
if (val >= ONE_MB && (val % ONE_MB) == 0) {
if (val >= ONE_GB && (val % ONE_GB) == 0)
- HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""GB%s", val / ONE_GB, end);
+ HDfprintf(output,
+ "%" H5_PRINTF_LL_WIDTH "d"
+ "GB%s",
+ val / ONE_GB, end);
else
- HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""MB%s", val / ONE_MB, end);
- } else {
- HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""KB%s", val / ONE_KB, end);
+ HDfprintf(output,
+ "%" H5_PRINTF_LL_WIDTH "d"
+ "MB%s",
+ val / ONE_MB, end);
}
- } else {
- HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""%s", val, end);
+ else {
+ HDfprintf(output,
+ "%" H5_PRINTF_LL_WIDTH "d"
+ "KB%s",
+ val / ONE_KB, end);
+ }
+ }
+ else {
+ HDfprintf(output,
+ "%" H5_PRINTF_LL_WIDTH "d"
+ "%s",
+ val, end);
}
}
@@ -1129,11 +1150,11 @@ static void
print_io_api(long io_types)
{
if (io_types & PIO_POSIX)
- HDfprintf(output, "posix ");
+ HDfprintf(output, "posix ");
if (io_types & PIO_MPI)
- HDfprintf(output, "mpiio ");
+ HDfprintf(output, "mpiio ");
if (io_types & PIO_HDF5)
- HDfprintf(output, "phdf5 ");
+ HDfprintf(output, "phdf5 ");
HDfprintf(output, "\n");
}
@@ -1142,90 +1163,84 @@ report_parameters(struct options *opts)
{
int rank = comm_world_rank_g;
- print_version("HDF5 Library"); /* print library version */
+ print_version("HDF5 Library"); /* print library version */
HDfprintf(output, "rank %d: ==== Parameters ====\n", rank);
HDfprintf(output, "rank %d: IO API=", rank);
print_io_api(opts->io_types);
- HDfprintf(output, "rank %d: Number of files=%ld\n", rank,
- opts->num_files);
- HDfprintf(output, "rank %d: Number of datasets=%ld\n", rank,
- opts->num_dsets);
- HDfprintf(output, "rank %d: Number of iterations=%d\n", rank,
- opts->num_iters);
- HDfprintf(output, "rank %d: Number of processes=%d:%d\n", rank,
- opts->min_num_procs, opts->max_num_procs);
-
- if (opts->dim2d){
- HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank);
- recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->min_num_procs), ":");
- recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->max_num_procs), "\n");
-
- HDfprintf(output, "rank %d: Size of dataset(s)=", rank);
- recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), "x");
- recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":");
- recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "x");
- recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n");
-
- HDfprintf(output, "rank %d: File size=", rank);
- recover_size_and_print((long long)(squareo(opts->num_bpp * opts->min_num_procs)
- * opts->num_dsets), ":");
- recover_size_and_print((long long)(squareo(opts->num_bpp * opts->max_num_procs)
- * opts->num_dsets), "\n");
-
- HDfprintf(output, "rank %d: Transfer buffer size=", rank);
- if(opts->interleaved){
- recover_size_and_print((long long)opts->min_xfer_size, "x");
- recover_size_and_print((long long)opts->blk_size, ":");
- recover_size_and_print((long long)opts->max_xfer_size, "x");
+ HDfprintf(output, "rank %d: Number of files=%ld\n", rank, opts->num_files);
+ HDfprintf(output, "rank %d: Number of datasets=%ld\n", rank, opts->num_dsets);
+ HDfprintf(output, "rank %d: Number of iterations=%d\n", rank, opts->num_iters);
+ HDfprintf(output, "rank %d: Number of processes=%d:%d\n", rank, opts->min_num_procs, opts->max_num_procs);
+
+ if (opts->dim2d) {
+ HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank);
+ recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->min_num_procs), ":");
+ recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->max_num_procs), "\n");
+
+ HDfprintf(output, "rank %d: Size of dataset(s)=", rank);
+ recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), "x");
+ recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":");
+ recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "x");
+ recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n");
+
+ HDfprintf(output, "rank %d: File size=", rank);
+ recover_size_and_print((long long)(squareo(opts->num_bpp * opts->min_num_procs) * opts->num_dsets),
+ ":");
+ recover_size_and_print((long long)(squareo(opts->num_bpp * opts->max_num_procs) * opts->num_dsets),
+ "\n");
+
+ HDfprintf(output, "rank %d: Transfer buffer size=", rank);
+ if (opts->interleaved) {
+ recover_size_and_print((long long)opts->min_xfer_size, "x");
+ recover_size_and_print((long long)opts->blk_size, ":");
+ recover_size_and_print((long long)opts->max_xfer_size, "x");
+ recover_size_and_print((long long)opts->blk_size, "\n");
+ }
+ else {
+ recover_size_and_print((long long)opts->blk_size, "x");
+ recover_size_and_print((long long)opts->min_xfer_size, ":");
+ recover_size_and_print((long long)opts->blk_size, "x");
+ recover_size_and_print((long long)opts->max_xfer_size, "\n");
+ }
+ HDfprintf(output, "rank %d: Block size=", rank);
+ recover_size_and_print((long long)opts->blk_size, "x");
recover_size_and_print((long long)opts->blk_size, "\n");
}
- else{
- recover_size_and_print((long long)opts->blk_size, "x");
+ else {
+ HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank);
+ recover_size_and_print((long long)opts->num_bpp, "\n");
+
+ HDfprintf(output, "rank %d: Size of dataset(s)=", rank);
+ recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":");
+ recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n");
+
+ HDfprintf(output, "rank %d: File size=", rank);
+ recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs * opts->num_dsets), ":");
+ recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs * opts->num_dsets), "\n");
+
+ HDfprintf(output, "rank %d: Transfer buffer size=", rank);
recover_size_and_print((long long)opts->min_xfer_size, ":");
- recover_size_and_print((long long)opts->blk_size, "x");
recover_size_and_print((long long)opts->max_xfer_size, "\n");
- }
- HDfprintf(output, "rank %d: Block size=", rank);
- recover_size_and_print((long long)opts->blk_size, "x");
- recover_size_and_print((long long)opts->blk_size, "\n");
- }
- else{
- HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank);
- recover_size_and_print((long long)opts->num_bpp, "\n");
-
- HDfprintf(output, "rank %d: Size of dataset(s)=", rank);
- recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":");
- recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n");
-
- HDfprintf(output, "rank %d: File size=", rank);
- recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs
- * opts->num_dsets), ":");
- recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs
- * opts->num_dsets), "\n");
-
- HDfprintf(output, "rank %d: Transfer buffer size=", rank);
- recover_size_and_print((long long)opts->min_xfer_size, ":");
- recover_size_and_print((long long)opts->max_xfer_size, "\n");
- HDfprintf(output, "rank %d: Block size=", rank);
- recover_size_and_print((long long)opts->blk_size, "\n");
+ HDfprintf(output, "rank %d: Block size=", rank);
+ recover_size_and_print((long long)opts->blk_size, "\n");
}
HDfprintf(output, "rank %d: Block Pattern in Dataset=", rank);
- if(opts->interleaved)
+ if (opts->interleaved)
HDfprintf(output, "Interleaved\n");
else
HDfprintf(output, "Contiguous\n");
HDfprintf(output, "rank %d: I/O Method for MPI and HDF5=", rank);
- if(opts->collective)
+ if (opts->collective)
HDfprintf(output, "Collective\n");
else
HDfprintf(output, "Independent\n");
HDfprintf(output, "rank %d: Geometry=", rank);
- if(opts->dim2d)
+ if (opts->dim2d)
HDfprintf(output, "2D\n");
else
HDfprintf(output, "1D\n");
@@ -1233,7 +1248,7 @@ report_parameters(struct options *opts)
HDfprintf(output, "rank %d: VFL used for HDF5 I/O=%s\n", rank, "MPI-IO driver");
HDfprintf(output, "rank %d: Data storage method in HDF5=", rank);
- if(opts->h5_use_chunks)
+ if (opts->h5_use_chunks)
HDfprintf(output, "Chunked\n");
else
HDfprintf(output, "Contiguous\n");
@@ -1241,8 +1256,7 @@ report_parameters(struct options *opts)
{
char *prefix = HDgetenv("HDF5_PARAPREFIX");
- HDfprintf(output, "rank %d: Env HDF5_PARAPREFIX=%s\n", rank,
- (prefix ? prefix : "not set"));
+ HDfprintf(output, "rank %d: Env HDF5_PARAPREFIX=%s\n", rank, (prefix ? prefix : "not set"));
}
HDfprintf(output, "rank %d: ", rank);
@@ -1264,45 +1278,44 @@ report_parameters(struct options *opts)
static struct options *
parse_command_line(int argc, char *argv[])
{
- register int opt;
+ register int opt;
struct options *cl_opts;
cl_opts = (struct options *)malloc(sizeof(struct options));
- cl_opts->output_file = NULL;
- cl_opts->io_types = 0; /* will set default after parsing options */
- cl_opts->num_dsets = 1;
- cl_opts->num_files = 1;
- cl_opts->num_bpp = 0;
- cl_opts->num_iters = 1;
+ cl_opts->output_file = NULL;
+ cl_opts->io_types = 0; /* will set default after parsing options */
+ cl_opts->num_dsets = 1;
+ cl_opts->num_files = 1;
+ cl_opts->num_bpp = 0;
+ cl_opts->num_iters = 1;
cl_opts->max_num_procs = comm_world_nprocs_g;
cl_opts->min_num_procs = 1;
cl_opts->max_xfer_size = 0;
cl_opts->min_xfer_size = 0;
- cl_opts->blk_size = 0;
- cl_opts->interleaved = 0; /* Default to contiguous blocks in dataset */
- cl_opts->collective = 0; /* Default to independent I/O access */
- cl_opts->dim2d = 0; /* Default to 1D */
- cl_opts->print_times = FALSE; /* Printing times is off by default */
- cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */
- cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */
- cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */
+ cl_opts->blk_size = 0;
+ cl_opts->interleaved = 0; /* Default to contiguous blocks in dataset */
+ cl_opts->collective = 0; /* Default to independent I/O access */
+ cl_opts->dim2d = 0; /* Default to 1D */
+ cl_opts->print_times = FALSE; /* Printing times is off by default */
+ cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */
+ cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */
+ cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */
cl_opts->h5_use_chunks = FALSE; /* Don't chunk the HDF5 dataset by default */
cl_opts->h5_write_only = FALSE; /* Do both read and write by default */
- cl_opts->verify = FALSE; /* No Verify data correctness by default */
+ cl_opts->verify = FALSE; /* No Verify data correctness by default */
- while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) {
+ while ((opt = H5_get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
- case 'a':
- cl_opts->h5_alignment = parse_size_directive(opt_arg);
- break;
- case 'A':
- {
- const char *end = opt_arg;
+ case 'a':
+ cl_opts->h5_alignment = parse_size_directive(H5_optarg);
+ break;
+ case 'A': {
+ const char *end = H5_optarg;
while (end && *end != '\0') {
char buf[10];
- int i;
+ int i;
HDmemset(buf, '\0', sizeof(buf));
@@ -1312,13 +1325,15 @@ parse_command_line(int argc, char *argv[])
if (!HDstrcasecmp(buf, "phdf5")) {
cl_opts->io_types |= PIO_HDF5;
- } else if (!HDstrcasecmp(buf, "mpiio")) {
+ }
+ else if (!HDstrcasecmp(buf, "mpiio")) {
cl_opts->io_types |= PIO_MPI;
- } else if (!HDstrcasecmp(buf, "posix")) {
+ }
+ else if (!HDstrcasecmp(buf, "posix")) {
cl_opts->io_types |= PIO_POSIX;
- } else {
- HDfprintf(stderr, "pio_perf: invalid --api option %s\n",
- buf);
+ }
+ else {
+ HDfprintf(stderr, "pio_perf: invalid --api option %s\n", buf);
HDexit(EXIT_FAILURE);
}
@@ -1334,27 +1349,26 @@ parse_command_line(int argc, char *argv[])
case 'b':
/* the future "binary" option */
break;
-#endif /* 0 */
- case 'B':
- cl_opts->blk_size = (size_t)parse_size_directive(opt_arg);
- break;
- case 'c':
- /* Turn on chunked HDF5 dataset creation */
- cl_opts->h5_use_chunks = TRUE;
- break;
- case 'C':
- cl_opts->collective = 1;
- break;
- case 'd':
- cl_opts->num_dsets = atoi(opt_arg);
- break;
- case 'D':
- {
- const char *end = opt_arg;
+#endif /* 0 */
+ case 'B':
+ cl_opts->blk_size = (size_t)parse_size_directive(H5_optarg);
+ break;
+ case 'c':
+ /* Turn on chunked HDF5 dataset creation */
+ cl_opts->h5_use_chunks = TRUE;
+ break;
+ case 'C':
+ cl_opts->collective = 1;
+ break;
+ case 'd':
+ cl_opts->num_dsets = atoi(H5_optarg);
+ break;
+ case 'D': {
+ const char *end = H5_optarg;
while (end && *end != '\0') {
char buf[10];
- int i;
+ int i;
HDmemset(buf, '\0', sizeof(buf));
@@ -1367,8 +1381,7 @@ parse_command_line(int argc, char *argv[])
for (j = 0; j < 10 && buf[j] != '\0'; ++j)
if (!isdigit(buf[j])) {
- HDfprintf(stderr, "pio_perf: invalid --debug option %s\n",
- buf);
+ HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf);
HDexit(EXIT_FAILURE);
}
@@ -1378,23 +1391,24 @@ parse_command_line(int argc, char *argv[])
pio_debug_level = 4;
else if (pio_debug_level < 0)
pio_debug_level = 0;
- } else {
+ }
+ else {
switch (*buf) {
- case 'r':
- /* Turn on raw data throughput info */
- cl_opts->print_raw = TRUE;
- break;
- case 't':
- /* Turn on time printing */
- cl_opts->print_times = TRUE;
- break;
- case 'v':
- /* Turn on verify data correctness*/
- cl_opts->verify = TRUE;
- break;
- default:
- HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf);
- HDexit(EXIT_FAILURE);
+ case 'r':
+ /* Turn on raw data throughput info */
+ cl_opts->print_raw = TRUE;
+ break;
+ case 't':
+ /* Turn on time printing */
+ cl_opts->print_times = TRUE;
+ break;
+ case 'v':
+ /* Turn on verify data correctness*/
+ cl_opts->verify = TRUE;
+ break;
+ default:
+ HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf);
+ HDexit(EXIT_FAILURE);
}
}
@@ -1406,53 +1420,52 @@ parse_command_line(int argc, char *argv[])
}
break;
- case 'e':
- cl_opts->num_bpp = parse_size_directive(opt_arg);
- break;
- case 'F':
- cl_opts->num_files = HDatoi(opt_arg);
- break;
- case 'g':
- cl_opts->dim2d = 1;
- break;
- case 'i':
- cl_opts->num_iters = HDatoi(opt_arg);
- break;
- case 'I':
- cl_opts->interleaved = 1;
- break;
- case 'o':
- cl_opts->output_file = opt_arg;
- break;
- case 'p':
- cl_opts->min_num_procs = HDatoi(opt_arg);
- break;
- case 'P':
- cl_opts->max_num_procs = HDatoi(opt_arg);
- break;
- case 'T':
- cl_opts->h5_threshold = parse_size_directive(opt_arg);
- break;
- case 'w':
- cl_opts->h5_write_only = TRUE;
- break;
- case 'x':
- cl_opts->min_xfer_size = (size_t)parse_size_directive(opt_arg);
- break;
- case 'X':
- cl_opts->max_xfer_size = (size_t)parse_size_directive(opt_arg);
- break;
- case 'h':
- case '?':
- default:
- usage(progname);
- HDfree(cl_opts);
- return NULL;
+ case 'e':
+ cl_opts->num_bpp = parse_size_directive(H5_optarg);
+ break;
+ case 'F':
+ cl_opts->num_files = HDatoi(H5_optarg);
+ break;
+ case 'g':
+ cl_opts->dim2d = 1;
+ break;
+ case 'i':
+ cl_opts->num_iters = HDatoi(H5_optarg);
+ break;
+ case 'I':
+ cl_opts->interleaved = 1;
+ break;
+ case 'o':
+ cl_opts->output_file = H5_optarg;
+ break;
+ case 'p':
+ cl_opts->min_num_procs = HDatoi(H5_optarg);
+ break;
+ case 'P':
+ cl_opts->max_num_procs = HDatoi(H5_optarg);
+ break;
+ case 'T':
+ cl_opts->h5_threshold = parse_size_directive(H5_optarg);
+ break;
+ case 'w':
+ cl_opts->h5_write_only = TRUE;
+ break;
+ case 'x':
+ cl_opts->min_xfer_size = (size_t)parse_size_directive(H5_optarg);
+ break;
+ case 'X':
+ cl_opts->max_xfer_size = (size_t)parse_size_directive(H5_optarg);
+ break;
+ case 'h':
+ case '?':
+ default:
+ usage(progname);
+ HDfree(cl_opts);
+ return NULL;
}
}
-
- if (cl_opts->num_bpp == 0){
+ if (cl_opts->num_bpp == 0) {
if (cl_opts->dim2d == 0)
cl_opts->num_bpp = 256 * ONE_KB;
else
@@ -1463,38 +1476,37 @@ parse_command_line(int argc, char *argv[])
cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp;
if (cl_opts->min_xfer_size == 0)
- cl_opts->min_xfer_size = (size_t)(cl_opts->num_bpp)/2;
+ cl_opts->min_xfer_size = (size_t)(cl_opts->num_bpp) / 2;
if (cl_opts->blk_size == 0)
- cl_opts->blk_size = (size_t)(cl_opts->num_bpp)/2;
-
+ cl_opts->blk_size = (size_t)(cl_opts->num_bpp) / 2;
/* set default if none specified yet */
if (!cl_opts->io_types)
- cl_opts->io_types = PIO_HDF5 | PIO_MPI | PIO_POSIX; /* run all API */
+ cl_opts->io_types = PIO_HDF5 | PIO_MPI | PIO_POSIX; /* run all API */
/* verify parameters sanity. Adjust if needed. */
/* cap xfer_size with bytes per process */
if (!cl_opts->dim2d) {
if (cl_opts->min_xfer_size > (size_t)cl_opts->num_bpp)
- cl_opts->min_xfer_size = (size_t)cl_opts->num_bpp;
+ cl_opts->min_xfer_size = (size_t)cl_opts->num_bpp;
if (cl_opts->max_xfer_size > (size_t)cl_opts->num_bpp)
- cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp;
+ cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp;
}
if (cl_opts->min_xfer_size > cl_opts->max_xfer_size)
- cl_opts->min_xfer_size = cl_opts->max_xfer_size;
- if (cl_opts->blk_size > (size_t)cl_opts->num_bpp )
+ cl_opts->min_xfer_size = cl_opts->max_xfer_size;
+ if (cl_opts->blk_size > (size_t)cl_opts->num_bpp)
cl_opts->blk_size = (size_t)cl_opts->num_bpp;
/* check range of number of processes */
if (cl_opts->min_num_procs <= 0)
- cl_opts->min_num_procs = 1;
+ cl_opts->min_num_procs = 1;
if (cl_opts->max_num_procs <= 0)
- cl_opts->max_num_procs = 1;
+ cl_opts->max_num_procs = 1;
if (cl_opts->min_num_procs > cl_opts->max_num_procs)
- cl_opts->min_num_procs = cl_opts->max_num_procs;
+ cl_opts->min_num_procs = cl_opts->max_num_procs;
/* check iteration */
if (cl_opts->num_iters <= 0)
- cl_opts->num_iters = 1;
+ cl_opts->num_iters = 1;
return cl_opts;
}
@@ -1572,7 +1584,7 @@ usage(const char *prog)
HDprintf(" -A AL, --api=AL Which APIs to test [default: all of them]\n");
#if 0
HDprintf(" -b, --binary The elusive binary option\n");
-#endif /* 0 */
+#endif /* 0 */
HDprintf(" -B S, --block-size=S Block size within transfer buffer\n");
HDprintf(" (see below for description)\n");
HDprintf(" [default: half the number of bytes per process\n");
@@ -1615,7 +1627,7 @@ usage(const char *prog)
HDprintf(" M - Megabyte (%d)\n", ONE_MB);
HDprintf(" G - Gigabyte (%d)\n", ONE_GB);
HDprintf("\n");
- HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37*ONE_MB);
+ HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37 * ONE_MB);
HDprintf("\n");
HDprintf(" AL - is an API list. Valid values are:\n");
HDprintf(" phdf5 - Parallel HDF5\n");
diff --git a/tools/src/h5perf/pio_perf.h b/tools/src/h5perf/pio_perf.h
new file mode 100644
index 0000000..8924c20
--- /dev/null
+++ b/tools/src/h5perf/pio_perf.h
@@ -0,0 +1,109 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef PIO_PERF_H
+#define PIO_PERF_H
+
+#ifndef STANDALONE
+#include "io_timer.h"
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#else
+#include "io_timer.h"
+#include "pio_standalone.h"
+#endif
+
+#ifdef H5_HAVE_PARALLEL
+extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
+#endif
+
+#ifdef H5_HAVE_PARALLEL
+int h5_set_info_object(void);
+void h5_dump_info_object(MPI_Info info);
+#endif
+
+/* setup the dataset no fill option if this is v1.5 or more */
+#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4
+#define H5_HAVE_NOFILL 1
+#endif
+
+typedef enum iotype_ {
+ POSIXIO,
+ MPIO,
+ PHDF5
+ /*NUM_TYPES*/
+} iotype;
+
+typedef struct parameters_ {
+ iotype io_type; /* The type of IO test to perform */
+ int num_procs; /* Maximum number of processes to use */
+ long num_files; /* Number of files to create */
+ long num_dsets; /* Number of datasets to create */
+ off_t num_bytes; /* Number of bytes in each dset */
+ int num_iters; /* Number of times to loop doing the IO */
+ size_t buf_size; /* Buffer size */
+ size_t blk_size; /* Block size */
+ unsigned interleaved; /* Interleaved vs. contiguous blocks */
+ unsigned collective; /* Collective vs. independent I/O */
+ unsigned dim2d; /* 1D vs. 2D */
+ hsize_t h5_align; /* HDF5 object alignment */
+ hsize_t h5_thresh; /* HDF5 object alignment threshold */
+ int h5_use_chunks; /* Make HDF5 dataset chunked */
+ int h5_write_only; /* Perform the write tests only */
+ int verify; /* Verify data correctness */
+} parameters;
+
+typedef struct results_ {
+ herr_t ret_code;
+ io_time_t *timers;
+} results;
+
+#ifndef SUCCESS
+#define SUCCESS 0
+#endif /* !SUCCESS */
+
+#ifndef FAIL
+#define FAIL -1
+#endif /* !FAIL */
+
+extern FILE * output; /* output file */
+extern io_time_t *timer_g; /* timer: global for stub functions */
+extern int comm_world_rank_g; /* my rank in MPI_COMM_RANK */
+extern int comm_world_nprocs_g; /* num. of processes of MPI_COMM_WORLD */
+extern MPI_Comm pio_comm_g; /* Communicator to run the PIO */
+extern int pio_mpi_rank_g; /* MPI rank of pio_comm_g */
+extern int pio_mpi_nprocs_g; /* number of processes of pio_comm_g */
+extern int pio_debug_level; /* The debug level:
+ * 0 - Off
+ * 1 - Minimal
+ * 2 - Some more
+ * 3 - Maximal
+ * 4 - Even More Debugging (timer stuff)
+ */
+
+#define HDprint_rank(f) /* print rank in MPI_COMM_WORLD */ HDfprintf(f, "%d: ", comm_world_rank_g);
+#define HDprint_size(f) /* print size of MPI_COMM_WORLD */ HDfprintf(f, "%d", comm_world_nprocs_g);
+#define HDprint_rank_size(f) /* print rank/size of MPI_COMM_WORLD */ \
+ HDfprintf(f, "%d/%d: ", comm_world_rank_g, comm_world_nprocs_g);
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+extern results do_pio(parameters param);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* PIO_PERF_H */
diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c
new file mode 100644
index 0000000..dc2c68e
--- /dev/null
+++ b/tools/src/h5perf/sio_engine.c
@@ -0,0 +1,1330 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Author: Christian Chilan, April 2008
+ */
+
+#include "hdf5.h"
+
+#ifdef H5_STDC_HEADERS
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+#ifdef H5_HAVE_UNISTD_H
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#ifdef H5_HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#include "sio_perf.h"
+
+/* Macro definitions */
+
+/* sizes of various items. these sizes won't change during program execution */
+#define ELMT_H5_TYPE H5T_NATIVE_UCHAR
+
+#define GOTOERROR(errcode) \
+ { \
+ ret_code = errcode; \
+ goto done; \
+ }
+#define ERRMSG(mesg) \
+ { \
+ HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \
+ }
+
+/* verify: if val is false (0), print mesg. */
+#define VRFY(val, mesg) \
+ do { \
+ if (!val) { \
+ ERRMSG(mesg); \
+ GOTOERROR(FAIL); \
+ } \
+ } while (0)
+
+/* POSIX I/O macros */
+#ifdef H5_HAVE_WIN32_API
+/* Can't link against the library, so this test will use the older, non-Unicode
+ * _open() call on Windows.
+ */
+#define HDopen(S, F, ...) _open(S, F | _O_BINARY, __VA_ARGS__)
+#endif /* H5_HAVE_WIN32_API */
+#define POSIXCREATE(fn) HDopen(fn, O_CREAT | O_TRUNC | O_RDWR, 0600)
+#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
+#define POSIXCLOSE(F) HDclose(F)
+#define POSIXSEEK(F, L) HDlseek(F, L, SEEK_SET)
+#define POSIXWRITE(F, B, S) HDwrite(F, B, S)
+#define POSIXREAD(F, B, S) HDread(F, B, S)
+
+enum { SIO_CREATE = 1, SIO_WRITE = 2, SIO_READ = 4 };
+
+/* Global variables */
+static int clean_file_g = -1; /*whether to cleanup temporary test */
+/*files. -1 is not defined; */
+/*0 is no cleanup; 1 is do cleanup */
+
+/* the different types of file descriptors we can expect */
+typedef union {
+ int posixfd; /* POSIX file handle*/
+ hid_t h5fd; /* HDF5 file */
+} file_descr;
+
+/* local functions */
+static char * sio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size,
+ parameters *param);
+static herr_t do_write(results *res, file_descr *fd, parameters *parms, void *buffer);
+static herr_t do_read(results *res, file_descr *fd, parameters *parms, void *buffer);
+static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer);
+static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer);
+static herr_t dset_read(int localrank, file_descr *fd, parameters *parms, void *buffer, const char *buffer2);
+static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer);
+static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags);
+hid_t set_vfd(parameters *param);
+static herr_t do_fclose(iotype iot, file_descr *fd);
+static void do_cleanupfile(iotype iot, char *fname);
+
+/* global variables */
+static HDoff_t offset[MAX_DIMS]; /* dataset size in bytes */
+static size_t buf_offset[MAX_DIMS]; /* dataset size in bytes */
+static int order[MAX_DIMS]; /* dimension access order */
+static size_t linear_buf_size; /* linear buffer size */
+static int cont_dim; /* lowest dimension for contiguous POSIX
+ access */
+static size_t cont_size; /* size of contiguous POSIX access */
+static hid_t fapl; /* file access list */
+static unsigned char *buf_p; /* buffer pointer */
+static const char * multi_letters = "msbrglo"; /* string for multi driver */
+
+/* HDF5 global variables */
+static hsize_t h5count[MAX_DIMS]; /*selection count */
+static hssize_t h5offset[MAX_DIMS]; /* Selection offset within dataspace */
+static hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+static hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+static hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
+static hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+static hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
+
+/*
+ * Function: do_sio
+ * Purpose: SIO Engine where IO are executed.
+ * Return: results
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+void
+do_sio(parameters param, results *res)
+{
+ char * buffer = NULL; /*data buffer pointer */
+ size_t buf_size[MAX_DIMS]; /* general buffer size in bytes */
+ file_descr fd; /* file handles */
+ iotype iot; /* API type */
+ char base_name[256]; /* test file base name */
+ /* return codes */
+ herr_t ret_code = 0; /*return code */
+
+ char fname[FILENAME_MAX]; /* test file name */
+ int i;
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+
+ /* Sanity check parameters */
+
+ /* IO type */
+ iot = param.io_type;
+
+ switch (iot) {
+ case POSIXIO:
+ fd.posixfd = -1;
+ res->timers = io_time_new(SYS_CLOCK);
+ break;
+ case HDF5:
+ fd.h5fd = -1;
+ res->timers = io_time_new(SYS_CLOCK);
+ break;
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
+ GOTOERROR(FAIL);
+ }
+
+ linear_buf_size = 1;
+
+ for (i = 0; i < param.rank; i++) {
+ buf_size[i] = param.buf_size[i];
+ order[i] = param.order[i];
+ linear_buf_size *= buf_size[i];
+ buf_offset[i] = 0;
+ offset[i] = 0;
+
+ /* Validate transfer buffer size */
+ if (param.buf_size[i] <= 0) {
+ HDfprintf(stderr, "Transfer buffer size[%d] (%zu) must be > 0\n", i, buf_size[i]);
+ GOTOERROR(FAIL);
+ }
+
+ if ((param.dset_size[i] % param.buf_size[i]) != 0) {
+ HDfprintf(stderr,
+ "Dataset size[%d] (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "trasfer buffer size[%d] (%zu)\n",
+ param.rank, (long long)param.dset_size[i], param.rank, param.buf_size[i]);
+ GOTOERROR(FAIL);
+ }
+ }
+
+ /* Allocate transfer buffer */
+ if ((buffer = (char *)malloc(linear_buf_size)) == NULL) {
+ HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", linear_buf_size);
+ GOTOERROR(FAIL);
+ }
+
+ if (sio_debug_level >= 4)
+
+ /* output all of the times for all iterations */
+ HDfprintf(output, "Timer details:\n");
+
+ /*
+ * Write performance measurement
+ */
+ /* Open file for write */
+
+ HDstrcpy(base_name, "#sio_tmp");
+ sio_create_filename(iot, base_name, fname, sizeof(fname), &param);
+
+ if (sio_debug_level > 0)
+ HDfprintf(output, "data filename=%s\n", fname);
+
+ io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_fopen(&param, fname, &fd, SIO_CREATE | SIO_WRITE);
+ VRFY((hrc == SUCCESS), "do_fopen failed");
+
+ io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_write(res, &fd, &param, buffer);
+ io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_write failed");
+
+ /* Close file for write */
+ hrc = do_fclose(iot, &fd);
+ io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_fclose failed");
+
+ if (!param.h5_write_only) {
+ /*
+ * Read performance measurement
+ */
+
+ /* Open file for read */
+ io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
+ hrc = do_fopen(&param, fname, &fd, SIO_READ);
+ VRFY((hrc == SUCCESS), "do_fopen failed");
+
+ io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
+ hrc = do_read(res, &fd, &param, buffer);
+ io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_read failed");
+
+ /* Close file for read */
+ hrc = do_fclose(iot, &fd);
+
+ io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_fclose failed");
+ }
+
+ do_cleanupfile(iot, fname);
+
+done:
+ /* clean up */
+ /* release HDF5 objects */
+
+ /* close any opened files */
+ /* no remove(fname) because that should have happened normally. */
+ switch (iot) {
+ case POSIXIO:
+ if (fd.posixfd != -1)
+ hrc = do_fclose(iot, &fd);
+ break;
+ case HDF5:
+ if (fd.h5fd != -1)
+ hrc = do_fclose(iot, &fd);
+ break;
+ default:
+ /* unknown request */
+ HDassert(0 && "Unknown IO type");
+ break;
+ }
+
+ /* release generic resources */
+ if (buffer)
+ free(buffer);
+
+ res->ret_code = ret_code;
+}
+
+/*
+ * Function: sio_create_filename
+ * Purpose: Create a new filename to write to. Determine the correct
+ * suffix to append to the filename by the type of I/O we're
+ * doing. Also, place in the /tmp/{$USER,$LOGIN} directory if
+ * USER or LOGIN are specified in the environment.
+ * Return: Pointer to filename or NULL
+ * Programmer: Bill Wendling, 21. November 2001
+ * Modifications: Support for file drivers. Christian Chilan, April, 2008
+ */
+static char *
+sio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size, parameters *param)
+{
+ const char *prefix, *suffix = "";
+ char * ptr, last = '\0';
+ size_t i, j;
+ vfdtype vfd;
+ vfd = param->vfd;
+
+ if (!base_name || !fullname || size < 1)
+ return NULL;
+
+ memset(fullname, 0, size);
+
+ switch (iot) {
+ case POSIXIO:
+ suffix = ".posix";
+ break;
+ case HDF5:
+ suffix = ".h5";
+ if (vfd == family)
+ suffix = "%05d.h5";
+ else if (vfd == multi)
+ suffix = NULL;
+ break;
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
+ HDassert(0 && "Unknown IO type");
+ break;
+ }
+
+ /* First use the environment variable and then try the constant */
+ prefix = HDgetenv("HDF5_PREFIX");
+
+#ifdef HDF5_PREFIX
+ if (!prefix)
+ prefix = HDF5_PREFIX;
+#endif /* HDF5_PREFIX */
+
+ /* Prepend the prefix value to the base name */
+ if (prefix && *prefix) {
+ /* If the prefix specifies the HDF5_PREFIX directory, then
+ * default to using the "/tmp/$USER" or "/tmp/$LOGIN"
+ * directory instead. */
+ register char *user, *login, *subdir;
+
+ user = HDgetenv("USER");
+ login = HDgetenv("LOGIN");
+ subdir = (user ? user : login);
+
+ if (subdir) {
+ for (i = 0; i < size - 1 && prefix[i]; i++)
+ fullname[i] = prefix[i];
+
+ fullname[i++] = '/';
+
+ for (j = 0; i < size && subdir[j]; i++, j++)
+ fullname[i] = subdir[j];
+ }
+ else {
+ /* We didn't append the prefix yet */
+ HDstrncpy(fullname, prefix, size);
+ fullname[size - 1] = '\0';
+ }
+
+ if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) {
+ /* Append the base_name with a slash first. Multiple slashes are
+ * handled below. */
+ h5_stat_t buf;
+
+ if (HDstat(fullname, &buf) < 0)
+ /* The directory doesn't exist just yet */
+ if (HDmkdir(fullname, 0755) < 0 && errno != EEXIST) {
+ /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory.
+ * Default to PREFIX's original prefix value. */
+ HDstrcpy(fullname, prefix);
+ }
+
+ HDstrcat(fullname, "/");
+ HDstrcat(fullname, base_name);
+ }
+ else {
+ /* Buffer is too small */
+ return NULL;
+ }
+ }
+ else if (strlen(base_name) >= size) {
+ /* Buffer is too small */
+ return NULL;
+ }
+ else {
+ HDstrcpy(fullname, base_name);
+ }
+
+ /* Append a suffix */
+ if (suffix) {
+ if (HDstrlen(fullname) + HDstrlen(suffix) >= size)
+ return NULL;
+
+ HDstrcat(fullname, suffix);
+ }
+
+ /* Remove any double slashes in the filename */
+ for (ptr = fullname, i = j = 0; ptr && (i < size); i++, ptr++) {
+ if (*ptr != '/' || last != '/')
+ fullname[j++] = *ptr;
+
+ last = *ptr;
+ }
+
+ return fullname;
+}
+
+/*
+ * Function: do_write
+ * Purpose: Write the required amount of data to the file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+static herr_t
+do_write(results *res, file_descr *fd, parameters *parms, void *buffer)
+{
+ int ret_code = SUCCESS;
+ char dname[64];
+ int i;
+ size_t u;
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+ hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */
+ hsize_t h5chunk[MAX_DIMS]; /*dataset dim sizes */
+ hsize_t h5block[MAX_DIMS]; /*dataspace selection */
+ hsize_t h5stride[MAX_DIMS]; /*selection stride */
+ hsize_t h5start[MAX_DIMS]; /*selection start */
+ hsize_t h5maxdims[MAX_DIMS];
+ int rank; /*rank of dataset */
+
+ /* Prepare buffer for verifying data */
+ /* if (parms->verify)
+ memset(buffer,1,linear_buf_size); */
+
+ buf_p = (unsigned char *)buffer;
+
+ for (u = 0; u < linear_buf_size; u++)
+ buf_p[u] = u % 128;
+
+ rank = parms->rank;
+
+ for (i = 0; i < rank; i++)
+ h5offset[i] = offset[i] = 0;
+
+ /* I/O Access specific setup */
+ switch (parms->io_type) {
+ case POSIXIO:
+
+ /* determine lowest dimension for contiguous POSIX access */
+ cont_dim = rank;
+
+ for (i = rank - 1; i >= 0; i--) {
+ if (parms->buf_size[i] == parms->dset_size[i])
+ cont_dim = i;
+ else
+ break;
+ }
+
+ /* determine size of the contiguous POSIX access */
+ cont_size = (!cont_dim) ? 1 : parms->buf_size[cont_dim - 1];
+ for (i = cont_dim; i < rank; i++)
+ cont_size *= parms->buf_size[i];
+
+ break;
+
+ case HDF5: /* HDF5 setup */
+
+ for (i = 0; i < rank; i++) {
+ h5dims[i] = parms->dset_size[i];
+ h5start[i] = 0;
+ h5stride[i] = 1;
+ h5block[i] = 1;
+ h5count[i] = parms->buf_size[i];
+ h5chunk[i] = parms->chk_size[i];
+ h5maxdims[i] = H5S_UNLIMITED;
+ }
+
+ if (parms->h5_use_chunks && parms->h5_extendable) {
+ h5dset_space_id = H5Screate_simple(rank, h5count, h5maxdims);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+ }
+ else {
+ h5dset_space_id = H5Screate_simple(rank, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+ }
+
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ h5mem_space_id = H5Screate_simple(rank, h5count, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+
+ /* Create the dataset transfer property list */
+ h5dxpl = H5Pcreate(H5P_DATASET_XFER);
+ if (h5dxpl < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ break;
+
+ default:
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ GOTOERROR(FAIL);
+ break;
+ } /* end switch */
+
+ /* create dataset */
+ switch (parms->io_type) {
+ case POSIXIO:
+ break;
+
+ case HDF5:
+ h5dcpl = H5Pcreate(H5P_DATASET_CREATE);
+
+ if (h5dcpl < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ if (parms->h5_use_chunks) {
+ /* Set the chunk size to be the same as the buffer size */
+ hrc = H5Pset_chunk(h5dcpl, rank, h5chunk);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+
+ HDsprintf(dname, "Dataset_%ld", (unsigned long)parms->num_bytes);
+ h5ds_id =
+ H5Dcreate2(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, H5P_DEFAULT, h5dcpl, H5P_DEFAULT);
+
+ if (h5ds_id < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ hrc = H5Pclose(h5dcpl);
+ /* verifying the close of the dcpl */
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Close failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ GOTOERROR(FAIL);
+ break;
+ }
+
+ /* Start "raw data" write timer */
+ io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
+
+ /* Perform write */
+ hrc = dset_write(rank - 1, fd, parms, buffer);
+
+ if (hrc < 0) {
+ HDfprintf(stderr, "Error in dataset write\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Stop "raw data" write timer */
+ io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
+
+ /* Calculate write time */
+
+ /* Close dataset. Only HDF5 needs to do an explicit close. */
+ if (parms->io_type == HDF5) {
+ hrc = H5Dclose(h5ds_id);
+
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ h5ds_id = H5I_INVALID_HID;
+ } /* end if */
+
+done:
+
+ /* release HDF5 objects */
+ if (h5dset_space_id != -1) {
+ hrc = H5Sclose(h5dset_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dset_space_id = H5I_INVALID_HID;
+ }
+ }
+
+ if (h5mem_space_id != -1) {
+ hrc = H5Sclose(h5mem_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5mem_space_id = H5I_INVALID_HID;
+ }
+ }
+
+ if (h5dxpl != -1) {
+ hrc = H5Pclose(h5dxpl);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dxpl = H5I_INVALID_HID;
+ }
+ }
+
+ return ret_code;
+}
+
+/*
+ * Function: dset_write
+ * Purpose: Write buffer into the dataset.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+static herr_t
+dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
+{
+ int cur_dim = order[local_dim] - 1;
+ int ret_code = SUCCESS;
+ int k;
+ hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS];
+ hsize_t i;
+ int j;
+ herr_t hrc;
+
+ /* iterates according to the dimensions in order array */
+ for (i = 0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]) {
+
+ h5offset[cur_dim] = (hssize_t)i;
+ offset[cur_dim] = (HDoff_t)i;
+
+ if (local_dim > 0) {
+
+ dset_write(local_dim - 1, fd, parms, buffer);
+ }
+ else {
+
+ switch (parms->io_type) {
+
+ case POSIXIO:
+ /* initialize POSIX offset in the buffer */
+ for (j = 0; j < parms->rank; j++)
+ buf_offset[j] = 0;
+ buf_p = (unsigned char *)buffer;
+ /* write POSIX buffer */
+ posix_buffer_write(0, fd, parms, buffer);
+ break;
+
+ case HDF5:
+ /* if dimensions are extendable, extend them as needed during access */
+ if (parms->h5_use_chunks && parms->h5_extendable) {
+
+ hrc = H5Sget_simple_extent_dims(h5dset_space_id, dims, maxdims);
+ VRFY((hrc >= 0), "H5Sget_simple_extent_dims");
+
+ for (k = 0; k < parms->rank; k++) {
+
+ HDassert(h5offset[k] >= 0);
+ if (dims[k] <= (hsize_t)h5offset[k]) {
+ dims[k] = dims[k] + h5count[k];
+ hrc = H5Sset_extent_simple(h5dset_space_id, parms->rank, dims, maxdims);
+ VRFY((hrc >= 0), "H5Sset_extent_simple");
+ hrc = H5Dset_extent(h5ds_id, dims);
+ VRFY((hrc >= 0), "H5Dextend");
+ }
+ }
+ }
+ /* applies offset */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Write the buffer out */
+ hrc = H5Sget_simple_extent_dims(h5dset_space_id, dims, maxdims);
+ hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
+
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ HDassert(0 && "Unknown IO type");
+ break;
+ } /* switch (parms->io_type) */
+ }
+ }
+done:
+ return ret_code;
+}
+
+/*
+ * Function: posix_buffer_write
+ * Purpose: Write buffer into the POSIX file considering contiguity.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+
+static herr_t
+posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
+{
+ int ret_code = SUCCESS;
+
+ /* if dimension is not contiguous, call recursively */
+ if (local_dim < parms->rank - 1 && local_dim != cont_dim) {
+ size_t u;
+
+ for (u = 0; u < parms->buf_size[local_dim]; u++) {
+ buf_offset[local_dim] = u;
+ posix_buffer_write(local_dim + 1, fd, parms, buffer);
+
+ /* if next dimension is cont_dim, it will fill out the buffer
+ traversing the entire dimension local_dim without the need
+ of performing iteration */
+ if (local_dim + 1 == cont_dim)
+ break;
+ }
+ /* otherwise, perform contiguous POSIX access */
+ }
+ else {
+ HDoff_t d_offset;
+ HDoff_t linear_dset_offset = 0;
+ int i, j, rc;
+
+ buf_offset[local_dim] = 0;
+
+ /* determine offset in the buffer */
+ for (i = 0; i < parms->rank; i++) {
+ d_offset = 1;
+
+ for (j = i + 1; j < parms->rank; j++)
+ d_offset *= (HDoff_t)parms->dset_size[j];
+
+ linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset;
+ }
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, linear_dset_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+ /* check if all bytes are written */
+ rc = ((ssize_t)cont_size == POSIXWRITE(fd->posixfd, buf_p, cont_size));
+ VRFY((rc != 0), "POSIXWRITE");
+
+ /* Advance location in buffer */
+ buf_p += cont_size;
+ }
+
+done:
+ return ret_code;
+}
+
+/*
+ * Function: do_read
+ * Purpose: Read the required amount of data to the file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+static herr_t
+do_read(results *res, file_descr *fd, parameters *parms, void *buffer)
+{
+ char * buffer2 = NULL; /* Buffer for data verification */
+ int ret_code = SUCCESS;
+ char dname[64];
+ int i;
+ size_t u;
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+ hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */
+ hsize_t h5block[MAX_DIMS]; /*dataspace selection */
+ hsize_t h5stride[MAX_DIMS]; /*selection stride */
+ hsize_t h5start[MAX_DIMS]; /*selection start */
+ int rank;
+
+ /* Allocate data verification buffer */
+ if (NULL == (buffer2 = (char *)malloc(linear_buf_size))) {
+ HDfprintf(stderr, "malloc for data verification buffer size (%zu) failed\n", linear_buf_size);
+ GOTOERROR(FAIL);
+ } /* end if */
+
+ /* Prepare buffer for verifying data */
+ for (u = 0; u < linear_buf_size; u++)
+ buffer2[u] = (char)(u % 128);
+
+ rank = parms->rank;
+ for (i = 0; i < rank; i++)
+ h5offset[i] = offset[i] = 0;
+
+ /* I/O Access specific setup */
+ switch (parms->io_type) {
+ case POSIXIO:
+ cont_dim = rank;
+
+ for (i = rank - 1; i >= 0; i--) {
+ if (parms->buf_size[i] == parms->dset_size[i])
+ cont_dim = i;
+ else
+ break;
+ }
+ cont_size = (!cont_dim) ? 1 : parms->buf_size[cont_dim - 1];
+ for (i = cont_dim; i < rank; i++)
+ cont_size *= parms->buf_size[i];
+
+ break;
+
+ case HDF5: /* HDF5 setup */
+ for (i = 0; i < rank; i++) {
+ h5dims[i] = parms->dset_size[i];
+ h5start[i] = 0;
+ h5stride[i] = 1;
+ h5block[i] = 1;
+ h5count[i] = parms->buf_size[i];
+ }
+
+ h5dset_space_id = H5Screate_simple(rank, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count, h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ h5mem_space_id = H5Screate_simple(rank, h5count, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+
+ /* Create the dataset transfer property list */
+ h5dxpl = H5Pcreate(H5P_DATASET_XFER);
+ if (h5dxpl < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ GOTOERROR(FAIL);
+ break;
+ } /* end switch */
+
+ /* create dataset */
+ switch (parms->io_type) {
+ case POSIXIO:
+ break;
+
+ case HDF5:
+ HDsprintf(dname, "Dataset_%ld", (long)parms->num_bytes);
+ h5ds_id = H5Dopen2(fd->h5fd, dname, H5P_DEFAULT);
+ if (h5ds_id < 0) {
+ HDfprintf(stderr, "HDF5 Dataset open failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ GOTOERROR(FAIL);
+ break;
+ } /* end switch */
+
+ /* Start "raw data" read timer */
+ io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
+ hrc = dset_read(rank - 1, fd, parms, buffer, buffer2);
+
+ if (hrc < 0) {
+ HDfprintf(stderr, "Error in dataset read\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Stop "raw data" read timer */
+ io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
+
+ /* Calculate read time */
+
+ /* Close dataset. Only HDF5 needs to do an explicit close. */
+ if (parms->io_type == HDF5) {
+ hrc = H5Dclose(h5ds_id);
+
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ h5ds_id = H5I_INVALID_HID;
+ } /* end if */
+
+done:
+
+ /* release HDF5 objects */
+ if (h5dset_space_id != -1) {
+ hrc = H5Sclose(h5dset_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dset_space_id = H5I_INVALID_HID;
+ }
+ }
+
+ if (h5mem_space_id != -1) {
+ hrc = H5Sclose(h5mem_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5mem_space_id = H5I_INVALID_HID;
+ }
+ }
+
+ if (h5dxpl != -1) {
+ hrc = H5Pclose(h5dxpl);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dxpl = H5I_INVALID_HID;
+ }
+ }
+
+ /* release generic resources */
+ if (buffer2)
+ free(buffer2);
+
+ return ret_code;
+}
+
+/*
+ * Function: dset_read
+ * Purpose: Read buffer into the dataset.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+
+static herr_t
+dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer, const char *buffer2)
+{
+ int cur_dim = order[local_dim] - 1;
+ hsize_t i;
+ int j;
+ herr_t hrc;
+ int ret_code = SUCCESS;
+
+ /* iterate on the current dimension */
+ for (i = 0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]) {
+
+ h5offset[cur_dim] = (hssize_t)i;
+ offset[cur_dim] = (HDoff_t)i;
+
+ /* if traverse in order array is incomplete, recurse */
+ if (local_dim > 0) {
+
+ ret_code = dset_read(local_dim - 1, fd, parms, buffer, buffer2);
+
+ /* otherwise, write buffer into dataset */
+ }
+ else {
+
+ switch (parms->io_type) {
+
+ case POSIXIO:
+ for (j = 0; j < parms->rank; j++) {
+ buf_offset[j] = 0;
+ }
+ buf_p = (unsigned char *)buffer;
+ posix_buffer_read(0, fd, parms, buffer);
+ break;
+
+ case HDF5:
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+ /* Read the buffer out */
+ hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dread");
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ HDassert(0 && "Unknown IO type");
+ break;
+ } /* switch (parms->io_type) */
+ }
+ }
+done:
+ return ret_code;
+}
+
+/*
+ * Function: posix_buffer_read
+ * Purpose: Read buffer into the POSIX file considering contiguity.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+
+static herr_t
+posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer)
+{
+ int ret_code = SUCCESS;
+
+ /* if local dimension is not contiguous, recurse */
+ if (local_dim < parms->rank - 1 && local_dim != cont_dim) {
+ size_t u;
+
+ for (u = 0; u < parms->buf_size[local_dim]; u++) {
+ buf_offset[local_dim] = u;
+ ret_code = posix_buffer_read(local_dim + 1, fd, parms, buffer);
+ if (local_dim + 1 == cont_dim)
+ break;
+ }
+ /* otherwise, perform contiguous POSIX access */
+ }
+ else {
+ HDoff_t d_offset;
+ HDoff_t linear_dset_offset = 0;
+ int i, j, rc;
+
+ buf_offset[local_dim] = 0;
+ /* determine offset in buffer */
+ for (i = 0; i < parms->rank; i++) {
+ d_offset = 1;
+
+ for (j = i + 1; j < parms->rank; j++)
+ d_offset *= (HDoff_t)parms->dset_size[j];
+
+ linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset;
+ }
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, linear_dset_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+ /* check if all bytes are read */
+ rc = ((ssize_t)cont_size == POSIXREAD(fd->posixfd, buf_p, cont_size));
+ VRFY((rc != 0), "POSIXREAD");
+
+ /* Advance location in buffer */
+ buf_p += cont_size;
+ }
+done:
+ return ret_code;
+}
+
+/*
+ * Function: do_fopen
+ * Purpose: Open the specified file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
+ * Modifications: Support for file drivers, Christian Chilan, April, 2008
+ */
+static herr_t
+do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
+{
+ int ret_code = SUCCESS;
+ hid_t fcpl;
+
+ switch (param->io_type) {
+ case POSIXIO:
+ if (flags & (SIO_CREATE | SIO_WRITE))
+ fd->posixfd = POSIXCREATE(fname);
+ else
+ fd->posixfd = POSIXOPEN(fname, O_RDONLY);
+
+ if (fd->posixfd < 0) {
+ HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+
+ break;
+
+ case HDF5:
+
+ fapl = set_vfd(param);
+
+ if (fapl < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ if (param->page_size) {
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1);
+ H5Pset_file_space_page_size(fcpl, param->page_size);
+ if (param->page_buffer_size)
+ H5Pset_page_buffer_size(fapl, param->page_buffer_size, 0, 0);
+ }
+
+ /* create the parallel file */
+ if (flags & (SIO_CREATE | SIO_WRITE)) {
+ fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl);
+ }
+ else {
+ fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, fapl);
+ }
+
+ if (fd->h5fd < 0) {
+ HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)param->io_type);
+ GOTOERROR(FAIL);
+ break;
+ }
+
+done:
+ return ret_code;
+}
+
+/*
+ * Function: set_vfd
+ * Purpose: Sets file driver.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+
+hid_t
+set_vfd(parameters *param)
+{
+ hid_t my_fapl = H5I_INVALID_HID;
+ vfdtype vfd;
+
+ vfd = param->vfd;
+
+ if ((my_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ return -1;
+
+ if (vfd == sec2) {
+ /* Unix read() and write() system calls */
+ if (H5Pset_fapl_sec2(my_fapl) < 0)
+ return -1;
+ }
+ else if (vfd == stdio) {
+ /* Standard C fread() and fwrite() system calls */
+ if (H5Pset_fapl_stdio(my_fapl) < 0)
+ return -1;
+ }
+ else if (vfd == core) {
+ /* In-core temporary file with 1MB increment */
+ if (H5Pset_fapl_core(my_fapl, (size_t)1024 * 1024, TRUE) < 0)
+ return -1;
+ }
+ else if (vfd == split) {
+ /* Split meta data and raw data each using default driver */
+ if (H5Pset_fapl_split(my_fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0)
+ return -1;
+ }
+ else if (vfd == multi) {
+ /* Multi-file driver, general case of the split driver */
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
+ const char *memb_name[H5FD_MEM_NTYPES];
+ char sv[H5FD_MEM_NTYPES][1024];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ H5FD_mem_t mt;
+
+ HDmemset(memb_map, 0, sizeof memb_map);
+ HDmemset(memb_fapl, 0, sizeof memb_fapl);
+ HDmemset(memb_name, 0, sizeof memb_name);
+ HDmemset(memb_addr, 0, sizeof memb_addr);
+
+ HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
+ memb_fapl[mt] = H5P_DEFAULT;
+ HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
+ memb_name[mt] = sv[mt];
+ memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
+ }
+
+ if (H5Pset_fapl_multi(my_fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) {
+ return -1;
+ }
+ }
+ else if (vfd == family) {
+ hsize_t fam_size = 1 * 1024 * 1024; /*100 MB*/
+
+ /* Family of files, each 1MB and using the default driver */
+ /* if ((val=HDstrtok(NULL, " \t\n\r")))
+ fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); */
+ if (H5Pset_fapl_family(my_fapl, fam_size, H5P_DEFAULT) < 0)
+ return -1;
+ }
+ else if (vfd == direct) {
+#ifdef H5_HAVE_DIRECT
+ /* Linux direct read() and write() system calls. Set memory boundary, file block size,
+ * and copy buffer size to the default values. */
+ if (H5Pset_fapl_direct(my_fapl, 1024, 4096, 8 * 4096) < 0)
+ return -1;
+#endif
+ }
+ else {
+ /* Unknown driver */
+ return -1;
+ }
+
+ return my_fapl;
+}
+
+/*
+ * Function: do_fclose
+ * Purpose: Close the specified file descriptor.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
+ * Modifications:
+ */
+static herr_t
+do_fclose(iotype iot, file_descr *fd /*out*/)
+{
+ herr_t ret_code = SUCCESS, hrc;
+ int rc = 0;
+
+ switch (iot) {
+ case POSIXIO:
+ rc = POSIXCLOSE(fd->posixfd);
+
+ if (rc != 0) {
+ HDfprintf(stderr, "POSIX File Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->posixfd = -1;
+ break;
+
+ case HDF5:
+ hrc = H5Fclose(fd->h5fd);
+
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 File Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->h5fd = -1;
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
+ GOTOERROR(FAIL);
+ break;
+ }
+
+done:
+ return ret_code;
+}
+
+/*
+ * Function: do_cleanupfile
+ * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set.
+ * Return: void
+ * Programmer: Albert Cheng 2001/12/12
+ * Modifications: Support for file drivers. Christian Chilan, April, 2008
+ */
+static void
+do_cleanupfile(iotype iot, char *filename)
+{
+ char temp[2048];
+ int j;
+ hid_t driver;
+
+ if (clean_file_g == -1)
+ clean_file_g = (HDgetenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0;
+
+ if (clean_file_g) {
+
+ switch (iot) {
+ case POSIXIO:
+ HDremove(filename);
+ break;
+
+ case HDF5:
+ driver = H5Pget_driver(fapl);
+
+ if (driver == H5FD_FAMILY) {
+ for (j = 0; /*void*/; j++) {
+ HDsnprintf(temp, sizeof temp, filename, j);
+
+ if (HDaccess(temp, F_OK) < 0)
+ break;
+
+ HDremove(temp);
+ }
+ }
+ else if (driver == H5FD_CORE) {
+ hbool_t backing; /* Whether the core file has backing store */
+
+ H5Pget_fapl_core(fapl, NULL, &backing);
+
+ /* If the file was stored to disk with bacing store, remove it */
+ if (backing)
+ HDremove(filename);
+ }
+ else if (driver == H5FD_MULTI) {
+ H5FD_mem_t mt;
+ assert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
+
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
+ HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]);
+ HDremove(temp); /*don't care if it fails*/
+ }
+ }
+ else {
+ HDremove(filename);
+ }
+ H5Pclose(fapl);
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
+ HDassert(0 && "Unknown IO type");
+ break;
+ }
+ }
+}
diff --git a/tools/test/perform/sio_perf.c b/tools/src/h5perf/sio_perf.c
index d2eb3fc..1b200b0 100644
--- a/tools/test/perform/sio_perf.c
+++ b/tools/src/h5perf/sio_perf.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -51,42 +51,41 @@
#include "hdf5.h"
-
/* our header files */
#include "sio_perf.h"
/* useful macros */
-#define TAB_SPACE 4
+#define TAB_SPACE 4
-#define ONE_KB 1024
-#define ONE_MB (ONE_KB * ONE_KB)
-#define ONE_GB (ONE_MB * ONE_KB)
+#define ONE_KB 1024
+#define ONE_MB (ONE_KB * ONE_KB)
+#define ONE_GB (ONE_MB * ONE_KB)
-#define SIO_POSIX 0x1
-#define SIO_HDF5 0x4
+#define SIO_POSIX 0x1
+#define SIO_HDF5 0x4
/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) (H5_DBL_ABS_EQUAL(t, (double)0.0F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t)))
+#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL(t, 0.0) ? 0.0 : ((((double)(bytes)) / (double)ONE_MB) / (t)))
#ifndef TRUE
-#define TRUE 1
-#endif /* TRUE */
+#define TRUE 1
+#endif /* TRUE */
#ifndef FALSE
-#define FALSE (!TRUE)
-#endif /* FALSE */
+#define FALSE (!TRUE)
+#endif /* FALSE */
/* global variables */
-FILE *output; /* output file */
-int sio_debug_level = 0;/* The debug level:
- * 0 - Off
- * 1 - Minimal
- * 2 - Some more
- * 3 - Maximal
- * 4 - Maximal & then some
- */
+FILE *output; /* output file */
+int sio_debug_level = 0; /* The debug level:
+ * 0 - Off
+ * 1 - Minimal
+ * 2 - Some more
+ * 3 - Maximal
+ * 4 - Maximal & then some
+ */
/* local variables */
-static const char *progname = "h5perf_serial";
+static const char *progname = "h5perf_serial";
/*
* Command-line options: The user can specify short or long-named
@@ -98,219 +97,81 @@ static const char *progname = "h5perf_serial";
* It seems that only the options that accept additional information
* such as dataset size (-e) require the colon next to it.
*/
-static const char *s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:";
-static struct long_options l_opts[] = {
- { "align", require_arg, 'a' },
- { "alig", require_arg, 'a' },
- { "ali", require_arg, 'a' },
- { "al", require_arg, 'a' },
- { "api", require_arg, 'A' },
- { "ap", require_arg, 'A' },
+static const char * s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:";
+static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'},
+ {"api", require_arg, 'A'},
#if 0
/* a sighting of the elusive binary option */
{ "binary", no_arg, 'b' },
- { "binar", no_arg, 'b' },
- { "bina", no_arg, 'b' },
- { "bin", no_arg, 'b' },
- { "bi", no_arg, 'b' },
-#endif /* 0 */
- { "block-size", require_arg, 'B' },
- { "block-siz", require_arg, 'B' },
- { "block-si", require_arg, 'B' },
- { "block-s", require_arg, 'B' },
- { "block-", require_arg, 'B' },
- { "block", require_arg, 'B' },
- { "bloc", require_arg, 'B' },
- { "blo", require_arg, 'B' },
- { "bl", require_arg, 'B' },
- { "chunk", no_arg, 'c' },
- { "chun", no_arg, 'c' },
- { "chu", no_arg, 'c' },
- { "ch", no_arg, 'c' },
- { "collective", no_arg, 'C' },
- { "collectiv", no_arg, 'C' },
- { "collecti", no_arg, 'C' },
- { "collect", no_arg, 'C' },
- { "collec", no_arg, 'C' },
- { "colle", no_arg, 'C' },
- { "coll", no_arg, 'C' },
- { "col", no_arg, 'C' },
- { "co", no_arg, 'C' },
- { "debug", require_arg, 'D' },
- { "debu", require_arg, 'D' },
- { "deb", require_arg, 'D' },
- { "de", require_arg, 'D' },
- { "file-driver", require_arg, 'v' },
- { "file-drive", require_arg, 'v' },
- { "file-driv", require_arg, 'v' },
- { "file-dri", require_arg, 'v' },
- { "file-dr", require_arg, 'v' },
- { "file-d", require_arg, 'v' },
- { "file-", require_arg, 'v' },
- { "file", require_arg, 'v' },
- { "fil", require_arg, 'v' },
- { "fi", require_arg, 'v' },
- { "geometry", no_arg, 'g' },
- { "geometr", no_arg, 'g' },
- { "geomet", no_arg, 'g' },
- { "geome", no_arg, 'g' },
- { "geom", no_arg, 'g' },
- { "geo", no_arg, 'g' },
- { "ge", no_arg, 'g' },
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h' },
- { "he", no_arg, 'h' },
- { "interleaved", require_arg, 'I' },
- { "interleave", require_arg, 'I' },
- { "interleav", require_arg, 'I' },
- { "interlea", require_arg, 'I' },
- { "interle", require_arg, 'I' },
- { "interl", require_arg, 'I' },
- { "inter", require_arg, 'I' },
- { "inte", require_arg, 'I' },
- { "int", require_arg, 'I' },
- { "in", require_arg, 'I' },
- { "max-num-processes", require_arg, 'P' },
- { "max-num-processe", require_arg, 'P' },
- { "max-num-process", require_arg, 'P' },
- { "max-num-proces", require_arg, 'P' },
- { "max-num-proce", require_arg, 'P' },
- { "max-num-proc", require_arg, 'P' },
- { "max-num-pro", require_arg, 'P' },
- { "max-num-pr", require_arg, 'P' },
- { "max-num-p", require_arg, 'P' },
- { "min-num-processes", require_arg, 'p' },
- { "min-num-processe", require_arg, 'p' },
- { "min-num-process", require_arg, 'p' },
- { "min-num-proces", require_arg, 'p' },
- { "min-num-proce", require_arg, 'p' },
- { "min-num-proc", require_arg, 'p' },
- { "min-num-pro", require_arg, 'p' },
- { "min-num-pr", require_arg, 'p' },
- { "min-num-p", require_arg, 'p' },
- { "max-xfer-size", require_arg, 'X' },
- { "max-xfer-siz", require_arg, 'X' },
- { "max-xfer-si", require_arg, 'X' },
- { "max-xfer-s", require_arg, 'X' },
- { "max-xfer", require_arg, 'X' },
- { "max-xfe", require_arg, 'X' },
- { "max-xf", require_arg, 'X' },
- { "max-x", require_arg, 'X' },
- { "min-xfer-size", require_arg, 'x' },
- { "min-xfer-siz", require_arg, 'x' },
- { "min-xfer-si", require_arg, 'x' },
- { "min-xfer-s", require_arg, 'x' },
- { "min-xfer", require_arg, 'x' },
- { "min-xfe", require_arg, 'x' },
- { "min-xf", require_arg, 'x' },
- { "min-x", require_arg, 'x' },
- { "num-bytes", require_arg, 'e' },
- { "num-byte", require_arg, 'e' },
- { "num-byt", require_arg, 'e' },
- { "num-by", require_arg, 'e' },
- { "num-b", require_arg, 'e' },
- { "num-dsets", require_arg, 'd' },
- { "num-dset", require_arg, 'd' },
- { "num-dse", require_arg, 'd' },
- { "num-ds", require_arg, 'd' },
- { "num-d", require_arg, 'd' },
- { "num-files", require_arg, 'F' },
- { "num-file", require_arg, 'F' },
- { "num-fil", require_arg, 'F' },
- { "num-fi", require_arg, 'F' },
- { "num-f", require_arg, 'F' },
- { "num-iterations", require_arg, 'i' },
- { "num-iteration", require_arg, 'i' },
- { "num-iteratio", require_arg, 'i' },
- { "num-iterati", require_arg, 'i' },
- { "num-iterat", require_arg, 'i' },
- { "num-itera", require_arg, 'i' },
- { "num-iter", require_arg, 'i' },
- { "num-ite", require_arg, 'i' },
- { "num-it", require_arg, 'i' },
- { "num-i", require_arg, 'i' },
- { "order", require_arg, 'r' },
- { "orde", require_arg, 'r' },
- { "ord", require_arg, 'r' },
- { "or", require_arg, 'r' },
- { "output", require_arg, 'o' },
- { "outpu", require_arg, 'o' },
- { "outp", require_arg, 'o' },
- { "out", require_arg, 'o' },
- { "ou", require_arg, 'o' },
- { "extendable", no_arg, 't' },
- { "extendabl", no_arg, 't' },
- { "extendab", no_arg, 't' },
- { "extenda", no_arg, 't' },
- { "extend", no_arg, 't' },
- { "exten", no_arg, 't' },
- { "exte", no_arg, 't' },
- { "ext", no_arg, 't' },
- { "ex", no_arg, 't' },
- { "threshold", require_arg, 'T' },
- { "threshol", require_arg, 'T' },
- { "thresho", require_arg, 'T' },
- { "thresh", require_arg, 'T' },
- { "thres", require_arg, 'T' },
- { "thre", require_arg, 'T' },
- { "thr", require_arg, 'T' },
- { "th", require_arg, 'T' },
- { "write-only", require_arg, 'w' },
- { "write-onl", require_arg, 'w' },
- { "write-on", require_arg, 'w' },
- { "write-o", require_arg, 'w' },
- { "write", require_arg, 'w' },
- { "writ", require_arg, 'w' },
- { "wri", require_arg, 'w' },
- { "wr", require_arg, 'w' },
- { NULL, 0, '\0' }
-};
+#endif /* 0 */
+ {"block-size", require_arg, 'B'},
+ {"chunk", no_arg, 'c'},
+ {"collective", no_arg, 'C'},
+ {"debug", require_arg, 'D'},
+ {"file-driver", require_arg, 'v'},
+ {"geometry", no_arg, 'g'},
+ {"help", no_arg, 'h'},
+ {"interleaved", require_arg, 'I'},
+ {"max-num-processes", require_arg, 'P'},
+ {"min-num-processes", require_arg, 'p'},
+ {"max-xfer-size", require_arg, 'X'},
+ {"min-xfer-size", require_arg, 'x'},
+ {"num-bytes", require_arg, 'e'},
+ {"num-dsets", require_arg, 'd'},
+ {"num-files", require_arg, 'F'},
+ {"num-iterations", require_arg, 'i'},
+ {"order", require_arg, 'r'},
+ {"output", require_arg, 'o'},
+ {"extendable", no_arg, 't'},
+ {"threshold", require_arg, 'T'},
+ {"write-only", require_arg, 'w'},
+ {NULL, 0, '\0'}};
struct options {
- long io_types; /* bitmask of which I/O types to test */
- const char *output_file; /* file to print report to */
- long num_dsets; /* number of datasets */
- long num_files; /* number of files */
- off_t num_bpp; /* number of bytes per proc per dset */
- int num_iters; /* number of iterations */
- hsize_t dset_size[MAX_DIMS]; /* Dataset size */
- size_t buf_size[MAX_DIMS]; /* Buffer size */
- size_t chk_size[MAX_DIMS]; /* Chunk size */
- int order[MAX_DIMS]; /* Dimension access order */
- int dset_rank; /* Rank */
- int buf_rank; /* Rank */
- int order_rank; /* Rank */
- int chk_rank; /* Rank */
- int print_times; /* print times as well as throughputs */
- int print_raw; /* print raw data throughput info */
- hsize_t h5_alignment; /* alignment in HDF5 file */
- hsize_t h5_threshold; /* threshold for alignment in HDF5 file */
- int h5_use_chunks; /* Make HDF5 dataset chunked */
- int h5_write_only; /* Perform the write tests only */
- int h5_extendable; /* Perform the write tests only */
- int verify; /* Verify data correctness */
- vfdtype vfd; /* File driver */
- size_t page_buffer_size;
- size_t page_size;
+ long io_types; /* bitmask of which I/O types to test */
+ const char *output_file; /* file to print report to */
+ long num_dsets; /* number of datasets */
+ long num_files; /* number of files */
+ off_t num_bpp; /* number of bytes per proc per dset */
+ int num_iters; /* number of iterations */
+ hsize_t dset_size[MAX_DIMS]; /* Dataset size */
+ size_t buf_size[MAX_DIMS]; /* Buffer size */
+ size_t chk_size[MAX_DIMS]; /* Chunk size */
+ int order[MAX_DIMS]; /* Dimension access order */
+ int dset_rank; /* Rank */
+ int buf_rank; /* Rank */
+ int order_rank; /* Rank */
+ int chk_rank; /* Rank */
+ int print_times; /* print times as well as throughputs */
+ int print_raw; /* print raw data throughput info */
+ hsize_t h5_alignment; /* alignment in HDF5 file */
+ hsize_t h5_threshold; /* threshold for alignment in HDF5 file */
+ int h5_use_chunks; /* Make HDF5 dataset chunked */
+ int h5_write_only; /* Perform the write tests only */
+ int h5_extendable; /* Perform the write tests only */
+ int verify; /* Verify data correctness */
+ vfdtype vfd; /* File driver */
+ size_t page_buffer_size;
+ size_t page_size;
};
-typedef struct _minmax {
+typedef struct {
double min;
double max;
double sum;
- int num;
+ int num;
} minmax;
/* local functions */
-static hsize_t parse_size_directive(const char *size);
+static hsize_t parse_size_directive(const char *size);
static struct options *parse_command_line(int argc, const char *argv[]);
-static void run_test_loop(struct options *options);
-static int run_test(iotype iot, parameters parms, struct options *opts);
-static void output_all_info(minmax *mm, int count, int indent_level);
-static void get_minmax(minmax *mm, double val);
-static void accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm);
-static void output_results(const struct options *options, const char *name,
- minmax *table, int table_size, off_t data_size);
+static void run_test_loop(struct options *options);
+static int run_test(iotype iot, parameters parms, struct options *opts);
+static void output_all_info(minmax *mm, int count, int indent_level);
+static void get_minmax(minmax *mm, double val);
+static void accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm);
+static void output_results(const struct options *options, const char *name, minmax *table, int table_size,
+ off_t data_size);
static void output_report(const char *fmt, ...);
static void print_indent(register int indent);
static void usage(const char *prog);
@@ -326,8 +187,8 @@ static void report_parameters(struct options *opts);
int
main(int argc, const char *argv[])
{
- int exit_value = EXIT_SUCCESS;
- struct options *opts = NULL;
+ int exit_value = EXIT_SUCCESS;
+ struct options *opts = NULL;
#ifndef STANDALONE
/* Initialize h5tools lib */
@@ -389,35 +250,35 @@ run_test_loop(struct options *opts)
size_t buf_bytes;
/* load options into parameter structure */
- parms.num_files = opts->num_files;
- parms.num_dsets = opts->num_dsets;
- parms.num_iters = opts->num_iters;
- parms.rank = opts->dset_rank;
- parms.h5_align = opts->h5_alignment;
- parms.h5_thresh = opts->h5_threshold;
- parms.h5_use_chunks = opts->h5_use_chunks;
- parms.h5_extendable = opts->h5_extendable;
- parms.h5_write_only = opts->h5_write_only;
- parms.verify = opts->verify;
- parms.vfd = opts->vfd;
+ parms.num_files = opts->num_files;
+ parms.num_dsets = opts->num_dsets;
+ parms.num_iters = opts->num_iters;
+ parms.rank = opts->dset_rank;
+ parms.h5_align = opts->h5_alignment;
+ parms.h5_thresh = opts->h5_threshold;
+ parms.h5_use_chunks = opts->h5_use_chunks;
+ parms.h5_extendable = opts->h5_extendable;
+ parms.h5_write_only = opts->h5_write_only;
+ parms.verify = opts->verify;
+ parms.vfd = opts->vfd;
parms.page_buffer_size = opts->page_buffer_size;
- parms.page_size = opts->page_size;
+ parms.page_size = opts->page_size;
/* load multidimensional options */
parms.num_bytes = 1;
- buf_bytes = 1;
- for (i=0; i<parms.rank; i++){
- parms.buf_size[i] = opts->buf_size[i];
+ buf_bytes = 1;
+ for (i = 0; i < parms.rank; i++) {
+ parms.buf_size[i] = opts->buf_size[i];
parms.dset_size[i] = opts->dset_size[i];
- parms.chk_size[i] = opts->chk_size[i];
- parms.order[i] = opts->order[i];
+ parms.chk_size[i] = opts->chk_size[i];
+ parms.order[i] = opts->order[i];
parms.num_bytes *= opts->dset_size[i];
buf_bytes *= opts->buf_size[i];
}
/* print size information */
output_report("Transfer Buffer Size (bytes): %d\n", buf_bytes);
- output_report("File Size(MB): %.2f\n",((double)parms.num_bytes) / ONE_MB);
+ output_report("File Size(MB): %.2f\n", ((double)parms.num_bytes) / ONE_MB);
print_indent(0);
if (opts->io_types & SIO_POSIX)
@@ -438,27 +299,27 @@ run_test_loop(struct options *opts)
static int
run_test(iotype iot, parameters parms, struct options *opts)
{
- results res;
- register int i, ret_value = SUCCESS;
- off_t raw_size;
- minmax *write_sys_mm_table=NULL;
- minmax *write_mm_table=NULL;
- minmax *write_gross_mm_table=NULL;
- minmax *write_raw_mm_table=NULL;
- minmax *read_sys_mm_table=NULL;
- minmax *read_mm_table=NULL;
- minmax *read_gross_mm_table=NULL;
- minmax *read_raw_mm_table=NULL;
- minmax write_sys_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax write_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax write_gross_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax write_raw_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax read_sys_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax read_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax read_gross_mm = {0.0F, 0.0F, 0.0F, 0};
- minmax read_raw_mm = {0.0F, 0.0F, 0.0F, 0};
-
- raw_size = (off_t)parms.num_bytes;
+ results res;
+ register int i, ret_value = SUCCESS;
+ off_t raw_size;
+ minmax * write_sys_mm_table = NULL;
+ minmax * write_mm_table = NULL;
+ minmax * write_gross_mm_table = NULL;
+ minmax * write_raw_mm_table = NULL;
+ minmax * read_sys_mm_table = NULL;
+ minmax * read_mm_table = NULL;
+ minmax * read_gross_mm_table = NULL;
+ minmax * read_raw_mm_table = NULL;
+ minmax write_sys_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax write_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax write_gross_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax write_raw_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax read_sys_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax read_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax read_gross_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax read_raw_mm = {0.0F, 0.0F, 0.0F, 0};
+
+ raw_size = (off_t)parms.num_bytes;
parms.io_type = iot;
print_indent(2);
output_report("IO API = ");
@@ -479,16 +340,16 @@ run_test(iotype iot, parameters parms, struct options *opts)
/* allocate space for tables minmax and that it is sufficient */
/* to initialize all elements to zeros by calloc. */
- write_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
- write_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
- write_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
- write_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
+ write_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax));
+ write_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax));
+ write_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax));
+ write_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax));
if (!parms.h5_write_only) {
- read_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
- read_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
- read_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
- read_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
+ read_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax));
+ read_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax));
+ read_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax));
+ read_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters, sizeof(minmax));
}
/* Do IO iteration times, collecting statistics each time */
@@ -563,7 +424,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_all_info(write_raw_mm_table, parms.num_iters, 4);
}
- output_results(opts,"Raw Data Write",write_raw_mm_table,parms.num_iters,raw_size);
+ output_results(opts, "Raw Data Write", write_raw_mm_table, parms.num_iters, raw_size);
} /* end if */
/* show sys write statics */
@@ -585,7 +446,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_all_info(write_mm_table, parms.num_iters, 4);
}
- output_results(opts,"Write",write_mm_table,parms.num_iters,raw_size);
+ output_results(opts, "Write", write_mm_table, parms.num_iters, raw_size);
/* accumulate and output the max, min, and average "gross write" times */
if (sio_debug_level >= 3) {
@@ -595,7 +456,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_all_info(write_gross_mm_table, parms.num_iters, 4);
}
- output_results(opts,"Write Open-Close",write_gross_mm_table,parms.num_iters,raw_size);
+ output_results(opts, "Write Open-Close", write_gross_mm_table, parms.num_iters, raw_size);
if (!parms.h5_write_only) {
/* Read statistics */
@@ -609,8 +470,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_all_info(read_raw_mm_table, parms.num_iters, 4);
}
- output_results(opts, "Raw Data Read", read_raw_mm_table,
- parms.num_iters, raw_size);
+ output_results(opts, "Raw Data Read", read_raw_mm_table, parms.num_iters, raw_size);
} /* end if */
/* show mpi read statics */
@@ -642,8 +502,7 @@ run_test(iotype iot, parameters parms, struct options *opts)
output_all_info(read_gross_mm_table, parms.num_iters, 4);
}
- output_results(opts, "Read Open-Close", read_gross_mm_table,
- parms.num_iters, raw_size);
+ output_results(opts, "Read Open-Close", read_gross_mm_table, parms.num_iters, raw_size);
}
/* clean up our mess */
@@ -733,7 +592,6 @@ accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm)
}
}
-
/*
* Function: output_results
* Purpose: Print information about the time & bandwidth for a given
@@ -743,36 +601,34 @@ accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm)
* Modifications:
*/
static void
-output_results(const struct options *opts, const char *name, minmax *table,
- int table_size,off_t data_size)
+output_results(const struct options *opts, const char *name, minmax *table, int table_size, off_t data_size)
{
- minmax total_mm;
+ minmax total_mm;
accumulate_minmax_stuff(table, table_size, &total_mm);
print_indent(3);
- output_report("%s (%d iteration(s)):\n", name,table_size);
+ output_report("%s (%d iteration(s)):\n", name, table_size);
/* Note: The maximum throughput uses the minimum amount of time & vice versa */
print_indent(4);
- output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size,total_mm.min));
- if(opts->print_times)
+ output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.min));
+ if (opts->print_times)
output_report(" (%7.3f s)\n", total_mm.min);
else
output_report("\n");
print_indent(4);
- output_report("Average Throughput: %6.2f MB/s",
- MB_PER_SEC(data_size,total_mm.sum / total_mm.num));
- if(opts->print_times)
+ output_report("Average Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.sum / total_mm.num));
+ if (opts->print_times)
output_report(" (%7.3f s)\n", (total_mm.sum / total_mm.num));
else
output_report("\n");
print_indent(4);
- output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size,total_mm.max));
- if(opts->print_times)
+ output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.max));
+ if (opts->print_times)
output_report(" (%7.3f s)\n", total_mm.max);
else
output_report("\n");
@@ -788,11 +644,11 @@ output_results(const struct options *opts, const char *name, minmax *table,
static void
output_report(const char *fmt, ...)
{
- va_list ap;
+ va_list ap;
- HDva_start(ap, fmt);
- HDvfprintf(output, fmt, ap);
- HDva_end(ap);
+ HDva_start(ap, fmt);
+ HDvfprintf(output, fmt, ap);
+ HDva_end(ap);
}
/*
@@ -818,14 +674,28 @@ recover_size_and_print(long long val, const char *end)
if (val >= ONE_KB && (val % ONE_KB) == 0) {
if (val >= ONE_MB && (val % ONE_MB) == 0) {
if (val >= ONE_GB && (val % ONE_GB) == 0)
- HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""GB%s", val / ONE_GB, end);
+ HDfprintf(output,
+ "%" H5_PRINTF_LL_WIDTH "d"
+ "GB%s",
+ val / ONE_GB, end);
else
- HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""MB%s", val / ONE_MB, end);
- } else {
- HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""KB%s", val / ONE_KB, end);
+ HDfprintf(output,
+ "%" H5_PRINTF_LL_WIDTH "d"
+ "MB%s",
+ val / ONE_MB, end);
+ }
+ else {
+ HDfprintf(output,
+ "%" H5_PRINTF_LL_WIDTH "d"
+ "KB%s",
+ val / ONE_KB, end);
}
- } else {
- HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""%s", val, end);
+ }
+ else {
+ HDfprintf(output,
+ "%" H5_PRINTF_LL_WIDTH "d"
+ "%s",
+ val, end);
}
}
@@ -833,9 +703,9 @@ static void
print_io_api(long io_types)
{
if (io_types & SIO_POSIX)
- HDfprintf(output, "posix ");
+ HDfprintf(output, "posix ");
if (io_types & SIO_HDF5)
- HDfprintf(output, "hdf5 ");
+ HDfprintf(output, "hdf5 ");
HDfprintf(output, "\n");
}
@@ -845,31 +715,29 @@ report_parameters(struct options *opts)
int i, rank;
rank = opts->dset_rank;
- print_version("HDF5 Library"); /* print library version */
+ print_version("HDF5 Library"); /* print library version */
HDfprintf(output, "==== Parameters ====\n");
HDfprintf(output, "IO API=");
print_io_api(opts->io_types);
- HDfprintf(output, "Number of iterations=%d\n",
- opts->num_iters);
+ HDfprintf(output, "Number of iterations=%d\n", opts->num_iters);
HDfprintf(output, "Dataset size=");
- for (i=0; i<rank; i++)
+ for (i = 0; i < rank; i++)
recover_size_and_print((long long)opts->dset_size[i], " ");
HDfprintf(output, "\n");
-
HDfprintf(output, "Transfer buffer size=");
- for (i=0; i<rank; i++)
+ for (i = 0; i < rank; i++)
recover_size_and_print((long long)opts->buf_size[i], " ");
HDfprintf(output, "\n");
- if(opts->page_size) {
- HDfprintf(output, "Page Aggregation Enabled. Page size = %ld\n", opts->page_size);
- if(opts->page_buffer_size)
- HDfprintf(output, "Page Buffering Enabled. Page Buffer size = %ld\n", opts->page_buffer_size);
+ if (opts->page_size) {
+ HDfprintf(output, "Page Aggregation Enabled. Page size = %zu\n", opts->page_size);
+ if (opts->page_buffer_size)
+ HDfprintf(output, "Page Buffering Enabled. Page Buffer size = %zu\n", opts->page_buffer_size);
else
HDfprintf(output, "Page Buffering Disabled\n");
}
@@ -877,7 +745,7 @@ report_parameters(struct options *opts)
HDfprintf(output, "Page Aggregation Disabled\n");
HDfprintf(output, "Dimension access order=");
- for (i=0; i<rank; i++)
+ for (i = 0; i < rank; i++)
recover_size_and_print((long long)opts->order[i], " ");
HDfprintf(output, "\n");
@@ -885,11 +753,11 @@ report_parameters(struct options *opts)
HDfprintf(output, "HDF5 data storage method=");
- if (opts->h5_use_chunks){
+ if (opts->h5_use_chunks) {
HDfprintf(output, "Chunked\n");
HDfprintf(output, "HDF5 chunk size=");
- for (i=0; i<rank; i++)
+ for (i = 0; i < rank; i++)
recover_size_and_print((long long)opts->chk_size[i], " ");
HDfprintf(output, "\n");
@@ -906,19 +774,25 @@ report_parameters(struct options *opts)
}
HDfprintf(output, "HDF5 file driver=");
- if (opts->vfd==sec2) {
+ if (opts->vfd == sec2) {
HDfprintf(output, "sec2\n");
- } else if (opts->vfd==stdio) {
+ }
+ else if (opts->vfd == stdio) {
HDfprintf(output, "stdio\n");
- } else if (opts->vfd==core) {
+ }
+ else if (opts->vfd == core) {
HDfprintf(output, "core\n");
- } else if (opts->vfd==split) {
+ }
+ else if (opts->vfd == split) {
HDfprintf(output, "split\n");
- } else if (opts->vfd==multi) {
+ }
+ else if (opts->vfd == multi) {
HDfprintf(output, "multi\n");
- } else if (opts->vfd==family) {
+ }
+ else if (opts->vfd == family) {
HDfprintf(output, "family\n");
- } else if (opts->vfd==direct) {
+ }
+ else if (opts->vfd == direct) {
HDfprintf(output, "direct\n");
}
}
@@ -926,8 +800,7 @@ report_parameters(struct options *opts)
{
char *prefix = HDgetenv("HDF5_PREFIX");
- HDfprintf(output, "Env HDF5_PREFIX=%s\n",
- (prefix ? prefix : "not set"));
+ HDfprintf(output, "Env HDF5_PREFIX=%s\n", (prefix ? prefix : "not set"));
}
HDfprintf(output, "==== End of Parameters ====\n");
@@ -946,58 +819,57 @@ report_parameters(struct options *opts)
static struct options *
parse_command_line(int argc, const char *argv[])
{
- int opt;
+ int opt;
struct options *cl_opts;
- int i, default_rank, actual_rank, ranks[4];
+ int i, default_rank, actual_rank, ranks[4];
cl_opts = (struct options *)HDmalloc(sizeof(struct options));
cl_opts->page_buffer_size = 0;
- cl_opts->page_size = 0;
+ cl_opts->page_size = 0;
cl_opts->output_file = NULL;
- cl_opts->io_types = 0; /* will set default after parsing options */
- cl_opts->num_iters = 1;
+ cl_opts->io_types = 0; /* will set default after parsing options */
+ cl_opts->num_iters = 1;
default_rank = 2;
- cl_opts->dset_rank = 0;
- cl_opts->buf_rank = 0;
- cl_opts->chk_rank = 0;
+ cl_opts->dset_rank = 0;
+ cl_opts->buf_rank = 0;
+ cl_opts->chk_rank = 0;
cl_opts->order_rank = 0;
- for(i = 0; i < MAX_DIMS; i++) {
- cl_opts->buf_size[i] = (size_t)((i + 1) * 10);
+ for (i = 0; i < MAX_DIMS; i++) {
+ cl_opts->buf_size[i] = (size_t)((i + 1) * 10);
cl_opts->dset_size[i] = (hsize_t)((i + 1) * 100);
- cl_opts->chk_size[i] = (size_t)((i + 1) * 10);
- cl_opts->order[i] = i + 1;
+ cl_opts->chk_size[i] = (size_t)((i + 1) * 10);
+ cl_opts->order[i] = i + 1;
}
cl_opts->vfd = sec2;
- cl_opts->print_times = FALSE; /* Printing times is off by default */
- cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */
- cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */
- cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */
+ cl_opts->print_times = FALSE; /* Printing times is off by default */
+ cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */
+ cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */
+ cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */
cl_opts->h5_use_chunks = FALSE; /* Don't chunk the HDF5 dataset by default */
cl_opts->h5_write_only = FALSE; /* Do both read and write by default */
cl_opts->h5_extendable = FALSE; /* Use extendable dataset */
- cl_opts->verify = FALSE; /* No Verify data correctness by default */
+ cl_opts->verify = FALSE; /* No Verify data correctness by default */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
- case 'a':
- cl_opts->h5_alignment = parse_size_directive(opt_arg);
- break;
- case 'G':
- cl_opts->page_size = parse_size_directive(opt_arg);
- break;
- case 'b':
- cl_opts->page_buffer_size = parse_size_directive(opt_arg);
- break;
- case 'A':
- {
- const char *end = opt_arg;
+ case 'a':
+ cl_opts->h5_alignment = parse_size_directive(H5_optarg);
+ break;
+ case 'G':
+ cl_opts->page_size = parse_size_directive(H5_optarg);
+ break;
+ case 'b':
+ cl_opts->page_buffer_size = parse_size_directive(H5_optarg);
+ break;
+ case 'A': {
+ const char *end = H5_optarg;
while (end && *end != '\0') {
char buf[10];
@@ -1009,11 +881,12 @@ parse_command_line(int argc, const char *argv[])
if (!HDstrcasecmp(buf, "hdf5")) {
cl_opts->io_types |= SIO_HDF5;
- } else if (!HDstrcasecmp(buf, "posix")) {
+ }
+ else if (!HDstrcasecmp(buf, "posix")) {
cl_opts->io_types |= SIO_POSIX;
- } else {
- HDfprintf(stderr, "sio_perf: invalid --api option %s\n",
- buf);
+ }
+ else {
+ HDfprintf(stderr, "sio_perf: invalid --api option %s\n", buf);
HDexit(EXIT_FAILURE);
}
@@ -1029,41 +902,39 @@ parse_command_line(int argc, const char *argv[])
case 'b':
/* the future "binary" option */
break;
-#endif /* 0 */
- case 'c':
- /* Turn on chunked HDF5 dataset creation */
- cl_opts->h5_use_chunks = 1;
- {
- const char *end = opt_arg;
- int j = 0;
+#endif /* 0 */
+ case 'c':
+ /* Turn on chunked HDF5 dataset creation */
+ cl_opts->h5_use_chunks = 1;
+ {
+ const char *end = H5_optarg;
+ int j = 0;
- while (end && *end != '\0') {
- char buf[10];
+ while (end && *end != '\0') {
+ char buf[10];
- HDmemset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
- for (i = 0; *end != '\0' && *end != ','; ++end)
- if (HDisalnum(*end) && i < 10)
- buf[i++] = *end;
+ for (i = 0; *end != '\0' && *end != ','; ++end)
+ if (HDisalnum(*end) && i < 10)
+ buf[i++] = *end;
- cl_opts->chk_size[j] = parse_size_directive(buf);
+ cl_opts->chk_size[j] = parse_size_directive(buf);
- j++;
+ j++;
- if (*end == '\0')
- break;
+ if (*end == '\0')
+ break;
- end++;
+ end++;
+ }
+ cl_opts->chk_rank = j;
}
- cl_opts->chk_rank = j;
- }
-
- break;
+ break;
- case 'D':
- {
- const char *end = opt_arg;
+ case 'D': {
+ const char *end = H5_optarg;
while (end && *end != '\0') {
char buf[10];
@@ -1079,8 +950,7 @@ parse_command_line(int argc, const char *argv[])
for (j = 0; j < 10 && buf[j] != '\0'; ++j)
if (!HDisdigit(buf[j])) {
- HDfprintf(stderr, "sio_perf: invalid --debug option %s\n",
- buf);
+ HDfprintf(stderr, "sio_perf: invalid --debug option %s\n", buf);
HDexit(EXIT_FAILURE);
}
@@ -1090,23 +960,24 @@ parse_command_line(int argc, const char *argv[])
sio_debug_level = 4;
else if (sio_debug_level < 0)
sio_debug_level = 0;
- } else {
+ }
+ else {
switch (*buf) {
- case 'r':
- /* Turn on raw data throughput info */
- cl_opts->print_raw = TRUE;
- break;
- case 't':
- /* Turn on time printing */
- cl_opts->print_times = TRUE;
- break;
- case 'v':
- /* Turn on verify data correctness*/
- cl_opts->verify = TRUE;
- break;
- default:
- HDfprintf(stderr, "sio_perf: invalid --debug option %s\n", buf);
- HDexit(EXIT_FAILURE);
+ case 'r':
+ /* Turn on raw data throughput info */
+ cl_opts->print_raw = TRUE;
+ break;
+ case 't':
+ /* Turn on time printing */
+ cl_opts->print_times = TRUE;
+ break;
+ case 'v':
+ /* Turn on verify data correctness*/
+ cl_opts->verify = TRUE;
+ break;
+ default:
+ HDfprintf(stderr, "sio_perf: invalid --debug option %s\n", buf);
+ HDexit(EXIT_FAILURE);
}
}
@@ -1118,10 +989,9 @@ parse_command_line(int argc, const char *argv[])
}
break;
- case 'e':
- {
- const char *end = opt_arg;
- int j = 0;
+ case 'e': {
+ const char *end = H5_optarg;
+ int j = 0;
while (end && *end != '\0') {
char buf[10];
@@ -1146,46 +1016,51 @@ parse_command_line(int argc, const char *argv[])
break;
- case 'i':
- cl_opts->num_iters = HDatoi(opt_arg);
- break;
- case 'o':
- cl_opts->output_file = opt_arg;
- break;
- case 'T':
- cl_opts->h5_threshold = parse_size_directive(opt_arg);
- break;
- case 'v':
- if (!HDstrcasecmp(opt_arg, "sec2")) {
- cl_opts->vfd=sec2;
- } else if (!HDstrcasecmp(opt_arg, "stdio")) {
- cl_opts->vfd=stdio;
- } else if (!HDstrcasecmp(opt_arg, "core")) {
- cl_opts->vfd=core;
- } else if (!HDstrcasecmp(opt_arg, "split")) {
- cl_opts->vfd=split;
- } else if (!HDstrcasecmp(opt_arg, "multi")) {
- cl_opts->vfd=multi;
- } else if (!HDstrcasecmp(opt_arg, "family")) {
- cl_opts->vfd=family;
- } else if (!HDstrcasecmp(opt_arg, "direct")) {
- cl_opts->vfd=direct;
- } else {
- HDfprintf(stderr, "sio_perf: invalid --api option %s\n",
- opt_arg);
- HDexit(EXIT_FAILURE);
- }
- break;
- case 'w':
- cl_opts->h5_write_only = TRUE;
- break;
- case 't':
- cl_opts->h5_extendable = TRUE;
- break;
- case 'x':
- {
- const char *end = opt_arg;
- int j = 0;
+ case 'i':
+ cl_opts->num_iters = HDatoi(H5_optarg);
+ break;
+ case 'o':
+ cl_opts->output_file = H5_optarg;
+ break;
+ case 'T':
+ cl_opts->h5_threshold = parse_size_directive(H5_optarg);
+ break;
+ case 'v':
+ if (!HDstrcasecmp(H5_optarg, "sec2")) {
+ cl_opts->vfd = sec2;
+ }
+ else if (!HDstrcasecmp(H5_optarg, "stdio")) {
+ cl_opts->vfd = stdio;
+ }
+ else if (!HDstrcasecmp(H5_optarg, "core")) {
+ cl_opts->vfd = core;
+ }
+ else if (!HDstrcasecmp(H5_optarg, "split")) {
+ cl_opts->vfd = split;
+ }
+ else if (!HDstrcasecmp(H5_optarg, "multi")) {
+ cl_opts->vfd = multi;
+ }
+ else if (!HDstrcasecmp(H5_optarg, "family")) {
+ cl_opts->vfd = family;
+ }
+ else if (!HDstrcasecmp(H5_optarg, "direct")) {
+ cl_opts->vfd = direct;
+ }
+ else {
+ HDfprintf(stderr, "sio_perf: invalid --api option %s\n", H5_optarg);
+ HDexit(EXIT_FAILURE);
+ }
+ break;
+ case 'w':
+ cl_opts->h5_write_only = TRUE;
+ break;
+ case 't':
+ cl_opts->h5_extendable = TRUE;
+ break;
+ case 'x': {
+ const char *end = H5_optarg;
+ int j = 0;
while (end && *end != '\0') {
char buf[10];
@@ -1210,10 +1085,9 @@ parse_command_line(int argc, const char *argv[])
break;
- case 'r':
- {
- const char *end = opt_arg;
- int j = 0;
+ case 'r': {
+ const char *end = H5_optarg;
+ int j = 0;
while (end && *end != '\0') {
char buf[10];
@@ -1239,12 +1113,12 @@ parse_command_line(int argc, const char *argv[])
break;
- case 'h':
- case '?':
- default:
- usage(progname);
- HDfree(cl_opts);
- return NULL;
+ case 'h':
+ case '?':
+ default:
+ usage(progname);
+ HDfree(cl_opts);
+ return NULL;
}
}
@@ -1256,8 +1130,8 @@ parse_command_line(int argc, const char *argv[])
ranks[2] = cl_opts->order_rank;
ranks[3] = cl_opts->chk_rank;
- for (i=0; i<4; i++) {
- if (ranks[i]>0) {
+ for (i = 0; i < 4; i++) {
+ if (ranks[i] > 0) {
if (!actual_rank) {
actual_rank = ranks[i];
}
@@ -1271,12 +1145,12 @@ parse_command_line(int argc, const char *argv[])
if (!actual_rank)
actual_rank = default_rank;
- cl_opts->dset_rank = actual_rank;
- cl_opts->buf_rank = actual_rank;
+ cl_opts->dset_rank = actual_rank;
+ cl_opts->buf_rank = actual_rank;
cl_opts->order_rank = actual_rank;
- cl_opts->chk_rank = actual_rank;
+ cl_opts->chk_rank = actual_rank;
- for (i=0; i<actual_rank; i++) {
+ for (i = 0; i < actual_rank; i++) {
if (cl_opts->order[i] > actual_rank) {
exit(EXIT_FAILURE);
}
@@ -1314,7 +1188,7 @@ static hsize_t
parse_size_directive(const char *size)
{
hsize_t s;
- char *endptr;
+ char * endptr;
s = HDstrtoull(size, &endptr, 10);
@@ -1358,71 +1232,70 @@ static void
usage(const char *prog)
{
print_version(prog);
- HDprintf("usage: %s [OPTIONS]\n", prog);
- HDprintf(" OPTIONS\n");
- HDprintf(" -h Print an usage message and exit\n");
- HDprintf(" -A AL Which APIs to test\n");
- HDprintf(" [default: all of them]\n");
- HDprintf(" -c SL Selects chunked storage and defines chunks dimensions\n");
- HDprintf(" and sizes\n");
- HDprintf(" [default: Off]\n");
- HDprintf(" -e SL Dimensions and sizes of dataset\n");
- HDprintf(" [default: 100,200]\n");
- HDprintf(" -i N Number of iterations to perform\n");
- HDprintf(" [default: 1]\n");
- HDprintf(" -r NL Dimension access order (see below for description)\n");
- HDprintf(" [default: 1,2]\n");
- HDprintf(" -t Selects extendable dimensions for HDF5 dataset\n");
- HDprintf(" [default: Off]\n");
- HDprintf(" -v VFD Selects file driver for HDF5 access\n");
- HDprintf(" [default: sec2]\n");
- HDprintf(" -w Perform write tests, not the read tests\n");
- HDprintf(" [default: Off]\n");
- HDprintf(" -x SL Dimensions and sizes of the transfer buffer\n");
- HDprintf(" [default: 10,20]\n");
- HDprintf("\n");
- HDprintf(" N - is an integer > 0.\n");
- HDprintf("\n");
- HDprintf(" S - is a size specifier, an integer > 0 followed by a size indicator:\n");
- HDprintf(" K - Kilobyte (%d)\n", ONE_KB);
- HDprintf(" M - Megabyte (%d)\n", ONE_MB);
- HDprintf(" G - Gigabyte (%d)\n", ONE_GB);
- HDprintf("\n");
- HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37*ONE_MB);
- HDprintf("\n");
- HDprintf(" AL - is an API list. Valid values are:\n");
- HDprintf(" hdf5 - HDF5\n");
- HDprintf(" posix - POSIX\n");
- HDprintf("\n");
- HDprintf(" Example: -A posix,hdf5\n");
- HDprintf("\n");
- HDprintf(" NL - is list of integers (N) separated by commas.\n");
- HDprintf("\n");
- HDprintf(" Example: 1,2,3\n");
- HDprintf("\n");
- HDprintf(" SL - is list of size specifiers (S) separated by commas.\n");
- HDprintf("\n");
- HDprintf(" Example: 2K,2K,3K\n");
- HDprintf("\n");
- HDprintf(" The example defines an object (dataset, tranfer buffer) with three\n");
- HDprintf(" dimensions. Be aware that as the number of dimensions increases, the\n");
- HDprintf(" the total size of the object increases exponentially.\n");
- HDprintf("\n");
- HDprintf(" VFD - is an HDF5 file driver specifier. Valid values are:\n");
- HDprintf(" sec2, stdio, core, split, multi, family, direct\n");
- HDprintf("\n");
- HDprintf(" Dimension access order:\n");
- HDprintf(" Data access starts at the cardinal origin of the dataset using the\n");
- HDprintf(" transfer buffer. The next access occurs on a dataset region next to\n");
- HDprintf(" the previous one. For a multidimensional dataset, there are several\n");
- HDprintf(" directions as to where to proceed. This can be specified in the dimension\n");
- HDprintf(" access order. For example, -r 1,2 states that the tool should traverse\n");
- HDprintf(" dimension 1 first, and then dimension 2.\n");
- HDprintf("\n");
- HDprintf(" Environment variables:\n");
- HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n");
- HDprintf(" HDF5_PREFIX Data file prefix\n");
- HDprintf("\n");
- HDfflush(stdout);
+ HDprintf("usage: %s [OPTIONS]\n", prog);
+ HDprintf(" OPTIONS\n");
+ HDprintf(" -h Print an usage message and exit\n");
+ HDprintf(" -A AL Which APIs to test\n");
+ HDprintf(" [default: all of them]\n");
+ HDprintf(" -c SL Selects chunked storage and defines chunks dimensions\n");
+ HDprintf(" and sizes\n");
+ HDprintf(" [default: Off]\n");
+ HDprintf(" -e SL Dimensions and sizes of dataset\n");
+ HDprintf(" [default: 100,200]\n");
+ HDprintf(" -i N Number of iterations to perform\n");
+ HDprintf(" [default: 1]\n");
+ HDprintf(" -r NL Dimension access order (see below for description)\n");
+ HDprintf(" [default: 1,2]\n");
+ HDprintf(" -t Selects extendable dimensions for HDF5 dataset\n");
+ HDprintf(" [default: Off]\n");
+ HDprintf(" -v VFD Selects file driver for HDF5 access\n");
+ HDprintf(" [default: sec2]\n");
+ HDprintf(" -w Perform write tests, not the read tests\n");
+ HDprintf(" [default: Off]\n");
+ HDprintf(" -x SL Dimensions and sizes of the transfer buffer\n");
+ HDprintf(" [default: 10,20]\n");
+ HDprintf("\n");
+ HDprintf(" N - is an integer > 0.\n");
+ HDprintf("\n");
+ HDprintf(" S - is a size specifier, an integer > 0 followed by a size indicator:\n");
+ HDprintf(" K - Kilobyte (%d)\n", ONE_KB);
+ HDprintf(" M - Megabyte (%d)\n", ONE_MB);
+ HDprintf(" G - Gigabyte (%d)\n", ONE_GB);
+ HDprintf("\n");
+ HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37 * ONE_MB);
+ HDprintf("\n");
+ HDprintf(" AL - is an API list. Valid values are:\n");
+ HDprintf(" hdf5 - HDF5\n");
+ HDprintf(" posix - POSIX\n");
+ HDprintf("\n");
+ HDprintf(" Example: -A posix,hdf5\n");
+ HDprintf("\n");
+ HDprintf(" NL - is list of integers (N) separated by commas.\n");
+ HDprintf("\n");
+ HDprintf(" Example: 1,2,3\n");
+ HDprintf("\n");
+ HDprintf(" SL - is list of size specifiers (S) separated by commas.\n");
+ HDprintf("\n");
+ HDprintf(" Example: 2K,2K,3K\n");
+ HDprintf("\n");
+ HDprintf(" The example defines an object (dataset, tranfer buffer) with three\n");
+ HDprintf(" dimensions. Be aware that as the number of dimensions increases, the\n");
+ HDprintf(" the total size of the object increases exponentially.\n");
+ HDprintf("\n");
+ HDprintf(" VFD - is an HDF5 file driver specifier. Valid values are:\n");
+ HDprintf(" sec2, stdio, core, split, multi, family, direct\n");
+ HDprintf("\n");
+ HDprintf(" Dimension access order:\n");
+ HDprintf(" Data access starts at the cardinal origin of the dataset using the\n");
+ HDprintf(" transfer buffer. The next access occurs on a dataset region next to\n");
+ HDprintf(" the previous one. For a multidimensional dataset, there are several\n");
+ HDprintf(" directions as to where to proceed. This can be specified in the dimension\n");
+ HDprintf(" access order. For example, -r 1,2 states that the tool should traverse\n");
+ HDprintf(" dimension 1 first, and then dimension 2.\n");
+ HDprintf("\n");
+ HDprintf(" Environment variables:\n");
+ HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n");
+ HDprintf(" HDF5_PREFIX Data file prefix\n");
+ HDprintf("\n");
+ HDfflush(stdout);
} /* end usage() */
-
diff --git a/tools/src/h5perf/sio_perf.h b/tools/src/h5perf/sio_perf.h
new file mode 100644
index 0000000..d998377
--- /dev/null
+++ b/tools/src/h5perf/sio_perf.h
@@ -0,0 +1,104 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef SIO_PERF_H
+#define SIO_PERF_H
+
+#ifndef STANDALONE
+#include "io_timer.h"
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#else
+#include "io_timer.h"
+#include "sio_standalone.h"
+#endif
+
+/* setup the dataset no fill option if this is v1.5 or more */
+#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4
+#define H5_HAVE_NOFILL 1
+#endif
+
+#define MAX_DIMS 32
+
+typedef enum iotype_ {
+ POSIXIO,
+ HDF5
+ /*NUM_TYPES*/
+} iotype;
+
+typedef enum vfdtype_ {
+ sec2,
+ stdio,
+ core,
+ split,
+ multi,
+ family,
+ direct
+ /*NUM_TYPES*/
+} vfdtype;
+
+typedef struct parameters_ {
+ iotype io_type; /* The type of IO test to perform */
+ vfdtype vfd;
+ long num_files; /* Number of files to create */
+ long num_dsets; /* Number of datasets to create */
+ hsize_t num_bytes; /* Number of bytes in each dset */
+ int num_iters; /* Number of times to loop doing the IO */
+ int rank; /* Rank of dataset */
+ hsize_t dset_size[MAX_DIMS]; /* Dataset size */
+ size_t buf_size[MAX_DIMS]; /* Buffer size */
+ size_t chk_size[MAX_DIMS]; /* Chunk size */
+ int order[MAX_DIMS]; /* Buffer size */
+ hsize_t h5_align; /* HDF5 object alignment */
+ hsize_t h5_thresh; /* HDF5 object alignment threshold */
+ int h5_use_chunks; /* Make HDF5 dataset chunked */
+ int h5_extendable; /* Make HDF5 dataset chunked */
+ int h5_write_only; /* Perform the write tests only */
+ int verify; /* Verify data correctness */
+ size_t page_size;
+ size_t page_buffer_size;
+} parameters;
+
+typedef struct results_ {
+ herr_t ret_code;
+ io_time_t *timers;
+} results;
+
+#ifndef SUCCESS
+#define SUCCESS 0
+#endif /* !SUCCESS */
+
+#ifndef FAIL
+#define FAIL -1
+#endif /* !FAIL */
+
+extern FILE * output; /* output file */
+extern io_time_t *timer_g; /* timer: global for stub functions */
+extern int sio_debug_level; /* The debug level:
+ * 0 - Off
+ * 1 - Minimal
+ * 2 - Some more
+ * 3 - Maximal
+ * 4 - Even More Debugging (timer stuff)
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+extern void do_sio(parameters param, results *res);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* SIO_PERF_H */
diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt
index a4aa1ef..b8b4709 100644
--- a/tools/src/h5repack/CMakeLists.txt
+++ b/tools/src/h5repack/CMakeLists.txt
@@ -12,11 +12,12 @@ set (REPACK_COMMON_SOURCES
${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_refs.c
${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_verify.c
${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.h
)
if (NOT ONLY_SHARED_LIBS)
add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c)
- target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5repack PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5repack STATIC)
target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -28,7 +29,7 @@ endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c)
- target_include_directories (h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5repack-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5repack-shared SHARED)
target_link_libraries (h5repack-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
@@ -38,6 +39,17 @@ if (BUILD_SHARED_LIBS)
set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5repack-shared)
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_H5REPACK_SRC_FORMAT h5repack)
+ else ()
+ clang_format (HDF5_H5REPACK_SRC_FORMAT h5repack-shared)
+ endif ()
+endif ()
+
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
diff --git a/tools/src/h5repack/Makefile.am b/tools/src/h5repack/Makefile.am
index 925b8a7..245329d 100644
--- a/tools/src/h5repack/Makefile.am
+++ b/tools/src/h5repack/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/src/h5repack/Makefile.in b/tools/src/h5repack/Makefile.in
index 743ddee..6b25a8a 100644
--- a/tools/src/h5repack/Makefile.in
+++ b/tools/src/h5repack/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -429,12 +430,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src, test, and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -472,11 +473,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -508,8 +554,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -523,7 +567,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -533,6 +579,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -726,7 +773,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1302,8 +1349,9 @@ uninstall-am: uninstall-binPROGRAMS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 77f2272..005f522 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -22,10 +22,10 @@
*-------------------------------------------------------------------------
*/
-static int check_options(pack_opt_t *options);
-static int check_objects(const char* fname, pack_opt_t *options);
-static const char* get_sfilter(H5Z_filter_t filtn);
-static int have_request(pack_opt_t *options);
+static int check_options(pack_opt_t *options);
+static int check_objects(const char *fname, pack_opt_t *options);
+static const char *get_sfilter(H5Z_filter_t filtn);
+static int have_request(pack_opt_t *options);
/*-------------------------------------------------------------------------
* Function: h5repack
@@ -42,7 +42,7 @@ static int have_request(pack_opt_t *options);
*-------------------------------------------------------------------------
*/
int
-h5repack(const char* infile, const char* outfile, pack_opt_t *options)
+h5repack(const char *infile, const char *outfile, pack_opt_t *options)
{
/* check input */
if (check_options(options) < 0)
@@ -73,17 +73,17 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest)
int k, n;
HDmemset(options, 0, sizeof(pack_opt_t));
- options->min_comp = 0;
- options->verbose = verbose;
- options->latest = latest;
- options->layout_g = H5D_LAYOUT_ERROR;
- options->low_bound = H5F_LIBVER_EARLIEST;
+ options->min_comp = 0;
+ options->verbose = verbose;
+ options->latest = latest;
+ options->layout_g = H5D_LAYOUT_ERROR;
+ options->low_bound = H5F_LIBVER_EARLIEST;
options->high_bound = H5F_LIBVER_LATEST;
- options->fin_fapl = H5P_DEFAULT;
- options->fout_fapl = H5P_DEFAULT;
+ options->fin_fapl = H5P_DEFAULT;
+ options->fout_fapl = H5P_DEFAULT;
for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) {
- options->filter_g[n].filtn = -1;
+ options->filter_g[n].filtn = -1;
options->filter_g[n].cd_nelmts = 0;
for (k = 0; k < CD_VALUES; k++)
options->filter_g[n].cd_values[k] = 0;
@@ -117,7 +117,7 @@ h5repack_end(pack_opt_t *options)
int
h5repack_addfilter(const char *str, pack_opt_t *options)
{
- obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */
+ obj_list_t * obj_list = NULL; /* one object list for the -f and -l option entry */
filter_info_t filter; /* filter info for the current -f option entry */
unsigned n_objs; /* number of objects in the current -f or -l option entry */
int is_glb; /* is the filter global */
@@ -166,7 +166,7 @@ h5repack_addlayout(const char *str, pack_opt_t *options)
init_packobject(&pack);
if (options->all_layout == 1) {
- error_msg( "invalid layout input: 'all' option is present with other objects <%s>\n", str);
+ error_msg("invalid layout input: 'all' option is present with other objects <%s>\n", str);
return ret_value;
}
@@ -222,11 +222,12 @@ h5repack_addlayout(const char *str, pack_opt_t *options)
*-------------------------------------------------------------------------
*/
hid_t
-copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
+copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt,
+ pack_opt_t *options)
{
- named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
- named_dt_t *dt_ret = NULL; /* Datatype to return */
- H5O_info_t oinfo; /* Object info of input dtype */
+ named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
+ named_dt_t *dt_ret = NULL; /* Datatype to return */
+ H5O_info_t oinfo; /* Object info of input dtype */
hid_t ret_value = H5I_INVALID_HID;
if (H5Oget_info2(type_in, &oinfo, H5O_INFO_BASIC) < 0)
@@ -247,20 +248,20 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t
/* Push onto the stack */
if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed");
- dt->next = *named_dt_head_p;
+ dt->next = *named_dt_head_p;
*named_dt_head_p = dt;
/* Update the address and id */
dt->addr_in = travt->objs[i].objno;
- dt->id_out = H5I_INVALID_HID;
+ dt->id_out = H5I_INVALID_HID;
/* Check if this type is the one requested */
if (oinfo.addr == dt->addr_in) {
dt_ret = dt;
}
} /* end if named datatype */
- } /* end for each object in traversal table */
- } /* end else (create the stack) */
+ } /* end for each object in traversal table */
+ } /* end else (create the stack) */
/* Handle the case that the requested datatype was not found. This is
* possible if the datatype was committed anonymously in the input file.
@@ -269,12 +270,12 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t
/* Push the new datatype onto the stack */
if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed");
- dt_ret->next = *named_dt_head_p;
+ dt_ret->next = *named_dt_head_p;
*named_dt_head_p = dt_ret;
/* Update the address and id */
dt_ret->addr_in = oinfo.addr;
- dt_ret->id_out = H5I_INVALID_HID;
+ dt_ret->id_out = H5I_INVALID_HID;
} /* end if requested datatype not found */
/* If the requested datatype does not yet exist in the output file, copy it
@@ -313,8 +314,8 @@ done:
int
named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err)
{
- named_dt_t *dt = *named_dt_head_p;
- int ret_value = -1;
+ named_dt_t *dt = *named_dt_head_p;
+ int ret_value = -1;
while (dt) {
/* Pop the datatype off the stack and free it */
@@ -345,24 +346,24 @@ done:
int
copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
{
- hid_t attr_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr_id = H5I_INVALID_HID; /* attr ID */
hid_t attr_out = H5I_INVALID_HID; /* attr ID */
hid_t space_id = H5I_INVALID_HID; /* space ID */
hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
- size_t msize; /* size of type */
- void *buf = NULL; /* data buffer */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- htri_t is_named; /* Whether the datatype is named */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ size_t msize; /* size of type */
+ void * buf = NULL; /* data buffer */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ htri_t is_named; /* Whether the datatype is named */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
char name[255];
- H5O_info_t oinfo; /* object info */
+ H5O_info_t oinfo; /* object info */
int j;
unsigned u;
- hbool_t is_ref = 0;
+ hbool_t is_ref = 0;
H5T_class_t type_class = -1;
- int ret_value = 0;
+ int ret_value = 0;
if (H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
@@ -371,12 +372,13 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
* copy all attributes
*-------------------------------------------------------------------------
*/
- for (u = 0; u < (unsigned) oinfo.num_attrs; u++) {
+ for (u = 0; u < (unsigned)oinfo.num_attrs; u++) {
/* open attribute */
- if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aopen_by_idx failed");
- if (H5Aget_name(attr_id, (size_t) 255, name) < 0)
+ if (H5Aget_name(attr_id, (size_t)255, name) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
/* get the file datatype */
@@ -432,12 +434,12 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
*---------------------------------------------------------------------
*/
type_class = H5Tget_class(wtype_id);
- is_ref = (type_class == H5T_REFERENCE);
+ is_ref = (type_class == H5T_REFERENCE);
if (type_class == H5T_VLEN || type_class == H5T_ARRAY) {
hid_t base_type = H5I_INVALID_HID;
base_type = H5Tget_super(ftype_id);
- is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE));
+ is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE));
if (H5Tclose(base_type) < 0)
H5TOOLS_ERROR((-1), "H5Tclose base_type failed");
} /* end if type_class is variable length or array */
@@ -446,7 +448,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
int nmembers = H5Tget_nmembers(wtype_id);
for (j = 0; j < nmembers; j++) {
- hid_t mtid = H5Tget_member_type(wtype_id, (unsigned)j);
+ hid_t mtid = H5Tget_member_type(wtype_id, (unsigned)j);
H5T_class_t mtclass = H5Tget_class(mtid);
if (H5Tclose(mtid) < 0)
H5TOOLS_ERROR((-1), "H5Tclose mtid failed");
@@ -456,7 +458,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
break;
}
} /* end for each member */
- } /* end if type_class is H5T_COMPOUND */
+ } /* end if type_class is H5T_COMPOUND */
if (!is_ref) {
/*-----------------------------------------------------------------
@@ -515,7 +517,8 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
} /* for u (each attribute) */
done:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
if (buf) {
/* Check if we have VL data and string in the attribute's
* datatype that must be reclaimed
@@ -532,7 +535,8 @@ done:
H5Tclose(wtype_id);
H5Tclose(ftype_id);
H5Aclose(attr_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return ret_value;
} /* end copy_attr() */
@@ -561,31 +565,31 @@ check_options(pack_opt_t *options)
if (options->all_layout == 1) {
HDprintf("All objects to modify layout are...\n");
switch (options->layout_g) {
- case H5D_COMPACT:
- strcpy(slayout, "compact");
- break;
- case H5D_CONTIGUOUS:
- strcpy(slayout, "contiguous");
- break;
- case H5D_CHUNKED:
- strcpy(slayout, "chunked");
- break;
- case H5D_VIRTUAL:
- strcpy(slayout, "virtual");
- break;
- case H5D_LAYOUT_ERROR:
- case H5D_NLAYOUTS:
- H5TOOLS_GOTO_ERROR((-1), "invalid layout");
- break;
- default:
- strcpy(slayout, "invalid layout\n");
- H5TOOLS_GOTO_DONE((-1));
+ case H5D_COMPACT:
+ strcpy(slayout, "compact");
+ break;
+ case H5D_CONTIGUOUS:
+ strcpy(slayout, "contiguous");
+ break;
+ case H5D_CHUNKED:
+ strcpy(slayout, "chunked");
+ break;
+ case H5D_VIRTUAL:
+ strcpy(slayout, "virtual");
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
+ H5TOOLS_GOTO_ERROR((-1), "invalid layout");
+ break;
+ default:
+ strcpy(slayout, "invalid layout\n");
+ H5TOOLS_GOTO_DONE((-1));
}
HDprintf(" Apply %s layout to all", slayout);
if (H5D_CHUNKED == options->layout_g) {
HDprintf("with dimension [ ");
for (j = 0; j < options->chunk_g.rank; j++)
- HDprintf("%d ", (int) options->chunk_g.chunk_lengths[j]);
+ HDprintf("%d ", (int)options->chunk_g.chunk_lengths[j]);
HDprintf("]");
}
HDprintf("\n");
@@ -595,13 +599,13 @@ check_options(pack_opt_t *options)
} /* end if verbose */
for (i = 0; i < options->op_tbl->nelems; i++) {
- char* name = options->op_tbl->objs[i].path;
+ char *name = options->op_tbl->objs[i].path;
if (options->op_tbl->objs[i].chunk.rank > 0) {
if (options->verbose) {
HDprintf(" <%s> with chunk size ", name);
for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
- HDprintf("%d ", (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]);
+ HDprintf("%d ", (int)options->op_tbl->objs[i].chunk.chunk_lengths[k]);
HDprintf("\n");
}
has_ck = 1;
@@ -631,36 +635,38 @@ check_options(pack_opt_t *options)
continue;
}
switch (filtn) {
- case H5Z_FILTER_NONE:
- HDprintf(" Uncompress all\n");
- break;
- case H5Z_FILTER_SHUFFLE:
- case H5Z_FILTER_FLETCHER32:
- HDprintf(" All with %s\n", get_sfilter(filtn));
- break;
- case H5Z_FILTER_SZIP:
- case H5Z_FILTER_DEFLATE:
- HDprintf(" All with %s, parameter %d\n", get_sfilter(filtn), options->filter_g[k].cd_values[0]);
- break;
- default:
- HDprintf(" User Defined %d\n", filtn);
- break;
+ case H5Z_FILTER_NONE:
+ HDprintf(" Uncompress all\n");
+ break;
+ case H5Z_FILTER_SHUFFLE:
+ case H5Z_FILTER_FLETCHER32:
+ HDprintf(" All with %s\n", get_sfilter(filtn));
+ break;
+ case H5Z_FILTER_SZIP:
+ case H5Z_FILTER_DEFLATE:
+ HDprintf(" All with %s, parameter %d\n", get_sfilter(filtn),
+ options->filter_g[k].cd_values[0]);
+ break;
+ default:
+ HDprintf(" User Defined %d\n", filtn);
+ break;
} /* end switch */
- } /* end for each filter */
- } /* end if options->all_filter == 1 (TODO: meaning) */
+ } /* end for each filter */
+ } /* end if options->all_filter == 1 (TODO: meaning) */
else
HDprintf("No all objects to apply filter\n");
} /* end if verbose */
for (i = 0; i < options->op_tbl->nelems; i++) {
pack_info_t pack = options->op_tbl->objs[i];
- char* name = pack.path;
+ char * name = pack.path;
for (j = 0; j < pack.nfilters; j++) {
if (options->verbose) {
if (pack.filter[j].filtn >= 0) {
if (pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) {
- HDprintf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), pack.filter[j].filtn);
+ HDprintf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn),
+ pack.filter[j].filtn);
}
else {
HDprintf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn));
@@ -669,7 +675,7 @@ check_options(pack_opt_t *options)
}
has_cp = 1;
} /* end for each filter */
- } /* end for each object in options table */
+ } /* end for each object in options table */
if (options->all_filter == 1 && has_cp)
H5TOOLS_GOTO_ERROR((-1), "invalid compression input: 'all' option is present with other objects");
@@ -695,13 +701,14 @@ check_options(pack_opt_t *options)
*/
if (options->ublock_filename != NULL && options->ublock_size == 0) {
if (options->verbose) {
- HDprintf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", options->ublock_filename);
+ HDprintf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n",
+ options->ublock_filename);
options->ublock_size = 1024;
}
}
if (options->ublock_filename == NULL && options->ublock_size != 0)
- H5TOOLS_GOTO_ERROR((-1), "file name missing for user block", options->ublock_filename);
+ H5TOOLS_GOTO_ERROR((-1), "file name missing for user block");
/*------------------------------------------------------------------------
* Verify alignment options; threshold is zero default but alignment not
@@ -725,14 +732,14 @@ done:
*-------------------------------------------------------------------------
*/
static int
-check_objects(const char* fname, pack_opt_t *options)
+check_objects(const char *fname, pack_opt_t *options)
{
hid_t fid = H5I_INVALID_HID;
hid_t did = H5I_INVALID_HID;
hid_t sid = H5I_INVALID_HID;
unsigned int i;
int ifil;
- trav_table_t *travt = NULL;
+ trav_table_t *travt = NULL;
int ret_value = 0;
/* nothing to do */
@@ -744,7 +751,7 @@ check_objects(const char* fname, pack_opt_t *options)
*-------------------------------------------------------------------------
*/
if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl,
- (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
+ (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR);
/*-------------------------------------------------------------------------
@@ -770,8 +777,8 @@ check_objects(const char* fname, pack_opt_t *options)
HDprintf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs);
for (i = 0; i < options->op_tbl->nelems; i++) {
- pack_info_t obj = options->op_tbl->objs[i];
- char* name = obj.path;
+ pack_info_t obj = options->op_tbl->objs[i];
+ char * name = obj.path;
if (options->verbose)
HDprintf(" <%s>", name);
@@ -779,7 +786,7 @@ check_objects(const char* fname, pack_opt_t *options)
/* the input object names are present in the file and are valid */
if (h5trav_getindext(name, travt) < 0)
H5TOOLS_GOTO_ERROR((-1), "%s Could not find <%s> in file <%s>. Exiting...\n",
- (options->verbose ? "\n" : ""), name, fname);
+ (options->verbose ? "\n" : ""), name, fname);
if (options->verbose)
HDprintf("...Found\n");
@@ -788,14 +795,13 @@ check_objects(const char* fname, pack_opt_t *options)
H5TOOLS_GOTO_ERROR((-1), "invalid filter");
/* check for extra filter conditions */
switch (obj.filter[ifil].filtn) {
- /* chunk size must be smaller than pixels per block */
- case H5Z_FILTER_SZIP:
- {
- int j;
- hsize_t csize = 1;
- unsigned ppb = obj.filter[ifil].cd_values[0];
- hsize_t dims[H5S_MAX_RANK];
- int rank;
+ /* chunk size must be smaller than pixels per block */
+ case H5Z_FILTER_SZIP: {
+ int j;
+ hsize_t csize = 1;
+ unsigned ppb = obj.filter[ifil].cd_values[0];
+ hsize_t dims[H5S_MAX_RANK];
+ int rank;
if (obj.chunk.rank > 0) {
rank = obj.chunk.rank;
@@ -826,18 +832,20 @@ check_objects(const char* fname, pack_opt_t *options)
}
} /* end case SZIP */
break;
- default:
- break;
+ default:
+ break;
} /* end switch */
- } /* for ifil (each user-defined filter) */
- } /* for i (each object in options traversal table) */
+ } /* for ifil (each user-defined filter) */
+ } /* for i (each object in options traversal table) */
done:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
if (travt)
trav_table_free(travt);
return ret_value;
@@ -891,4 +899,3 @@ get_sfilter(H5Z_filter_t filtn)
else
return "UD";
} /* end get_sfilter() */
-
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index a8207b5..3503ce9 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -6,34 +6,32 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#ifndef H5REPACK_H__
-#define H5REPACK_H__
+#ifndef H5REPACK_H
+#define H5REPACK_H
#include "H5private.h"
#include "hdf5.h"
#include "h5trav.h"
-#define H5FOPENERROR "unable to open file"
-#define PFORMAT "%-7s %-7s %-7s\n" /* chunk info, compression info, name*/
-#define PFORMAT1 "%-7s %-7s %-7s" /* chunk info, compression info, name*/
-#define MAX_NC_NAME 256 /* max length of a name */
-#define MAX_VAR_DIMS 32 /* max per variable dimensions */
-#define FORMAT_OBJ " %-27s %s\n" /* obj type, name */
-#define FORMAT_OBJ_ATTR " %-27s %s\n" /* obj type, name */
-#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */
+#define H5FOPENERROR "unable to open file"
+#define PFORMAT "%-7s %-7s %-7s\n" /* chunk info, compression info, name*/
+#define PFORMAT1 "%-7s %-7s %-7s" /* chunk info, compression info, name*/
+#define MAX_NC_NAME 256 /* max length of a name */
+#define MAX_VAR_DIMS 32 /* max per variable dimensions */
+#define FORMAT_OBJ " %-27s %s\n" /* obj type, name */
+#define FORMAT_OBJ_ATTR " %-27s %s\n" /* obj type, name */
+#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */
/* File space default information */
-#define FS_PAGESIZE_DEF 4096
-#define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
-#define FS_PERSIST_DEF FALSE
-#define FS_THRESHOLD_DEF 1
-
+#define FS_PAGESIZE_DEF 4096
+#define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
+#define FS_PERSIST_DEF FALSE
+#define FS_THRESHOLD_DEF 1
/*-------------------------------------------------------------------------
* data structures for command line options
@@ -42,7 +40,7 @@
/* a list of names */
typedef struct {
- char obj[MAX_NC_NAME];
+ char obj[MAX_NC_NAME];
} obj_list_t;
/*
@@ -60,16 +58,16 @@ typedef struct {
#define CD_VALUES 20
typedef struct {
- H5Z_filter_t filtn; /* filter identification number */
- unsigned filt_flag; /* filter definition flag */
- unsigned cd_values[CD_VALUES]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned filt_flag; /* filter definition flag */
+ unsigned cd_values[CD_VALUES]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
} filter_info_t;
/* chunk lengths along each dimension and rank */
typedef struct {
- hsize_t chunk_lengths[MAX_VAR_DIMS];
- int rank;
+ hsize_t chunk_lengths[MAX_VAR_DIMS];
+ int rank;
} chunk_info_t;
/* we currently define a maximum value for the filters array,
@@ -78,22 +76,21 @@ typedef struct {
/* information for one object, contains PATH, CHUNK info and FILTER info */
typedef struct {
- char path[MAX_NC_NAME]; /* name of object */
- filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */
- int nfilters; /* current number of filters */
- H5D_layout_t layout; /* layout information */
- chunk_info_t chunk; /* chunk information */
- hid_t refobj_id; /* object ID, references */
+ char path[MAX_NC_NAME]; /* name of object */
+ filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */
+ int nfilters; /* current number of filters */
+ H5D_layout_t layout; /* layout information */
+ chunk_info_t chunk; /* chunk information */
+ hid_t refobj_id; /* object ID, references */
} pack_info_t;
/* store a table of all objects */
typedef struct {
- unsigned int size;
- unsigned int nelems;
- pack_info_t *objs;
+ unsigned int size;
+ unsigned int nelems;
+ pack_info_t *objs;
} pack_opttbl_t;
-
/*-------------------------------------------------------------------------
* command line options
*-------------------------------------------------------------------------
@@ -101,43 +98,42 @@ typedef struct {
/* all the above, ready to go to the hrepack call */
typedef struct {
- pack_opttbl_t *op_tbl; /* table with all -c and -f options */
- int all_layout; /* apply the layout to all objects */
- int all_filter; /* apply the filter to all objects */
- filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */
- int n_filter_g; /* number of global filters */
- chunk_info_t chunk_g; /* global chunk INFO for the ALL case */
- H5D_layout_t layout_g; /* global layout information for the ALL case */
- int verbose; /* verbose mode */
- hbool_t merge; /* Merge external file. */
- hbool_t prune; /* Don't follow external file. */
- hsize_t min_comp; /* minimum size to compress, in bytes */
- int use_native; /* use a native type in write */
- hbool_t latest; /* pack file with the latest file format */
- H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */
- H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */
- hid_t fin_fapl; /* FAPL to use for opening the input file */
- hid_t fout_fapl; /* FAPL to use for opening/creating the output file */
- int grp_compact; /* Set the maximum number of links to store as header messages in the group */
- int grp_indexed; /* Set the minimum number of links to store in the indexed format */
- int msg_size[8]; /* Minimum size of shared messages: dataspace,
- datatype, fill value, filter pipleline, attribute */
- const char *ublock_filename; /* user block file name */
- hsize_t ublock_size; /* user block size */
- hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
- hsize_t threshold; /* alignment threshold for H5Pset_alignment */
- hsize_t alignment; /* alignment for H5Pset_alignment */
- H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
- int fs_persist; /* Free space section threshold */
- long fs_threshold; /* Free space section threshold */
- long long fs_pagesize; /* File space page size */
+ pack_opttbl_t *op_tbl; /* table with all -c and -f options */
+ int all_layout; /* apply the layout to all objects */
+ int all_filter; /* apply the filter to all objects */
+ filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */
+ int n_filter_g; /* number of global filters */
+ chunk_info_t chunk_g; /* global chunk INFO for the ALL case */
+ H5D_layout_t layout_g; /* global layout information for the ALL case */
+ int verbose; /* verbose mode */
+ hbool_t merge; /* Merge external file. */
+ hbool_t prune; /* Don't follow external file. */
+ hsize_t min_comp; /* minimum size to compress, in bytes */
+ int use_native; /* use a native type in write */
+ hbool_t latest; /* pack file with the latest file format */
+ H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */
+ H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */
+ hid_t fin_fapl; /* FAPL to use for opening the input file */
+ hid_t fout_fapl; /* FAPL to use for opening/creating the output file */
+ int grp_compact; /* Set the maximum number of links to store as header messages in the group */
+ int grp_indexed; /* Set the minimum number of links to store in the indexed format */
+ int msg_size[8]; /* Minimum size of shared messages: dataspace,
+ datatype, fill value, filter pipleline, attribute */
+ const char * ublock_filename; /* user block file name */
+ hsize_t ublock_size; /* user block size */
+ hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
+ hsize_t threshold; /* alignment threshold for H5Pset_alignment */
+ hsize_t alignment; /* alignment for H5Pset_alignment */
+ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
+ int fs_persist; /* Free space section threshold */
+ long fs_threshold; /* Free space section threshold */
+ long long fs_pagesize; /* File space page size */
} pack_opt_t;
-
typedef struct named_dt_t {
- haddr_t addr_in; /* Address of the named dtype in the in file */
- hid_t id_out; /* Open identifier for the dtype in the out file */
- struct named_dt_t *next; /* Next dtype */
+ haddr_t addr_in; /* Address of the named dtype in the in file */
+ hid_t id_out; /* Open identifier for the dtype in the out file */
+ struct named_dt_t *next; /* Next dtype */
} named_dt_t;
/*-------------------------------------------------------------------------
@@ -149,9 +145,9 @@ typedef struct named_dt_t {
extern "C" {
#endif
-int h5repack(const char* infile, const char* outfile, pack_opt_t *options);
-int h5repack_addfilter(const char* str, pack_opt_t *options);
-int h5repack_addlayout(const char* str, pack_opt_t *options);
+int h5repack(const char *infile, const char *outfile, pack_opt_t *options);
+int h5repack_addfilter(const char *str, pack_opt_t *options);
+int h5repack_addlayout(const char *str, pack_opt_t *options);
int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest);
int h5repack_end(pack_opt_t *options);
int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options);
@@ -164,36 +160,29 @@ int h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, h
* However copy_attr() may be obsoleted when H5Acopy is available and put back
* others to static in h5repack_copy.c.
*/
-hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options);
-int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err);
-int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
- trav_table_t *travt, pack_opt_t *options);
+hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt,
+ pack_opt_t *options);
+int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err);
+int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt,
+ pack_opt_t *options);
#ifdef __cplusplus
}
#endif
-
-
/*-------------------------------------------------------------------------
* private functions
*-------------------------------------------------------------------------
*/
-
/*-------------------------------------------------------------------------
* copy module
*-------------------------------------------------------------------------
*/
-int copy_objects (const char* fnamein,
- const char* fnameout,
- pack_opt_t *options);
+int copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options);
-int do_copy_refobjs(hid_t fidin,
- hid_t fidout,
- trav_table_t *travt,
- pack_opt_t *options);
+int do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options);
/*-------------------------------------------------------------------------
* filters and verify module
@@ -201,56 +190,38 @@ int do_copy_refobjs(hid_t fidin,
*/
void init_packobject(pack_info_t *obj);
-
/*-------------------------------------------------------------------------
* filters and copy module
*-------------------------------------------------------------------------
*/
-int apply_filters(const char* name, /* object name from traverse list */
- int rank, /* rank of dataset */
- hsize_t *dims, /* dimensions of dataset */
- size_t msize, /* size of type */
- hid_t dcpl_id, /* dataset creation property list */
- pack_opt_t *options, /* repack options */
- int *has_filter); /* (OUT) object NAME has a filter */
-
+int apply_filters(const char * name, /* object name from traverse list */
+ int rank, /* rank of dataset */
+ const hsize_t *dims, /* dimensions of dataset */
+ size_t msize, /* size of type */
+ hid_t dcpl_id, /* dataset creation property list */
+ pack_opt_t * options, /* repack options */
+ int * has_filter); /* (OUT) object NAME has a filter */
/*-------------------------------------------------------------------------
* options table
*-------------------------------------------------------------------------
*/
-int options_table_init(pack_opttbl_t **tbl);
-int options_table_free(pack_opttbl_t *table);
-int options_add_layout(obj_list_t *obj_list,
- unsigned n_objs,
- pack_info_t *pack,
- pack_opttbl_t *table);
-int options_add_filter(obj_list_t *obj_list,
- unsigned n_objs,
- filter_info_t filt,
- pack_opttbl_t *table);
-pack_info_t* options_get_object(const char *path,
- pack_opttbl_t *table);
+int options_table_init(pack_opttbl_t **tbl);
+int options_table_free(pack_opttbl_t *table);
+int options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pack_opttbl_t *table);
+int options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pack_opttbl_t *table);
+pack_info_t *options_get_object(const char *path, pack_opttbl_t *table);
/*-------------------------------------------------------------------------
* parse functions
*-------------------------------------------------------------------------
*/
-obj_list_t* parse_filter(const char *str,
- unsigned *n_objs,
- filter_info_t *filt,
- pack_opt_t *options,
+obj_list_t *parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t *options,
int *is_glb);
-obj_list_t* parse_layout(const char *str,
- unsigned *n_objs,
- pack_info_t *pack, /* info about object */
+obj_list_t *parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about object */
pack_opt_t *options);
-
-
-
-#endif /* H5REPACK_H__ */
-
+#endif /* H5REPACK_H */
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 4d330d1..b3c8ffb 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -31,24 +31,21 @@
*/
/* size of buffer/# of bytes to xfer at a time when copying userblock */
-#define USERBLOCK_XFER_SIZE 512
+#define USERBLOCK_XFER_SIZE 512
/*-------------------------------------------------------------------------
* local functions
*-------------------------------------------------------------------------
*/
-static int get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
- size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p);
+static int get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t size_datum,
+ hsize_t dims_hslab[], hsize_t *hslab_nbytes_p);
static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr);
-static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
- pack_opt_t *options);
-static int copy_user_block(const char *infile, const char *outfile,
- hsize_t size);
-#if defined (H5REPACK_DEBUG_USER_BLOCK)
+static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options);
+static int copy_user_block(const char *infile, const char *outfile, hsize_t size);
+#if defined(H5REPACK_DEBUG_USER_BLOCK)
static void print_user_block(const char *filename, hid_t fid);
#endif
-
/*-------------------------------------------------------------------------
* Function: copy_objects
*
@@ -59,33 +56,33 @@ static void print_user_block(const char *filename, hid_t fid);
*-------------------------------------------------------------------------
*/
int
-copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
+copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options)
{
- hid_t fidin = H5I_INVALID_HID;
- hid_t fidout = H5I_INVALID_HID;
- hid_t fcpl_in = H5I_INVALID_HID; /* file creation property list ID for input file */
- hid_t grp_in = H5I_INVALID_HID; /* group ID */
- hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
- hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
- trav_table_t *travt = NULL;
- hsize_t ub_size = 0; /* size of user block */
- H5F_fspace_strategy_t set_strategy; /* Strategy to be set in outupt file */
- hbool_t set_persist; /* Persist free-space status to be set in output file */
- hsize_t set_threshold; /* Free-space section threshold to be set in output file */
- hsize_t set_pagesize; /* File space page size to be set in output file */
- H5F_fspace_strategy_t in_strategy; /* Strategy from input file */
- hbool_t in_persist; /* Persist free-space status from input file */
- hsize_t in_threshold; /* Free-space section threshold from input file */
- hsize_t in_pagesize; /* File space page size from input file */
- unsigned crt_order_flags; /* group creation order flag */
- int ret_value = 0;
+ hid_t fidin = H5I_INVALID_HID;
+ hid_t fidout = H5I_INVALID_HID;
+ hid_t fcpl_in = H5I_INVALID_HID; /* file creation property list ID for input file */
+ hid_t grp_in = H5I_INVALID_HID; /* group ID */
+ hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
+ hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
+ trav_table_t * travt = NULL;
+ hsize_t ub_size = 0; /* size of user block */
+ H5F_fspace_strategy_t set_strategy; /* Strategy to be set in outupt file */
+ hbool_t set_persist; /* Persist free-space status to be set in output file */
+ hsize_t set_threshold; /* Free-space section threshold to be set in output file */
+ hsize_t set_pagesize; /* File space page size to be set in output file */
+ H5F_fspace_strategy_t in_strategy; /* Strategy from input file */
+ hbool_t in_persist; /* Persist free-space status from input file */
+ hsize_t in_threshold; /* Free-space section threshold from input file */
+ hsize_t in_pagesize; /* File space page size from input file */
+ unsigned crt_order_flags; /* group creation order flag */
+ int ret_value = 0;
/*-------------------------------------------------------------------------
* open input file
*-------------------------------------------------------------------------
*/
if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl,
- (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, (size_t) 0)) < 0)
+ (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, (size_t)0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR);
/* get user block size and file space strategy/persist/threshold */
@@ -97,11 +94,11 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_userblock failed to retrieve userblock size");
/* If the -S option is not set, get "strategy" from the input file */
- if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0)
+ if (H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy");
/* If the -G option is not set, get "pagesize" from the input file */
- if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0)
+ if (H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space threshold");
/* open root group */
@@ -120,7 +117,7 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed to close property list");
}
- if(options->latest)
+ if (options->latest)
options->low_bound = options->high_bound = H5F_LIBVER_LATEST;
/* Create file access property list */
@@ -129,7 +126,7 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create file access property list");
/* It can be default, latest or other settings by users */
- if(H5Pset_libver_bounds(options->fout_fapl, options->low_bound, options->high_bound) < 0)
+ if (H5Pset_libver_bounds(options->fout_fapl, options->low_bound, options->high_bound) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_libver_bounds failed to set format version bounds");
/* Check if we need to create a non-default file creation property list */
@@ -147,8 +144,11 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
/* Adjust group creation parameters for root group */
/* (So that it is created in "dense storage" form) */
- if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_phase_change failed to adjust group creation parameters for root group");
+ if (H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact,
+ (unsigned)options->grp_indexed) < 0)
+ H5TOOLS_GOTO_ERROR(
+ (-1),
+ "H5Pset_link_phase_change failed to adjust group creation parameters for root group");
for (i = 0; i < 5; i++) {
if (options->msg_size[i] > 0) {
@@ -176,26 +176,28 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
default:
break;
} /* end switch */
- min_mesg_sizes[nindex] = (unsigned) options->msg_size[i];
+ min_mesg_sizes[nindex] = (unsigned)options->msg_size[i];
nindex++;
} /* end if */
- } /* end for */
+ } /* end for */
if (nindex > 0) {
if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_nindexes failed to set the number of shared object header message indexes");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_nindexes failed to set the number of shared "
+ "object header message indexes");
/* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
for (i = 0; i < (nindex - 1); i++)
if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_index failed to configure the specified shared object header message index");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_index failed to configure the specified "
+ "shared object header message index");
} /* if (nindex>0) */
} /* end if */
- } /* end if */
-#if defined (H5REPACK_DEBUG_USER_BLOCK)
-print_user_block(fnamein, fidin);
+ } /* end if */
+#if defined(H5REPACK_DEBUG_USER_BLOCK)
+ print_user_block(fnamein, fidin);
#endif
/*-------------------------------------------------------------------------
@@ -255,41 +257,41 @@ print_user_block(fnamein, fidin);
if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create a file creation property list");
- if(H5Pset_link_creation_order(fcpl, crt_order_flags ) < 0)
+ if (H5Pset_link_creation_order(fcpl, crt_order_flags) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_creation_order failed");
/* Set file space info to those from input file */
- set_strategy = in_strategy;
- set_persist = in_persist;
+ set_strategy = in_strategy;
+ set_persist = in_persist;
set_threshold = in_threshold;
- set_pagesize = in_pagesize;
+ set_pagesize = in_pagesize;
- if(options->fs_strategy == (H5F_fspace_strategy_t)-1) /* A default strategy is specified by user */
+ if (options->fs_strategy == (H5F_fspace_strategy_t)-1) /* A default strategy is specified by user */
set_strategy = FS_STRATEGY_DEF;
- else if(options->fs_strategy != (H5F_fspace_strategy_t)0) /* Set strategy as specified by user */
+ else if (options->fs_strategy != (H5F_fspace_strategy_t)0) /* Set strategy as specified by user */
set_strategy = options->fs_strategy;
- if(options->fs_persist == -1) /* A default "persist" is specified by user */
+ if (options->fs_persist == -1) /* A default "persist" is specified by user */
set_persist = FS_PERSIST_DEF;
- else if(options->fs_persist != 0) /* Set "persist" as specified by user */
+ else if (options->fs_persist != 0) /* Set "persist" as specified by user */
set_persist = (hbool_t)options->fs_persist;
- if(options->fs_threshold == -1) /* A "0" threshold is specified by user */
+ if (options->fs_threshold == -1) /* A "0" threshold is specified by user */
set_threshold = (hsize_t)0;
- else if(options->fs_threshold != 0) /* Set threshold as specified by user */
+ else if (options->fs_threshold != 0) /* Set threshold as specified by user */
set_threshold = (hsize_t)options->fs_threshold;
/* Set file space information as specified */
- if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0)
+ if (H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_file_space_strategy failed to set file space strategy");
- if(options->fs_pagesize == -1) /* A "0" file space page size is specified by user */
+ if (options->fs_pagesize == -1) /* A "0" file space page size is specified by user */
set_pagesize = (hsize_t)0;
- else if(options->fs_pagesize != 0) /* Set file space page size as specified by user */
+ else if (options->fs_pagesize != 0) /* Set file space page size as specified by user */
set_pagesize = (hsize_t)options->fs_pagesize;
- if(set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */
- if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0)
+ if (set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */
+ if (H5Pset_file_space_page_size(fcpl, set_pagesize) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_file_space_page_size failed to set file space page size");
/*-------------------------------------------------------------------------
@@ -303,14 +305,6 @@ print_user_block(fnamein, fidin);
H5TOOLS_GOTO_ERROR((-1), "H5Fcreate could not create file <%s>:", fnameout);
/*-------------------------------------------------------------------------
- * write a new user block if requested
- *-------------------------------------------------------------------------
- */
- if (options->ublock_size > 0)
- if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0)
- H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting...");
-
- /*-------------------------------------------------------------------------
* get list of objects
*-------------------------------------------------------------------------
*/
@@ -326,41 +320,78 @@ print_user_block(fnamein, fidin);
H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
/*-------------------------------------------------------------------------
- * do the copy
- *-------------------------------------------------------------------------
- */
+ * do the copy
+ *-------------------------------------------------------------------------
+ */
if (do_copy_objects(fidin, fidout, travt, options) < 0)
- H5TOOLS_GOTO_ERROR((-1), "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout);
+ H5TOOLS_GOTO_ERROR((-1), "do_copy_objects from <%s> could not copy data to <%s>", fnamein,
+ fnameout);
/*-------------------------------------------------------------------------
- * do the copy of referenced objects
- * and create hard links
- *-------------------------------------------------------------------------
- */
+ * do the copy of referenced objects
+ * and create hard links
+ *-------------------------------------------------------------------------
+ */
if (do_copy_refobjs(fidin, fidout, travt, options) < 0)
- H5TOOLS_GOTO_ERROR((-1), "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout);
+ H5TOOLS_GOTO_ERROR((-1), "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein,
+ fnameout);
}
/*-------------------------------------------------------------------------
- * write only the input file user block if there is no user block file input
+ * Close the file and everything in it so the lock is removed
*-------------------------------------------------------------------------
*/
+ if (H5Pclose(fcpl) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "could not close fcpl");
+ if (H5Pclose(options->fout_fapl) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "could not close fcpl");
+ options->fout_fapl = H5P_DEFAULT;
+ if (H5Pclose(gcpl_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "could not close fcpl");
+ if (H5Gclose(grp_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "could not close fcpl");
+ if (H5Fclose(fidout) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "could not close fcpl");
+ if (H5Fclose(fidin) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "could not close fcpl");
- if (ub_size > 0 && options->ublock_size == 0)
+ /*-------------------------------------------------------------------------
+ * NOTE: The userblock MUST be written out AFTER the file is closed or
+ * the file locking will cause failures on Windows, where file locks
+ * are mandatory, not advisory.
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * Write a new user block if requested, using the input file user block if
+ * there is no separate user block file input
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->ublock_size > 0) {
+ if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting...");
+ }
+ else if (ub_size > 0 && options->ublock_size == 0) {
if (copy_user_block(fnamein, fnameout, ub_size) < 0)
H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting...");
+ }
done:
- H5E_BEGIN_TRY {
- H5Pclose(fcpl_in);
- H5Pclose(gcpl_in);
- H5Pclose(fcpl);
- H5Gclose(grp_in);
- H5Fclose(fidin);
- H5Fclose(fidout);
- H5Fclose(fidin);
- H5Fclose(fidout);
- } H5E_END_TRY;
+ if (-1 == ret_value) {
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fcpl);
+ H5Pclose(options->fout_fapl);
+ options->fout_fapl = H5P_DEFAULT;
+ H5Pclose(gcpl_in);
+ H5Gclose(grp_in);
+ H5Pclose(fcpl_in);
+ H5Fclose(fidout);
+ H5Fclose(fidin);
+ }
+ H5E_END_TRY;
+ }
if (travt)
trav_table_free(travt);
@@ -400,20 +431,20 @@ done:
*-----------------------------------------*/
int
-get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
- size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p)
+get_hyperslab(hid_t dcpl_id, int rank_dset, const hsize_t dims_dset[], size_t size_datum,
+ hsize_t dims_hslab[], hsize_t *hslab_nbytes_p)
{
- int k;
+ int k;
H5D_layout_t dset_layout;
- int rank_chunk;
- hsize_t dims_chunk[H5S_MAX_RANK];
- hsize_t size_chunk = 1;
- hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
- hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
- hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
- hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
- hsize_t hslab_nbytes; /* size of hyperslab in byte */
- int ret_value = 0;
+ int rank_chunk;
+ hsize_t dims_chunk[H5S_MAX_RANK];
+ hsize_t size_chunk = 1;
+ hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
+ hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
+ hsize_t hslab_nbytes; /* size of hyperslab in byte */
+ int ret_value = 0;
/* init to set as size of a data element */
hslab_nbytes = size_datum;
@@ -452,7 +483,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
chunk_dims_map[k - 1]++;
/* get mapped hyperslab dims */
- hs_dims_map[k - 1] = MIN (nchunk_fit, chunk_dims_map[k-1]);
+ hs_dims_map[k - 1] = MIN(nchunk_fit, chunk_dims_map[k - 1]);
/* prepare next round */
nchunk_fit = nchunk_fit / chunk_dims_map[k - 1];
@@ -461,7 +492,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
nchunk_fit = 1;
/* get hyperslab dimentions as unmapping to actual size */
- dims_hslab[k - 1] = MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]);
+ dims_hslab[k - 1] = MIN((hs_dims_map[k - 1] * dims_chunk[k - 1]), dims_dset[k - 1]);
/* calculate total size for the hyperslab */
hslab_nbytes *= dims_hslab[k - 1];
@@ -482,7 +513,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
if (ndatum_fit == 0)
ndatum_fit = 1;
/* get hyperslab dimentions within a chunk boundary */
- dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit);
+ dims_hslab[k - 1] = MIN(dims_chunk[k - 1], ndatum_fit);
/* calculate total size for the hyperslab */
hslab_nbytes *= dims_hslab[k - 1];
@@ -578,49 +609,49 @@ done:
*/
int
-do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
- pack_opt_t *options) /* repack options */
+do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */
{
- hid_t grp_in = H5I_INVALID_HID; /* group ID */
- hid_t grp_out = H5I_INVALID_HID; /* group ID */
- hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
- hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
- hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
- hid_t gcpl_out = H5I_INVALID_HID; /* group creation property list */
- hid_t type_in = H5I_INVALID_HID; /* named type ID */
- hid_t type_out = H5I_INVALID_HID; /* named type ID */
- hid_t dcpl_in = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t dcpl_out = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t f_space_id = H5I_INVALID_HID; /* file space ID */
- hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
- hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
- hid_t ocpl_id = H5I_INVALID_HID; /* property to pass copy options */
- hid_t lcpl_id = H5I_INVALID_HID; /* link creation property list */
- named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
- size_t msize; /* size of type */
- hsize_t nelmts; /* number of elements in dataset */
- H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */
- int rank; /* rank of dataset */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
- hsize_t dsize_in; /* input dataset size before filter */
- hsize_t dsize_out; /* output dataset size after filter */
- int apply_s; /* flag for apply filter to small dataset sizes */
- int apply_f; /* flag for apply filter to return error on H5Dcreate */
- void *buf = NULL; /* buffer for raw data */
- void *hslab_buf = NULL; /* hyperslab buffer for raw data */
- int has_filter; /* current object has a filter */
- int req_filter; /* there was a request for a filter */
- int req_obj_layout = 0; /* request layout to current object */
- unsigned crt_order_flags; /* group creation order flag */
+ hid_t grp_in = H5I_INVALID_HID; /* group ID */
+ hid_t grp_out = H5I_INVALID_HID; /* group ID */
+ hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
+ hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
+ hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
+ hid_t gcpl_out = H5I_INVALID_HID; /* group creation property list */
+ hid_t type_in = H5I_INVALID_HID; /* named type ID */
+ hid_t type_out = H5I_INVALID_HID; /* named type ID */
+ hid_t dcpl_in = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t dcpl_out = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t f_space_id = H5I_INVALID_HID; /* file space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
+ hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
+ hid_t ocpl_id = H5I_INVALID_HID; /* property to pass copy options */
+ hid_t lcpl_id = H5I_INVALID_HID; /* link creation property list */
+ hid_t dxpl_id = H5I_INVALID_HID; /* dataset transfer property list */
+ named_dt_t * named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
+ size_t msize; /* size of type */
+ hsize_t nelmts; /* number of elements in dataset */
+ H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */
+ int rank; /* rank of dataset */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
+ hsize_t dsize_in; /* input dataset size before filter */
+ hsize_t dsize_out; /* output dataset size after filter */
+ int apply_s; /* flag for apply filter to small dataset sizes */
+ int apply_f; /* flag for apply filter to return error on H5Dcreate */
+ void * buf = NULL; /* buffer for raw data */
+ void * hslab_buf = NULL; /* hyperslab buffer for raw data */
+ int has_filter; /* current object has a filter */
+ int req_filter; /* there was a request for a filter */
+ int req_obj_layout = 0; /* request layout to current object */
+ unsigned crt_order_flags; /* group creation order flag */
h5tool_link_info_t linkinfo;
- unsigned i;
- unsigned u;
- int ifil;
- int is_ref = 0;
- htri_t is_named;
- hbool_t limit_maxdims;
- hsize_t size_dset;
- int ret_value = 0;
+ unsigned i;
+ unsigned u;
+ int ifil;
+ int is_ref = 0;
+ htri_t is_named;
+ hbool_t limit_maxdims;
+ hsize_t size_dset;
+ int ret_value = 0;
/* init linkinfo struct */
HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t));
@@ -639,625 +670,669 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
if (travt->objs) {
for (i = 0; i < travt->nobjs; i++) {
/* init variables per obj */
- buf = NULL;
+ buf = NULL;
limit_maxdims = FALSE;
switch (travt->objs[i].type) {
- case H5TRAV_TYPE_UNKNOWN:
- break;
+ case H5TRAV_TYPE_UNKNOWN:
+ break;
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_GROUP
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_GROUP:
- if (options->verbose)
- HDprintf(FORMAT_OBJ, "group", travt->objs[i].name);
-
- /* open input group */
- if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed");
-
- /* get input group creation property list */
- if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Gget_create_plist failed");
-
- /* query and set the group creation properties */
- if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pget_link_creation_order failed");
-
- /* set up group creation property list */
- if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
-
- if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_creation_order failed");
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_GROUP
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_GROUP:
+ if (options->verbose)
+ HDprintf(FORMAT_OBJ, "group", travt->objs[i].name);
- /*-------------------------------------------------------------------------
- * the root is a special case, we get an ID for the root group
- * and copy its attributes using that ID
- *-------------------------------------------------------------------------
- */
- if (HDstrcmp(travt->objs[i].name, "/") == 0) {
- if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0)
+ /* open input group */
+ if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed");
- }
- else {
- if (options->grp_compact > 0 || options->grp_indexed > 0)
- if (H5Pset_link_phase_change(gcpl_out, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_phase_change failed");
- if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Gcreate2 failed");
- }
+ /* get input group creation property list */
+ if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Gget_create_plist failed");
- /*-------------------------------------------------------------------------
- * copy attrs
- *-------------------------------------------------------------------------
- */
- if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0)
- H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
-
- if (H5Pclose(gcpl_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if (H5Pclose(gcpl_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if (H5Gclose(grp_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
- if (H5Gclose(grp_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
-
- break;
+ /* query and set the group creation properties */
+ if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_link_creation_order failed");
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_DATASET
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_DATASET:
- {
- hbool_t use_h5ocopy;
-
- has_filter = 0;
- req_filter = 0;
-
- /* check if global filters were requested */
- if (options->n_filter_g)
- req_filter = 1;
-
- /* check if filters were requested for individual objects */
- if (options->op_tbl->objs) {
- for (u = 0; u < options->op_tbl->nelems; u++) {
- if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
- for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) {
- if (options->op_tbl->objs[u].filter[ifil].filtn > 0)
- req_filter = 1;
- }
- }
- }
+ /* set up group creation property list */
+ if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
- /* check if layout change requested individual object */
- if (options->layout_g != H5D_LAYOUT_ERROR) {
- pack_info_t *pckinfo;
+ if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_creation_order failed");
- /* any dataset is specified */
- if (options->op_tbl->nelems > 0) {
- /* check if object exist */
- pckinfo = options_get_object(travt->objs[i].name, options->op_tbl);
- if (pckinfo)
- req_obj_layout = 1;
+ /*-------------------------------------------------------------------------
+ * the root is a special case, we get an ID for the root group
+ * and copy its attributes using that ID
+ *-------------------------------------------------------------------------
+ */
+ if (HDstrcmp(travt->objs[i].name, "/") == 0) {
+ if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed");
+ }
+ else {
+ if (options->grp_compact > 0 || options->grp_indexed > 0)
+ if (H5Pset_link_phase_change(gcpl_out, (unsigned)options->grp_compact,
+ (unsigned)options->grp_indexed) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_phase_change failed");
+
+ if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out,
+ H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Gcreate2 failed");
}
- }
- /* early detection of references */
- if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
- if ((ftype_id = H5Dget_type(dset_in)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
- if (H5T_REFERENCE == H5Tget_class(ftype_id))
- is_ref = 1;
-
- /* Check if the datatype is committed */
- if ((is_named = H5Tcommitted(ftype_id)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tcommitted failed");
- if (is_named)
- if ((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed");
+ /*-------------------------------------------------------------------------
+ * copy attrs
+ *-------------------------------------------------------------------------
+ */
+ if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
+
+ if (H5Pclose(gcpl_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ if (H5Pclose(gcpl_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ if (H5Gclose(grp_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
+ if (H5Gclose(grp_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
- if (H5Tclose(ftype_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if (H5Dclose(dset_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
+ break;
/*-------------------------------------------------------------------------
- * check if we should use H5Ocopy or not
- * if there is a request for filters/layout, we read/write the object
- * otherwise we do a copy using H5Ocopy
+ * H5TRAV_TYPE_DATASET
*-------------------------------------------------------------------------
*/
- use_h5ocopy = !(options->op_tbl->nelems || options->all_filter == 1
- || options->all_layout == 1 || is_ref || is_named);
+ case H5TRAV_TYPE_DATASET: {
+ hbool_t use_h5ocopy;
+
+ has_filter = 0;
+ req_filter = 0;
+
+ /* check if global filters were requested */
+ if (options->n_filter_g)
+ req_filter = 1;
+
+ /* check if filters were requested for individual objects */
+ if (options->op_tbl->objs) {
+ for (u = 0; u < options->op_tbl->nelems; u++) {
+ if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
+ for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) {
+ if (options->op_tbl->objs[u].filter[ifil].filtn > 0)
+ req_filter = 1;
+ }
+ }
+ }
- if (!use_h5ocopy) {
- int j;
+ /* check if layout change requested individual object */
+ if (options->layout_g != H5D_LAYOUT_ERROR) {
+ pack_info_t *pckinfo;
+ /* any dataset is specified */
+ if (options->op_tbl->nelems > 0) {
+ /* check if object exist */
+ pckinfo = options_get_object(travt->objs[i].name, options->op_tbl);
+ if (pckinfo)
+ req_obj_layout = 1;
+ }
+ }
+
+ /* early detection of references */
if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
- if ((f_space_id = H5Dget_space(dset_in)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
if ((ftype_id = H5Dget_type(dset_in)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
- if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed");
- HDmemset(dims, 0, sizeof dims);
- if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed");
- if (H5Dget_space_status(dset_in, &space_status) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dget_space_status failed");
-
- /* If the input dataset has external storage, it must be contiguous.
- * Accordingly, there would be no filter or chunk properties to preserve,
- * so create a new DCPL.
- * Otherwise, copy dcpl_in.
- */
- if (H5Pget_external_count(dcpl_in)) {
- if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
- }
- else if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) {
- H5TOOLS_GOTO_ERROR((-1), "H5Pcopy failed");
- }
+ if (H5T_REFERENCE == H5Tget_class(ftype_id))
+ is_ref = 1;
- nelmts = 1;
- for (j = 0; j < rank; j++)
- nelmts *= dims[j];
+ /* Check if the datatype is committed */
+ if ((is_named = H5Tcommitted(ftype_id)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tcommitted failed");
+ if (is_named)
+ if ((wtype_id =
+ copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed");
- /* wtype_id will have already been set if using a named dtype */
- if (!is_named) {
- if (options->use_native == 1)
- wtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT);
- else
- wtype_id = H5Tcopy(ftype_id);
- }
-
- if ((msize = H5Tget_size(wtype_id)) == 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
-
- /* size of current dset */
- size_dset = nelmts * msize;
+ if (H5Tclose(ftype_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ if (H5Dclose(dset_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
/*-------------------------------------------------------------------------
- * check if the dataset creation property list has filters that
- * are not registered in the current configuration
- * 1) the external filters GZIP and SZIP might not be available
- * 2) the internal filters might be turned off
+ * check if we should use H5Ocopy or not
+ * if there is a request for filters/layout, we read/write the object
+ * otherwise we do a copy using H5Ocopy
*-------------------------------------------------------------------------
*/
- if (h5tools_canreadf((travt->objs[i].name), dcpl_in) == 1) {
- apply_s = 1;
- apply_f = 1;
-
- /*-------------------------------------------------------------------------
- * references are a special case
- * we cannot just copy the buffers, but instead we recreate the reference
- * in a second traversal of the output file
- *-------------------------------------------------------------------------
+ use_h5ocopy = !(options->op_tbl->nelems || options->all_filter == 1 ||
+ options->all_layout == 1 || is_ref || is_named);
+
+ if (!use_h5ocopy) {
+ int j;
+
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
+ if ((f_space_id = H5Dget_space(dset_in)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
+ if ((ftype_id = H5Dget_type(dset_in)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
+ if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
+ if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed");
+ HDmemset(dims, 0, sizeof dims);
+ if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed");
+ if (H5Dget_space_status(dset_in, &space_status) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_space_status failed");
+
+ /* If the input dataset has external storage, it must be contiguous.
+ * Accordingly, there would be no filter or chunk properties to preserve,
+ * so create a new DCPL.
+ * Otherwise, copy dcpl_in.
*/
- if (H5T_REFERENCE != H5Tget_class(wtype_id)) {
- /* get the storage size of the input dataset */
- dsize_in = H5Dget_storage_size(dset_in);
+ if (H5Pget_external_count(dcpl_in)) {
+ if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
+ }
+ else if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) {
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcopy failed");
+ }
- /* check for small size datasets (less than 1k) except
- * changing to COMPACT. For the reference, COMPACT is limited
- * by size 64K by library.
- */
- if (options->layout_g != H5D_COMPACT)
- if (size_dset < options->min_comp)
- apply_s = 0;
-
- /* apply the filter */
- if (apply_s)
- if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out, options, &has_filter) < 0)
- H5TOOLS_GOTO_ERROR((-1), "apply_filters failed");
-
- /* only if layout change requested for entire file or
- * individual obj */
- if (options->all_layout > 0 || req_obj_layout == 1) {
- /*-------------------------------------------------
- * Unset the unlimited max dims if convert to other
- * than chunk layouts, because unlimited max dims
- * only can be applied to chunk layout.
- * Also perform only for targeted dataset
- * Also check for size limit to convert to compact
- *-------------------------------------------------*/
- if (options->layout_g != H5D_CHUNKED) {
- /* any dataset is specified */
- if (options->op_tbl->nelems > 0) {
- /* if current obj match specified obj */
- if (options_get_object(travt->objs[i].name, options->op_tbl))
- limit_maxdims = TRUE;
- }
- else /* no dataset is specified */
- limit_maxdims = TRUE;
+ nelmts = 1;
+ for (j = 0; j < rank; j++)
+ nelmts *= dims[j];
- /* if convert to COMPACT */
- if (options->layout_g == H5D_COMPACT)
- if (size_dset > MAX_COMPACT_DSIZE)
- limit_maxdims = FALSE;
+ /* wtype_id will have already been set if using a named dtype */
+ if (!is_named) {
+ if (options->use_native == 1)
+ wtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT);
+ else
+ wtype_id = H5Tcopy(ftype_id);
+ }
- /* unset unlimited max dims */
- if (limit_maxdims)
- H5Sset_extent_simple(f_space_id, rank, dims, NULL);
- } /* end if not chunked */
- } /* end if layout change requested for entire file or individual object */
+ if ((msize = H5Tget_size(wtype_id)) == 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
- /*-------------------------------------------------------------------------
- * create the output dataset;
- * disable error checking in case the dataset cannot be created with the
- * modified dcpl; in that case use the original instead
- *-------------------------------------------------------------------------
- */
- dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT);
- if (dset_out == H5I_INVALID_HID) {
- H5TOOLS_INFO("H5Dcreate2 failed");
- if (options->verbose)
- HDprintf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name);
+ /* size of current dset */
+ size_dset = nelmts * msize;
- if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed");
- apply_f = 0;
- } /* end if retry dataset create */
+ /*-------------------------------------------------------------------------
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if (h5tools_canreadf((travt->objs[i].name), dcpl_in) == 1) {
+ apply_s = 1;
+ apply_f = 1;
/*-------------------------------------------------------------------------
- * read/write
+ * references are a special case
+ * we cannot just copy the buffers, but instead we recreate the reference
+ * in a second traversal of the output file
*-------------------------------------------------------------------------
*/
- if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) {
- size_t need = (size_t)(nelmts * msize); /* bytes needed */
-
- /* have to read the whole dataset if there is only one element in the dataset */
- if (need < H5TOOLS_MALLOCSIZE)
- buf = HDmalloc(need);
-
- if (buf != NULL) {
- if(H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
- if(H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
-
- /* Check if we have VL data in the dataset's
- * datatype that must be reclaimed */
- if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
- if (H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dvlen_reclaim failed");
-
- if (buf != NULL) { /* TODO: is buf potentially released by H5Dvlen_reclaim()? */
- HDfree(buf);
- buf = NULL;
- }
- }
- else { /* possibly not enough memory, read/write by hyperslabs */
- size_t p_type_nbytes = msize; /*size of memory type */
- hsize_t p_nelmts = nelmts; /*total elements */
- hsize_t elmtno; /*counter */
- int carry; /*counter carry value */
- unsigned int vl_data = 0; /*contains VL datatypes */
-
- /* hyperslab info */
- hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */
- hsize_t hslab_nbytes; /*bytes per hyperslab */
- hsize_t hslab_nelmts; /*elements per hyperslab*/
- hid_t hslab_space; /*hyperslab data space */
-
- /* hyperslab selection info */
- hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */
- hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */
- hsize_t hs_select_nelmts; /* selected elements */
- hsize_t zero[8]; /*vector of zeros */
- int k;
- H5D_layout_t dset_layout;
- hid_t dcpl_tmp = H5I_INVALID_HID; /* dataset creation property list ID */
-
- /* check if we have VL data in the dataset's datatype */
- if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE)
- vl_data = TRUE;
-
- /* check first if writing dataset is chunked,
- * if so use its chunk layout for better performance. */
- dset_layout = H5Pget_layout(dcpl_out);
- if (dset_layout == H5D_CHUNKED)
- dcpl_tmp = dcpl_out; /* writing dataset */
- else {
- dset_layout = H5Pget_layout(dcpl_in);
- if (dset_layout == H5D_CHUNKED)
- dcpl_tmp = dcpl_in; /* reading dataset */
- }
+ if (H5T_REFERENCE != H5Tget_class(wtype_id)) {
+ /* get the storage size of the input dataset */
+ dsize_in = H5Dget_storage_size(dset_in);
- /* get hyperslab dims and size in byte */
- if (get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0)
- H5TOOLS_GOTO_ERROR((-1), "get_hyperslab failed");
-
- hslab_buf = HDmalloc((size_t)hslab_nbytes);
- if (hslab_buf == NULL)
- H5TOOLS_GOTO_ERROR((-1), "can't allocate space for hyperslab");
-
- hslab_nelmts = hslab_nbytes / p_type_nbytes;
- hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL);
-
- /* the hyperslab selection loop */
- HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset);
- HDmemset(zero, 0, sizeof zero);
-
- for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) {
- if (rank > 0) {
- /* calculate the hyperslab selections.
- * The selection would be same as the hyperslab
- * except for remaining edge portion of the dataset
- * which is smaller then the hyperslab.
- */
- for (k = 0, hs_select_nelmts = 1; k < rank; k++) {
- /* MIN() is used to get the remaining edge portion if exist.
- * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/
- hs_sel_count[k] = MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]);
- hs_select_nelmts *= hs_sel_count[k];
- }
+ /* check for small size datasets (less than 1k) except
+ * changing to COMPACT. For the reference, COMPACT is limited
+ * by size 64K by library.
+ */
+ if (options->layout_g != H5D_COMPACT)
+ if (size_dset < options->min_comp)
+ apply_s = 0;
+
+ /* apply the filter */
+ if (apply_s)
+ if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out,
+ options, &has_filter) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "apply_filters failed");
+
+ /* only if layout change requested for entire file or
+ * individual obj */
+ if (options->all_layout > 0 || req_obj_layout == 1) {
+ /*-------------------------------------------------
+ * Unset the unlimited max dims if convert to other
+ * than chunk layouts, because unlimited max dims
+ * only can be applied to chunk layout.
+ * Also perform only for targeted dataset
+ * Also check for size limit to convert to compact
+ *-------------------------------------------------*/
+ if (options->layout_g != H5D_CHUNKED) {
+ /* any dataset is specified */
+ if (options->op_tbl->nelems > 0) {
+ /* if current obj match specified obj */
+ if (options_get_object(travt->objs[i].name, options->op_tbl))
+ limit_maxdims = TRUE;
+ }
+ else /* no dataset is specified */
+ limit_maxdims = TRUE;
- if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed");
- if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed");
- } /* end if rank > 0 */
- else {
- H5Sselect_all(f_space_id);
- H5Sselect_all(hslab_space);
- hs_select_nelmts = 1;
- } /* end (else) rank == 0 */
+ /* if convert to COMPACT */
+ if (options->layout_g == H5D_COMPACT)
+ if (size_dset > MAX_COMPACT_DSIZE)
+ limit_maxdims = FALSE;
+
+ /* unset unlimited max dims */
+ if (limit_maxdims)
+ H5Sset_extent_simple(f_space_id, rank, dims, NULL);
+ } /* end if not chunked */
+ } /* end if layout change requested for entire file or individual object */
+
+ /*-------------------------------------------------------------------------
+ * create the output dataset;
+ * disable error checking in case the dataset cannot be created with the
+ * modified dcpl; in that case use the original instead
+ *-------------------------------------------------------------------------
+ */
+ dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id,
+ H5P_DEFAULT, dcpl_out, H5P_DEFAULT);
+ if (dset_out == H5I_INVALID_HID) {
+ H5TOOLS_INFO("H5Dcreate2 failed");
+ if (options->verbose)
+ HDprintf(" warning: could not create dataset <%s>. Applying original "
+ "settings\n",
+ travt->objs[i].name);
+
+ if ((dset_out =
+ H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id,
+ H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed");
+ apply_f = 0;
+ } /* end if retry dataset create */
+
+ /*-------------------------------------------------------------------------
+ * read/write
+ *-------------------------------------------------------------------------
+ */
+ if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) {
+ size_t need = (size_t)(nelmts * msize); /* bytes needed */
+
+ /* have to read the whole dataset if there is only one element in the
+ * dataset */
+ if (need < H5TOOLS_MALLOCSIZE)
+ buf = HDmalloc(need);
+
+ /* Set up collective write if using filters in parallel */
+ {
+#ifdef H5_HAVE_PARALLEL
+ hbool_t parallel = (H5FD_MPIO == H5Pget_driver(options->fout_fapl));
+
+ if (parallel && apply_s && apply_f) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
+ if (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_dxpl_mpio failed");
+ }
+ else
+#endif
+ dxpl_id = H5P_DEFAULT;
+ }
- if(H5Dread(dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0)
+ if (buf != NULL) {
+ if (H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) <
+ 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
- if(H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0)
+ if (H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
- /* reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT, hslab_buf);
-
- /* calculate the next hyperslab offset */
- for (k = rank, carry = 1; k > 0 && carry; --k) {
- hs_sel_offset[k - 1] += hs_sel_count[k - 1];
- /* if reached the end of a dim */
- if (hs_sel_offset[k - 1] == dims[k - 1])
- hs_sel_offset[k - 1] = 0;
- else
- carry = 0;
- }
- } /* end for (hyperslab selection loop) */
+ /* Check if we have VL data in the dataset's
+ * datatype that must be reclaimed */
+ if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
+ if (H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dvlen_reclaim failed");
- H5Sclose(hslab_space);
- if (hslab_buf != NULL) {
- HDfree(hslab_buf);
- hslab_buf = NULL;
+ if (buf != NULL) { /* TODO: is buf potentially released by
+ H5Dvlen_reclaim()? */
+ HDfree(buf);
+ buf = NULL;
+ }
}
- } /* end if reading/writing by hyperslab */
- } /* end if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) */
-
- /*-------------------------------------------------------------------------
- * print amount of compression used
- *-------------------------------------------------------------------------
- */
- if (options->verbose) {
- double ratio = 0;
-
- /* only print the compression ration if there was a filter request */
- if (apply_s && apply_f && req_filter) {
- /* get the storage size of the output dataset */
- dsize_out = H5Dget_storage_size(dset_out);
-
- /* compression ratio = uncompressed size / compressed size */
- if (dsize_out != 0)
- ratio = (double) dsize_in / (double) dsize_out;
- print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1);
- }
- else
- print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0);
+ else { /* possibly not enough memory, read/write by hyperslabs */
+ size_t p_type_nbytes = msize; /*size of memory type */
+ hsize_t p_nelmts = nelmts; /*total elements */
+ hsize_t elmtno; /*counter */
+ int carry; /*counter carry value */
+ unsigned int vl_data = 0; /*contains VL datatypes */
+
+ /* hyperslab info */
+ hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */
+ hsize_t hslab_nbytes; /*bytes per hyperslab */
+ hsize_t hslab_nelmts; /*elements per hyperslab*/
+ hid_t hslab_space; /*hyperslab data space */
+
+ /* hyperslab selection info */
+ hsize_t hs_sel_offset[H5S_MAX_RANK]; /* selection offset */
+ hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */
+ hsize_t hs_select_nelmts; /* selected elements */
+ hsize_t zero[8]; /*vector of zeros */
+ int k;
+ H5D_layout_t dset_layout;
+ hid_t dcpl_tmp =
+ H5I_INVALID_HID; /* dataset creation property list ID */
+
+ /* check if we have VL data in the dataset's datatype */
+ if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE)
+ vl_data = TRUE;
+
+ /* check first if writing dataset is chunked,
+ * if so use its chunk layout for better performance. */
+ dset_layout = H5Pget_layout(dcpl_out);
+ if (dset_layout == H5D_CHUNKED)
+ dcpl_tmp = dcpl_out; /* writing dataset */
+ else {
+ dset_layout = H5Pget_layout(dcpl_in);
+ if (dset_layout == H5D_CHUNKED)
+ dcpl_tmp = dcpl_in; /* reading dataset */
+ }
- /* print a message that the filter was not applied
- * (in case there was a filter)
- */
- if (has_filter && apply_s == 0)
- HDprintf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", travt->objs[i].name, (int) options->min_comp);
+ /* get hyperslab dims and size in byte */
+ if (get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims,
+ &hslab_nbytes) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "get_hyperslab failed");
+
+ hslab_buf = HDmalloc((size_t)hslab_nbytes);
+ if (hslab_buf == NULL)
+ H5TOOLS_GOTO_ERROR((-1), "can't allocate space for hyperslab");
+
+ hslab_nelmts = hslab_nbytes / p_type_nbytes;
+ hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL);
+
+ /* the hyperslab selection loop */
+ HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset);
+ HDmemset(zero, 0, sizeof zero);
+
+ for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) {
+ if (rank > 0) {
+ /* calculate the hyperslab selections.
+ * The selection would be same as the hyperslab
+ * except for remaining edge portion of the dataset
+ * which is smaller then the hyperslab.
+ */
+ for (k = 0, hs_select_nelmts = 1; k < rank; k++) {
+ /* MIN() is used to get the remaining edge portion if
+ * exist. "dims[k] - hs_sel_offset[k]" is remaining edge
+ * portion that is smaller then the hyperslab.*/
+ hs_sel_count[k] =
+ MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]);
+ hs_select_nelmts *= hs_sel_count[k];
+ }
+
+ if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET,
+ hs_sel_offset, NULL, hs_sel_count,
+ NULL) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed");
+ if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero,
+ NULL, &hs_select_nelmts, NULL) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed");
+ } /* end if rank > 0 */
+ else {
+ H5Sselect_all(f_space_id);
+ H5Sselect_all(hslab_space);
+ hs_select_nelmts = 1;
+ } /* end (else) rank == 0 */
+
+ if (H5Dread(dset_in, wtype_id, hslab_space, f_space_id,
+ H5P_DEFAULT, hslab_buf) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
+ if (H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, dxpl_id,
+ hslab_buf) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
+
+ /* reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT,
+ hslab_buf);
+
+ /* calculate the next hyperslab offset */
+ for (k = rank, carry = 1; k > 0 && carry; --k) {
+ hs_sel_offset[k - 1] += hs_sel_count[k - 1];
+ /* if reached the end of a dim */
+ if (hs_sel_offset[k - 1] == dims[k - 1])
+ hs_sel_offset[k - 1] = 0;
+ else
+ carry = 0;
+ }
+ } /* end for (hyperslab selection loop) */
- if (has_filter && apply_f == 0)
- HDprintf(" <warning: could not apply the filter to %s>\n", travt->objs[i].name);
- } /* end if verbose (print compression) */
+ H5Sclose(hslab_space);
+ if (hslab_buf != NULL) {
+ HDfree(hslab_buf);
+ hslab_buf = NULL;
+ }
+ } /* end if reading/writing by hyperslab */
+ } /* end if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) */
- /*-------------------------------------------------------------------------
- * copy attrs
- *-------------------------------------------------------------------------
- */
- if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
- H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
+ /*-------------------------------------------------------------------------
+ * print amount of compression used
+ *-------------------------------------------------------------------------
+ */
+ if (options->verbose) {
+ double ratio = 0;
+
+ /* only print the compression ration if there was a filter request */
+ if (apply_s && apply_f && req_filter) {
+ /* get the storage size of the output dataset */
+ dsize_out = H5Dget_storage_size(dset_out);
+
+ /* compression ratio = uncompressed size / compressed size */
+ if (dsize_out != 0)
+ ratio = (double)dsize_in / (double)dsize_out;
+ print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1);
+ }
+ else
+ print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0);
+
+ /* print a message that the filter was not applied
+ * (in case there was a filter)
+ */
+ if (has_filter && apply_s == 0)
+ HDprintf(" <warning: filter not applied to %s. dataset smaller than "
+ "%d bytes>\n",
+ travt->objs[i].name, (int)options->min_comp);
+
+ if (has_filter && apply_f == 0)
+ HDprintf(" <warning: could not apply the filter to %s>\n",
+ travt->objs[i].name);
+ } /* end if verbose (print compression) */
+
+ /*-------------------------------------------------------------------------
+ * copy attrs
+ *-------------------------------------------------------------------------
+ */
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
- if (H5Dclose(dset_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
- } /* end if not a reference */
- } /* end if h5tools_canreadf (filter availability check) */
+ if (H5Dclose(dset_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
+ } /* end if not a reference */
+ } /* end if h5tools_canreadf (filter availability check) */
+ /*-------------------------------------------------------------------------
+ * Close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Tclose(ftype_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ if (H5Tclose(wtype_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ if (H5Pclose(dcpl_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ if (H5Pclose(dcpl_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ if (H5Sclose(f_space_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
+ if (H5Dclose(dset_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
+ }
/*-------------------------------------------------------------------------
- * Close
+ * We do not have request for filter/chunking; use H5Ocopy instead
*-------------------------------------------------------------------------
*/
- if (H5Tclose(ftype_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if (H5Tclose(wtype_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if (H5Pclose(dcpl_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if (H5Pclose(dcpl_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if (H5Sclose(f_space_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- if (H5Dclose(dset_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
- }
+ else {
+ /* create property to pass copy options */
+ if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
+
+ /* set options for object copy */
+ if (H5Pset_copy_object(ocpl_id, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
+
+ if (H5Ocopy(fidin, /* Source file or group identifier */
+ travt->objs[i].name, /* Name of the source object to be copied */
+ fidout, /* Destination file or group identifier */
+ travt->objs[i].name, /* Name of the destination object */
+ ocpl_id, /* Properties which apply to the copy */
+ H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
+ H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
+
+ if (H5Pclose(ocpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ ocpl_id = H5I_INVALID_HID;
+
+ /*-------------------------------------------------------------------------
+ * Copy attrs manually
+ *-------------------------------------------------------------------------
+ */
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
+ if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
+ if (H5Dclose(dset_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
+ if (H5Dclose(dset_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
+
+ if (options->verbose)
+ HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
+
+ } /* end whether we have request for filter/chunking */
+
+ break;
+ } /* H5TRAV_TYPE_DATASET */
+
/*-------------------------------------------------------------------------
- * We do not have request for filter/chunking; use H5Ocopy instead
+ * H5TRAV_TYPE_NAMED_DATATYPE
*-------------------------------------------------------------------------
*/
- else {
- /* create property to pass copy options */
- if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
+ case H5TRAV_TYPE_NAMED_DATATYPE:
+ if (options->verbose)
+ HDprintf(FORMAT_OBJ, "type", travt->objs[i].name);
- /* set options for object copy */
- if (H5Pset_copy_object(ocpl_id, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
+ if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Topen2 failed");
- if (H5Ocopy(fidin, /* Source file or group identifier */
- travt->objs[i].name, /* Name of the source object to be copied */
- fidout, /* Destination file or group identifier */
- travt->objs[i].name, /* Name of the destination object */
- ocpl_id, /* Properties which apply to the copy */
- H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
- H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
+ /* Copy the datatype anonymously */
+ if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, travt, options)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed");
- if (H5Pclose(ocpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- ocpl_id = H5I_INVALID_HID;
+ /* Link in to group structure */
+ if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) <
+ 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Lcreate_hard failed");
/*-------------------------------------------------------------------------
- * Copy attrs manually
+ * copy attrs
*-------------------------------------------------------------------------
*/
- if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
- if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
- if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0)
H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
- if (H5Dclose(dset_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
- if (H5Dclose(dset_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
-
- if (options->verbose)
- HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
- } /* end whether we have request for filter/chunking */
-
- break;
- } /* H5TRAV_TYPE_DATASET */
-
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_NAMED_DATATYPE
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_NAMED_DATATYPE:
- if (options->verbose)
- HDprintf(FORMAT_OBJ, "type", travt->objs[i].name);
-
- if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Topen2 failed");
-
- /* Copy the datatype anonymously */
- if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, travt, options)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed");
+ if (H5Tclose(type_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ if (H5Tclose(type_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ type_out = H5I_INVALID_HID; /* named datatypes stack, named_dt_head, manages allocation */
- /* Link in to group structure */
- if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Lcreate_hard failed");
+ break;
/*-------------------------------------------------------------------------
- * copy attrs
+ * H5TRAV_TYPE_LINK
+ * H5TRAV_TYPE_UDLINK
+ *
+ * Only handles external links; H5Lcopy will fail for other UD link types
+ * since we don't have creation or copy callbacks for them.
*-------------------------------------------------------------------------
*/
- if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0)
- H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
+ case H5TRAV_TYPE_LINK:
+ case H5TRAV_TYPE_UDLINK:
+ if (options->verbose)
+ HDprintf(FORMAT_OBJ, "link", travt->objs[i].name);
+
+ /* Check -X option. */
+ if (options->merge) {
+ if (H5tools_get_symlink_info(fidin, travt->objs[i].name, &linkinfo, 1) == 0) {
+ /* dangling link */
+ if (options->prune) {
+ HDprintf("Pruned %s.\n", travt->objs[i].name);
+ }
+ else {
+ if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed");
+ }
+ }
+ else {
+ /* valid link */
+ /* create property to pass copy options */
+ if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate create property failed");
+
+ /* set options for object copy */
+ if (H5Pset_copy_object(ocpl_id, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
+
+ /* Create link creation property list */
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate link creation property failed");
+ }
- if (H5Tclose(type_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if (H5Tclose(type_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- type_out = H5I_INVALID_HID; /* named datatypes stack, named_dt_head, manages allocation */
+ /* Set flag for intermediate group creation */
+ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_create_intermediate_group failed");
- break;
+ if (H5Ocopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, ocpl_id,
+ lcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_LINK
- * H5TRAV_TYPE_UDLINK
- *
- * Only handles external links; H5Lcopy will fail for other UD link types
- * since we don't have creation or copy callbacks for them.
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_LINK:
- case H5TRAV_TYPE_UDLINK:
- if (options->verbose)
- HDprintf(FORMAT_OBJ, "link", travt->objs[i].name);
-
- /* Check -X option. */
- if (options->merge) {
- if (H5tools_get_symlink_info(fidin, travt->objs[i].name, &linkinfo, 1) == 0) {
- /* dangling link */
+ if (H5Pclose(lcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+
+ if (H5Pclose(ocpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ }
+
+ /* free link info path */
+ if (linkinfo.trg_path)
+ HDfree(linkinfo.trg_path);
+ linkinfo.trg_path = NULL;
+ } /* options->merge */
+ else {
if (options->prune) {
HDprintf("Pruned %s.\n", travt->objs[i].name);
}
else {
- if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed");
}
}
- else {
- /* valid link */
- /* create property to pass copy options */
- if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate create property failed");
-
- /* set options for object copy */
- if (H5Pset_copy_object(ocpl_id, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
-
- /* Create link creation property list */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate link creation property failed");
- }
-
- /* Set flag for intermediate group creation */
- if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_create_intermediate_group failed");
-
- if (H5Ocopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, ocpl_id, lcpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
-
- if (H5Pclose(lcpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
-
- if (H5Pclose(ocpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- }
-
- /* free link info path */
- if (linkinfo.trg_path)
- HDfree(linkinfo.trg_path);
- linkinfo.trg_path = NULL;
- } /* options->merge */
- else {
- if (options->prune) {
- HDprintf("Pruned %s.\n", travt->objs[i].name);
- }
- else {
- if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed");
- }
- }
- break;
+ break;
- default:
- H5TOOLS_GOTO_ERROR((-1), "Object type not found");
+ default:
+ H5TOOLS_GOTO_ERROR((-1), "Object type not found");
} /* switch */
- } /* end for each object to traverse */
- } /* end if there are objects */
+ } /* end for each object to traverse */
+ } /* end if there are objects */
done:
@@ -1268,9 +1343,11 @@ done:
H5TOOLS_ERROR((-1), "named_datatype_free failed");
}
else {
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
named_datatype_free(&named_dt_head, 1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
}
/* free link info path */
@@ -1286,6 +1363,7 @@ done:
H5Pclose(dcpl_in);
H5Pclose(gcpl_in);
H5Pclose(gcpl_out);
+ H5Pclose(dxpl_id);
H5Sclose(f_space_id);
H5Dclose(dset_in);
H5Dclose(dset_out);
@@ -1293,7 +1371,8 @@ done:
H5Tclose(wtype_id);
H5Tclose(type_in);
H5Tclose(type_out);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* free */
if (buf != NULL)
@@ -1313,17 +1392,17 @@ done:
static void
print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
{
- char strfilter[255];
-#if defined (PRINT_DEBUG )
- char temp[255];
+ char strfilter[255];
+#if defined(PRINT_DEBUG)
+ char temp[255];
#endif
- int nfilters; /* number of filters */
- unsigned filt_flags; /* filter flags */
- H5Z_filter_t filtn; /* filter identification number */
- unsigned cd_values[20]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
- char f_objname[256]; /* filter objname */
- int i;
+ int nfilters; /* number of filters */
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ char f_objname[256]; /* filter objname */
+ int i;
HDstrcpy(strfilter, "\0");
@@ -1334,8 +1413,8 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
for (i = 0; i < nfilters; i++) {
cd_nelmts = NELMTS(cd_values);
- if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_objname), f_objname, NULL)) < 0) {
+ if ((filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, cd_values,
+ sizeof(f_objname), f_objname, NULL)) < 0) {
HDstrcat(strfilter, "ERROR ");
continue;
}
@@ -1348,11 +1427,11 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
case H5Z_FILTER_DEFLATE:
HDstrcat(strfilter, "GZIP ");
-#if defined (PRINT_DEBUG)
+#if defined(PRINT_DEBUG)
{
unsigned level = cd_values[0];
- HDsprintf(temp,"(%d)", level);
+ HDsprintf(temp, "(%d)", level);
HDstrcat(strfilter, temp);
}
#endif
@@ -1361,12 +1440,12 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
case H5Z_FILTER_SZIP:
HDstrcat(strfilter, "SZIP ");
-#if defined (PRINT_DEBUG)
+#if defined(PRINT_DEBUG)
{
unsigned options_mask = cd_values[0]; /* from dcpl, not filt*/
- unsigned ppb = cd_values[1];
+ unsigned ppb = cd_values[1];
- HDsprintf(temp,"(%d,", ppb);
+ HDsprintf(temp, "(%d,", ppb);
HDstrcat(strfilter, temp);
if (options_mask & H5_SZIP_EC_OPTION_MASK)
HDstrcpy(temp, "EC) ");
@@ -1397,7 +1476,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
HDstrcat(strfilter, "UD ");
break;
} /* end switch */
- } /* end for each filter */
+ } /* end for each filter */
if (!pr)
HDprintf(FORMAT_OBJ, "dset", objname);
@@ -1436,9 +1515,9 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size)
/* Copy the userblock from the input file to the output file */
while (size > 0) {
- ssize_t nread, nbytes; /* # of bytes transfered, etc. */
- char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */
- const char *wbuf; /* Pointer into buffer, for writing */
+ ssize_t nread, nbytes; /* # of bytes transfered, etc. */
+ char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */
+ const char *wbuf; /* Pointer into buffer, for writing */
/* Read buffer from source file */
if (size > USERBLOCK_XFER_SIZE)
@@ -1451,14 +1530,14 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size)
/* Write buffer to destination file */
/* (compensating for interrupted writes & checking for errors, etc.) */
nbytes = nread;
- wbuf = rbuf;
+ wbuf = rbuf;
while (nbytes > 0) {
ssize_t nwritten; /* # of bytes written */
do {
nwritten = HDwrite(outfid, wbuf, (size_t)nbytes);
} while (-1 == nwritten && EINTR == errno);
- if (-1 == nwritten) /* error */
+ if (-1 == nwritten) /* error */
H5TOOLS_GOTO_ERROR((-1), "HDwrite failed");
HDassert(nwritten > 0);
HDassert(nwritten <= nbytes);
@@ -1470,7 +1549,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size)
} /* end while */
/* Update size of userblock left to transfer */
- size = size - (hsize_t) nread;
+ size = size - (hsize_t)nread;
} /* end while */
done:
@@ -1490,14 +1569,13 @@ done:
* Return: 0, ok, -1 no
*-------------------------------------------------------------------------
*/
-#if defined (H5REPACK_DEBUG_USER_BLOCK)
-static
-void
+#if defined(H5REPACK_DEBUG_USER_BLOCK)
+static void
print_user_block(const char *filename, hid_t fid)
{
- int fh = -1; /* file handle */
- hsize_t ub_size; /* user block size */
- hsize_t size; /* size read */
+ int fh = -1; /* file handle */
+ hsize_t ub_size; /* user block size */
+ hsize_t size; /* size read */
hid_t fcpl = H5I_INVALID_HID; /* file creation property list ID for HDF5 file */
int i;
int ret_value = 0;
@@ -1524,8 +1602,8 @@ print_user_block(const char *filename, hid_t fid)
/* read file */
while (size > 0) {
- ssize_t nread; /* # of bytes read */
- char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
+ ssize_t nread; /* # of bytes read */
+ char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
/* read buffer */
if (size > USERBLOCK_XFER_SIZE)
@@ -1536,7 +1614,6 @@ print_user_block(const char *filename, hid_t fid)
for (i = 0; i < nread; i++) {
HDprintf("%c ", rbuf[i]);
-
}
HDprintf("\n");
@@ -1555,4 +1632,3 @@ done:
return;
} /* end print_user_block() */
#endif
-
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index d1179fb..32476ce 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,12 +17,12 @@
/* number of members in an array */
#ifndef NELMTS
-# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
+#define NELMTS(X) (sizeof(X) / sizeof(X[0]))
#endif
/* minimum of two values */
#undef MIN
-#define MIN(a,b) (((a)<(b)) ? (a) : (b))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
/*-------------------------------------------------------------------------
* Function: aux_copy_obj
@@ -32,15 +32,16 @@
* Return: 0 success, -1 failure
*-------------------------------------------------------------------------
*/
-static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
- const char* name, /* object name from traverse list */
- pack_info_t *objout /*OUT*/) /* info about object to filter */
+static int
+aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
+ const char * name, /* object name from traverse list */
+ pack_info_t *objout /*OUT*/) /* info about object to filter */
{
int nfilters; /* number of filters in DCPL */
char f_objname[256]; /* filter objname */
H5D_layout_t layout;
- int rank; /* rank of dataset */
- hsize_t chsize[64]; /* chunk size in elements */
+ int rank; /* rank of dataset */
+ hsize_t chsize[64]; /* chunk size in elements */
int i;
unsigned u;
int ret_value = 0;
@@ -50,8 +51,9 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
H5TOOLS_GOTO_ERROR((-1), "H5Pget_nfilters failed");
/* copy filter_info_t structure */
for (i = 0; i < nfilters; i++) {
- if ((objout->filter[i].filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &objout->filter[i].filt_flag, &objout->filter[i].cd_nelmts,
- objout->filter[i].cd_values, sizeof(f_objname), f_objname, NULL)) < 0)
+ if ((objout->filter[i].filtn = H5Pget_filter2(
+ dcpl_id, (unsigned)i, &objout->filter[i].filt_flag, &objout->filter[i].cd_nelmts,
+ objout->filter[i].cd_values, sizeof(f_objname), f_objname, NULL)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_filter2 failed");
}
@@ -63,7 +65,7 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
objout->layout = layout;
if (layout == H5D_CHUNKED) {
- if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
+ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize /*out*/)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_chunk failed");
objout->chunk.rank = rank;
for (u = 0; u < (unsigned)rank; u++)
@@ -81,30 +83,33 @@ done:
* in the repack options list
*-------------------------------------------------------------------------
*/
-static int aux_find_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+static int
+aux_find_obj(const char * name, /* object name from traverse list */
+ pack_opt_t * options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
- char *pdest = NULL;
- const char *pname = NULL;
+ char * pdest = NULL;
+ const char * pname = NULL;
unsigned int i;
for (i = 0; i < options->op_tbl->nelems; i++) {
if (HDstrcmp(options->op_tbl->objs[i].path, name) == 0) {
*obj = options->op_tbl->objs[i];
- return (int) i;
+ return (int)i;
}
pdest = options->op_tbl->objs[i].path;
- if (pdest[0] == '/') pdest++;
+ if (pdest[0] == '/')
+ pdest++;
pname = name;
- if (pname[0] == '/') pname++;
+ if (pname[0] == '/')
+ pname++;
if (HDstrcmp(pdest, pname) == 0) {
*obj = options->op_tbl->objs[i];
- return (int) i;
+ return (int)i;
}
- }/*i*/
+ } /*i*/
return -1;
}
@@ -118,9 +123,10 @@ static int aux_find_obj(const char* name, /* object name from traverse list */
* Return: 0 not found, 1 found
*-------------------------------------------------------------------------
*/
-static int aux_assign_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+static int
+aux_assign_obj(const char * name, /* object name from traverse list */
+ pack_opt_t * options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
int idx, i;
pack_info_t tmp;
@@ -136,44 +142,44 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
/* assign the global layout info to the OBJ info */
tmp.layout = options->layout_g;
switch (options->layout_g) {
- case H5D_CHUNKED:
- tmp.chunk.rank = options->chunk_g.rank;
- for (i = 0; i < tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i] = options->chunk_g.chunk_lengths[i];
- break;
- case H5D_LAYOUT_ERROR:
- case H5D_COMPACT:
- case H5D_CONTIGUOUS:
- case H5D_VIRTUAL:
- case H5D_NLAYOUTS:
- break;
- default:
- break;
- }/*switch*/
+ case H5D_CHUNKED:
+ tmp.chunk.rank = options->chunk_g.rank;
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] = options->chunk_g.chunk_lengths[i];
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_COMPACT:
+ case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
+ case H5D_NLAYOUTS:
+ break;
+ default:
+ break;
+ } /*switch*/
}
else {
tmp.layout = options->op_tbl->objs[idx].layout;
switch (tmp.layout) {
- case H5D_CHUNKED:
- tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank;
- for (i = 0; i < tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i] = options->op_tbl->objs[idx].chunk.chunk_lengths[i];
- break;
- case H5D_LAYOUT_ERROR:
- case H5D_COMPACT:
- case H5D_CONTIGUOUS:
- case H5D_VIRTUAL:
- case H5D_NLAYOUTS:
- break;
- default:
- break;
- }/*switch*/
+ case H5D_CHUNKED:
+ tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank;
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] = options->op_tbl->objs[idx].chunk.chunk_lengths[i];
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_COMPACT:
+ case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
+ case H5D_NLAYOUTS:
+ break;
+ default:
+ break;
+ } /*switch*/
}
/* applying to all objects */
if (options->all_filter) {
/* assign the global filter */
- tmp.nfilters = 1;
+ tmp.nfilters = 1;
tmp.filter[0] = options->filter_g[0];
} /* if all */
else {
@@ -197,21 +203,20 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
/* assign the global layout info to the OBJ info */
tmp.layout = options->layout_g;
switch (options->layout_g) {
- case H5D_CHUNKED:
- tmp.chunk.rank = options->chunk_g.rank;
- for (i = 0; i < tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i] =
- options->chunk_g.chunk_lengths[i];
- break;
- case H5D_LAYOUT_ERROR:
- case H5D_COMPACT:
- case H5D_CONTIGUOUS:
- case H5D_VIRTUAL:
- case H5D_NLAYOUTS:
- break;
- default:
- break;
- }/*switch*/
+ case H5D_CHUNKED:
+ tmp.chunk.rank = options->chunk_g.rank;
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] = options->chunk_g.chunk_lengths[i];
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_COMPACT:
+ case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
+ case H5D_NLAYOUTS:
+ break;
+ default:
+ break;
+ } /*switch*/
}
}
@@ -230,16 +235,17 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
-int apply_filters(const char* name, /* object name from traverse list */
- int rank, /* rank of dataset */
- hsize_t *dims, /* dimensions of dataset */
- size_t msize, /* size of type */
- hid_t dcpl_id, /* dataset creation property list */
- pack_opt_t *options, /* repack options */
- int *has_filter) /* (OUT) object NAME has a filter */
+int
+apply_filters(const char * name, /* object name from traverse list */
+ int rank, /* rank of dataset */
+ const hsize_t *dims, /* dimensions of dataset */
+ size_t msize, /* size of type */
+ hid_t dcpl_id, /* dataset creation property list */
+ pack_opt_t * options, /* repack options */
+ int * has_filter) /* (OUT) object NAME has a filter */
{
- int nfilters; /* number of filters in DCPL */
- hsize_t chsize[64]; /* chunk size in elements */
+ int nfilters; /* number of filters in DCPL */
+ hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout;
int i;
pack_info_t obj;
@@ -269,7 +275,6 @@ int apply_filters(const char* name, /* object name from traverse list */
if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_nfilters failed");
-
/*-------------------------------------------------------------------------
* check if we have filters in the pipeline
* we want to replace them with the input filters
@@ -281,7 +286,7 @@ int apply_filters(const char* name, /* object name from traverse list */
if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Premove_filter failed");
}
- else if(nfilters) {
+ else if (nfilters) {
*has_filter = 1;
if (aux_copy_obj(dcpl_id, name, &filtobj) < 0)
H5TOOLS_GOTO_ERROR((-1), "aux_copy_obj failed");
@@ -297,9 +302,9 @@ int apply_filters(const char* name, /* object name from traverse list */
H5TOOLS_GOTO_ERROR((-1), "H5Pget_layout failed");
if (layout == H5D_CHUNKED) {
- if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
+ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize /*out*/)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_chunk failed");
- obj.layout = H5D_CHUNKED;
+ obj.layout = H5D_CHUNKED;
obj.chunk.rank = rank;
for (i = 0; i < rank; i++)
obj.chunk.chunk_lengths[i] = chsize[i];
@@ -327,7 +332,7 @@ int apply_filters(const char* name, /* object name from traverse list */
if (obj.layout == -1) {
/* stripmine info */
hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
- hsize_t sm_nbytes; /*bytes per stripmine */
+ hsize_t sm_nbytes; /*bytes per stripmine */
obj.chunk.rank = rank;
@@ -339,7 +344,7 @@ int apply_filters(const char* name, /* object name from traverse list */
sm_nbytes = msize;
for (i = rank; i > 0; --i) {
hsize_t size = 0;
- if(sm_nbytes == 0)
+ if (sm_nbytes == 0)
H5TOOLS_GOTO_ERROR((-1), "number of bytes per stripmine must be > 0");
size = H5TOOLS_BUFSIZE / sm_nbytes;
if (size == 0) /* datum size > H5TOOLS_BUFSIZE */
@@ -358,19 +363,18 @@ int apply_filters(const char* name, /* object name from traverse list */
H5TOOLS_GOTO_ERROR((-1), "invalid filter");
switch (obj.filter[i].filtn) {
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_NONE 0 , uncompress if compressed
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_NONE:
- break;
-
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE 1 , deflation like gzip
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_DEFLATE:
- {
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_NONE 0 , uncompress if compressed
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_NONE:
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_DEFLATE: {
unsigned aggression; /* the deflate level */
aggression = obj.filter[i].cd_values[0];
@@ -379,19 +383,17 @@ int apply_filters(const char* name, /* object name from traverse list */
H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
if (H5Pset_deflate(dcpl_id, aggression) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_deflate failed");
- }
- break;
+ } break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP 4 , szip compression
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SZIP:
- {
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP 4 , szip compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SZIP: {
unsigned options_mask;
unsigned pixels_per_block;
- options_mask = obj.filter[i].cd_values[0];
+ options_mask = obj.filter[i].cd_values[0];
pixels_per_block = obj.filter[i].cd_values[1];
/* set up for szip data */
@@ -399,70 +401,64 @@ int apply_filters(const char* name, /* object name from traverse list */
H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
if (H5Pset_szip(dcpl_id, options_mask, pixels_per_block) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_szip failed");
- }
- break;
+ } break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SHUFFLE 2 , shuffle the data
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SHUFFLE:
- if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
- if (H5Pset_shuffle(dcpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_shuffle failed");
- break;
-
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_FLETCHER32:
- if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
- if (H5Pset_fletcher32(dcpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_fletcher32 failed");
- break;
- /*----------- -------------------------------------------------------------
- * H5Z_FILTER_NBIT , NBIT compression
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_NBIT:
- if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
- if (H5Pset_nbit(dcpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_nbit failed");
- break;
- /*----------- -------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET , scale+offset compression
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SCALEOFFSET:
- {
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SHUFFLE:
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
+ if (H5Pset_shuffle(dcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_shuffle failed");
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_FLETCHER32:
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
+ if (H5Pset_fletcher32(dcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_fletcher32 failed");
+ break;
+ /*----------- -------------------------------------------------------------
+ * H5Z_FILTER_NBIT , NBIT compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_NBIT:
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
+ if (H5Pset_nbit(dcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_nbit failed");
+ break;
+ /*----------- -------------------------------------------------------------
+ * H5Z_FILTER_SCALEOFFSET , scale+offset compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SCALEOFFSET: {
H5Z_SO_scale_type_t scale_type;
- int scale_factor;
+ int scale_factor;
- scale_type = (H5Z_SO_scale_type_t) obj.filter[i].cd_values[0];
- scale_factor = (int) obj.filter[i].cd_values[1];
+ scale_type = (H5Z_SO_scale_type_t)obj.filter[i].cd_values[0];
+ scale_factor = (int)obj.filter[i].cd_values[1];
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
if (H5Pset_scaleoffset(dcpl_id, scale_type, scale_factor) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_scaleoffset failed");
- }
- break;
- default:
- {
+ } break;
+ default: {
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
- if (H5Pset_filter(dcpl_id, obj.filter[i].filtn,
- obj.filter[i].filt_flag, obj.filter[i].cd_nelmts,
- obj.filter[i].cd_values) < 0)
+ if (H5Pset_filter(dcpl_id, obj.filter[i].filtn, obj.filter[i].filt_flag,
+ obj.filter[i].cd_nelmts, obj.filter[i].cd_values) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_filter failed");
- }
- break;
+ } break;
} /* switch */
- }/*i*/
+ } /*i*/
}
/*obj.nfilters*/
@@ -474,7 +470,7 @@ int apply_filters(const char* name, /* object name from traverse list */
if (H5Zfilter_avail(filtobj.filter[i].filtn) <= 0)
H5TOOLS_GOTO_ERROR((-1), "%d filter unavailable", filtobj.filter[i].filtn);
} /* for */
- } /* nfilters */
+ } /* nfilters */
/*-------------------------------------------------------------------------
* layout
@@ -504,4 +500,3 @@ int apply_filters(const char* name, /* object name from traverse list */
done:
return ret_value;
}
-
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 009755e..e4fa10d 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,54 +18,51 @@
/* Name of tool */
#define PROGRAMNAME "h5repack"
-static int parse_command_line(int argc, const char **argv, pack_opt_t* options);
+static int parse_command_line(int argc, const char **argv, pack_opt_t *options);
static void leave(int ret) H5_ATTR_NORETURN;
-
/* module-scoped variables */
-static int has_i = 0;
-static int has_o = 0;
-const char *infile = NULL;
+static int has_i = 0;
+static int has_o = 0;
+const char *infile = NULL;
const char *outfile = NULL;
/*
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW";
-static struct long_options l_opts[] = {
- { "alignment", require_arg, 'a' },
- { "block", require_arg, 'b' },
- { "compact", require_arg, 'c' },
- { "indexed", require_arg, 'd' },
- { "file", require_arg, 'e' },
- { "filter", require_arg, 'f' },
- { "help", no_arg, 'h' },
- { "infile", require_arg, 'i' }, /* for backward compability */
- { "low", require_arg, 'j' },
- { "high", require_arg, 'k' },
- { "layout", require_arg, 'l' },
- { "minimum", require_arg, 'm' },
- { "native", no_arg, 'n' },
- { "outfile", require_arg, 'o' }, /* for backward compability */
- { "sort_by", require_arg, 'q' },
- { "ssize", require_arg, 's' },
- { "threshold", require_arg, 't' },
- { "ublock", require_arg, 'u' },
- { "verbose", no_arg, 'v' },
- { "sort_order", require_arg, 'z' },
- { "enable-error-stack", no_arg, 'E' },
- { "fs_pagesize", require_arg, 'G' },
- { "latest", no_arg, 'L' },
- { "metadata_block_size", require_arg, 'M' },
- { "fs_persist", require_arg, 'P' },
- { "fs_strategy", require_arg, 'S' },
- { "fs_threshold", require_arg, 'T' },
- { "version", no_arg, 'V' },
- { "merge", no_arg, 'X' },
- { "prune", no_arg, 'W' },
- { NULL, 0, '\0' }
-};
+static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW";
+static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'},
+ {"block", require_arg, 'b'},
+ {"compact", require_arg, 'c'},
+ {"indexed", require_arg, 'd'},
+ {"file", require_arg, 'e'},
+ {"filter", require_arg, 'f'},
+ {"help", no_arg, 'h'},
+ {"infile", require_arg, 'i'}, /* for backward compability */
+ {"low", require_arg, 'j'},
+ {"high", require_arg, 'k'},
+ {"layout", require_arg, 'l'},
+ {"minimum", require_arg, 'm'},
+ {"native", no_arg, 'n'},
+ {"outfile", require_arg, 'o'}, /* for backward compability */
+ {"sort_by", require_arg, 'q'},
+ {"ssize", require_arg, 's'},
+ {"threshold", require_arg, 't'},
+ {"ublock", require_arg, 'u'},
+ {"verbose", no_arg, 'v'},
+ {"sort_order", require_arg, 'z'},
+ {"enable-error-stack", no_arg, 'E'},
+ {"fs_pagesize", require_arg, 'G'},
+ {"latest", no_arg, 'L'},
+ {"metadata_block_size", require_arg, 'M'},
+ {"fs_persist", require_arg, 'P'},
+ {"fs_strategy", require_arg, 'S'},
+ {"fs_threshold", require_arg, 'T'},
+ {"version", no_arg, 'V'},
+ {"merge", no_arg, 'X'},
+ {"prune", no_arg, 'W'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -76,7 +73,9 @@ static struct long_options l_opts[] = {
*
*-------------------------------------------------------------------------
*/
-static void usage(const char *prog) {
+static void
+usage(const char *prog)
+{
FLUSHSTREAM(rawoutstream);
PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] file1 file2\n", prog);
PRINTVALSTREAM(rawoutstream, " file1 Input HDF5 File\n");
@@ -86,91 +85,120 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " -v, --verbose Verbose mode, print object information\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n");
- PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --enable-error-stack Prints messages from the HDF5 error stack as they\n");
PRINTVALSTREAM(rawoutstream, " occur\n");
PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n");
- PRINTVALSTREAM(rawoutstream, " This option will take precedence over the options\n");
+ PRINTVALSTREAM(rawoutstream,
+ " This option will take precedence over the options\n");
PRINTVALSTREAM(rawoutstream, " --low and --high\n");
- PRINTVALSTREAM(rawoutstream, " --low=BOUND The low bound for library release versions to use\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --low=BOUND The low bound for library release versions to use\n");
PRINTVALSTREAM(rawoutstream, " when creating objects in the file\n");
PRINTVALSTREAM(rawoutstream, " (default is H5F_LIBVER_EARLIEST)\n");
- PRINTVALSTREAM(rawoutstream, " --high=BOUND The high bound for library release versions to use\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --high=BOUND The high bound for library release versions to use\n");
PRINTVALSTREAM(rawoutstream, " when creating objects in the file\n");
PRINTVALSTREAM(rawoutstream, " (default is H5F_LIBVER_LATEST)\n");
- PRINTVALSTREAM(rawoutstream, " --merge Follow external soft link recursively and merge data\n");
- PRINTVALSTREAM(rawoutstream, " --prune Do not follow external soft links and remove link\n");
- PRINTVALSTREAM(rawoutstream, " --merge --prune Follow external link, merge data and remove dangling link\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --merge Follow external soft link recursively and merge data\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --prune Do not follow external soft links and remove link\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --merge --prune Follow external link, merge data and remove dangling link\n");
PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n");
- PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -d L2, --indexed=L2 Minimum number of links in the indexed format\n");
PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n");
- PRINTVALSTREAM(rawoutstream, " -m M, --minimum=M Do not apply the filter to datasets smaller than M\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -m M, --minimum=M Do not apply the filter to datasets smaller than M\n");
PRINTVALSTREAM(rawoutstream, " -e E, --file=E Name of file E with the -f and -l options\n");
- PRINTVALSTREAM(rawoutstream, " -u U, --ublock=U Name of file U with user block data to be added\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -u U, --ublock=U Name of file U with user block data to be added\n");
PRINTVALSTREAM(rawoutstream, " -b B, --block=B Size of user block to be added\n");
- PRINTVALSTREAM(rawoutstream, " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n");
PRINTVALSTREAM(rawoutstream, " -t T, --threshold=T Threshold value for H5Pset_alignment\n");
PRINTVALSTREAM(rawoutstream, " -a A, --alignment=A Alignment value for H5Pset_alignment\n");
PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n");
PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n");
PRINTVALSTREAM(rawoutstream, " -f FILT, --filter=FILT Filter type\n");
PRINTVALSTREAM(rawoutstream, " -l LAYT, --layout=LAYT Layout type\n");
- PRINTVALSTREAM(rawoutstream, " -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for\n");
PRINTVALSTREAM(rawoutstream, " H5Pset_file_space_strategy\n");
- PRINTVALSTREAM(rawoutstream, " -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free-\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free-\n");
PRINTVALSTREAM(rawoutstream, " space for H5Pset_file_space_strategy\n");
- PRINTVALSTREAM(rawoutstream, " -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold\n");
PRINTVALSTREAM(rawoutstream, " for H5Pset_file_space_strategy\n");
PRINTVALSTREAM(rawoutstream, " -G FS_PAGESIZE, --fs_pagesize=FS_PAGESIZE File space page size for\n");
PRINTVALSTREAM(rawoutstream, " H5Pset_file_space_page_size\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " M - is an integer greater than 1, size of dataset in bytes (default is 0)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " M - is an integer greater than 1, size of dataset in bytes (default is 0)\n");
PRINTVALSTREAM(rawoutstream, " E - is a filename.\n");
PRINTVALSTREAM(rawoutstream, " S - is an integer\n");
PRINTVALSTREAM(rawoutstream, " U - is a filename.\n");
PRINTVALSTREAM(rawoutstream, " T - is an integer\n");
PRINTVALSTREAM(rawoutstream, " A - is an integer greater than zero\n");
- PRINTVALSTREAM(rawoutstream, " Q - is the sort index type for the input file. It can be \"name\" or\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Q - is the sort index type for the input file. It can be \"name\" or\n");
PRINTVALSTREAM(rawoutstream, " \"creation_order\" (default)\n");
- PRINTVALSTREAM(rawoutstream, " Z - is the sort order type for the input file. It can be \"descending\" or\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Z - is the sort order type for the input file. It can be \"descending\" or\n");
PRINTVALSTREAM(rawoutstream, " \"ascending\" (default)\n");
PRINTVALSTREAM(rawoutstream, " B - is the user block size, any value that is 512 or greater and is\n");
PRINTVALSTREAM(rawoutstream, " a power of 2 (1024 default)\n");
- PRINTVALSTREAM(rawoutstream, " F - is the shared object header message type, any of <dspace|dtype|fill|\n");
+ PRINTVALSTREAM(rawoutstream,
+ " F - is the shared object header message type, any of <dspace|dtype|fill|\n");
PRINTVALSTREAM(rawoutstream, " pline|attr>. If F is not specified, S applies to all messages\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " BOUND is an integer indicating the library release versions to use when\n");
+ PRINTVALSTREAM(rawoutstream,
+ " BOUND is an integer indicating the library release versions to use when\n");
PRINTVALSTREAM(rawoutstream, " creating objects in the file (see H5Pset_libver_bounds()):\n");
PRINTVALSTREAM(rawoutstream, " 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct\n");
PRINTVALSTREAM(rawoutstream, " 1: This is H5F_LIBVER_V18 in H5F_libver_t struct\n");
PRINTVALSTREAM(rawoutstream, " 2: This is H5F_LIBVER_V110 in H5F_libver_t struct\n");
- PRINTVALSTREAM(rawoutstream, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 for this release\n");
+ PRINTVALSTREAM(rawoutstream,
+ " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 for this release\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " FS_STRATEGY is a string indicating the file space strategy used:\n");
PRINTVALSTREAM(rawoutstream, " FSM_AGGR:\n");
- PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are free-space\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The mechanisms used in managing file space are free-space\n");
PRINTVALSTREAM(rawoutstream, " managers, aggregators and virtual file driver.\n");
PRINTVALSTREAM(rawoutstream, " PAGE:\n");
- PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are free-space\n");
- PRINTVALSTREAM(rawoutstream, " managers with embedded paged aggregation and virtual file driver.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The mechanisms used in managing file space are free-space\n");
+ PRINTVALSTREAM(rawoutstream,
+ " managers with embedded paged aggregation and virtual file driver.\n");
PRINTVALSTREAM(rawoutstream, " AGGR:\n");
- PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are aggregators and\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The mechanisms used in managing file space are aggregators and\n");
PRINTVALSTREAM(rawoutstream, " virtual file driver.\n");
PRINTVALSTREAM(rawoutstream, " NONE:\n");
- PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are virtual file\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The mechanisms used in managing file space are virtual file\n");
PRINTVALSTREAM(rawoutstream, " driver.\n");
- PRINTVALSTREAM(rawoutstream, " The default strategy when not set is FSM_AGGR without persisting free-\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The default strategy when not set is FSM_AGGR without persisting free-\n");
PRINTVALSTREAM(rawoutstream, " space.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " FS_PERSIST is 1 to persisting free-space or 0 to not persisting free-space.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " FS_PERSIST is 1 to persisting free-space or 0 to not persisting free-space.\n");
PRINTVALSTREAM(rawoutstream, " The default when not set is not persisting free-space.\n");
PRINTVALSTREAM(rawoutstream, " The value is ignored for AGGR and NONE strategies.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be\n");
+ PRINTVALSTREAM(rawoutstream,
+ " FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be\n");
PRINTVALSTREAM(rawoutstream, " tracked by the library.\n");
PRINTVALSTREAM(rawoutstream, " The default when not set is 1.\n");
PRINTVALSTREAM(rawoutstream, " The value is ignored for AGGR and NONE strategies.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when\n");
+ PRINTVALSTREAM(rawoutstream,
+ " FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when\n");
PRINTVALSTREAM(rawoutstream, " the file space strategy PAGE is used.\n");
PRINTVALSTREAM(rawoutstream, " The default when not set is 4096.\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -178,8 +206,10 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " <list of objects>:<name of filter>=<filter parameters>\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " <list of objects> is a comma separated list of object names, meaning apply\n");
- PRINTVALSTREAM(rawoutstream, " compression only to those objects. If no names are specified, the filter\n");
+ PRINTVALSTREAM(rawoutstream,
+ " <list of objects> is a comma separated list of object names, meaning apply\n");
+ PRINTVALSTREAM(rawoutstream,
+ " compression only to those objects. If no names are specified, the filter\n");
PRINTVALSTREAM(rawoutstream, " is applied to all objects\n");
PRINTVALSTREAM(rawoutstream, " <name of filter> can be:\n");
PRINTVALSTREAM(rawoutstream, " GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n");
@@ -192,24 +222,31 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " NONE, to remove all filters\n");
PRINTVALSTREAM(rawoutstream, " <filter parameters> is optional filter parameter information\n");
PRINTVALSTREAM(rawoutstream, " GZIP=<deflation level> from 1-9\n");
- PRINTVALSTREAM(rawoutstream, " SZIP=<pixels per block,coding> pixels per block is a even number in\n");
+ PRINTVALSTREAM(rawoutstream,
+ " SZIP=<pixels per block,coding> pixels per block is a even number in\n");
PRINTVALSTREAM(rawoutstream, " 2-32 and coding method is either EC or NN\n");
PRINTVALSTREAM(rawoutstream, " SHUF (no parameter)\n");
PRINTVALSTREAM(rawoutstream, " FLET (no parameter)\n");
PRINTVALSTREAM(rawoutstream, " NBIT (no parameter)\n");
- PRINTVALSTREAM(rawoutstream, " SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
+ PRINTVALSTREAM(rawoutstream,
+ " SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
PRINTVALSTREAM(rawoutstream, " is either IN or DS\n");
- PRINTVALSTREAM(rawoutstream, " UD=<filter_number,filter_flag,cd_value_count,value1[,value2,...,valueN]>\n");
- PRINTVALSTREAM(rawoutstream, " Required values: filter_number, filter_flag, cd_value_count, value1\n");
+ PRINTVALSTREAM(rawoutstream,
+ " UD=<filter_number,filter_flag,cd_value_count,value1[,value2,...,valueN]>\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Required values: filter_number, filter_flag, cd_value_count, value1\n");
PRINTVALSTREAM(rawoutstream, " Optional values: value2 to valueN\n");
+ PRINTVALSTREAM(rawoutstream, " filter_flag: 1 is OPTIONAL or 0 is MANDATORY\n");
PRINTVALSTREAM(rawoutstream, " NONE (no parameter)\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " LAYT - is a string with the format:\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " <list of objects>:<layout type>=<layout parameters>\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " <list of objects> is a comma separated list of object names, meaning that\n");
- PRINTVALSTREAM(rawoutstream, " layout information is supplied for those objects. If no names are\n");
+ PRINTVALSTREAM(rawoutstream,
+ " <list of objects> is a comma separated list of object names, meaning that\n");
+ PRINTVALSTREAM(rawoutstream,
+ " layout information is supplied for those objects. If no names are\n");
PRINTVALSTREAM(rawoutstream, " specified, the layout type is applied to all objects\n");
PRINTVALSTREAM(rawoutstream, " <layout type> can be:\n");
PRINTVALSTREAM(rawoutstream, " CHUNK, to apply chunking layout\n");
@@ -228,11 +265,14 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "2) h5repack -v -f dset1:SZIP=8,NN file1 file2\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " SZIP compression with 8 pixels per block and NN coding method to object dset1\n");
+ PRINTVALSTREAM(rawoutstream,
+ " SZIP compression with 8 pixels per block and NN coding method to object dset1\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, "3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2\n");
+ PRINTVALSTREAM(rawoutstream,
+ "3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " Chunked layout, with a layout size of 20x10, to objects dset1 and dset2\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Chunked layout, with a layout size of 20x10, to objects dset1 and dset2\n");
PRINTVALSTREAM(rawoutstream, " and remove filters to objects dset3, dset4, dset5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "4) h5repack -L -c 10 -s 20:dtype file1 file2\n");
@@ -263,7 +303,8 @@ static void usage(const char *prog) {
* Return: Does not return
*-------------------------------------------------------------------------
*/
-static void leave(int ret)
+static void
+leave(int ret)
{
h5tools_close();
HDexit(ret);
@@ -277,15 +318,15 @@ static void leave(int ret)
* Return: void, exit on error
*-------------------------------------------------------------------------
*/
-static
-int read_info(const char *filename, pack_opt_t *options)
+static int
+read_info(const char *filename, pack_opt_t *options)
{
- char stype[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- char comp_info[1024];
+ char stype[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ char comp_info[1024];
FILE *fp = NULL;
- char c;
- int i;
- int ret_value = EXIT_SUCCESS;
+ char c;
+ int i;
+ int ret_value = EXIT_SUCCESS;
if (NULL == (fp = HDfopen(filename, "r"))) {
error_msg("cannot open options file %s\n", filename);
@@ -296,11 +337,11 @@ int read_info(const char *filename, pack_opt_t *options)
/* cycle until end of file reached */
while (1) {
- if (EOF == fscanf(fp, "%9s", stype))
+ if (EOF == HDfscanf(fp, "%9s", stype))
break;
/* Info indicator must be for layout or filter */
- if (HDstrcmp(stype,"-l") && HDstrcmp(stype, "-f")) {
+ if (HDstrcmp(stype, "-l") != 0 && HDstrcmp(stype, "-f") != 0) {
error_msg("bad file format for %s", filename);
h5tools_setstatus(EXIT_FAILURE);
ret_value = EXIT_FAILURE;
@@ -311,7 +352,7 @@ int read_info(const char *filename, pack_opt_t *options)
i = 0;
c = '0';
while (c != ' ') {
- if (fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
+ if (HDfscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
error_msg("fscanf error\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = EXIT_FAILURE;
@@ -323,7 +364,7 @@ int read_info(const char *filename, pack_opt_t *options)
c = '0';
/* go until end */
while (c != ' ') {
- if (fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
+ if (HDfscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
error_msg("fscanf error\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = EXIT_FAILURE;
@@ -414,25 +455,25 @@ set_sort_order(const char *form)
* Purpose: parse command line input
*-------------------------------------------------------------------------
*/
-static
-int parse_command_line(int argc, const char **argv, pack_opt_t* options)
+static int
+parse_command_line(int argc, const char **argv, pack_opt_t *options)
{
int bound, opt;
int ret_value = 0;
/* parse command line options */
- while (EOF != (opt = get_option(argc, argv, s_opts, l_opts))) {
- switch ((char) opt) {
+ while (EOF != (opt = H5_get_option(argc, argv, s_opts, l_opts))) {
+ switch ((char)opt) {
/* -i for backward compatibility */
case 'i':
- infile = opt_arg;
+ infile = H5_optarg;
has_i++;
break;
/* -o for backward compatibility */
case 'o':
- outfile = opt_arg;
+ outfile = H5_optarg;
has_o++;
break;
@@ -454,7 +495,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
case 'f':
/* parse the -f filter option */
- if (h5repack_addfilter(opt_arg, options) < 0) {
+ if (h5repack_addfilter(H5_optarg, options) < 0) {
error_msg("in parsing filter\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
@@ -464,7 +505,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
case 'l':
/* parse the -l layout option */
- if (h5repack_addlayout(opt_arg, options) < 0) {
+ if (h5repack_addlayout(H5_optarg, options) < 0) {
error_msg("in parsing layout\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
@@ -473,9 +514,9 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'm':
- options->min_comp = HDstrtoull(opt_arg , NULL, 0);
- if ((int) options->min_comp <= 0) {
- error_msg("invalid minimum compress size <%s>\n", opt_arg);
+ options->min_comp = HDstrtoull(H5_optarg, NULL, 0);
+ if ((int)options->min_comp <= 0) {
+ error_msg("invalid minimum compress size <%s>\n", H5_optarg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -483,8 +524,8 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'e':
- if ((ret_value = read_info(opt_arg, options)) < 0) {
- error_msg("failed to read from repack options file <%s>\n", opt_arg);
+ if ((ret_value = read_info(H5_optarg, options)) < 0) {
+ error_msg("failed to read from repack options file <%s>\n", H5_optarg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -500,7 +541,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'j':
- bound = HDatoi(opt_arg);
+ bound = HDatoi(H5_optarg);
if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) {
error_msg("in parsing low bound\n");
h5tools_setstatus(EXIT_FAILURE);
@@ -511,7 +552,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'k':
- bound = HDatoi(opt_arg);
+ bound = HDatoi(H5_optarg);
if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) {
error_msg("in parsing high bound\n");
h5tools_setstatus(EXIT_FAILURE);
@@ -530,123 +571,119 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'c':
- options->grp_compact = HDatoi( opt_arg );
+ options->grp_compact = HDatoi(H5_optarg);
if (options->grp_compact > 0)
options->latest = TRUE; /* must use latest format */
break;
case 'd':
- options->grp_indexed = HDatoi( opt_arg );
+ options->grp_indexed = HDatoi(H5_optarg);
if (options->grp_indexed > 0)
options->latest = TRUE; /* must use latest format */
break;
- case 's':
- {
- int idx = 0;
- int ssize = 0;
- char *msgPtr = HDstrchr(opt_arg, ':');
- options->latest = TRUE; /* must use latest format */
- if (msgPtr == NULL) {
- ssize = HDatoi(opt_arg);
- for (idx = 0; idx < 5; idx++)
- options->msg_size[idx] = ssize;
- }
- else {
- char msgType[10];
-
- HDstrcpy(msgType, msgPtr + 1);
- msgPtr[0] = '\0';
- ssize = HDatoi( opt_arg );
- if (!HDstrncmp(msgType, "dspace", 6))
- options->msg_size[0] = ssize;
- else if (!HDstrncmp(msgType, "dtype", 5))
- options->msg_size[1] = ssize;
- else if (!HDstrncmp(msgType, "fill", 4))
- options->msg_size[2] = ssize;
- else if (!HDstrncmp(msgType, "pline", 5))
- options->msg_size[3] = ssize;
- else if (!HDstrncmp(msgType, "attr", 4))
- options->msg_size[4] = ssize;
- }
+ case 's': {
+ int idx = 0;
+ int ssize = 0;
+ char *msgPtr = HDstrchr(H5_optarg, ':');
+ options->latest = TRUE; /* must use latest format */
+ if (msgPtr == NULL) {
+ ssize = HDatoi(H5_optarg);
+ for (idx = 0; idx < 5; idx++)
+ options->msg_size[idx] = ssize;
}
- break;
+ else {
+ char msgType[10];
+
+ HDstrcpy(msgType, msgPtr + 1);
+ msgPtr[0] = '\0';
+ ssize = HDatoi(H5_optarg);
+ if (!HDstrncmp(msgType, "dspace", 6))
+ options->msg_size[0] = ssize;
+ else if (!HDstrncmp(msgType, "dtype", 5))
+ options->msg_size[1] = ssize;
+ else if (!HDstrncmp(msgType, "fill", 4))
+ options->msg_size[2] = ssize;
+ else if (!HDstrncmp(msgType, "pline", 5))
+ options->msg_size[3] = ssize;
+ else if (!HDstrncmp(msgType, "attr", 4))
+ options->msg_size[4] = ssize;
+ }
+ } break;
case 'u':
- options->ublock_filename = opt_arg;
+ options->ublock_filename = H5_optarg;
break;
case 'b':
- options->ublock_size = (hsize_t) HDatol( opt_arg );
+ options->ublock_size = (hsize_t)HDatol(H5_optarg);
break;
case 'M':
- options->meta_block_size = (hsize_t) HDatol( opt_arg );
+ options->meta_block_size = (hsize_t)HDatol(H5_optarg);
break;
case 't':
- options->threshold = (hsize_t) HDatol( opt_arg );
+ options->threshold = (hsize_t)HDatol(H5_optarg);
break;
case 'a':
- options->alignment = HDstrtoull(opt_arg , NULL, 0);
+ options->alignment = HDstrtoull(H5_optarg, NULL, 0);
if (options->alignment < 1) {
- error_msg("invalid alignment size\n", opt_arg);
+ error_msg("invalid alignment size\n", H5_optarg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
}
break;
- case 'S':
- {
- char strategy[MAX_NC_NAME];
-
- HDstrcpy(strategy, opt_arg);
- if (!HDstrcmp(strategy, "FSM_AGGR"))
- options->fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
- else if (!HDstrcmp(strategy, "PAGE"))
- options->fs_strategy = H5F_FSPACE_STRATEGY_PAGE;
- else if (!HDstrcmp(strategy, "AGGR"))
- options->fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
- else if (!HDstrcmp(strategy, "NONE"))
- options->fs_strategy = H5F_FSPACE_STRATEGY_NONE;
- else {
- error_msg("invalid file space management strategy\n", opt_arg);
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- goto done;
- }
- if (options->fs_strategy == (H5F_fspace_strategy_t)0)
- /* To distinguish the "specified" zero value */
- options->fs_strategy = (H5F_fspace_strategy_t)-1;
+ case 'S': {
+ char strategy[MAX_NC_NAME];
+
+ HDstrcpy(strategy, H5_optarg);
+ if (!HDstrcmp(strategy, "FSM_AGGR"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
+ else if (!HDstrcmp(strategy, "PAGE"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_PAGE;
+ else if (!HDstrcmp(strategy, "AGGR"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
+ else if (!HDstrcmp(strategy, "NONE"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_NONE;
+ else {
+ error_msg("invalid file space management strategy\n", H5_optarg);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
}
- break;
+ if (options->fs_strategy == (H5F_fspace_strategy_t)0)
+ /* To distinguish the "specified" zero value */
+ options->fs_strategy = (H5F_fspace_strategy_t)-1;
+ } break;
case 'P':
- options->fs_persist = HDatoi(opt_arg);
+ options->fs_persist = HDatoi(H5_optarg);
if (options->fs_persist == 0)
/* To distinguish the "specified" zero value */
options->fs_persist = -1;
break;
case 'T':
- options->fs_threshold = HDatol(opt_arg);
+ options->fs_threshold = HDatol(H5_optarg);
if (options->fs_threshold == 0)
/* To distinguish the "specified" zero value */
options->fs_threshold = -1;
break;
case 'G':
- options->fs_pagesize = HDstrtoll(opt_arg, NULL, 0);
+ options->fs_pagesize = HDstrtoll(H5_optarg, NULL, 0);
if (options->fs_pagesize == 0)
/* To distinguish the "specified" zero value */
- options->fs_pagesize = -1;
+ options->fs_pagesize = -1;
break;
case 'q':
- if (H5_INDEX_UNKNOWN == (sort_by = set_sort_by(opt_arg))) {
- error_msg("failed to set sort by form <%s>\n", opt_arg);
+ if (H5_INDEX_UNKNOWN == (sort_by = set_sort_by(H5_optarg))) {
+ error_msg("failed to set sort by form <%s>\n", H5_optarg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -654,8 +691,8 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'z':
- if (H5_ITER_UNKNOWN == (sort_order = set_sort_order(opt_arg))) {
- error_msg("failed to set sort order form <%s>\n", opt_arg);
+ if (H5_ITER_UNKNOWN == (sort_order = set_sort_order(H5_optarg))) {
+ error_msg("failed to set sort order form <%s>\n", H5_optarg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -669,13 +706,13 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
default:
break;
} /* end switch */
- } /* end while there are more options to parse */
+ } /* end while there are more options to parse */
/* If neither -i nor -o given, get in and out files positionally */
if (0 == (has_i + has_o)) {
- if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) {
- infile = argv[opt_ind];
- outfile = argv[opt_ind + 1];
+ if (argv[H5_optind] != NULL && argv[H5_optind + 1] != NULL) {
+ infile = argv[H5_optind];
+ outfile = argv[H5_optind + 1];
if (!HDstrcmp(infile, outfile)) {
error_msg("file names cannot be the same\n");
@@ -712,10 +749,11 @@ done:
* Failure: EXIT_FAILURE(1)
*-------------------------------------------------------------------------
*/
-int main(int argc, const char **argv)
+int
+main(int argc, const char **argv)
{
- pack_opt_t options; /*the global options */
- int parse_ret;
+ pack_opt_t options; /*the global options */
+ int parse_ret;
HDmemset(&options, 0, sizeof(pack_opt_t));
@@ -777,4 +815,3 @@ done:
leave(h5tools_getstatus());
}
-
diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c
index 56fc12d..167506f 100644
--- a/tools/src/h5repack/h5repack_opttable.c
+++ b/tools/src/h5repack/h5repack_opttable.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,24 +21,25 @@
* Purpose: initialize a pack_info_t structure
*
* Return: void
- *-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
-void init_packobject(pack_info_t *obj)
+void
+init_packobject(pack_info_t *obj)
{
int j, k;
HDstrcpy(obj->path, "\0");
for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) {
- obj->filter[j].filtn = -1;
+ obj->filter[j].filtn = -1;
obj->filter[j].cd_nelmts = CD_VALUES;
for (k = 0; k < CD_VALUES; k++)
obj->filter[j].cd_values[k] = 0;
}
obj->chunk.rank = -1;
- obj->refobj_id = -1;
- obj->layout = H5D_LAYOUT_ERROR;
- obj->nfilters = 0;
+ obj->refobj_id = -1;
+ obj->layout = H5D_LAYOUT_ERROR;
+ obj->nfilters = 0;
}
/*-------------------------------------------------------------------------
@@ -50,7 +51,8 @@ void init_packobject(pack_info_t *obj)
*-------------------------------------------------------------------------
*/
-static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt)
+static void
+aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt)
{
if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS)
table->objs[I].filter[table->objs[I].nfilters++] = filt;
@@ -66,7 +68,8 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_in
* Return: void
*-------------------------------------------------------------------------
*/
-static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack)
+static void
+aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack)
{
int k;
@@ -75,15 +78,14 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info
/* -2 means the NONE option, remove chunking
and set the layout to contiguous */
if (pack->chunk.rank == -2) {
- table->objs[I].layout = H5D_CONTIGUOUS;
+ table->objs[I].layout = H5D_CONTIGUOUS;
table->objs[I].chunk.rank = -2;
}
/* otherwise set the chunking type */
else {
table->objs[I].chunk.rank = pack->chunk.rank;
for (k = 0; k < pack->chunk.rank; k++)
- table->objs[I].chunk.chunk_lengths[k] =
- pack->chunk.chunk_lengths[k];
+ table->objs[I].chunk.chunk_lengths[k] = pack->chunk.chunk_lengths[k];
}
}
}
@@ -100,10 +102,10 @@ static int
aux_inctable(pack_opttbl_t *table, unsigned n_objs)
{
unsigned u;
- int ret_value = 0;
+ int ret_value = 0;
table->size += n_objs;
- table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t));
+ table->objs = (pack_info_t *)HDrealloc(table->objs, table->size * sizeof(pack_info_t));
if (table->objs == NULL) {
H5TOOLS_INFO("not enough memory for options table");
ret_value = -1;
@@ -116,27 +118,28 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs)
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: options_table_init
*
* Purpose: init options table
*
* Return: 0, ok, -1, fail
- *-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
-int options_table_init(pack_opttbl_t **tbl) {
- unsigned int i;
+int
+options_table_init(pack_opttbl_t **tbl)
+{
+ unsigned int i;
pack_opttbl_t *table;
- int ret_value = 0;
+ int ret_value = 0;
- if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) {
+ if (NULL == (table = (pack_opttbl_t *)HDmalloc(sizeof(pack_opttbl_t)))) {
H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table");
}
- table->size = 30;
+ table->size = 30;
table->nelems = 0;
- if (NULL == (table->objs = (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) {
+ if (NULL == (table->objs = (pack_info_t *)HDmalloc(table->size * sizeof(pack_info_t)))) {
HDfree(table);
H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table");
}
@@ -149,7 +152,6 @@ done:
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: options_table_free
*
@@ -159,7 +161,9 @@ done:
*-------------------------------------------------------------------------
*/
-int options_table_free(pack_opttbl_t *table) {
+int
+options_table_free(pack_opttbl_t *table)
+{
HDfree(table->objs);
HDfree(table);
return 0;
@@ -171,15 +175,15 @@ int options_table_free(pack_opttbl_t *table) {
* Purpose: add a layout option to the option list
*
* Return: 0, ok, -1, fail
- *-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
int
-options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pack_opttbl_t *table)
+options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pack_opttbl_t *table)
{
unsigned i, j, I;
- unsigned added = 0;
- hbool_t found = FALSE;
- int ret_value = 0;
+ unsigned added = 0;
+ hbool_t found = FALSE;
+ int ret_value = 0;
/* increase the size of the collection by N_OBJS if necessary */
if (table->nelems + n_objs >= table->size)
@@ -193,7 +197,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa
/* linear table search */
for (i = 0; i < table->nelems; i++) {
/*already on the table */
- if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) {
+ if (HDstrcmp(obj_list[j].obj, table->objs[i].path) == 0) {
/* already chunk info inserted for this one; exit */
if (table->objs[i].chunk.rank > 0) {
H5TOOLS_INFO("chunk information already inserted for <%s>\n", obj_list[j].obj);
@@ -206,7 +210,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa
break;
}
} /* if */
- } /* i */
+ } /* i */
if (!found) {
/* keep the grow in a temp var */
@@ -220,14 +224,13 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa
-f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20
dset1 is already inserted, but dset2 must also be
*/
- else
- if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) {
- /* keep the grow in a temp var */
- I = table->nelems + added;
- added++;
- HDstrcpy(table->objs[I].path, obj_list[j].obj);
- aux_tblinsert_layout(table, I, pack);
- }
+ else if (found && HDstrcmp(obj_list[j].obj, table->objs[i].path) != 0) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_layout(table, I, pack);
+ }
} /* j */
}
/* first time insertion */
@@ -258,8 +261,8 @@ int
options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pack_opttbl_t *table)
{
unsigned int i, j, I;
- unsigned added = 0;
- hbool_t found = FALSE;
+ unsigned added = 0;
+ hbool_t found = FALSE;
/* increase the size of the collection by N_OBJS if necessary */
if (table->nelems + n_objs >= table->size)
@@ -279,7 +282,7 @@ options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pa
found = TRUE;
break;
} /* if */
- } /* i */
+ } /* i */
if (!found) {
/* keep the grow in a temp var */
@@ -293,14 +296,13 @@ options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pa
-l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1
dset1 is already inserted, but dset2 must also be
*/
- else
- if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) {
- /* keep the grow in a temp var */
- I = table->nelems + added;
- added++;
- HDstrcpy(table->objs[I].path, obj_list[j].obj);
- aux_tblinsert_filter(table, I, filt);
- }
+ else if (found && HDstrcmp(obj_list[j].obj, table->objs[i].path) != 0) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_filter(table, I, filt);
+ }
} /* j */
}
@@ -329,13 +331,15 @@ options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pa
*-------------------------------------------------------------------------
*/
-pack_info_t* options_get_object(const char *path, pack_opttbl_t *table) {
+pack_info_t *
+options_get_object(const char *path, pack_opttbl_t *table)
+{
unsigned int i;
- char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */
+ char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */
for (i = 0; i < table->nelems; i++) {
/* make full path (start with "/") to compare correctly */
- if (HDstrncmp(table->objs[i].path, "/", 1)) {
+ if (HDstrncmp(table->objs[i].path, "/", 1) != 0) {
HDstrcpy(tbl_path, "/");
HDstrcat(tbl_path, table->objs[i].path);
}
diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c
index 50ccd7a..1c06cae 100644
--- a/tools/src/h5repack/h5repack_parse.c
+++ b/tools/src/h5repack/h5repack_parse.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -37,8 +37,9 @@
* "A,B:NONE"
*-------------------------------------------------------------------------
*/
-obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
- pack_opt_t *options, int *is_glb) {
+obj_list_t *
+parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t *options, int *is_glb)
+{
size_t i, m, u;
char c;
size_t len = HDstrlen(str);
@@ -48,7 +49,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
char scomp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
char stype[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
char smask[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- obj_list_t* obj_list = NULL;
+ obj_list_t *obj_list = NULL;
unsigned pixels_per_block;
/* initialize compression info */
@@ -59,7 +60,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
for (i = 0, n = 0; i < len; i++) {
c = str[i];
if (c == ':') {
- end_obj = (int) i;
+ end_obj = (int)i;
break;
}
if (c == ',')
@@ -71,13 +72,13 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
if (end_obj == -1) {
/* apply to all objects */
options->all_filter = 1;
- *is_glb = 1;
- *n_objs = 1;
+ *is_glb = 1;
+ *n_objs = 1;
}
else
*n_objs = n;
- obj_list = (obj_list_t *) HDmalloc(n * sizeof(obj_list_t));
+ obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t));
if (obj_list == NULL) {
error_msg("could not allocate object list\n");
return NULL;
@@ -85,10 +86,10 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
/* get object list */
if (end_obj > 0)
- for (j = 0, k = 0, n = 0; j < (unsigned) end_obj; j++, k++) {
- c = str[j];
+ for (j = 0, k = 0, n = 0; j < (unsigned)end_obj; j++, k++) {
+ c = str[j];
sobj[k] = c;
- if (c == ',' || j == (unsigned) (end_obj - 1)) {
+ if (c == ',' || j == (unsigned)(end_obj - 1)) {
if (c == ',')
sobj[k] = '\0';
else
@@ -101,7 +102,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
/* nothing after : */
- if (end_obj + 1 == (int) len) {
+ if (end_obj + 1 == (int)len) {
if (obj_list)
HDfree(obj_list);
error_msg("input Error: Invalid compression type in <%s>\n", str);
@@ -111,25 +112,25 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
/* get filter additional parameters */
m = 0;
for (i = (size_t)(end_obj + 1), k = 0, j = 0; i < len; i++, k++) {
- c = str[i];
+ c = str[i];
scomp[k] = c;
if (c == '=' || i == len - 1) {
- if (c == '=') { /*one more parameter */
+ if (c == '=') { /*one more parameter */
scomp[k] = '\0'; /*cut space */
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP
- * szip has the format SZIP=<pixels per block,coding>
- * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN'
- * example SZIP=8,NN
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_SZIP
+ * szip has the format SZIP=<pixels per block,coding>
+ * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN'
+ * example SZIP=8,NN
+ *-------------------------------------------------------------------------
+ */
if (HDstrcmp(scomp, "SZIP") == 0) {
l = -1; /* mask index check */
for (m = 0, u = i + 1; u < len; u++, m++) {
if (str[u] == ',') {
stype[m] = '\0'; /* end digit of szip */
- l = 0; /* start EC or NN search */
- u++; /* skip ',' */
+ l = 0; /* start EC or NN search */
+ u++; /* skip ',' */
}
c = str[u];
if (!HDisdigit(c) && l == -1) {
@@ -145,10 +146,10 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
l++;
if (l == 2) {
smask[l] = '\0';
- i = len - 1; /* end */
- if (HDstrcmp(smask,"NN") == 0)
+ i = len - 1; /* end */
+ if (HDstrcmp(smask, "NN") == 0)
filt->cd_values[j++] = H5_SZIP_NN_OPTION_MASK;
- else if (HDstrcmp(smask,"EC") == 0)
+ else if (HDstrcmp(smask, "EC") == 0)
filt->cd_values[j++] = H5_SZIP_EC_OPTION_MASK;
else {
error_msg("szip mask must be 'NN' or 'EC' \n");
@@ -157,29 +158,29 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
} /* u */
- } /*if */
+ } /*if */
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET
- * scaleoffset has the format SOFF=<scale_factor,scale_type>
- * scale_type can be
- * integer datatype, H5Z_SO_INT (IN)
- * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS)
- * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented
- * for integer datatypes, scale_factor denotes Minimum Bits
- * for float datatypes, scale_factor denotes decimal scale factor
- * examples
- * SOFF=31,IN
- * SOFF=3,DF
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_SCALEOFFSET
+ * scaleoffset has the format SOFF=<scale_factor,scale_type>
+ * scale_type can be
+ * integer datatype, H5Z_SO_INT (IN)
+ * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS)
+ * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented
+ * for integer datatypes, scale_factor denotes Minimum Bits
+ * for float datatypes, scale_factor denotes decimal scale factor
+ * examples
+ * SOFF=31,IN
+ * SOFF=3,DF
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "SOFF") == 0) {
l = -1; /* mask index check */
for (m = 0, u = i + 1; u < len; u++, m++) {
if (str[u] == ',') {
stype[m] = '\0'; /* end digit */
- l = 0; /* start 'IN' , 'DS', or 'ES' search */
- u++; /* skip ',' */
+ l = 0; /* start 'IN' , 'DS', or 'ES' search */
+ u++; /* skip ',' */
}
c = str[u];
if (!HDisdigit(c) && l == -1) {
@@ -195,8 +196,8 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
l++;
if (l == 2) {
smask[l] = '\0';
- i = len - 1; /* end */
- if (HDstrcmp(smask,"IN") == 0)
+ i = len - 1; /* end */
+ if (HDstrcmp(smask, "IN") == 0)
filt->cd_values[j++] = H5Z_SO_INT;
else if (HDstrcmp(smask, "DS") == H5Z_SO_FLOAT_DSCALE)
filt->cd_values[j++] = H5Z_SO_FLOAT_DSCALE;
@@ -207,15 +208,15 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
} /* u */
- } /*if */
+ } /*if */
/*-------------------------------------------------------------------------
- * User Defined
- * has the format UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]>
- * BZIP2 example
- * UD=307,0,1,9
- *-------------------------------------------------------------------------
- */
+ * User Defined
+ * has the format
+ *UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]> BZIP2 example
+ * UD=307,0,1,9
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "UD") == 0) {
l = -1; /* filter number index check */
f = -1; /* filter flag index check */
@@ -225,15 +226,15 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
stype[q] = '\0'; /* end digit */
if (l == -1) {
filt->filtn = HDatoi(stype);
- l = 0;
+ l = 0;
}
else if (f == -1) {
filt->filt_flag = (unsigned)HDstrtoul(stype, NULL, 0);
- f = 0;
+ f = 0;
}
else if (p == -1) {
filt->cd_nelmts = HDstrtoull(stype, NULL, 0);
- p = 0;
+ p = 0;
}
else {
filt->cd_values[j++] = (unsigned)HDstrtoul(stype, NULL, 0);
@@ -260,9 +261,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
} /*if */
/*-------------------------------------------------------------------------
- * all other filters
- *-------------------------------------------------------------------------
- */
+ * all other filters
+ *-------------------------------------------------------------------------
+ */
else {
/* here we could have 1 or 2 digits */
for (m = 0, u = i + 1; u < len; u++, m++) {
@@ -279,36 +280,36 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
stype[m] = '\0';
} /*if */
- filt->cd_values[j++] = (unsigned) HDstrtoul(stype, NULL, 0);
- if(filt->cd_nelmts == 0)
+ filt->cd_values[j++] = (unsigned)HDstrtoul(stype, NULL, 0);
+ if (filt->cd_nelmts == 0)
j = 0;
i += m; /* jump */
}
else if (i == len - 1) { /*no more parameters */
scomp[k + 1] = '\0';
- no_param = 1;
+ no_param = 1;
}
/*-------------------------------------------------------------------------
- * translate from string to filter symbol
- *-------------------------------------------------------------------------
- */
+ * translate from string to filter symbol
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5Z_FILTER_NONE
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_NONE
+ *-------------------------------------------------------------------------
+ */
if (HDstrcmp(scomp, "NONE") == 0) {
- filt->filtn = H5Z_FILTER_NONE;
+ filt->filtn = H5Z_FILTER_NONE;
filt->cd_nelmts = 0;
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_DEFLATE
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "GZIP") == 0) {
- filt->filtn = H5Z_FILTER_DEFLATE;
+ filt->filtn = H5Z_FILTER_DEFLATE;
filt->cd_nelmts = 1;
if (no_param) { /*no more parameters, GZIP must have parameter */
if (obj_list)
@@ -319,11 +320,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_SZIP
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "SZIP") == 0) {
- filt->filtn = H5Z_FILTER_SZIP;
+ filt->filtn = H5Z_FILTER_SZIP;
filt->cd_nelmts = 2;
if (no_param) { /*no more parameters, SZIP must have parameter */
if (obj_list)
@@ -334,11 +335,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SHUFFLE
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_SHUFFLE
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "SHUF") == 0) {
- filt->filtn = H5Z_FILTER_SHUFFLE;
+ filt->filtn = H5Z_FILTER_SHUFFLE;
filt->cd_nelmts = 0;
if (m > 0) { /*shuffle does not have parameter */
if (obj_list)
@@ -348,11 +349,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_FLETCHER32
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_FLETCHER32
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "FLET") == 0) {
- filt->filtn = H5Z_FILTER_FLETCHER32;
+ filt->filtn = H5Z_FILTER_FLETCHER32;
filt->cd_nelmts = 0;
if (m > 0) { /*shuffle does not have parameter */
if (obj_list)
@@ -362,11 +363,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_NBIT
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_NBIT
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "NBIT") == 0) {
- filt->filtn = H5Z_FILTER_NBIT;
+ filt->filtn = H5Z_FILTER_NBIT;
filt->cd_nelmts = 0;
if (m > 0) { /*nbit does not have parameter */
if (obj_list)
@@ -376,11 +377,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_SCALEOFFSET
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "SOFF") == 0) {
- filt->filtn = H5Z_FILTER_SCALEOFFSET;
+ filt->filtn = H5Z_FILTER_SCALEOFFSET;
filt->cd_nelmts = 2;
if (no_param) { /*no more parameters, SOFF must have parameter */
if (obj_list)
@@ -390,9 +391,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
/*-------------------------------------------------------------------------
- * User Defined Filter
- *-------------------------------------------------------------------------
- */
+ * User Defined Filter
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "UD") == 0) {
/* parameters does not match count */
if (filt->cd_nelmts != j) {
@@ -413,56 +414,55 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
} /*i*/
/*-------------------------------------------------------------------------
- * check valid parameters
- *-------------------------------------------------------------------------
- */
+ * check valid parameters
+ *-------------------------------------------------------------------------
+ */
switch (filt->filtn) {
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_DEFLATE:
- if (filt->cd_values[0] > 9) {
- if (obj_list)
- HDfree(obj_list);
- error_msg("invalid compression parameter in <%s>\n", str);
- HDexit(EXIT_FAILURE);
- }
- break;
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SZIP:
- pixels_per_block = filt->cd_values[0];
- if ((pixels_per_block % 2) == 1) {
- if (obj_list)
- HDfree(obj_list);
- error_msg("pixels_per_block is not even in <%s>\n", str);
- HDexit(EXIT_FAILURE);
- }
- if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) {
- if (obj_list)
- HDfree(obj_list);
- error_msg("pixels_per_block is too large in <%s>\n", str);
- HDexit(EXIT_FAILURE);
- }
- if ((HDstrcmp(smask,"NN") != 0) && (HDstrcmp(smask,"EC") != 0)) {
- if (obj_list)
- HDfree(obj_list);
- error_msg("szip mask must be 'NN' or 'EC' \n");
- HDexit(EXIT_FAILURE);
- }
- break;
- default:
- break;
+ * H5Z_FILTER_DEFLATE
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_DEFLATE:
+ if (filt->cd_values[0] > 9) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("invalid compression parameter in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SZIP:
+ pixels_per_block = filt->cd_values[0];
+ if ((pixels_per_block % 2) == 1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("pixels_per_block is not even in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("pixels_per_block is too large in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ if ((HDstrcmp(smask, "NN") != 0) && (HDstrcmp(smask, "EC") != 0)) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("szip mask must be 'NN' or 'EC' \n");
+ HDexit(EXIT_FAILURE);
+ }
+ break;
+ default:
+ break;
};
return obj_list;
}
-
/*-------------------------------------------------------------------------
* Function: parse_layout
*
@@ -484,9 +484,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
*
*-------------------------------------------------------------------------
*/
-obj_list_t* parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about layout needed */
-pack_opt_t *options) {
- obj_list_t* obj_list = NULL;
+obj_list_t *
+parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about layout needed */
+ pack_opt_t *options)
+{
+ obj_list_t *obj_list = NULL;
unsigned i, j, n;
char c;
size_t len = HDstrlen(str);
@@ -503,7 +505,7 @@ pack_opt_t *options) {
for (i = 0, n = 0; i < len; i++) {
c = str[i];
if (c == ':')
- end_obj = (int) i;
+ end_obj = (int)i;
if (c == ',')
n++;
}
@@ -513,7 +515,7 @@ pack_opt_t *options) {
}
n++;
- obj_list = (obj_list_t*) HDmalloc(n * sizeof(obj_list_t));
+ obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t));
if (obj_list == NULL) {
error_msg("could not allocate object list\n");
return NULL;
@@ -522,10 +524,10 @@ pack_opt_t *options) {
/* get object list */
if (end_obj > 0)
- for (j = 0, k = 0, n = 0; j < (unsigned) end_obj; j++, k++) {
- c = str[j];
+ for (j = 0, k = 0, n = 0; j < (unsigned)end_obj; j++, k++) {
+ c = str[j];
sobj[k] = c;
- if (c == ',' || j == (unsigned) (end_obj - 1)) {
+ if (c == ',' || j == (unsigned)(end_obj - 1)) {
if (c == ',')
sobj[k] = '\0';
else
@@ -538,7 +540,7 @@ pack_opt_t *options) {
}
/* nothing after : */
- if (end_obj + 1 == (int) len) {
+ if (end_obj + 1 == (int)len) {
if (obj_list)
HDfree(obj_list);
error_msg("in parse layout, no characters after : in <%s>\n", str);
@@ -546,7 +548,7 @@ pack_opt_t *options) {
}
/* get layout info */
- for (j = (unsigned) (end_obj + 1), n = 0; n <= 5; j++, n++) {
+ for (j = (unsigned)(end_obj + 1), n = 0; n <= 5; j++, n++) {
if (n == 5) {
slayout[n] = '\0'; /*cut string */
if (HDstrcmp(slayout, "COMPA") == 0)
@@ -561,16 +563,16 @@ pack_opt_t *options) {
}
}
else {
- c = str[j];
+ c = str[j];
slayout[n] = c;
}
} /* j */
if (pack->layout == H5D_CHUNKED) {
/*-------------------------------------------------------------------------
- * get chunk info
- *-------------------------------------------------------------------------
- */
+ * get chunk info
+ *-------------------------------------------------------------------------
+ */
k = 0;
if (j > len) {
if (obj_list)
@@ -580,7 +582,7 @@ pack_opt_t *options) {
}
for (i = j, c_index = 0; i < len; i++) {
- c = str[i];
+ c = str[i];
sdim[k] = c;
k++; /*increment sdim index */
@@ -593,8 +595,8 @@ pack_opt_t *options) {
if (c == 'x' || i == len - 1) {
if (c == 'x') {
- sdim[k - 1] = '\0';
- k = 0;
+ sdim[k - 1] = '\0';
+ k = 0;
pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0);
if (pack->chunk.chunk_lengths[c_index] == 0) {
if (obj_list)
@@ -606,8 +608,8 @@ pack_opt_t *options) {
}
else if (i == len - 1) { /*no more parameters */
sdim[k] = '\0';
- k = 0;
- if (HDstrcmp(sdim,"NONE") == 0) {
+ k = 0;
+ if (HDstrcmp(sdim, "NONE") == 0) {
pack->chunk.rank = -2;
}
else {
@@ -621,9 +623,9 @@ pack_opt_t *options) {
pack->chunk.rank = c_index + 1;
}
} /*if */
- } /*if c=='x' || i==len-1 */
- } /*i*/
- } /*H5D_CHUNKED*/
+ } /*if c=='x' || i==len-1 */
+ } /*i*/
+ } /*H5D_CHUNKED*/
return obj_list;
}
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index ee17ed8..6f2afca 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,17 +15,15 @@
#include "h5diff.h"
#include "h5tools.h"
-
/*-------------------------------------------------------------------------
* local functions
*-------------------------------------------------------------------------
*/
-static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt);
-static int copy_refs_attr(hid_t loc_in, hid_t loc_out,
- trav_table_t *travt, hid_t fidout);
-static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
- hid_t fid_out, void *ref_out, trav_table_t *travt);
+static const char *MapIdToName(hid_t refobj_id, trav_table_t *travt);
+static int copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout);
+static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out,
+ trav_table_t *travt);
/*-------------------------------------------------------------------------
* Function: do_copy_refobjs
@@ -37,35 +35,33 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
*-------------------------------------------------------------------------
*/
-int do_copy_refobjs(hid_t fidin,
- hid_t fidout,
- trav_table_t *travt,
- pack_opt_t *options) /* repack options */
+int
+do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */
{
- hid_t grp_in = H5I_INVALID_HID; /* read group ID */
- hid_t grp_out = H5I_INVALID_HID; /* write group ID */
- hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
- hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
- hid_t type_in = H5I_INVALID_HID; /* named type ID */
- hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t space_id = H5I_INVALID_HID; /* space ID */
- hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
- hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
- size_t msize; /* memory size of memory type */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
+ hid_t grp_in = H5I_INVALID_HID; /* read group ID */
+ hid_t grp_out = H5I_INVALID_HID; /* write group ID */
+ hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
+ hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
+ hid_t type_in = H5I_INVALID_HID; /* named type ID */
+ hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
+ size_t msize; /* memory size of memory type */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
unsigned int i, j;
- int k;
- named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
- int ret_value = 0;
+ int k;
+ named_dt_t * named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
+ int ret_value = 0;
/*-------------------------------------------------------------------------
- * browse
- *-------------------------------------------------------------------------
- */
- for(i = 0; i < travt->nobjs; i++) {
- switch(travt->objs[i].type) {
+ * browse
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0; i < travt->nobjs; i++) {
+ switch (travt->objs[i].type) {
/*-------------------------------------------------------------------------
* H5TRAV_TYPE_GROUP
*-------------------------------------------------------------------------
@@ -75,27 +71,28 @@ int do_copy_refobjs(hid_t fidin,
* copy referenced objects in attributes
*-------------------------------------------------------------------------
*/
- if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed");
- if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed");
- if(copy_refs_attr(grp_in, grp_out, travt, fidout) < 0)
+ if (copy_refs_attr(grp_in, grp_out, travt, fidout) < 0)
H5TOOLS_GOTO_ERROR((-1), "copy_refs_attr failed");
- if(H5Gclose(grp_out) < 0)
+ if (H5Gclose(grp_out) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
- if(H5Gclose(grp_in) < 0)
+ if (H5Gclose(grp_in) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
/*-------------------------------------------------------------------------
* check for hard links
*-------------------------------------------------------------------------
*/
- if(travt->objs[i].nlinks)
- for(j = 0; j < travt->objs[i].nlinks; j++)
- H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
+ if (travt->objs[i].nlinks)
+ for (j = 0; j < travt->objs[i].nlinks; j++)
+ H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC,
+ travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
break;
/*-------------------------------------------------------------------------
@@ -103,26 +100,26 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
case H5TRAV_TYPE_DATASET:
- if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
- if((space_id = H5Dget_space(dset_in)) < 0)
+ if ((space_id = H5Dget_space(dset_in)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
- if((ftype_id = H5Dget_type(dset_in)) < 0)
+ if ((ftype_id = H5Dget_type(dset_in)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
- if((dcpl_id = H5Dget_create_plist(dset_in)) < 0)
+ if ((dcpl_id = H5Dget_create_plist(dset_in)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- if((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
+ if ((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed");
- if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed");
nelmts = 1;
- for(k = 0; k < rank; k++)
+ for (k = 0; k < rank; k++)
nelmts *= dims[k];
- if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
+ if ((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_native_type failed");
- if((msize = H5Tget_size(mtype_id)) == 0)
+ if ((msize = H5Tget_size(mtype_id)) == 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
/*-------------------------------------------------------------------------
@@ -132,7 +129,7 @@ int do_copy_refobjs(hid_t fidin,
* 2) the internal filters might be turned off
*-------------------------------------------------------------------------
*/
- if(h5tools_canreadf(NULL, dcpl_id) == 1) {
+ if (h5tools_canreadf(NULL, dcpl_id) == 1) {
/*-------------------------------------------------------------------------
* test for a valid output dataset
*-------------------------------------------------------------------------
@@ -144,75 +141,78 @@ int do_copy_refobjs(hid_t fidin,
* we cannot just copy the buffers, but instead we recreate the reference
*-------------------------------------------------------------------------
*/
- if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
- hid_t refobj_id = H5I_INVALID_HID;
- hobj_ref_t *refbuf = NULL; /* buffer for object references */
- hobj_ref_t *buf = NULL;
- const char* refname;
- unsigned u;
+ if (H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
+ hid_t refobj_id = H5I_INVALID_HID;
+ hobj_ref_t *refbuf = NULL; /* buffer for object references */
+ hobj_ref_t *buf = NULL;
+ const char *refname;
+ unsigned u;
/*-------------------------------------------------------------------------
* read to memory
*-------------------------------------------------------------------------
*/
- if(nelmts) {
+ if (nelmts) {
buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf==NULL) {
- HDprintf("cannot read into memory\n" );
+ if (buf == NULL) {
+ HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
- refbuf = (hobj_ref_t*) HDcalloc((unsigned)nelmts, msize);
- if(refbuf == NULL){
- HDprintf("cannot allocate memory\n" );
+ refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize);
+ if (refbuf == NULL) {
+ HDprintf("cannot allocate memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed");
} /* end if */
- for(u = 0; u < nelmts; u++) {
- H5E_BEGIN_TRY {
- if((refobj_id = H5Rdereference2(dset_in, H5P_DEFAULT, H5R_OBJECT, &buf[u])) < 0)
+ for (u = 0; u < nelmts; u++) {
+ H5E_BEGIN_TRY
+ {
+ if ((refobj_id =
+ H5Rdereference2(dset_in, H5P_DEFAULT, H5R_OBJECT, &buf[u])) < 0)
continue;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* get the name. a valid name could only occur
* in the second traversal of the file
*/
- if((refname = MapIdToName(refobj_id, travt)) != NULL) {
+ if ((refname = MapIdToName(refobj_id, travt)) != NULL) {
/* create the reference, -1 parameter for objects */
- if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed");
- if(options->verbose) {
- HDprintf(FORMAT_OBJ,"dset",travt->objs[i].name );
+ if (options->verbose) {
+ HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
HDprintf("object <%s> object reference created to <%s>\n",
- travt->objs[i].name,
- refname);
+ travt->objs[i].name, refname);
}
} /*refname*/
if (H5Oclose(refobj_id) < 0)
H5TOOLS_ERROR((-1), "H5Oclose refob failed");
} /* u */
- } /*nelmts*/
+ } /*nelmts*/
/*-------------------------------------------------------------------------
* create/write dataset/close
*-------------------------------------------------------------------------
*/
- if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id,
+ H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed");
- if(nelmts)
- if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
+ if (nelmts)
+ if (H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
- if(buf)
+ if (buf)
HDfree(buf);
- if(refbuf)
+ if (refbuf)
HDfree(refbuf);
- /*------------------------------------------------------
- * copy attrs
- *----------------------------------------------------*/
- if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ /*------------------------------------------------------
+ * copy attrs
+ *----------------------------------------------------*/
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
} /*H5T_STD_REF_OBJ*/
@@ -220,87 +220,93 @@ int do_copy_refobjs(hid_t fidin,
* dataset region references
*-------------------------------------------------------------------------
*/
- else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
+ else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
hid_t refobj_id = H5I_INVALID_HID;
- hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
- hdset_reg_ref_t *buf = NULL; /* output buffer */
- const char* refname;
+ hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
+ hdset_reg_ref_t *buf = NULL; /* output buffer */
+ const char * refname;
unsigned u;
/*-------------------------------------------------------------------------
* read input to memory
*-------------------------------------------------------------------------
*/
- if(nelmts) {
+ if (nelmts) {
buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf == NULL) {
+ if (buf == NULL) {
HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
/*-------------------------------------------------------------------------
* create output
*-------------------------------------------------------------------------
*/
- refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
- if(refbuf == NULL) {
+ refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t),
+ (size_t)nelmts); /*init to zero */
+ if (refbuf == NULL) {
HDprintf("cannot allocate memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed");
} /* end if */
- for(u = 0; u < nelmts; u++) {
- H5E_BEGIN_TRY {
- if((refobj_id = H5Rdereference2(dset_in, H5P_DEFAULT, H5R_DATASET_REGION, &buf[u])) < 0)
+ for (u = 0; u < nelmts; u++) {
+ H5E_BEGIN_TRY
+ {
+ if ((refobj_id = H5Rdereference2(dset_in, H5P_DEFAULT, H5R_DATASET_REGION,
+ &buf[u])) < 0)
continue;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* get the name. a valid name could only occur
* in the second traversal of the file
*/
- if((refname = MapIdToName(refobj_id, travt)) != NULL) {
- hid_t region_id = H5I_INVALID_HID; /* region id of the referenced dataset */
+ if ((refname = MapIdToName(refobj_id, travt)) != NULL) {
+ hid_t region_id =
+ H5I_INVALID_HID; /* region id of the referenced dataset */
- if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
+ if ((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Rget_region failed");
/* create the reference, we need the space_id */
- if(H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION, region_id) < 0)
+ if (H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION,
+ region_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed");
- if(H5Sclose(region_id) < 0)
+ if (H5Sclose(region_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- if(options->verbose) {
- HDprintf(FORMAT_OBJ,"dset",travt->objs[i].name );
+ if (options->verbose) {
+ HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
HDprintf("object <%s> region reference created to <%s>\n",
- travt->objs[i].name,
- refname);
+ travt->objs[i].name, refname);
}
} /*refname*/
if (H5Oclose(refobj_id) < 0)
H5TOOLS_ERROR((-1), "H5Oclose refobj_id failed");
} /* u */
- } /*nelmts*/
+ } /*nelmts*/
/*-------------------------------------------------------------------------
* create/write dataset/close
*-------------------------------------------------------------------------
*/
- if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id,
+ H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed");
- if(nelmts)
- if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
+ if (nelmts)
+ if (H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
- if(buf)
+ if (buf)
HDfree(buf);
- if(refbuf)
+ if (refbuf)
HDfree(refbuf);
- /*-----------------------------------------------------
- * copy attrs
- *----------------------------------------------------*/
- if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ /*-----------------------------------------------------
+ * copy attrs
+ *----------------------------------------------------*/
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
} /* H5T_STD_REF_DSETREG */
/*-------------------------------------------------------------------------
@@ -308,7 +314,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
else {
- if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
} /* end else */
@@ -316,18 +322,19 @@ int do_copy_refobjs(hid_t fidin,
* copy referenced objects in attributes
*-------------------------------------------------------------------------
*/
- if(copy_refs_attr(dset_in, dset_out, travt, fidout) < 0)
+ if (copy_refs_attr(dset_in, dset_out, travt, fidout) < 0)
H5TOOLS_GOTO_ERROR((-1), "copy_refs_attr failed");
/*-------------------------------------------------------------------------
* check for hard links
*-------------------------------------------------------------------------
*/
- if(travt->objs[i].nlinks)
- for(j = 0; j < travt->objs[i].nlinks; j++)
- H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
+ if (travt->objs[i].nlinks)
+ for (j = 0; j < travt->objs[i].nlinks; j++)
+ H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC,
+ travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
- if(H5Dclose(dset_out) < 0)
+ if (H5Dclose(dset_out) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
} /*can_read*/
@@ -335,15 +342,15 @@ int do_copy_refobjs(hid_t fidin,
* close
*-------------------------------------------------------------------------
*/
- if(H5Tclose(ftype_id) < 0)
+ if (H5Tclose(ftype_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if(H5Tclose(mtype_id) < 0)
+ if (H5Tclose(mtype_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- if(H5Dclose(dset_in) < 0)
+ if (H5Dclose(dset_in) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
break;
@@ -352,9 +359,9 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
case H5TRAV_TYPE_NAMED_DATATYPE:
- if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Topen2 failed");
- if(H5Tclose(type_in) < 0)
+ if (H5Tclose(type_in) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
break;
@@ -374,7 +381,7 @@ int do_copy_refobjs(hid_t fidin,
default:
break;
} /* end switch */
- } /* end for */
+ } /* end for */
/* Finalize (link) the stack of named datatypes (if any)
* This function is paired with copy_named_datatype() which is called
@@ -386,7 +393,8 @@ int do_copy_refobjs(hid_t fidin,
return ret_value;
done:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(grp_in);
H5Gclose(grp_out);
H5Pclose(dcpl_id);
@@ -397,12 +405,12 @@ done:
H5Tclose(mtype_id);
H5Tclose(type_in);
named_datatype_free(&named_dt_head, 1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: copy_refs_attr
*
@@ -425,91 +433,87 @@ done:
*-------------------------------------------------------------------------
*/
-static int copy_refs_attr(hid_t loc_in,
- hid_t loc_out,
- trav_table_t *travt,
- hid_t fidout) /* for saving references */
+static int
+copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) /* for saving references */
{
- hid_t attr_id = H5I_INVALID_HID; /* attr ID */
- hid_t attr_out = H5I_INVALID_HID; /* attr ID */
- hid_t space_id = H5I_INVALID_HID; /* space ID */
- hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
- hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
- size_t msize; /* memory size of type */
- hsize_t nelmts; /* number of elements in dataset */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ hid_t attr_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr_out = H5I_INVALID_HID; /* attr ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
+ size_t msize; /* memory size of type */
+ hsize_t nelmts; /* number of elements in dataset */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
char name[255];
- H5O_info_t oinfo; /* Object info */
+ H5O_info_t oinfo; /* Object info */
unsigned u, i, j;
int rank;
H5T_class_t type_class = -1;
- hbool_t is_ref = 0,
- is_ref_vlen = 0,
- is_ref_array = 0,
- is_ref_comp = 0;
- void *refbuf = NULL;
- void *buf = NULL;
- unsigned *ref_comp_index = NULL;
- size_t *ref_comp_size = NULL;
+ hbool_t is_ref = 0, is_ref_vlen = 0, is_ref_array = 0, is_ref_comp = 0;
+ void * refbuf = NULL;
+ void * buf = NULL;
+ unsigned * ref_comp_index = NULL;
+ size_t * ref_comp_size = NULL;
int ref_comp_field_n = 0;
- int ret_value = 0;
+ int ret_value = 0;
- if(H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
- for(u = 0; u < (unsigned)oinfo.num_attrs; u++) {
+ for (u = 0; u < (unsigned)oinfo.num_attrs; u++) {
is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0;
/* open attribute */
- if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aopen_by_idx failed");
/* get the file datatype */
- if((ftype_id = H5Aget_type(attr_id)) < 0)
+ if ((ftype_id = H5Aget_type(attr_id)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aget_type failed");
type_class = H5Tget_class(ftype_id);
- if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
+ if ((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_native_type failed");
- if((msize = H5Tget_size(mtype_id)) == 0)
+ if ((msize = H5Tget_size(mtype_id)) == 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
is_ref = (type_class == H5T_REFERENCE);
- if(type_class == H5T_VLEN ) {
+ if (type_class == H5T_VLEN) {
hid_t base_type = H5Tget_super(ftype_id);
is_ref_vlen = (H5Tget_class(base_type) == H5T_REFERENCE);
- msize = H5Tget_size(base_type);
+ msize = H5Tget_size(base_type);
if (H5Tclose(base_type) < 0)
H5TOOLS_ERROR((-1), "H5Tclose base_type failed");
}
- else if(type_class == H5T_ARRAY ) {
+ else if (type_class == H5T_ARRAY) {
hid_t base_type = H5Tget_super(ftype_id);
is_ref_array = (H5Tget_class(base_type) == H5T_REFERENCE);
- msize = H5Tget_size(base_type);
+ msize = H5Tget_size(base_type);
if (H5Tclose(base_type) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose base_type failed");
}
- else if(type_class == H5T_COMPOUND) {
- int nmembers = H5Tget_nmembers(ftype_id) ;
+ else if (type_class == H5T_COMPOUND) {
+ int nmembers = H5Tget_nmembers(ftype_id);
if (nmembers < 1)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_nmembers failed");
- ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers*sizeof(unsigned));
- ref_comp_size = (size_t *)HDmalloc((size_t)nmembers*sizeof(ref_comp_size));
+ ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers * sizeof(unsigned));
+ ref_comp_size = (size_t *)HDmalloc((size_t)nmembers * sizeof(ref_comp_size));
ref_comp_field_n = 0;
- for (i=0; i<(unsigned)nmembers; i++) {
+ for (i = 0; i < (unsigned)nmembers; i++) {
hid_t mtid = H5Tget_member_type(ftype_id, i);
if ((H5Tget_class(mtid) == H5T_REFERENCE)) {
ref_comp_index[ref_comp_field_n] = i;
- ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid);
+ ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid);
ref_comp_field_n++;
}
if (H5Tclose(mtid) < 0)
@@ -539,7 +543,6 @@ static int copy_refs_attr(hid_t loc_in,
is_ref_comp = (ref_comp_field_n > 0);
}
-
if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) {
if (H5Tclose(mtype_id) < 0)
H5TOOLS_ERROR((-1), "H5Tclose mtype_id failed");
@@ -551,31 +554,30 @@ static int copy_refs_attr(hid_t loc_in,
}
/* get name */
- if(H5Aget_name(attr_id, 255, name) < 0)
+ if (H5Aget_name(attr_id, 255, name) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aget_name failed");
/* get the dataspace handle */
- if((space_id = H5Aget_space(attr_id)) < 0)
+ if ((space_id = H5Aget_space(attr_id)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aget_space failed");
/* get dimensions */
- if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
+ if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed");
-
/*-------------------------------------------------------------------------
- * elements
- *-------------------------------------------------------------------------
- */
+ * elements
+ *-------------------------------------------------------------------------
+ */
nelmts = 1;
- for(j = 0; j < (unsigned)rank; j++)
+ for (j = 0; j < (unsigned)rank; j++)
nelmts *= dims[j];
if (is_ref_array) {
- unsigned array_rank = 0;
- hsize_t array_size = 1;
- hsize_t array_dims[H5S_MAX_RANK];
- hid_t base_type = H5Tget_super(ftype_id);
+ unsigned array_rank = 0;
+ hsize_t array_size = 1;
+ hsize_t array_dims[H5S_MAX_RANK];
+ hid_t base_type = H5Tget_super(ftype_id);
msize = H5Tget_size(base_type);
if (H5Tclose(base_type) < 0)
@@ -583,153 +585,163 @@ static int copy_refs_attr(hid_t loc_in,
array_rank = (unsigned)H5Tget_array_ndims(mtype_id);
H5Tget_array_dims2(mtype_id, array_dims);
- for(j = 0; j <array_rank; j++)
+ for (j = 0; j < array_rank; j++)
array_size *= array_dims[j];
nelmts *= array_size;
}
- if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Acreate2 failed");
- if (nelmts>0) {
+ if (nelmts > 0) {
/* handle object references */
- if((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE==msize)) {
+ if ((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE == msize)) {
buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf == NULL) {
+ if (buf == NULL) {
HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Aread(attr_id, mtype_id, buf) < 0)
+ if (H5Aread(attr_id, mtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aread failed");
refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize);
- if(refbuf == NULL) {
+ if (refbuf == NULL) {
HDprintf("cannot allocate memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed");
} /* end if */
- for(i = 0; i < (unsigned)nelmts; i++)
- if(update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt) < 0)
+ for (i = 0; i < (unsigned)nelmts; i++)
+ if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout,
+ &((hobj_ref_t *)refbuf)[i], travt) < 0)
continue;
} /* H5T_STD_REF_OBJ */
/* handle region references */
- else if((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) {
+ else if ((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) {
buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf == NULL) {
- HDprintf( "cannot read into memory\n" );
+ if (buf == NULL) {
+ HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Aread(attr_id, mtype_id, buf) < 0)
+ if (H5Aread(attr_id, mtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aread failed");
/*-------------------------------------------------------------------------
* create output
*-------------------------------------------------------------------------
*/
- refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
- if(refbuf == NULL) {
- HDprintf( "cannot allocate memory\n" );
+ refbuf =
+ (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
+ if (refbuf == NULL) {
+ HDprintf("cannot allocate memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed");
} /* end if */
- for(i = 0; i < (unsigned)nelmts; i++)
- if(update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt) < 0)
+ for (i = 0; i < (unsigned)nelmts; i++)
+ if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout,
+ &((hdset_reg_ref_t *)refbuf)[i], travt) < 0)
continue;
} /* H5T_STD_REF_DSETREG */
else if (is_ref_vlen) {
/* handle VLEN of references */
- buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t)));
+ buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t)));
refbuf = buf; /* reuse the read buffer for write */
- if(buf == NULL) {
- HDprintf( "cannot read into memory\n" );
+ if (buf == NULL) {
+ HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Aread(attr_id, mtype_id, buf) < 0)
+ if (H5Aread(attr_id, mtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aread failed");
- if (H5R_OBJ_REF_BUF_SIZE==msize) {
+ if (H5R_OBJ_REF_BUF_SIZE == msize) {
hobj_ref_t ref_out;
- for (i=0; i<(unsigned)nelmts; i++) {
+ for (i = 0; i < (unsigned)nelmts; i++) {
hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p;
- for (j=0; j<((hvl_t *)buf)[i].len; j++ ) {
- if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0)
+ for (j = 0; j < ((hvl_t *)buf)[i].len; j++) {
+ if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt) < 0)
continue;
HDmemcpy(&(ptr[j]), &ref_out, msize);
}
- } /* for (i=0; i<nelems; i++) */
+ } /* for (i=0; i<nelems; i++) */
}
else if (H5R_DSET_REG_REF_BUF_SIZE == msize) {
hdset_reg_ref_t ref_out;
- for (i=0; i<(unsigned)nelmts; i++) {
+ for (i = 0; i < (unsigned)nelmts; i++) {
hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p;
- for (j=0; j<((hvl_t *)buf)[i].len; j++ ) {
- if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0)
+ for (j = 0; j < ((hvl_t *)buf)[i].len; j++) {
+ if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out,
+ travt) < 0)
continue;
HDmemcpy(&(ptr[j]), &ref_out, msize);
}
- } /* for (i=0; i<nelems; i++) */
+ } /* for (i=0; i<nelems; i++) */
}
} /* else if (is_ref_vlen) */
else if (is_ref_comp) {
/* handle ref fields in a compound */
- buf = HDmalloc((unsigned)(nelmts * msize));
+ buf = HDmalloc((unsigned)(nelmts * msize));
refbuf = buf; /* reuse the read buffer for write */
- if(buf == NULL) {
- HDprintf( "cannot read into memory\n" );
+ if (buf == NULL) {
+ HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Aread(attr_id, mtype_id, buf) < 0)
+ if (H5Aread(attr_id, mtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aread failed");
- for (i=0; i<(unsigned)nelmts; i++) {
- for (j=0; j<(unsigned)ref_comp_field_n; j++) {
+ for (i = 0; i < (unsigned)nelmts; i++) {
+ for (j = 0; j < (unsigned)ref_comp_field_n; j++) {
if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) {
- size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
+ size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
hobj_ref_t ref_out;
- if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)((void *)(((char *)buf)+idx)), fidout, &ref_out, travt) < 0) /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */
+ if (update_ref_value(attr_id, H5R_OBJECT,
+ (hobj_ref_t *)((void *)(((char *)buf) + idx)), fidout,
+ &ref_out,
+ travt) < 0) /* Extra (void *) cast to quiet "cast to create
+ alignment" warning - 2019/07/05, QAK */
continue;
- HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
+ HDmemcpy(((char *)buf) + idx, &ref_out, ref_comp_size[j]);
} /* if */
else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) {
size_t idx = i * msize + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
hdset_reg_ref_t ref_out;
- if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0)
+ if (update_ref_value(attr_id, H5R_DATASET_REGION,
+ (hdset_reg_ref_t *)(((char *)buf) + idx), fidout, &ref_out,
+ travt) < 0)
continue;
- HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
+ HDmemcpy(((char *)buf) + idx, &ref_out, ref_comp_size[j]);
} /* else if */
- } /* j */
- } /* i */
- } /* else if (is_ref_comp) */
+ } /* j */
+ } /* i */
+ } /* else if (is_ref_comp) */
- if(H5Awrite(attr_out, mtype_id, refbuf) < 0)
+ if (H5Awrite(attr_out, mtype_id, refbuf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Awrite failed");
if (is_ref_vlen && buf)
- H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf);
+ H5Dvlen_reclaim(mtype_id, space_id, H5P_DEFAULT, buf);
} /* if (nelmts) */
if (refbuf == buf)
refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */
- if(buf) {
+ if (buf) {
HDfree(buf);
buf = NULL;
}
- if(refbuf) {
+ if (refbuf) {
HDfree(refbuf);
refbuf = NULL;
}
@@ -744,27 +756,27 @@ static int copy_refs_attr(hid_t loc_in,
ref_comp_size = NULL;
}
- if(H5Aclose(attr_out) < 0)
+ if (H5Aclose(attr_out) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed");
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if(H5Tclose(ftype_id) < 0)
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Tclose(ftype_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if(H5Tclose(mtype_id) < 0)
+ if (H5Tclose(mtype_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed");
} /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */
done:
- if(refbuf)
+ if (refbuf)
HDfree(refbuf);
- if(buf)
+ if (buf)
HDfree(buf);
if (ref_comp_index)
@@ -773,13 +785,15 @@ done:
if (ref_comp_size)
HDfree(ref_comp_size);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(ftype_id);
H5Tclose(mtype_id);
H5Sclose(space_id);
H5Aclose(attr_id);
H5Aclose(attr_out);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return ret_value;
}
@@ -791,29 +805,29 @@ done:
*
*-------------------------------------------------------------------------
*/
-static const char*
+static const char *
MapIdToName(hid_t refobj_id, trav_table_t *travt)
{
unsigned int u;
- const char *ret = NULL;
+ const char * ret = NULL;
/* linear search */
- for(u = 0; u < travt->nobjs; u++) {
- if(travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET ||
- travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP ||
- travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) {
- H5O_info_t ref_oinfo; /* Stat for the refobj id */
+ for (u = 0; u < travt->nobjs; u++) {
+ if (travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET ||
+ travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP ||
+ travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) {
+ H5O_info_t ref_oinfo; /* Stat for the refobj id */
/* obtain information to identify the referenced object uniquely */
- if(H5Oget_info2(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info2(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0)
goto out;
- if(ref_oinfo.addr == travt->objs[u].objno) {
+ if (ref_oinfo.addr == travt->objs[u].objno) {
ret = travt->objs[u].name;
goto out;
}
- } /* end if */
- } /* u */
+ } /* end if */
+ } /* u */
out:
return ret;
@@ -825,13 +839,14 @@ out:
* Purpose: Update a reference value
*-------------------------------------------------------------------------
*/
-static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
- hid_t fid_out, void *ref_out, trav_table_t *travt)
+static herr_t
+update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out,
+ trav_table_t *travt)
{
const char *ref_obj_name;
- hid_t space_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
hid_t ref_obj_id = H5I_INVALID_HID;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in);
if (ref_obj_id < 0)
@@ -847,15 +862,16 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
H5TOOLS_GOTO_ERROR(FAIL, "H5Rget_region failed");
}
- if(H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id) < 0)
+ if (H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Rcreate failed");
done:
- H5E_BEGIN_TRY {
- H5Sclose(space_id);
- H5Oclose(ref_obj_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(space_id);
+ H5Oclose(ref_obj_id);
+ }
+ H5E_END_TRY;
return ret_value;
}
-
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 76adc16..b62fe6d 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,13 +17,12 @@
/* number of members in an array */
#ifndef NELMTS
-# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
+#define NELMTS(X) (sizeof(X) / sizeof(X[0]))
#endif
static int verify_layout(hid_t pid, pack_info_t *obj);
static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter);
-
/*-------------------------------------------------------------------------
* Function: h5repack_verify
*
@@ -39,62 +38,62 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil
int
h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options)
{
- hid_t fidin = H5I_INVALID_HID; /* file ID for input file*/
- hid_t fidout = H5I_INVALID_HID; /* file ID for output file*/
- hid_t did = H5I_INVALID_HID; /* dataset ID */
- hid_t pid = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t sid = H5I_INVALID_HID; /* space ID */
- hid_t tid = H5I_INVALID_HID; /* type ID */
- int ok = 1; /* step results */
- unsigned int i;
- trav_table_t *travt = NULL;
- hid_t fcpl_in = H5I_INVALID_HID; /* file creation property for input file */
- hid_t fcpl_out = H5I_INVALID_HID; /* file creation property for output file */
- H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */
- hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
- hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
- hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
- int ret_value = 0;
+ hid_t fidin = H5I_INVALID_HID; /* file ID for input file*/
+ hid_t fidout = H5I_INVALID_HID; /* file ID for output file*/
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t pid = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t sid = H5I_INVALID_HID; /* space ID */
+ hid_t tid = H5I_INVALID_HID; /* type ID */
+ int ok = 1; /* step results */
+ unsigned int i;
+ trav_table_t * travt = NULL;
+ hid_t fcpl_in = H5I_INVALID_HID; /* file creation property for input file */
+ hid_t fcpl_out = H5I_INVALID_HID; /* file creation property for output file */
+ H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */
+ hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
+ hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
+ hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
+ int ret_value = 0;
/* open the output file */
- if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
+ if ((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Fopen failed on <%s>", out_fname);
- for(i = 0; i < options->op_tbl->nelems; i++) {
- char *name = options->op_tbl->objs[i].path;
- pack_info_t *obj = &options->op_tbl->objs[i];
+ for (i = 0; i < options->op_tbl->nelems; i++) {
+ char * name = options->op_tbl->objs[i].path;
+ pack_info_t *obj = &options->op_tbl->objs[i];
- /*-------------------------------------------------------------------------
- * open
- *-------------------------------------------------------------------------
- */
- if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
+ /*-------------------------------------------------------------------------
+ * open
+ *-------------------------------------------------------------------------
+ */
+ if ((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on <%s>", name);
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
- if((pid = H5Dget_create_plist(did)) < 0)
+ if ((pid = H5Dget_create_plist(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
- /*-------------------------------------------------------------------------
- * filter check
- *-------------------------------------------------------------------------
- */
- if(verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0)
+ /*-------------------------------------------------------------------------
+ * filter check
+ *-------------------------------------------------------------------------
+ */
+ if (verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0)
ok = 0;
- /*-------------------------------------------------------------------------
- * layout check
- *-------------------------------------------------------------------------
- */
- if((obj->layout != -1) && (verify_layout(pid, obj) == 0))
+ /*-------------------------------------------------------------------------
+ * layout check
+ *-------------------------------------------------------------------------
+ */
+ if ((obj->layout != -1) && (verify_layout(pid, obj) == 0))
ok = 0;
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
if (H5Pclose(pid) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Sclose(sid) < 0)
@@ -105,65 +104,65 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
}
- /*-------------------------------------------------------------------------
- * check for the "all" objects option
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * check for the "all" objects option
+ *-------------------------------------------------------------------------
+ */
- if(options->all_filter == 1 || options->all_layout == 1) {
+ if (options->all_filter == 1 || options->all_layout == 1) {
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
trav_table_init(&travt);
/* get the list of objects in the file */
- if(h5trav_gettable(fidout, travt) < 0)
+ if (h5trav_gettable(fidout, travt) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
- for(i = 0; i < travt->nobjs; i++) {
+ for (i = 0; i < travt->nobjs; i++) {
char *name = travt->objs[i].name;
- if(travt->objs[i].type == H5TRAV_TYPE_DATASET) {
- /*-------------------------------------------------------------------------
- * open
- *-------------------------------------------------------------------------
- */
- if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
+ if (travt->objs[i].type == H5TRAV_TYPE_DATASET) {
+ /*-------------------------------------------------------------------------
+ * open
+ *-------------------------------------------------------------------------
+ */
+ if ((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on <%s>", name);
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
- if((pid = H5Dget_create_plist(did)) < 0)
+ if ((pid = H5Dget_create_plist(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
- /*-------------------------------------------------------------------------
- * filter check
- *-------------------------------------------------------------------------
- */
- if(options->all_filter == 1) {
- if(verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0)
+ /*-------------------------------------------------------------------------
+ * filter check
+ *-------------------------------------------------------------------------
+ */
+ if (options->all_filter == 1) {
+ if (verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0)
ok = 0;
}
- /*-------------------------------------------------------------------------
- * layout check
- *-------------------------------------------------------------------------
- */
- if(options->all_layout == 1) {
+ /*-------------------------------------------------------------------------
+ * layout check
+ *-------------------------------------------------------------------------
+ */
+ if (options->all_layout == 1) {
pack_info_t pack;
init_packobject(&pack);
pack.layout = options->layout_g;
- pack.chunk = options->chunk_g;
- if(verify_layout(pid, &pack) == 0)
+ pack.chunk = options->chunk_g;
+ if (verify_layout(pid, &pack) == 0)
ok = 0;
}
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
if (H5Pclose(pid) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Sclose(sid) < 0)
@@ -173,45 +172,47 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
if (H5Tclose(tid) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
} /* if */
- } /* i */
+ } /* i */
/* free table */
trav_table_free(travt);
travt = NULL;
}
- /*-------------------------------------------------------------------------
- * Verify that file space info are set as expected
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Verify that file space info are set as expected
+ *-------------------------------------------------------------------------
+ */
/* open the input file */
- if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Fopen failed on file <%s>", in_fname);
/* Get file creation property list for input file */
- if((fcpl_in = H5Fget_create_plist(fidin)) < 0)
+ if ((fcpl_in = H5Fget_create_plist(fidin)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Fget_create_plist failed to retrieve file creation property list");
/* Get file space info for input file */
- if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
+ if (H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0)
+ H5TOOLS_GOTO_ERROR((-1),
+ "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
/* Get file space page size for input file */
- if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0)
+ if (H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space page size");
/* Output file is already opened */
/* Get file creation property list for output file */
- if((fcpl_out = H5Fget_create_plist(fidout)) < 0)
+ if ((fcpl_out = H5Fget_create_plist(fidout)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Fget_create_plist failed to retrieve file creation property list");
/* Get file space info for output file */
- if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
+ if (H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0)
+ H5TOOLS_GOTO_ERROR((-1),
+ "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
/* Get file space page size for output file */
- if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0)
+ if (H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space page size");
/*
@@ -219,12 +220,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* If -S option is not set, the file space handling strategy should be
* the same as the input file's strategy.
*/
- if(options->fs_strategy) {
- if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy))
+ if (options->fs_strategy) {
+ if (out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy))
H5TOOLS_GOTO_ERROR((-1), "file space strategy not set as unexpected");
}
else {
- if(out_strategy != in_strategy)
+ if (out_strategy != in_strategy)
H5TOOLS_GOTO_ERROR((-1), "file space strategy not set as unexpected");
}
@@ -233,12 +234,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* If the -P option is not set, the free-space persist status should be
* the same as the input file's free-space persist status
*/
- if(options->fs_persist) {
- if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist))
+ if (options->fs_persist) {
+ if (out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist))
H5TOOLS_GOTO_ERROR((-1), "free-space persist status not set as unexpected");
}
else {
- if(out_persist != in_persist)
+ if (out_persist != in_persist)
H5TOOLS_GOTO_ERROR((-1), "free-space persist status not set as unexpected");
}
@@ -247,12 +248,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* If the -T option is not set, the threshold should be the same as the
* input file's threshold size.
*/
- if(options->fs_threshold) {
- if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold))
+ if (options->fs_threshold) {
+ if (out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold))
H5TOOLS_GOTO_ERROR((-1), "threshold not set as unexpected");
}
else {
- if(out_threshold != in_threshold)
+ if (out_threshold != in_threshold)
H5TOOLS_GOTO_ERROR((-1), "threshold not set as unexpected");
}
@@ -261,20 +262,20 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* If the -G option is not set, the file space page size should be
* the same as the input file's file space page size.
*/
- if(options->fs_pagesize) {
- if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize))
+ if (options->fs_pagesize) {
+ if (out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize))
H5TOOLS_GOTO_ERROR((-1), "file space page size not set as unexpected");
}
else { /* "-G" is not set */
- if(out_pagesize != in_pagesize)
+ if (out_pagesize != in_pagesize)
H5TOOLS_GOTO_ERROR((-1), "file space page size not set as unexpected");
-
}
ret_value = ok;
done:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl_in);
H5Pclose(fcpl_out);
H5Pclose(pid);
@@ -285,7 +286,8 @@ done:
H5Fclose(fidout);
if (travt)
trav_table_free(travt);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return ret_value;
} /* h5repack_verify() */
@@ -305,13 +307,14 @@ done:
*-------------------------------------------------------------------------
*/
-int verify_layout(hid_t pid, pack_info_t *obj)
+int
+verify_layout(hid_t pid, pack_info_t *obj)
{
- hsize_t chsize[64]; /* chunk size in elements */
- H5D_layout_t layout; /* layout */
- int nfilters; /* number of filters */
- int rank; /* rank */
- int i; /* index */
+ hsize_t chsize[64]; /* chunk size in elements */
+ H5D_layout_t layout; /* layout */
+ int nfilters; /* number of filters */
+ int rank; /* rank */
+ int i; /* index */
/* check if we have filters in the input object */
if ((nfilters = H5Pget_nfilters(pid)) < 0)
@@ -328,8 +331,8 @@ int verify_layout(hid_t pid, pack_info_t *obj)
if (obj->layout != layout)
return 0;
- if (layout==H5D_CHUNKED) {
- if ((rank = H5Pget_chunk(pid, NELMTS(chsize), chsize/*out*/)) < 0)
+ if (layout == H5D_CHUNKED) {
+ if ((rank = H5Pget_chunk(pid, NELMTS(chsize), chsize /*out*/)) < 0)
return -1;
if (obj->chunk.rank != rank)
return 0;
@@ -353,49 +356,52 @@ int verify_layout(hid_t pid, pack_info_t *obj)
*-------------------------------------------------------------------------
*/
-int h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t fname2_fapl)
+int
+h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t fname2_fapl)
{
- hid_t fid1 = H5I_INVALID_HID; /* file ID */
- hid_t fid2 = H5I_INVALID_HID; /* file ID */
- hid_t dset1 = H5I_INVALID_HID; /* dataset ID */
- hid_t dset2 = H5I_INVALID_HID; /* dataset ID */
- hid_t gid = H5I_INVALID_HID; /* group ID */
- hid_t dcpl1 = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t dcpl2 = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t gcplid = H5I_INVALID_HID; /* group creation property list */
- unsigned crt_order_flag1; /* group creation order flag */
- unsigned crt_order_flag2; /* group creation order flag */
+ hid_t fid1 = H5I_INVALID_HID; /* file ID */
+ hid_t fid2 = H5I_INVALID_HID; /* file ID */
+ hid_t dset1 = H5I_INVALID_HID; /* dataset ID */
+ hid_t dset2 = H5I_INVALID_HID; /* dataset ID */
+ hid_t gid = H5I_INVALID_HID; /* group ID */
+ hid_t dcpl1 = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t dcpl2 = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t gcplid = H5I_INVALID_HID; /* group creation property list */
+ unsigned crt_order_flag1; /* group creation order flag */
+ unsigned crt_order_flag2; /* group creation order flag */
trav_table_t *trav = NULL;
unsigned int i;
int ret_value = 1;
- /*-------------------------------------------------------------------------
- * open the files
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * open the files
+ *-------------------------------------------------------------------------
+ */
/* Open the files */
- if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl, TRUE, NULL, 0)) < 0)
+ if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl,
+ (fname1_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR);
- if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl, TRUE, NULL, 0)) < 0)
+ if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl,
+ (fname2_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR);
- /*-------------------------------------------------------------------------
- * get file table list of objects
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * get file table list of objects
+ *-------------------------------------------------------------------------
+ */
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
trav_table_init(&trav);
- if(h5trav_gettable(fid1, trav) < 0)
+ if (h5trav_gettable(fid1, trav) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
- /*-------------------------------------------------------------------------
- * traverse the suppplied object list
- *-------------------------------------------------------------------------
- */
- for(i = 0; i < trav->nobjs; i++) {
- if(trav->objs[i].type == H5TRAV_TYPE_GROUP) {
+ /*-------------------------------------------------------------------------
+ * traverse the suppplied object list
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0; i < trav->nobjs; i++) {
+ if (trav->objs[i].type == H5TRAV_TYPE_GROUP) {
if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed on first <%s>", trav->objs[i].name);
if ((gcplid = H5Gget_create_plist(gid)) < 0)
@@ -421,40 +427,40 @@ int h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, h
if (crt_order_flag1 != crt_order_flag2)
H5TOOLS_GOTO_ERROR(0, "property lists failed for <%s> are different", trav->objs[i].name);
}
- else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) {
- if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
+ else if (trav->objs[i].type == H5TRAV_TYPE_DATASET) {
+ if ((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on first <%s>", trav->objs[i].name);
- if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on second <%s>", trav->objs[i].name);
- if((dcpl1 = H5Dget_create_plist(dset1)) < 0)
+ if ((dcpl1 = H5Dget_create_plist(dset1)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- if((dcpl2 = H5Dget_create_plist(dset2)) < 0)
+ if ((dcpl2 = H5Dget_create_plist(dset2)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- /*-------------------------------------------------------------------------
- * compare the property lists
- *-------------------------------------------------------------------------
- */
- if((ret_value = H5Pequal(dcpl1, dcpl2)) < 0)
+ /*-------------------------------------------------------------------------
+ * compare the property lists
+ *-------------------------------------------------------------------------
+ */
+ if ((ret_value = H5Pequal(dcpl1, dcpl2)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pequal failed");
- if(ret_value == 0)
+ if (ret_value == 0)
H5TOOLS_GOTO_ERROR(0, "property lists failed for <%s> are different", trav->objs[i].name);
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if(H5Pclose(dcpl1) < 0)
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Pclose(dcpl1) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if(H5Pclose(dcpl2) < 0)
+ if (H5Pclose(dcpl2) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if(H5Dclose(dset1) < 0)
+ if (H5Dclose(dset1) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
- if(H5Dclose(dset2) < 0)
+ if (H5Dclose(dset2) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
} /*if*/
- } /*for*/
+ } /*for*/
done:
H5E_BEGIN_TRY
@@ -467,14 +473,14 @@ done:
H5Fclose(fid2);
H5Pclose(gcplid);
H5Gclose(gid);
- if(trav)
+ if (trav)
trav_table_free(trav);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: verify_filters
*
@@ -489,27 +495,25 @@ done:
*-------------------------------------------------------------------------
*/
-static
-int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
+static int
+verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
{
- int nfilters_dcpl; /* number of filters in DCPL*/
- unsigned filt_flags; /* filter flags */
- H5Z_filter_t filtn; /* filter identification number */
- unsigned cd_values[20]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
- char f_name[256]; /* filter name */
- size_t size; /* type size */
- int i; /* index */
- unsigned j; /* index */
+ int nfilters_dcpl; /* number of filters in DCPL*/
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ char f_name[256]; /* filter name */
+ size_t size; /* type size */
+ int i; /* index */
+ unsigned j; /* index */
/* get information about filters */
- if((nfilters_dcpl = H5Pget_nfilters(pid)) < 0)
+ if ((nfilters_dcpl = H5Pget_nfilters(pid)) < 0)
return -1;
/* if we do not have filters and the requested filter is NONE, return 1 */
- if(!nfilters_dcpl &&
- nfilters == 1 &&
- filter[0].filtn == H5Z_FILTER_NONE)
+ if (!nfilters_dcpl && nfilters == 1 && filter[0].filtn == H5Z_FILTER_NONE)
return 1;
/* else the numbers of filters must match */
@@ -523,8 +527,8 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
for (i = 0; i < nfilters_dcpl; i++) {
cd_nelmts = NELMTS(cd_values);
- filtn = H5Pget_filter2(pid, (unsigned)i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_name), f_name, NULL);
+ filtn = H5Pget_filter2(pid, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name,
+ NULL);
/* filter ID */
if (filtn < 0)
@@ -535,7 +539,7 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
/* compare client data values. some filters do return local values */
switch (filtn) {
case H5Z_FILTER_NONE:
- break;
+ break;
case H5Z_FILTER_SHUFFLE:
/* 1 private client value is returned by DCPL */
@@ -543,7 +547,7 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
return 0;
/* get dataset's type size */
- if((size = H5Tget_size(tid)) <= 0)
+ if ((size = H5Tget_size(tid)) <= 0)
return -1;
/* the private client value holds the dataset's type size */
diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt
index f0722fd..88c0d3d 100644
--- a/tools/src/h5stat/CMakeLists.txt
+++ b/tools/src/h5stat/CMakeLists.txt
@@ -6,7 +6,7 @@ project (HDF5_TOOLS_SRC_H5STAT C)
# --------------------------------------------------------------------
if (NOT ONLY_SHARED_LIBS)
add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c)
- target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5stat PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5stat STATIC)
target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -18,7 +18,7 @@ endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c)
- target_include_directories (h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5stat-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5stat-shared SHARED)
target_link_libraries (h5stat-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
@@ -28,6 +28,17 @@ if (BUILD_SHARED_LIBS)
set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5stat-shared)
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_H5STAT_SRC_FORMAT h5stat)
+ else ()
+ clang_format (HDF5_H5STAT_SRC_FORMAT h5stat-shared)
+ endif ()
+endif ()
+
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
diff --git a/tools/src/h5stat/Makefile.am b/tools/src/h5stat/Makefile.am
index c228b48..9231633 100644
--- a/tools/src/h5stat/Makefile.am
+++ b/tools/src/h5stat/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/src/h5stat/Makefile.in b/tools/src/h5stat/Makefile.in
index efe1e4b..019eda9 100644
--- a/tools/src/h5stat/Makefile.in
+++ b/tools/src/h5stat/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -421,12 +422,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -464,11 +465,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -500,8 +546,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -515,7 +559,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -525,6 +571,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -718,7 +765,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1302,8 +1349,9 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index f4fdae6..6e54c78 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -6,12 +6,12 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#include "h5tools.h"
#include "h5tools_utils.h"
#include "h5tools_ref.h"
@@ -24,100 +24,98 @@
/* Parameters to control statistics gathered */
/* Default threshold for small groups/datasets/attributes */
-#define DEF_SIZE_SMALL_GROUPS 10
-#define DEF_SIZE_SMALL_DSETS 10
-#define DEF_SIZE_SMALL_ATTRS 10
+#define DEF_SIZE_SMALL_GROUPS 10
+#define DEF_SIZE_SMALL_DSETS 10
+#define DEF_SIZE_SMALL_ATTRS 10
-#define SIZE_SMALL_SECTS 10
+#define SIZE_SMALL_SECTS 10
-#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to
- accommodate for user-define filters + one
- to accomodate datasets whithout any filters */
+#define H5_NFILTERS_IMPL \
+ 8 /* Number of currently implemented filters + one to \
+ accommodate for user-define filters + one \
+ to accomodate datasets whithout any filters */
/* File space management strategies: see H5Fpublic.h for declarations */
-const char *FS_STRATEGY_NAME[] = {
- "H5F_FSPACE_STRATEGY_FSM_AGGR",
- "H5F_FSPACE_STRATEGY_PAGE",
- "H5F_FSPACE_STRATEGY_AGGR",
- "H5F_FSPACE_STRATEGY_NONE",
- "unknown",
- NULL
-};
+const char *FS_STRATEGY_NAME[] = {"H5F_FSPACE_STRATEGY_FSM_AGGR",
+ "H5F_FSPACE_STRATEGY_PAGE",
+ "H5F_FSPACE_STRATEGY_AGGR",
+ "H5F_FSPACE_STRATEGY_NONE",
+ "unknown",
+ NULL};
/* Datatype statistics for datasets */
typedef struct dtype_info_t {
- hid_t tid; /* ID of datatype */
- unsigned long count; /* Number of types found */
- unsigned long named; /* Number of types that are named */
+ hid_t tid; /* ID of datatype */
+ unsigned long count; /* Number of types found */
+ unsigned long named; /* Number of types that are named */
} dtype_info_t;
typedef struct ohdr_info_t {
- hsize_t total_size; /* Total size of object headers */
- hsize_t free_size; /* Total free space in object headers */
+ hsize_t total_size; /* Total size of object headers */
+ hsize_t free_size; /* Total free space in object headers */
} ohdr_info_t;
/* Info to pass to the iteration functions */
typedef struct iter_t {
- hid_t fid; /* File ID */
- hsize_t filesize; /* Size of the file */
- unsigned long uniq_groups; /* Number of unique groups */
- unsigned long uniq_dsets; /* Number of unique datasets */
- unsigned long uniq_dtypes; /* Number of unique named datatypes */
- unsigned long uniq_links; /* Number of unique links */
- unsigned long uniq_others; /* Number of other unique objects */
-
- unsigned long max_links; /* Maximum # of links to an object */
- hsize_t max_fanout; /* Maximum fanout from a group */
- unsigned long *num_small_groups; /* Size of small groups tracked */
- unsigned group_nbins; /* Number of bins for group counts */
- unsigned long *group_bins; /* Pointer to array of bins for group counts */
- ohdr_info_t group_ohdr_info; /* Object header information for groups */
-
- hsize_t max_attrs; /* Maximum attributes from a group */
- unsigned long *num_small_attrs; /* Size of small attributes tracked */
- unsigned attr_nbins; /* Number of bins for attribute counts */
- unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */
-
- unsigned max_dset_rank; /* Maximum rank of dataset */
- unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */
- hsize_t max_dset_dims; /* Maximum dimension size of dataset */
- unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */
- unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */
- unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */
- unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */
- dtype_info_t *dset_type_info; /* Pointer to dataset datatype information found */
- unsigned dset_dim_nbins; /* Number of bins for dataset dimensions */
- unsigned long *dset_dim_bins; /* Pointer to array of bins for dataset dimensions */
- ohdr_info_t dset_ohdr_info; /* Object header information for datasets */
- hsize_t dset_storage_size; /* Size of raw data for datasets */
- hsize_t dset_external_storage_size; /* Size of raw data for datasets with external storage */
- ohdr_info_t dtype_ohdr_info; /* Object header information for datatypes */
- hsize_t groups_btree_storage_size; /* btree size for group */
- hsize_t groups_heap_storage_size; /* heap size for group */
- hsize_t attrs_btree_storage_size; /* btree size for attributes (1.8) */
- hsize_t attrs_heap_storage_size; /* fractal heap size for attributes (1.8) */
- hsize_t SM_hdr_storage_size; /* header size for SOHM table (1.8) */
- hsize_t SM_index_storage_size; /* index (btree & list) size for SOHM table (1.8) */
- hsize_t SM_heap_storage_size; /* fractal heap size for SOHM table (1.8) */
- hsize_t super_size; /* superblock size */
- hsize_t super_ext_size; /* superblock extension size */
- hsize_t ublk_size; /* user block size (if exists) */
- H5F_fspace_strategy_t fs_strategy; /* File space management strategy */
- hbool_t fs_persist; /* Free-space persist or not */
- hsize_t fs_threshold; /* Free-space section threshold */
- hsize_t fsp_size; /* File space page size */
- hsize_t free_space; /* Amount of freespace in the file */
- hsize_t free_hdr; /* Size of free space manager metadata in the file */
- unsigned long num_small_sects[SIZE_SMALL_SECTS]; /* Size of small free-space sections */
- unsigned sect_nbins; /* Number of bins for free-space section sizes */
- unsigned long *sect_bins; /* Pointer to array of bins for free-space section sizes */
- hsize_t datasets_index_storage_size;/* meta size for chunked dataset's indexing type */
- hsize_t datasets_heap_storage_size; /* heap size for dataset with external storage */
- unsigned long nexternal; /* Number of external files for a dataset */
- int local; /* Flag to indicate iteration over the object*/
+ hid_t fid; /* File ID */
+ hsize_t filesize; /* Size of the file */
+ unsigned long uniq_groups; /* Number of unique groups */
+ unsigned long uniq_dsets; /* Number of unique datasets */
+ unsigned long uniq_dtypes; /* Number of unique named datatypes */
+ unsigned long uniq_links; /* Number of unique links */
+ unsigned long uniq_others; /* Number of other unique objects */
+
+ unsigned long max_links; /* Maximum # of links to an object */
+ hsize_t max_fanout; /* Maximum fanout from a group */
+ unsigned long *num_small_groups; /* Size of small groups tracked */
+ unsigned group_nbins; /* Number of bins for group counts */
+ unsigned long *group_bins; /* Pointer to array of bins for group counts */
+ ohdr_info_t group_ohdr_info; /* Object header information for groups */
+
+ hsize_t max_attrs; /* Maximum attributes from a group */
+ unsigned long *num_small_attrs; /* Size of small attributes tracked */
+ unsigned attr_nbins; /* Number of bins for attribute counts */
+ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */
+
+ unsigned max_dset_rank; /* Maximum rank of dataset */
+ unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */
+ hsize_t max_dset_dims; /* Maximum dimension size of dataset */
+ unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */
+ unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */
+ unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */
+ unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */
+ dtype_info_t * dset_type_info; /* Pointer to dataset datatype information found */
+ unsigned dset_dim_nbins; /* Number of bins for dataset dimensions */
+ unsigned long *dset_dim_bins; /* Pointer to array of bins for dataset dimensions */
+ ohdr_info_t dset_ohdr_info; /* Object header information for datasets */
+ hsize_t dset_storage_size; /* Size of raw data for datasets */
+ hsize_t dset_external_storage_size; /* Size of raw data for datasets with external storage */
+ ohdr_info_t dtype_ohdr_info; /* Object header information for datatypes */
+ hsize_t groups_btree_storage_size; /* btree size for group */
+ hsize_t groups_heap_storage_size; /* heap size for group */
+ hsize_t attrs_btree_storage_size; /* btree size for attributes (1.8) */
+ hsize_t attrs_heap_storage_size; /* fractal heap size for attributes (1.8) */
+ hsize_t SM_hdr_storage_size; /* header size for SOHM table (1.8) */
+ hsize_t SM_index_storage_size; /* index (btree & list) size for SOHM table (1.8) */
+ hsize_t SM_heap_storage_size; /* fractal heap size for SOHM table (1.8) */
+ hsize_t super_size; /* superblock size */
+ hsize_t super_ext_size; /* superblock extension size */
+ hsize_t ublk_size; /* user block size (if exists) */
+ H5F_fspace_strategy_t fs_strategy; /* File space management strategy */
+ hbool_t fs_persist; /* Free-space persist or not */
+ hsize_t fs_threshold; /* Free-space section threshold */
+ hsize_t fsp_size; /* File space page size */
+ hsize_t free_space; /* Amount of freespace in the file */
+ hsize_t free_hdr; /* Size of free space manager metadata in the file */
+ unsigned long num_small_sects[SIZE_SMALL_SECTS]; /* Size of small free-space sections */
+ unsigned sect_nbins; /* Number of bins for free-space section sizes */
+ unsigned long * sect_bins; /* Pointer to array of bins for free-space section sizes */
+ hsize_t datasets_index_storage_size; /* meta size for chunked dataset's indexing type */
+ hsize_t datasets_heap_storage_size; /* heap size for dataset with external storage */
+ unsigned long nexternal; /* Number of external files for a dataset */
+ int local; /* Flag to indicate iteration over the object*/
} iter_t;
-
static const char *drivername = NULL;
#ifdef H5_HAVE_ROS3_VFD
@@ -143,27 +141,27 @@ static H5FD_hdfs_fapl_t hdfs_fa = {
};
#endif /* H5_HAVE_LIBHDFS */
-static int display_all = TRUE;
+static int display_all = TRUE;
/* Enable the printing of selected statistics */
-static int display_file = FALSE; /* display file information */
-static int display_group = FALSE; /* display groups information */
-static int display_dset = FALSE; /* display datasets information */
-static int display_dset_dtype_meta = FALSE; /* display datasets' datatype information */
-static int display_attr = FALSE; /* display attributes information */
-static int display_free_sections = FALSE; /* display free space information */
-static int display_summary = FALSE; /* display summary of file space information */
+static int display_file = FALSE; /* display file information */
+static int display_group = FALSE; /* display groups information */
+static int display_dset = FALSE; /* display datasets information */
+static int display_dset_dtype_meta = FALSE; /* display datasets' datatype information */
+static int display_attr = FALSE; /* display attributes information */
+static int display_free_sections = FALSE; /* display free space information */
+static int display_summary = FALSE; /* display summary of file space information */
-static int display_file_metadata = FALSE; /* display file space info for file's metadata */
-static int display_group_metadata = FALSE; /* display file space info for groups' metadata */
-static int display_dset_metadata = FALSE; /* display file space info for datasets' metadata */
+static int display_file_metadata = FALSE; /* display file space info for file's metadata */
+static int display_group_metadata = FALSE; /* display file space info for groups' metadata */
+static int display_dset_metadata = FALSE; /* display file space info for datasets' metadata */
-static int display_object = FALSE; /* not implemented yet */
+static int display_object = FALSE; /* not implemented yet */
/* Initialize threshold for small groups/datasets/attributes */
-static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS;
-static int sdsets_threshold = DEF_SIZE_SMALL_DSETS;
-static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS;
+static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS;
+static int sdsets_threshold = DEF_SIZE_SMALL_DSETS;
+static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS;
/* a structure for handling the order command-line parameters come in */
struct handler_t {
@@ -171,120 +169,33 @@ struct handler_t {
char **obj;
};
-static const char *s_opts ="Aa:Ddm:EFfhGgl:sSTO:Vw:H:";
+static const char *s_opts = "Aa:Ddm:EFfhGgl:sSTO:Vw:H:";
/* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */
-static struct long_options l_opts[] = {
- {"help", no_arg, 'h'},
- {"hel", no_arg, 'h'},
- {"he", no_arg, 'h'},
- {"filemetadata", no_arg, 'F'},
- {"filemetadat", no_arg, 'F'},
- {"filemetada", no_arg, 'F'},
- {"filemetad", no_arg, 'F'},
- {"filemeta", no_arg, 'F'},
- {"filemet", no_arg, 'F'},
- {"fileme", no_arg, 'F'},
- {"filem", no_arg, 'F'},
- {"file", no_arg, 'f'},
- {"fil", no_arg, 'f'},
- {"fi", no_arg, 'f'},
- {"groupmetadata", no_arg, 'G'},
- {"groupmetadat", no_arg, 'G'},
- {"groupmetada", no_arg, 'G'},
- {"groupmetad", no_arg, 'G'},
- {"groupmeta", no_arg, 'G'},
- {"groupmet", no_arg, 'G'},
- {"groupme", no_arg, 'G'},
- {"groupm", no_arg, 'G'},
- {"group", no_arg, 'g'},
- {"grou", no_arg, 'g'},
- {"gro", no_arg, 'g'},
- {"gr", no_arg, 'g'},
- { "links", require_arg, 'l' },
- { "link", require_arg, 'l' },
- { "lin", require_arg, 'l' },
- { "li", require_arg, 'l' },
- {"dsetmetadata", no_arg, 'D'},
- {"dsetmetadat", no_arg, 'D'},
- {"dsetmetada", no_arg, 'D'},
- {"dsetmetad", no_arg, 'D'},
- {"dsetmeta", no_arg, 'D'},
- {"dsetmet", no_arg, 'D'},
- {"dsetme", no_arg, 'D'},
- {"dsetm", no_arg, 'D'},
- {"dset", no_arg, 'd'},
- {"dse", no_arg, 'd'},
- {"ds", no_arg, 'd'},
- {"dims", require_arg, 'm'},
- {"dim", require_arg, 'm'},
- {"di", require_arg, 'm'},
- {"dtypemetadata", no_arg, 'T'},
- {"dtypemetadat", no_arg, 'T'},
- {"dtypemetada", no_arg, 'T'},
- {"dtypemetad", no_arg, 'T'},
- {"dtypemeta", no_arg, 'T'},
- {"dtypemet", no_arg, 'T'},
- {"dtypeme", no_arg, 'T'},
- {"dtypem", no_arg, 'T'},
- {"dtype", no_arg, 'T'},
- {"dtyp", no_arg, 'T'},
- {"dty", no_arg, 'T'},
- {"dt", no_arg, 'T'},
- { "object", require_arg, 'O' },
- { "objec", require_arg, 'O' },
- { "obje", require_arg, 'O' },
- { "obj", require_arg, 'O' },
- { "ob", require_arg, 'O' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "ver", no_arg, 'V' },
- { "ve", no_arg, 'V' },
- { "attribute", no_arg, 'A' },
- { "attribut", no_arg, 'A' },
- { "attribu", no_arg, 'A' },
- { "attrib", no_arg, 'A' },
- { "attri", no_arg, 'A' },
- { "attr", no_arg, 'A' },
- { "att", no_arg, 'A' },
- { "at", no_arg, 'A' },
- { "enable-error-stack", no_arg, 'E' },
- { "numattrs", require_arg, 'a' },
- { "numattr", require_arg, 'a' },
- { "numatt", require_arg, 'a' },
- { "numat", require_arg, 'a' },
- { "numa", require_arg, 'a' },
- { "num", require_arg, 'a' },
- { "nu", require_arg, 'a' },
- { "freespace", no_arg, 's' },
- { "freespac", no_arg, 's' },
- { "freespa", no_arg, 's' },
- { "freesp", no_arg, 's' },
- { "frees", no_arg, 's' },
- { "free", no_arg, 's' },
- { "fre", no_arg, 's' },
- { "fr", no_arg, 's' },
- { "summary", no_arg, 'S' },
- { "summar", no_arg, 'S' },
- { "summa", no_arg, 'S' },
- { "summ", no_arg, 'S' },
- { "sum", no_arg, 'S' },
- { "su", no_arg, 'S' },
- { "s3-cred", require_arg, 'w' },
- { "hdfs-attrs", require_arg, 'H' },
- { NULL, 0, '\0' }
-};
+static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"filemetadata", no_arg, 'F'},
+ {"groupmetadata", no_arg, 'G'},
+ {"links", require_arg, 'l'},
+ {"dsetmetadata", no_arg, 'D'},
+ {"dims", require_arg, 'm'},
+ {"dtypemetadata", no_arg, 'T'},
+ {"object", require_arg, 'O'},
+ {"version", no_arg, 'V'},
+ {"attribute", no_arg, 'A'},
+ {"enable-error-stack", no_arg, 'E'},
+ {"numattrs", require_arg, 'a'},
+ {"freespace", no_arg, 's'},
+ {"summary", no_arg, 'S'},
+ {"s3-cred", require_arg, 'w'},
+ {"hdfs-attrs", require_arg, 'H'},
+ {NULL, 0, '\0'}};
static void
leave(int ret)
{
- h5tools_close();
- HDexit(ret);
+ h5tools_close();
+ HDexit(ret);
}
-
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -294,47 +205,49 @@ leave(int ret)
*
*-------------------------------------------------------------------------
*/
-static void usage(const char *prog)
+static void
+usage(const char *prog)
{
- HDfflush(stdout);
- HDfprintf(stdout, "Usage: %s [OPTIONS] file\n", prog);
- HDfprintf(stdout, "\n");
- HDfprintf(stdout, " OPTIONS\n");
- HDfprintf(stdout, " -h, --help Print a usage message and exit\n");
- HDfprintf(stdout, " -V, --version Print version number and exit\n");
- HDfprintf(stdout, " -f, --file Print file information\n");
- HDfprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n");
- HDfprintf(stdout, " -g, --group Print group information\n");
- HDfprintf(stdout, " -l N, --links=N Set the threshold for the # of links when printing\n");
- HDfprintf(stdout, " information for small groups. N is an integer greater\n");
- HDfprintf(stdout, " than 0. The default threshold is 10.\n");
- HDfprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n");
- HDfprintf(stdout, " -d, --dset Print dataset information\n");
- HDfprintf(stdout, " -m N, --dims=N Set the threshold for the dimension sizes when printing\n");
- HDfprintf(stdout, " information for small datasets. N is an integer greater\n");
- HDfprintf(stdout, " than 0. The default threshold is 10.\n");
- HDfprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n");
- HDfprintf(stdout, " -T, --dtypemetadata Print datasets' datatype information\n");
- HDfprintf(stdout, " -A, --attribute Print attribute information\n");
- HDfprintf(stdout, " -a N, --numattrs=N Set the threshold for the # of attributes when printing\n");
- HDfprintf(stdout, " information for small # of attributes. N is an integer greater\n");
- HDfprintf(stdout, " than 0. The default threshold is 10.\n");
- HDfprintf(stdout, " -s, --freespace Print free space information\n");
- HDfprintf(stdout, " -S, --summary Print summary of file space information\n");
- HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n");
- HDfprintf(stdout, " --s3-cred=<cred> Access file on S3, using provided credential\n");
- HDfprintf(stdout, " <cred> :: (region,id,key)\n");
- HDfprintf(stdout, " If <cred> == \"(,,)\", no authentication is used.\n");
- HDfprintf(stdout, " --hdfs-attrs=<attrs> Access a file on HDFS with given configuration\n");
- HDfprintf(stdout, " attributes.\n");
- HDfprintf(stdout, " <attrs> :: (<namenode name>,<namenode port>,\n");
- HDfprintf(stdout, " <kerberos cache path>,<username>,\n");
- HDfprintf(stdout, " <buffer size>)\n");
- HDfprintf(stdout, " If an attribute is empty, a default value will be\n");
- HDfprintf(stdout, " used.\n");
+ HDfflush(stdout);
+ HDfprintf(stdout, "Usage: %s [OPTIONS] file\n", prog);
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, " OPTIONS\n");
+ HDfprintf(stdout, " -h, --help Print a usage message and exit\n");
+ HDfprintf(stdout, " -V, --version Print version number and exit\n");
+ HDfprintf(stdout, " -f, --file Print file information\n");
+ HDfprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n");
+ HDfprintf(stdout, " -g, --group Print group information\n");
+ HDfprintf(stdout, " -l N, --links=N Set the threshold for the # of links when printing\n");
+ HDfprintf(stdout, " information for small groups. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
+ HDfprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n");
+ HDfprintf(stdout, " -d, --dset Print dataset information\n");
+ HDfprintf(stdout, " -m N, --dims=N Set the threshold for the dimension sizes when printing\n");
+ HDfprintf(stdout,
+ " information for small datasets. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
+ HDfprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n");
+ HDfprintf(stdout, " -T, --dtypemetadata Print datasets' datatype information\n");
+ HDfprintf(stdout, " -A, --attribute Print attribute information\n");
+ HDfprintf(stdout, " -a N, --numattrs=N Set the threshold for the # of attributes when printing\n");
+ HDfprintf(stdout,
+ " information for small # of attributes. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
+ HDfprintf(stdout, " -s, --freespace Print free space information\n");
+ HDfprintf(stdout, " -S, --summary Print summary of file space information\n");
+ HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n");
+ HDfprintf(stdout, " --s3-cred=<cred> Access file on S3, using provided credential\n");
+ HDfprintf(stdout, " <cred> :: (region,id,key)\n");
+ HDfprintf(stdout, " If <cred> == \"(,,)\", no authentication is used.\n");
+ HDfprintf(stdout, " --hdfs-attrs=<attrs> Access a file on HDFS with given configuration\n");
+ HDfprintf(stdout, " attributes.\n");
+ HDfprintf(stdout, " <attrs> :: (<namenode name>,<namenode port>,\n");
+ HDfprintf(stdout, " <kerberos cache path>,<username>,\n");
+ HDfprintf(stdout, " <buffer size>)\n");
+ HDfprintf(stdout, " If an attribute is empty, a default value will be\n");
+ HDfprintf(stdout, " used.\n");
}
-
/*-------------------------------------------------------------------------
* Function: ceil_log10
*
@@ -351,9 +264,9 @@ H5_ATTR_CONST static unsigned
ceil_log10(unsigned long x)
{
unsigned long pow10 = 1;
- unsigned ret = 0;
+ unsigned ret = 0;
- while(x >= pow10) {
+ while (x >= pow10) {
pow10 *= 10;
ret++;
} /* end while */
@@ -361,7 +274,6 @@ ceil_log10(unsigned long x)
return ret;
} /* ceil_log10() */
-
/*-------------------------------------------------------------------------
* Function: attribute_stats
*
@@ -379,39 +291,38 @@ ceil_log10(unsigned long x)
static herr_t
attribute_stats(iter_t *iter, const H5O_info_t *oi)
{
- unsigned bin; /* "bin" the number of objects falls in */
+ unsigned bin; /* "bin" the number of objects falls in */
/* Update dataset & attribute metadata info */
iter->attrs_btree_storage_size += oi->meta_size.attr.index_size;
iter->attrs_heap_storage_size += oi->meta_size.attr.heap_size;
/* Update small # of attribute count & limits */
- if(oi->num_attrs <= (hsize_t)sattrs_threshold)
+ if (oi->num_attrs <= (hsize_t)sattrs_threshold)
(iter->num_small_attrs[(size_t)oi->num_attrs])++;
- if(oi->num_attrs > iter->max_attrs)
+ if (oi->num_attrs > iter->max_attrs)
iter->max_attrs = oi->num_attrs;
/* Add attribute count to proper bin */
bin = ceil_log10((unsigned long)oi->num_attrs);
- if((bin + 1) > iter->attr_nbins) {
+ if ((bin + 1) > iter->attr_nbins) {
iter->attr_bins = (unsigned long *)HDrealloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long));
HDassert(iter->attr_bins);
/* Initialize counts for intermediate bins */
- while(iter->attr_nbins < bin)
+ while (iter->attr_nbins < bin)
iter->attr_bins[iter->attr_nbins++] = 0;
iter->attr_nbins++;
/* Initialize count for new bin */
iter->attr_bins[bin] = 1;
- } /* end if */
- else
- (iter->attr_bins[bin])++;
+ } /* end if */
+ else
+ (iter->attr_bins[bin])++;
- return 0;
+ return 0;
} /* end attribute_stats() */
-
/*-------------------------------------------------------------------------
* Function: group_stats
*
@@ -440,9 +351,9 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
static herr_t
group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
{
- H5G_info_t ginfo; /* Group information */
- unsigned bin; /* "bin" the number of objects falls in */
- herr_t ret_value = SUCCEED;
+ H5G_info_t ginfo; /* Group information */
+ unsigned bin; /* "bin" the number of objects falls in */
+ herr_t ret_value = SUCCEED;
/* Gather statistics about this type of object */
iter->uniq_groups++;
@@ -452,26 +363,27 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->group_ohdr_info.free_size += oi->hdr.space.free;
/* Get group information */
- if((ret_value = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT)) < 0)
+ if ((ret_value = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Gget_info_by_name() failed");
/* Update link stats */
/* Collect statistics for small groups */
- if(ginfo.nlinks < (hsize_t)sgroups_threshold)
+ if (ginfo.nlinks < (hsize_t)sgroups_threshold)
(iter->num_small_groups[(size_t)ginfo.nlinks])++;
/* Determine maximum link count */
- if(ginfo.nlinks > iter->max_fanout)
+ if (ginfo.nlinks > iter->max_fanout)
iter->max_fanout = ginfo.nlinks;
/* Add group count to proper bin */
bin = ceil_log10((unsigned long)ginfo.nlinks);
- if((bin + 1) > iter->group_nbins) {
+ if ((bin + 1) > iter->group_nbins) {
/* Allocate more storage for info about dataset's datatype */
- if((iter->group_bins = (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long))) == NULL)
+ if ((iter->group_bins =
+ (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long))) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed");
/* Initialize counts for intermediate bins */
- while(iter->group_nbins < bin)
+ while (iter->group_nbins < bin)
iter->group_bins[iter->group_nbins++] = 0;
iter->group_nbins++;
@@ -486,14 +398,13 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->groups_heap_storage_size += oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if ((ret_value = attribute_stats(iter, oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats failed");
done:
return ret_value;
} /* end group_stats() */
-
/*-------------------------------------------------------------------------
* Function: dataset_stats
*
@@ -510,22 +421,22 @@ done:
static herr_t
dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
{
- unsigned bin; /* "bin" the number of objects falls in */
- hid_t did; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hid_t dcpl; /* Dataset creation property list ID */
- hsize_t dims[H5S_MAX_RANK]; /* Dimensions of dataset */
- H5D_layout_t lout; /* Layout of dataset */
- unsigned type_found; /* Whether the dataset's datatype was */
- /* already found */
- int ndims; /* Number of dimensions of dataset */
- hsize_t storage; /* Size of dataset storage */
- unsigned u; /* Local index variable */
- int num_ext; /* Number of external files for a dataset */
- int nfltr; /* Number of filters for a dataset */
- H5Z_filter_t fltr; /* Filter identifier */
- herr_t ret_value = SUCCEED;
+ unsigned bin; /* "bin" the number of objects falls in */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ hsize_t dims[H5S_MAX_RANK]; /* Dimensions of dataset */
+ H5D_layout_t lout; /* Layout of dataset */
+ unsigned type_found; /* Whether the dataset's datatype was */
+ /* already found */
+ int ndims; /* Number of dimensions of dataset */
+ hsize_t storage; /* Size of dataset storage */
+ unsigned u; /* Local index variable */
+ int num_ext; /* Number of external files for a dataset */
+ int nfltr; /* Number of filters for a dataset */
+ H5Z_filter_t fltr; /* Filter identifier */
+ herr_t ret_value = SUCCEED;
/* Gather statistics about this type of object */
iter->uniq_dsets++;
@@ -534,7 +445,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->dset_ohdr_info.total_size += oi->hdr.space.total;
iter->dset_ohdr_info.free_size += oi->hdr.space.free;
- if((did = H5Dopen2(iter->fid, name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(iter->fid, name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen() failed");
/* Update dataset metadata info */
@@ -542,7 +453,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->datasets_heap_storage_size += oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if ((ret_value = attribute_stats(iter, oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
/* Get storage info */
@@ -550,26 +461,26 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
storage = H5Dget_storage_size(did);
/* Gather layout statistics */
- if((dcpl = H5Dget_create_plist(did)) < 0)
+ if ((dcpl = H5Dget_create_plist(did)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_create_plist() failed");
- if((lout = H5Pget_layout(dcpl)) < 0)
+ if ((lout = H5Pget_layout(dcpl)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_layout() failed");
/* Object header's total size for H5D_COMPACT layout includes raw data size */
/* "storage" also includes H5D_COMPACT raw data size */
- if(lout == H5D_COMPACT)
+ if (lout == H5D_COMPACT)
iter->dset_ohdr_info.total_size -= storage;
/* Track the layout type for dataset */
(iter->dset_layouts[lout])++;
/* Get the number of external files for the dataset */
- if((num_ext = H5Pget_external_count(dcpl)) < 0)
+ if ((num_ext = H5Pget_external_count(dcpl)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_external_count() failed");
/* Accumulate raw data size accordingly */
- if(num_ext) {
+ if (num_ext) {
iter->nexternal += (unsigned long)num_ext;
iter->dset_external_storage_size += (unsigned long)storage;
}
@@ -577,37 +488,38 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->dset_storage_size += storage;
/* Gather dataspace statistics */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_space() failed");
- if((ndims = H5Sget_simple_extent_dims(sid, dims, NULL)) < 0)
+ if ((ndims = H5Sget_simple_extent_dims(sid, dims, NULL)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims() failed");
/* Check for larger rank of dataset */
- if((unsigned)ndims > iter->max_dset_rank)
+ if ((unsigned)ndims > iter->max_dset_rank)
iter->max_dset_rank = (unsigned)ndims;
/* Track the number of datasets with each rank */
(iter->dset_rank_count[ndims])++;
/* Only gather dim size statistics on 1-D datasets */
- if(ndims == 1) {
+ if (ndims == 1) {
/* Determine maximum dimension size */
- if(dims[0] > iter->max_dset_dims)
+ if (dims[0] > iter->max_dset_dims)
iter->max_dset_dims = dims[0];
/* Collect statistics for small datasets */
- if(dims[0] < (hsize_t)sdsets_threshold)
+ if (dims[0] < (hsize_t)sdsets_threshold)
(iter->small_dset_dims[(size_t)dims[0]])++;
/* Add dim count to proper bin */
bin = ceil_log10((unsigned long)dims[0]);
- if((bin + 1) > iter->dset_dim_nbins) {
+ if ((bin + 1) > iter->dset_dim_nbins) {
/* Allocate more storage for info about dataset's datatype */
- if((iter->dset_dim_bins = (unsigned long *)HDrealloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long))) == NULL)
+ if ((iter->dset_dim_bins = (unsigned long *)HDrealloc(iter->dset_dim_bins,
+ (bin + 1) * sizeof(unsigned long))) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed");
/* Initialize counts for intermediate bins */
- while(iter->dset_dim_nbins < bin)
+ while (iter->dset_dim_nbins < bin)
iter->dset_dim_bins[iter->dset_dim_nbins++] = 0;
iter->dset_dim_nbins++;
@@ -618,22 +530,22 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
(iter->dset_dim_bins[bin])++;
} /* end if */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose() failed");
/* Gather datatype statistics */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_type() failed");
type_found = FALSE;
- for(u = 0; u < iter->dset_ntypes; u++)
- if(H5Tequal(iter->dset_type_info[u].tid, tid) > 0) {
+ for (u = 0; u < iter->dset_ntypes; u++)
+ if (H5Tequal(iter->dset_type_info[u].tid, tid) > 0) {
type_found = TRUE;
break;
} /* end for */
- if(type_found)
- (iter->dset_type_info[u].count)++;
+ if (type_found)
+ (iter->dset_type_info[u].count)++;
else {
unsigned curr_ntype = (unsigned)iter->dset_ntypes;
@@ -641,11 +553,12 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->dset_ntypes++;
/* Allocate more storage for info about dataset's datatype */
- if((iter->dset_type_info = (dtype_info_t *)HDrealloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t))) == NULL)
+ if ((iter->dset_type_info = (dtype_info_t *)HDrealloc(
+ iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t))) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed");
/* Initialize information about datatype */
- if((iter->dset_type_info[curr_ntype].tid = H5Tcopy(tid)) < 0)
+ if ((iter->dset_type_info[curr_ntype].tid = H5Tcopy(tid)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Tcopy() failed");
iter->dset_type_info[curr_ntype].count = 1;
iter->dset_type_info[curr_ntype].named = 0;
@@ -655,37 +568,36 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
} /* end else */
/* Check if the datatype is a named datatype */
- if(H5Tcommitted(tid) > 0)
+ if (H5Tcommitted(tid) > 0)
(iter->dset_type_info[u].named)++;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose() failed");
/* Track different filters */
- if((nfltr = H5Pget_nfilters(dcpl)) >= 0) {
- if(nfltr == 0)
- iter->dset_comptype[0]++;
- for(u = 0; u < (unsigned)nfltr; u++) {
+ if ((nfltr = H5Pget_nfilters(dcpl)) >= 0) {
+ if (nfltr == 0)
+ iter->dset_comptype[0]++;
+ for (u = 0; u < (unsigned)nfltr; u++) {
fltr = H5Pget_filter2(dcpl, u, 0, 0, 0, 0, 0, NULL);
- if(fltr >= 0) {
- if(fltr < (H5_NFILTERS_IMPL - 1))
+ if (fltr >= 0) {
+ if (fltr < (H5_NFILTERS_IMPL - 1))
iter->dset_comptype[fltr]++;
else
iter->dset_comptype[H5_NFILTERS_IMPL - 1]++; /*other filters*/
- } /* end if */
- } /* end for */
- } /* endif nfltr */
+ } /* end if */
+ } /* end for */
+ } /* endif nfltr */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose() failed");
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose() failed");
done:
- return ret_value;
-} /* end dataset_stats() */
-
+ return ret_value;
+} /* end dataset_stats() */
/*-------------------------------------------------------------------------
* Function: datatype_stats
@@ -712,12 +624,11 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi)
iter->dtype_ohdr_info.free_size += oi->hdr.space.free;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if ((ret_value = attribute_stats(iter, oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
done:
- return ret_value;
-} /* end datatype_stats() */
-
+ return ret_value;
+} /* end datatype_stats() */
/*-------------------------------------------------------------------------
* Function: obj_stats
@@ -733,31 +644,30 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
- void *_iter)
+obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited, void *_iter)
{
- iter_t *iter = (iter_t *)_iter;
- herr_t ret_value = SUCCEED;
+ iter_t *iter = (iter_t *)_iter;
+ herr_t ret_value = SUCCEED;
/* If the object has already been seen then just return */
- if(NULL == already_visited) {
+ if (NULL == already_visited) {
/* Gather some general statistics about the object */
- if(oi->rc > iter->max_links)
+ if (oi->rc > iter->max_links)
iter->max_links = oi->rc;
- switch(oi->type) {
+ switch (oi->type) {
case H5O_TYPE_GROUP:
- if(group_stats(iter, path, oi) < 0)
+ if (group_stats(iter, path, oi) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "group_stats failed");
break;
case H5O_TYPE_DATASET:
- if(dataset_stats(iter, path, oi) < 0)
+ if (dataset_stats(iter, path, oi) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "dataset_stats failed");
break;
case H5O_TYPE_NAMED_DATATYPE:
- if(datatype_stats(iter, oi) < 0)
+ if (datatype_stats(iter, oi) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "datatype_stats failed");
break;
@@ -768,13 +678,12 @@ obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
iter->uniq_others++;
break;
} /* end switch */
- } /* end if */
+ } /* end if */
done:
return ret_value;
} /* end obj_stats() */
-
/*-------------------------------------------------------------------------
* Function: lnk_stats
*
@@ -793,7 +702,7 @@ lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info_t *li, void *_iter)
{
iter_t *iter = (iter_t *)_iter;
- switch(li->type) {
+ switch (li->type) {
case H5L_TYPE_SOFT:
case H5L_TYPE_EXTERNAL:
/* Gather statistics about links and UD links */
@@ -827,35 +736,35 @@ lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info_t *li, void *_iter)
static herr_t
freespace_stats(hid_t fid, iter_t *iter)
{
- H5F_sect_info_t *sect_info = NULL; /* Free space sections */
- ssize_t nsects; /* Number of free space sections */
- size_t u; /* Local index variable */
+ H5F_sect_info_t *sect_info = NULL; /* Free space sections */
+ ssize_t nsects; /* Number of free space sections */
+ size_t u; /* Local index variable */
/* Query section information */
- if((nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, 0, NULL)) < 0)
- return(FAIL);
- else if(nsects) {
- if(NULL == (sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t))))
- return(FAIL);
+ if ((nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, 0, NULL)) < 0)
+ return (FAIL);
+ else if (nsects) {
+ if (NULL == (sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t))))
+ return (FAIL);
nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info);
HDassert(nsects);
} /* end else-if */
- for(u = 0; u < (size_t)nsects; u++) {
- unsigned bin; /* "bin" the number of objects falls in */
+ for (u = 0; u < (size_t)nsects; u++) {
+ unsigned bin; /* "bin" the number of objects falls in */
- if(sect_info[u].size < SIZE_SMALL_SECTS)
+ if (sect_info[u].size < SIZE_SMALL_SECTS)
(iter->num_small_sects[(size_t)sect_info[u].size])++;
/* Add section size to proper bin */
bin = ceil_log10((unsigned long)sect_info[u].size);
- if(bin >= iter->sect_nbins) {
+ if (bin >= iter->sect_nbins) {
/* Allocate more storage for section info */
iter->sect_bins = (unsigned long *)HDrealloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long));
HDassert(iter->sect_bins);
/* Initialize counts for intermediate bins */
- while(iter->sect_nbins < bin)
+ while (iter->sect_nbins < bin)
iter->sect_bins[iter->sect_nbins++] = 0;
iter->sect_nbins++;
@@ -866,13 +775,12 @@ freespace_stats(hid_t fid, iter_t *iter)
(iter->sect_bins[bin])++;
} /* end for */
- if(sect_info)
+ if (sect_info)
HDfree(sect_info);
return 0;
} /* end freespace_stats() */
-
/*-------------------------------------------------------------------------
* Function: hand_free
*
@@ -887,11 +795,11 @@ freespace_stats(hid_t fid, iter_t *iter)
static void
hand_free(struct handler_t *hand)
{
- if(hand) {
+ if (hand) {
unsigned u;
- for(u = 0; u < hand->obj_count; u++)
- if(hand->obj[u]) {
+ for (u = 0; u < hand->obj_count; u++)
+ if (hand->obj[u]) {
HDfree(hand->obj[u]);
hand->obj[u] = NULL;
} /* end if */
@@ -901,7 +809,6 @@ hand_free(struct handler_t *hand)
} /* end if */
} /* end hand_free() */
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -919,13 +826,13 @@ hand_free(struct handler_t *hand)
static int
parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
{
- int opt;
- unsigned u;
- struct handler_t *hand = NULL;
+ int opt;
+ unsigned u;
+ struct handler_t *hand = NULL;
/* parse command line options */
- while((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char)opt) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
case 'h':
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
@@ -943,29 +850,29 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
break;
case 'F':
- display_all = FALSE;
+ display_all = FALSE;
display_file_metadata = TRUE;
break;
case 'f':
- display_all = FALSE;
+ display_all = FALSE;
display_file = TRUE;
break;
case 'G':
- display_all = FALSE;
+ display_all = FALSE;
display_group_metadata = TRUE;
break;
case 'g':
- display_all = FALSE;
+ display_all = FALSE;
display_group = TRUE;
break;
case 'l':
- if(opt_arg) {
- sgroups_threshold = HDatoi(opt_arg);
- if(sgroups_threshold < 1) {
+ if (H5_optarg) {
+ sgroups_threshold = HDatoi(H5_optarg);
+ if (sgroups_threshold < 1) {
error_msg("Invalid threshold for small groups\n");
goto error;
}
@@ -976,19 +883,19 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
break;
case 'D':
- display_all = FALSE;
+ display_all = FALSE;
display_dset_metadata = TRUE;
break;
case 'd':
- display_all = FALSE;
+ display_all = FALSE;
display_dset = TRUE;
break;
case 'm':
- if(opt_arg) {
- sdsets_threshold = HDatoi(opt_arg);
- if(sdsets_threshold < 1) {
+ if (H5_optarg) {
+ sdsets_threshold = HDatoi(H5_optarg);
+ if (sdsets_threshold < 1) {
error_msg("Invalid threshold for small datasets\n");
goto error;
}
@@ -999,19 +906,19 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
break;
case 'T':
- display_all = FALSE;
+ display_all = FALSE;
display_dset_dtype_meta = TRUE;
break;
case 'A':
- display_all = FALSE;
+ display_all = FALSE;
display_attr = TRUE;
break;
case 'a':
- if(opt_arg) {
- sattrs_threshold = HDatoi(opt_arg);
- if(sattrs_threshold < 1) {
+ if (H5_optarg) {
+ sattrs_threshold = HDatoi(H5_optarg);
+ if (sattrs_threshold < 1) {
error_msg("Invalid threshold for small # of attributes\n");
goto error;
}
@@ -1022,35 +929,35 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
break;
case 's':
- display_all = FALSE;
+ display_all = FALSE;
display_free_sections = TRUE;
break;
case 'S':
- display_all = FALSE;
+ display_all = FALSE;
display_summary = TRUE;
break;
case 'O':
- display_all = FALSE;
+ display_all = FALSE;
display_object = TRUE;
/* Allocate space to hold the command line info */
- if(NULL == (hand = (struct handler_t *)HDcalloc((size_t)1, sizeof(struct handler_t)))) {
+ if (NULL == (hand = (struct handler_t *)HDcalloc((size_t)1, sizeof(struct handler_t)))) {
error_msg("unable to allocate memory for object struct\n");
goto error;
} /* end if */
/* Allocate space to hold the object strings */
hand->obj_count = (size_t)argc;
- if(NULL == (hand->obj = (char **)HDcalloc((size_t)argc, sizeof(char *)))) {
+ if (NULL == (hand->obj = (char **)HDcalloc((size_t)argc, sizeof(char *)))) {
error_msg("unable to allocate memory for object array\n");
goto error;
} /* end if */
/* Store object names */
- for(u = 0; u < hand->obj_count; u++)
- if(NULL == (hand->obj[u] = HDstrdup(opt_arg))) {
+ for (u = 0; u < hand->obj_count; u++)
+ if (NULL == (hand->obj[u] = HDstrdup(H5_optarg))) {
error_msg("unable to allocate memory for object name\n");
goto error;
} /* end if */
@@ -1058,7 +965,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
case 'w':
#ifdef H5_HAVE_ROS3_VFD
- if (h5tools_parse_ros3_fapl_tuple(opt_arg, ',', &ros3_fa) < 0) {
+ if (h5tools_parse_ros3_fapl_tuple(H5_optarg, ',', &ros3_fa) < 0) {
error_msg("failed to parse S3 VFD credential info\n");
goto error;
}
@@ -1072,7 +979,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
case 'H':
#ifdef H5_HAVE_LIBHDFS
- if (h5tools_parse_hdfs_fapl_tuple(opt_arg, ',', &hdfs_fa) < 0) {
+ if (h5tools_parse_hdfs_fapl_tuple(H5_optarg, ',', &hdfs_fa) < 0) {
error_msg("failed to parse HDFS VFD configuration info\n");
goto error;
}
@@ -1088,10 +995,10 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
usage(h5tools_getprogname());
goto error;
} /* end switch */
- } /* end while */
+ } /* end while */
/* check for file name to be processed */
- if(argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
goto error;
@@ -1110,7 +1017,6 @@ error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: iter_free
*
@@ -1127,55 +1033,54 @@ iter_free(iter_t *iter)
{
/* Clear array of bins for group counts */
- if(iter->group_bins) {
+ if (iter->group_bins) {
HDfree(iter->group_bins);
iter->group_bins = NULL;
} /* end if */
/* Clear array for tracking small groups */
- if(iter->num_small_groups) {
+ if (iter->num_small_groups) {
HDfree(iter->num_small_groups);
iter->num_small_groups = NULL;
} /* end if */
/* Clear array of bins for attribute counts */
- if(iter->attr_bins) {
+ if (iter->attr_bins) {
HDfree(iter->attr_bins);
iter->attr_bins = NULL;
} /* end if */
/* Clear array for tracking small attributes */
- if(iter->num_small_attrs) {
+ if (iter->num_small_attrs) {
HDfree(iter->num_small_attrs);
- iter->num_small_attrs= NULL;
+ iter->num_small_attrs = NULL;
} /* end if */
/* Clear dataset datatype information found */
- if(iter->dset_type_info) {
+ if (iter->dset_type_info) {
HDfree(iter->dset_type_info);
iter->dset_type_info = NULL;
} /* end if */
/* Clear array of bins for dataset dimensions */
- if(iter->dset_dim_bins) {
+ if (iter->dset_dim_bins) {
HDfree(iter->dset_dim_bins);
iter->dset_dim_bins = NULL;
} /* end if */
/* Clear array of tracking 1-D small datasets */
- if(iter->small_dset_dims) {
+ if (iter->small_dset_dims) {
HDfree(iter->small_dset_dims);
iter->small_dset_dims = NULL;
} /* end if */
/* Clear array of bins for free-space section sizes */
- if(iter->sect_bins) {
+ if (iter->sect_bins) {
HDfree(iter->sect_bins);
iter->sect_bins = NULL;
} /* end if */
} /* end iter_free() */
-
/*-------------------------------------------------------------------------
* Function: print_file_info
*
@@ -1202,12 +1107,11 @@ print_file_info(const iter_t *iter)
HDprintf("\t# of unique links: %lu\n", iter->uniq_links);
HDprintf("\t# of unique other: %lu\n", iter->uniq_others);
HDprintf("\tMax. # of links to object: %lu\n", iter->max_links);
- HDfprintf(stdout, "\tMax. # of objects in group: %Hu\n", iter->max_fanout);
+ HDfprintf(stdout, "\tMax. # of objects in group: %" PRIuHSIZE "\n", iter->max_fanout);
return 0;
} /* print_file_info() */
-
/*-------------------------------------------------------------------------
* Function: print_file_metadata
*
@@ -1226,45 +1130,44 @@ static herr_t
print_file_metadata(const iter_t *iter)
{
HDfprintf(stdout, "File space information for file metadata (in bytes):\n");
- HDfprintf(stdout, "\tSuperblock: %Hu\n", iter->super_size);
- HDfprintf(stdout, "\tSuperblock extension: %Hu\n", iter->super_ext_size);
- HDfprintf(stdout, "\tUser block: %Hu\n", iter->ublk_size);
+ HDfprintf(stdout, "\tSuperblock: %" PRIuHSIZE "\n", iter->super_size);
+ HDfprintf(stdout, "\tSuperblock extension: %" PRIuHSIZE "\n", iter->super_ext_size);
+ HDfprintf(stdout, "\tUser block: %" PRIuHSIZE "\n", iter->ublk_size);
HDfprintf(stdout, "\tObject headers: (total/unused)\n");
- HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size,
- iter->group_ohdr_info.free_size);
- HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n",
- iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size);
- HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n", iter->dtype_ohdr_info.total_size,
- iter->dtype_ohdr_info.free_size);
+ HDfprintf(stdout, "\t\tGroups: %" PRIuHSIZE "/%" PRIuHSIZE "\n", iter->group_ohdr_info.total_size,
+ iter->group_ohdr_info.free_size);
+ HDfprintf(stdout, "\t\tDatasets(exclude compact data): %" PRIuHSIZE "/%" PRIuHSIZE "\n",
+ iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size);
+ HDfprintf(stdout, "\t\tDatatypes: %" PRIuHSIZE "/%" PRIuHSIZE "\n", iter->dtype_ohdr_info.total_size,
+ iter->dtype_ohdr_info.free_size);
HDfprintf(stdout, "\tGroups:\n");
- HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
- HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->groups_heap_storage_size);
+ HDfprintf(stdout, "\t\tB-tree/List: %" PRIuHSIZE "\n", iter->groups_btree_storage_size);
+ HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->groups_heap_storage_size);
HDfprintf(stdout, "\tAttributes:\n");
- HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->attrs_btree_storage_size);
- HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->attrs_heap_storage_size);
+ HDfprintf(stdout, "\t\tB-tree/List: %" PRIuHSIZE "\n", iter->attrs_btree_storage_size);
+ HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->attrs_heap_storage_size);
HDfprintf(stdout, "\tChunked datasets:\n");
- HDfprintf(stdout, "\t\tIndex: %Hu\n", iter->datasets_index_storage_size);
+ HDfprintf(stdout, "\t\tIndex: %" PRIuHSIZE "\n", iter->datasets_index_storage_size);
HDfprintf(stdout, "\tDatasets:\n");
- HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->datasets_heap_storage_size);
+ HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->datasets_heap_storage_size);
HDfprintf(stdout, "\tShared Messages:\n");
- HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->SM_hdr_storage_size);
- HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->SM_index_storage_size);
- HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->SM_heap_storage_size);
+ HDfprintf(stdout, "\t\tHeader: %" PRIuHSIZE "\n", iter->SM_hdr_storage_size);
+ HDfprintf(stdout, "\t\tB-tree/List: %" PRIuHSIZE "\n", iter->SM_index_storage_size);
+ HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->SM_heap_storage_size);
HDfprintf(stdout, "\tFree-space managers:\n");
- HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->free_hdr);
- HDfprintf(stdout, "\t\tAmount of free space: %Hu\n", iter->free_space);
+ HDfprintf(stdout, "\t\tHeader: %" PRIuHSIZE "\n", iter->free_hdr);
+ HDfprintf(stdout, "\t\tAmount of free space: %" PRIuHSIZE "\n", iter->free_space);
return 0;
} /* print_file_metadata() */
-
/*-------------------------------------------------------------------------
* Function: print_group_info
*
@@ -1287,32 +1190,32 @@ print_file_metadata(const iter_t *iter)
static herr_t
print_group_info(const iter_t *iter)
{
- unsigned long power; /* Temporary "power" for bins */
- unsigned long total; /* Total count for various statistics */
- unsigned u; /* Local index variable */
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
- HDprintf("Small groups (with 0 to %u links):\n", sgroups_threshold-1);
+ HDprintf("Small groups (with 0 to %u links):\n", sgroups_threshold - 1);
total = 0;
- for(u = 0; u < (unsigned)sgroups_threshold; u++) {
- if(iter->num_small_groups[u] > 0) {
+ for (u = 0; u < (unsigned)sgroups_threshold; u++) {
+ if (iter->num_small_groups[u] > 0) {
HDprintf("\t# of groups with %u link(s): %lu\n", u, iter->num_small_groups[u]);
total += iter->num_small_groups[u];
} /* end if */
- } /* end for */
+ } /* end for */
HDprintf("\tTotal # of small groups: %lu\n", total);
HDprintf("Group bins:\n");
total = 0;
- if((iter->group_nbins > 0) && (iter->group_bins[0] > 0)) {
- HDprintf("\t# of groups with 0 link: %lu\n", iter->group_bins[0]);
- total = iter->group_bins[0];
+ if ((iter->group_nbins > 0) && (iter->group_bins[0] > 0)) {
+ HDprintf("\t# of groups with 0 link: %lu\n", iter->group_bins[0]);
+ total = iter->group_bins[0];
} /* end if */
power = 1;
- for(u = 1; u < iter->group_nbins; u++) {
- if(iter->group_bins[u] > 0) {
- HDprintf("\t# of groups with %lu - %lu links: %lu\n", power, (power * 10) - 1,
- iter->group_bins[u]);
- total += iter->group_bins[u];
+ for (u = 1; u < iter->group_nbins; u++) {
+ if (iter->group_bins[u] > 0) {
+ HDprintf("\t# of groups with %lu - %lu links: %lu\n", power, (power * 10) - 1,
+ iter->group_bins[u]);
+ total += iter->group_bins[u];
} /* end if */
power *= 10;
} /* end for */
@@ -1321,7 +1224,6 @@ print_group_info(const iter_t *iter)
return 0;
} /* print_group_info() */
-
/*-------------------------------------------------------------------------
* Function: print_group_metadata
*
@@ -1339,16 +1241,15 @@ print_group_metadata(const iter_t *iter)
{
HDprintf("File space information for groups' metadata (in bytes):\n");
- HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n",
- iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size);
+ HDfprintf(stdout, "\tObject headers (total/unused): %" PRIuHSIZE "/%" PRIuHSIZE "\n",
+ iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size);
- HDfprintf(stdout, "\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
- HDfprintf(stdout, "\tHeap: %Hu\n", iter->groups_heap_storage_size);
+ HDfprintf(stdout, "\tB-tree/List: %" PRIuHSIZE "\n", iter->groups_btree_storage_size);
+ HDfprintf(stdout, "\tHeap: %" PRIuHSIZE "\n", iter->groups_heap_storage_size);
return 0;
} /* print_group_metadata() */
-
/*-------------------------------------------------------------------------
* Function: print_dataset_info
*
@@ -1365,44 +1266,43 @@ print_group_metadata(const iter_t *iter)
static herr_t
print_dataset_info(const iter_t *iter)
{
- unsigned long power; /* Temporary "power" for bins */
- unsigned long total; /* Total count for various statistics */
- unsigned u; /* Local index variable */
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
- if(iter->uniq_dsets > 0) {
+ if (iter->uniq_dsets > 0) {
HDprintf("Dataset dimension information:\n");
HDprintf("\tMax. rank of datasets: %u\n", iter->max_dset_rank);
HDprintf("\tDataset ranks:\n");
- for(u = 0; u < H5S_MAX_RANK; u++)
- if(iter->dset_rank_count[u] > 0)
+ for (u = 0; u < H5S_MAX_RANK; u++)
+ if (iter->dset_rank_count[u] > 0)
HDprintf("\t\t# of dataset with rank %u: %lu\n", u, iter->dset_rank_count[u]);
HDprintf("1-D Dataset information:\n");
- HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %Hu\n", iter->max_dset_dims);
+ HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %" PRIuHSIZE "\n", iter->max_dset_dims);
HDprintf("\tSmall 1-D datasets (with dimension sizes 0 to %u):\n", sdsets_threshold - 1);
total = 0;
- for(u = 0; u < (unsigned)sdsets_threshold; u++) {
- if(iter->small_dset_dims[u] > 0) {
- HDprintf("\t\t# of datasets with dimension sizes %u: %lu\n", u,
- iter->small_dset_dims[u]);
+ for (u = 0; u < (unsigned)sdsets_threshold; u++) {
+ if (iter->small_dset_dims[u] > 0) {
+ HDprintf("\t\t# of datasets with dimension sizes %u: %lu\n", u, iter->small_dset_dims[u]);
total += iter->small_dset_dims[u];
} /* end if */
- } /* end for */
+ } /* end for */
HDprintf("\t\tTotal # of small datasets: %lu\n", total);
/* Protect against no datasets in file */
- if(iter->dset_dim_nbins > 0) {
+ if (iter->dset_dim_nbins > 0) {
HDprintf("\t1-D Dataset dimension bins:\n");
total = 0;
- if(iter->dset_dim_bins[0] > 0) {
+ if (iter->dset_dim_bins[0] > 0) {
HDprintf("\t\t# of datasets with dimension size 0: %lu\n", iter->dset_dim_bins[0]);
total = iter->dset_dim_bins[0];
} /* end if */
power = 1;
- for(u = 1; u < iter->dset_dim_nbins; u++) {
- if(iter->dset_dim_bins[u] > 0) {
- HDprintf("\t\t# of datasets with dimension size %lu - %lu: %lu\n", power, (power * 10) - 1,
- iter->dset_dim_bins[u]);
+ for (u = 1; u < iter->dset_dim_nbins; u++) {
+ if (iter->dset_dim_bins[u] > 0) {
+ HDprintf("\t\t# of datasets with dimension size %lu - %lu: %lu\n", power,
+ (power * 10) - 1, iter->dset_dim_bins[u]);
total += iter->dset_dim_bins[u];
} /* end if */
power *= 10;
@@ -1411,31 +1311,34 @@ print_dataset_info(const iter_t *iter)
} /* end if */
HDprintf("Dataset storage information:\n");
- HDfprintf(stdout, "\tTotal raw data size: %Hu\n", iter->dset_storage_size);
- HDfprintf(stdout, "\tTotal external raw data size: %Hu\n", iter->dset_external_storage_size);
+ HDfprintf(stdout, "\tTotal raw data size: %" PRIuHSIZE "\n", iter->dset_storage_size);
+ HDfprintf(stdout, "\tTotal external raw data size: %" PRIuHSIZE "\n",
+ iter->dset_external_storage_size);
HDprintf("Dataset layout information:\n");
- for(u = 0; u < H5D_NLAYOUTS; u++)
- HDprintf("\tDataset layout counts[%s]: %lu\n", (u == H5D_COMPACT ? "COMPACT" :
- (u == H5D_CONTIGUOUS ? "CONTIG" : (u == H5D_CHUNKED ? "CHUNKED" : "VIRTUAL"))), iter->dset_layouts[u]);
+ for (u = 0; u < H5D_NLAYOUTS; u++)
+ HDprintf("\tDataset layout counts[%s]: %lu\n",
+ (u == H5D_COMPACT
+ ? "COMPACT"
+ : (u == H5D_CONTIGUOUS ? "CONTIG" : (u == H5D_CHUNKED ? "CHUNKED" : "VIRTUAL"))),
+ iter->dset_layouts[u]);
HDprintf("\tNumber of external files : %lu\n", iter->nexternal);
HDprintf("Dataset filters information:\n");
HDprintf("\tNumber of datasets with:\n");
- HDprintf("\t\tNO filter: %lu\n", iter->dset_comptype[H5Z_FILTER_ERROR+1]);
+ HDprintf("\t\tNO filter: %lu\n", iter->dset_comptype[H5Z_FILTER_ERROR + 1]);
HDprintf("\t\tGZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_DEFLATE]);
HDprintf("\t\tSHUFFLE filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SHUFFLE]);
HDprintf("\t\tFLETCHER32 filter: %lu\n", iter->dset_comptype[H5Z_FILTER_FLETCHER32]);
HDprintf("\t\tSZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SZIP]);
HDprintf("\t\tNBIT filter: %lu\n", iter->dset_comptype[H5Z_FILTER_NBIT]);
HDprintf("\t\tSCALEOFFSET filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SCALEOFFSET]);
- HDprintf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL-1]);
+ HDprintf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL - 1]);
} /* end if */
return 0;
} /* print_dataset_info() */
-
/*-------------------------------------------------------------------------
* Function: print_dataset_metadata
*
@@ -1454,17 +1357,15 @@ print_dset_metadata(const iter_t *iter)
{
HDprintf("File space information for datasets' metadata (in bytes):\n");
- HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n",
- iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size);
+ HDfprintf(stdout, "\tObject headers (total/unused): %" PRIuHSIZE "/%" PRIuHSIZE "\n",
+ iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size);
- HDfprintf(stdout, "\tIndex for Chunked datasets: %Hu\n",
- iter->datasets_index_storage_size);
- HDfprintf(stdout, "\tHeap: %Hu\n", iter->datasets_heap_storage_size);
+ HDfprintf(stdout, "\tIndex for Chunked datasets: %" PRIuHSIZE "\n", iter->datasets_index_storage_size);
+ HDfprintf(stdout, "\tHeap: %" PRIuHSIZE "\n", iter->datasets_heap_storage_size);
return 0;
} /* print_dset_metadata() */
-
/*-------------------------------------------------------------------------
* Function: print_dset_dtype_meta
*
@@ -1481,21 +1382,21 @@ print_dset_metadata(const iter_t *iter)
static herr_t
print_dset_dtype_meta(const iter_t *iter)
{
- unsigned long total; /* Total count for various statistics */
- size_t dtype_size; /* Size of encoded datatype */
- unsigned u; /* Local index variable */
+ unsigned long total; /* Total count for various statistics */
+ size_t dtype_size; /* Size of encoded datatype */
+ unsigned u; /* Local index variable */
- if(iter->dset_ntypes) {
+ if (iter->dset_ntypes) {
HDprintf("Dataset datatype information:\n");
HDprintf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes);
total = 0;
- for(u = 0; u < iter->dset_ntypes; u++) {
+ for (u = 0; u < iter->dset_ntypes; u++) {
H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size);
HDprintf("\tDataset datatype #%u:\n", u);
- HDprintf("\t\tCount (total/named) = (%lu/%lu)\n",
- iter->dset_type_info[u].count, iter->dset_type_info[u].named);
+ HDprintf("\t\tCount (total/named) = (%lu/%lu)\n", iter->dset_type_info[u].count,
+ iter->dset_type_info[u].named);
HDprintf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size,
- (unsigned long)H5Tget_size(iter->dset_type_info[u].tid));
+ (unsigned long)H5Tget_size(iter->dset_type_info[u].tid));
H5Tclose(iter->dset_type_info[u].tid);
total += iter->dset_type_info[u].count;
} /* end for */
@@ -1505,7 +1406,6 @@ print_dset_dtype_meta(const iter_t *iter)
return 0;
} /* print_dset_dtype_meta() */
-
/*-------------------------------------------------------------------------
* Function: print_attr_info
*
@@ -1523,28 +1423,28 @@ print_dset_dtype_meta(const iter_t *iter)
static herr_t
print_attr_info(const iter_t *iter)
{
- unsigned long power; /* Temporary "power" for bins */
- unsigned long total; /* Total count for various statistics */
- unsigned u; /* Local index variable */
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
HDprintf("Small # of attributes (objects with 1 to %u attributes):\n", sattrs_threshold);
total = 0;
- for(u = 1; u <= (unsigned)sattrs_threshold; u++) {
- if(iter->num_small_attrs[u] > 0) {
+ for (u = 1; u <= (unsigned)sattrs_threshold; u++) {
+ if (iter->num_small_attrs[u] > 0) {
HDprintf("\t# of objects with %u attributes: %lu\n", u, iter->num_small_attrs[u]);
total += iter->num_small_attrs[u];
} /* end if */
- } /* end for */
+ } /* end for */
HDprintf("\tTotal # of objects with small # of attributes: %lu\n", total);
HDprintf("Attribute bins:\n");
total = 0;
power = 1;
- for(u = 1; u < iter->attr_nbins; u++) {
- if(iter->attr_bins[u] > 0) {
- HDprintf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1,
- iter->attr_bins[u]);
- total += iter->attr_bins[u];
+ for (u = 1; u < iter->attr_nbins; u++) {
+ if (iter->attr_bins[u] > 0) {
+ HDprintf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1,
+ iter->attr_bins[u]);
+ total += iter->attr_bins[u];
} /* end if */
power *= 10;
} /* end for */
@@ -1554,7 +1454,6 @@ print_attr_info(const iter_t *iter)
return 0;
} /* print_attr_info() */
-
/*-------------------------------------------------------------------------
* Function: print_freespace_info
*
@@ -1571,31 +1470,30 @@ print_attr_info(const iter_t *iter)
static herr_t
print_freespace_info(const iter_t *iter)
{
- unsigned long power; /* Temporary "power" for bins */
- unsigned long total; /* Total count for various statistics */
- unsigned u; /* Local index variable */
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
HDfprintf(stdout, "Free-space persist: %s\n", iter->fs_persist ? "TRUE" : "FALSE");
- HDfprintf(stdout, "Free-space section threshold: %Hu bytes\n", iter->fs_threshold);
+ HDfprintf(stdout, "Free-space section threshold: %" PRIuHSIZE " bytes\n", iter->fs_threshold);
HDprintf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS);
total = 0;
- for(u = 0; u < SIZE_SMALL_SECTS; u++) {
- if(iter->num_small_sects[u] > 0) {
+ for (u = 0; u < SIZE_SMALL_SECTS; u++) {
+ if (iter->num_small_sects[u] > 0) {
HDprintf("\t# of sections of size %u: %lu\n", u, iter->num_small_sects[u]);
total += iter->num_small_sects[u];
} /* end if */
- } /* end for */
+ } /* end for */
HDprintf("\tTotal # of small size sections: %lu\n", total);
HDprintf("Free-space section bins:\n");
total = 0;
power = 1;
- for(u = 1; u < iter->sect_nbins; u++) {
- if(iter->sect_bins[u] > 0) {
- HDprintf("\t# of sections of size %lu - %lu: %lu\n", power, (power * 10) - 1,
- iter->sect_bins[u]);
- total += iter->sect_bins[u];
+ for (u = 1; u < iter->sect_nbins; u++) {
+ if (iter->sect_bins[u] > 0) {
+ HDprintf("\t# of sections of size %lu - %lu: %lu\n", power, (power * 10) - 1, iter->sect_bins[u]);
+ total += iter->sect_bins[u];
} /* end if */
power *= 10;
} /* end for */
@@ -1604,7 +1502,6 @@ print_freespace_info(const iter_t *iter)
return 0;
} /* print_freespace_info() */
-
/*-------------------------------------------------------------------------
* Function: print_storage_summary
*
@@ -1622,53 +1519,45 @@ static herr_t
print_storage_summary(const iter_t *iter)
{
hsize_t total_meta = 0;
- hsize_t unaccount = 0;
- double percent = 0.0f;
+ hsize_t unaccount = 0;
+ double percent = 0.0;
HDfprintf(stdout, "File space management strategy: %s\n", FS_STRATEGY_NAME[iter->fs_strategy]);
- HDfprintf(stdout, "File space page size: %Hu bytes\n", iter->fsp_size);
+ HDfprintf(stdout, "File space page size: %" PRIuHSIZE " bytes\n", iter->fsp_size);
HDprintf("Summary of file space information:\n");
total_meta =
- iter->super_size + iter->super_ext_size + iter->ublk_size +
- iter->group_ohdr_info.total_size +
- iter->dset_ohdr_info.total_size +
- iter->dtype_ohdr_info.total_size +
- iter->groups_btree_storage_size +
- iter->groups_heap_storage_size +
- iter->attrs_btree_storage_size +
- iter->attrs_heap_storage_size +
- iter->datasets_index_storage_size +
- iter->datasets_heap_storage_size +
- iter->SM_hdr_storage_size +
- iter->SM_index_storage_size +
- iter->SM_heap_storage_size +
- iter->free_hdr;
-
- HDfprintf(stdout, " File metadata: %Hu bytes\n", total_meta);
- HDfprintf(stdout, " Raw data: %Hu bytes\n", iter->dset_storage_size);
-
- percent = ((double)iter->free_space / (double)iter->filesize) * (double)100.0f;
- HDfprintf(stdout, " Amount/Percent of tracked free space: %Hu bytes/%3.1f%\n",
- iter->free_space, percent);
-
- if(iter->filesize < (total_meta + iter->dset_storage_size + iter->free_space)) {
+ iter->super_size + iter->super_ext_size + iter->ublk_size + iter->group_ohdr_info.total_size +
+ iter->dset_ohdr_info.total_size + iter->dtype_ohdr_info.total_size + iter->groups_btree_storage_size +
+ iter->groups_heap_storage_size + iter->attrs_btree_storage_size + iter->attrs_heap_storage_size +
+ iter->datasets_index_storage_size + iter->datasets_heap_storage_size + iter->SM_hdr_storage_size +
+ iter->SM_index_storage_size + iter->SM_heap_storage_size + iter->free_hdr;
+
+ HDfprintf(stdout, " File metadata: %" PRIuHSIZE " bytes\n", total_meta);
+ HDfprintf(stdout, " Raw data: %" PRIuHSIZE " bytes\n", iter->dset_storage_size);
+
+ percent = ((double)iter->free_space / (double)iter->filesize) * 100.0;
+ HDfprintf(stdout, " Amount/Percent of tracked free space: %" PRIuHSIZE " bytes/%3.1f%%\n",
+ iter->free_space, percent);
+
+ if (iter->filesize < (total_meta + iter->dset_storage_size + iter->free_space)) {
unaccount = (total_meta + iter->dset_storage_size + iter->free_space) - iter->filesize;
- HDfprintf(stdout, " ??? File has %Hu more bytes accounted for than its size! ???\n", unaccount);
+ HDfprintf(stdout, " ??? File has %" PRIuHSIZE " more bytes accounted for than its size! ???\n",
+ unaccount);
}
else {
unaccount = iter->filesize - (total_meta + iter->dset_storage_size + iter->free_space);
- HDfprintf(stdout, " Unaccounted space: %Hu bytes\n", unaccount);
+ HDfprintf(stdout, " Unaccounted space: %" PRIuHSIZE " bytes\n", unaccount);
}
- HDfprintf(stdout, "Total space: %Hu bytes\n", total_meta + iter->dset_storage_size + iter->free_space + unaccount);
+ HDfprintf(stdout, "Total space: %" PRIuHSIZE " bytes\n",
+ total_meta + iter->dset_storage_size + iter->free_space + unaccount);
- if(iter->nexternal)
- HDfprintf(stdout, "External raw data: %Hu bytes\n", iter->dset_external_storage_size);
+ if (iter->nexternal)
+ HDfprintf(stdout, "External raw data: %" PRIuHSIZE " bytes\n", iter->dset_external_storage_size);
return 0;
} /* print_storage_summary() */
-
/*-------------------------------------------------------------------------
* Function: print_file_statistics
*
@@ -1686,36 +1575,45 @@ print_storage_summary(const iter_t *iter)
static void
print_file_statistics(const iter_t *iter)
{
- if(display_all) {
- display_file = TRUE;
- display_group = TRUE;
- display_dset = TRUE;
+ if (display_all) {
+ display_file = TRUE;
+ display_group = TRUE;
+ display_dset = TRUE;
display_dset_dtype_meta = TRUE;
- display_attr = TRUE;
- display_free_sections = TRUE;
- display_summary = TRUE;
+ display_attr = TRUE;
+ display_free_sections = TRUE;
+ display_summary = TRUE;
- display_file_metadata = TRUE;
+ display_file_metadata = TRUE;
display_group_metadata = TRUE;
- display_dset_metadata = TRUE;
+ display_dset_metadata = TRUE;
}
- if(display_file) print_file_info(iter);
- if(display_file_metadata) print_file_metadata(iter);
-
- if(display_group) print_group_info(iter);
- if(!display_all && display_group_metadata) print_group_metadata(iter);
-
- if(display_dset) print_dataset_info(iter);
- if(display_dset_dtype_meta) print_dset_dtype_meta(iter);
- if(!display_all && display_dset_metadata) print_dset_metadata(iter);
-
- if(display_attr) print_attr_info(iter);
- if(display_free_sections) print_freespace_info(iter);
- if(display_summary) print_storage_summary(iter);
+ if (display_file)
+ print_file_info(iter);
+ if (display_file_metadata)
+ print_file_metadata(iter);
+
+ if (display_group)
+ print_group_info(iter);
+ if (!display_all && display_group_metadata)
+ print_group_metadata(iter);
+
+ if (display_dset)
+ print_dataset_info(iter);
+ if (display_dset_dtype_meta)
+ print_dset_dtype_meta(iter);
+ if (!display_all && display_dset_metadata)
+ print_dset_metadata(iter);
+
+ if (display_attr)
+ print_attr_info(iter);
+ if (display_free_sections)
+ print_freespace_info(iter);
+ if (display_summary)
+ print_storage_summary(iter);
} /* print_file_statistics() */
-
/*-------------------------------------------------------------------------
* Function: print_object_statistics
*
@@ -1738,7 +1636,6 @@ print_object_statistics(const char *name)
HDprintf("Object name %s\n", name);
} /* print_object_statistics() */
-
/*-------------------------------------------------------------------------
* Function: print_statistics
*
@@ -1758,13 +1655,12 @@ print_object_statistics(const char *name)
static void
print_statistics(const char *name, const iter_t *iter)
{
- if(display_object)
+ if (display_object)
print_object_statistics(name);
else
print_file_statistics(iter);
} /* print_statistics() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1777,11 +1673,11 @@ print_statistics(const char *name, const iter_t *iter)
int
main(int argc, const char *argv[])
{
- iter_t iter;
- const char *fname = NULL;
- hid_t fid = H5I_INVALID_HID;
- struct handler_t *hand = NULL;
- hid_t fapl_id = H5P_DEFAULT;
+ iter_t iter;
+ const char * fname = NULL;
+ hid_t fid = H5I_INVALID_HID;
+ struct handler_t *hand = NULL;
+ hid_t fapl_id = H5P_DEFAULT;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -1791,7 +1687,7 @@ main(int argc, const char *argv[])
HDmemset(&iter, 0, sizeof(iter));
- if(parse_command_line(argc, argv, &hand) < 0)
+ if (parse_command_line(argc, argv, &hand) < 0)
goto done;
/* enable error reporting if command line option */
@@ -1800,8 +1696,8 @@ main(int argc, const char *argv[])
if (drivername) {
h5tools_vfd_info_t vfd_info;
- vfd_info.info = NULL;
- vfd_info.name = drivername;
+ vfd_info.info = NULL;
+ vfd_info.name = drivername;
if (!HDstrcmp(drivername, drivernames[ROS3_VFD_IDX])) {
#ifdef H5_HAVE_ROS3_VFD
@@ -1826,19 +1722,18 @@ main(int argc, const char *argv[])
}
}
- fname = argv[opt_ind];
+ fname = argv[H5_optind];
/* Check for filename given */
- if(fname) {
- hid_t fcpl;
- H5F_info2_t finfo;
+ if (fname) {
+ hid_t fcpl;
+ H5F_info2_t finfo;
HDprintf("Filename: %s\n", fname);
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id,
- (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
- if(fid < 0) {
+ if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -1847,72 +1742,74 @@ main(int argc, const char *argv[])
/* Initialize iter structure */
iter.fid = fid;
- if(H5Fget_filesize(fid, &iter.filesize) < 0)
+ if (H5Fget_filesize(fid, &iter.filesize) < 0)
warn_msg("Unable to retrieve file size\n");
HDassert(iter.filesize != 0);
/* Get storge info for file-level structures */
- if(H5Fget_info2(fid, &finfo) < 0)
+ if (H5Fget_info2(fid, &finfo) < 0)
warn_msg("Unable to retrieve file info\n");
else {
- iter.super_size = finfo.super.super_size;
- iter.super_ext_size = finfo.super.super_ext_size;
- iter.SM_hdr_storage_size = finfo.sohm.hdr_size;
+ iter.super_size = finfo.super.super_size;
+ iter.super_ext_size = finfo.super.super_ext_size;
+ iter.SM_hdr_storage_size = finfo.sohm.hdr_size;
iter.SM_index_storage_size = finfo.sohm.msgs_info.index_size;
- iter.SM_heap_storage_size = finfo.sohm.msgs_info.heap_size;
- iter.free_space = finfo.free.tot_space;
- iter.free_hdr = finfo.free.meta_size;
+ iter.SM_heap_storage_size = finfo.sohm.msgs_info.heap_size;
+ iter.free_space = finfo.free.tot_space;
+ iter.free_hdr = finfo.free.meta_size;
} /* end else */
iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long));
- iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long));
+ iter.num_small_attrs =
+ (unsigned long *)HDcalloc((size_t)(sattrs_threshold + 1), sizeof(unsigned long));
iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long));
- if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
+ if (iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- if((fcpl = H5Fget_create_plist(fid)) < 0)
+ if ((fcpl = H5Fget_create_plist(fid)) < 0)
warn_msg("Unable to retrieve file creation property\n");
- if(H5Pget_userblock(fcpl, &iter.ublk_size) < 0)
+ if (H5Pget_userblock(fcpl, &iter.ublk_size) < 0)
warn_msg("Unable to retrieve userblock size\n");
- if(H5Pget_file_space_strategy(fcpl, &iter.fs_strategy, &iter.fs_persist, &iter.fs_threshold) < 0)
+ if (H5Pget_file_space_strategy(fcpl, &iter.fs_strategy, &iter.fs_persist, &iter.fs_threshold) < 0)
warn_msg("Unable to retrieve file space information\n");
HDassert(iter.fs_strategy >= 0 && iter.fs_strategy < H5F_FSPACE_STRATEGY_NTYPES);
- if(H5Pget_file_space_page_size(fcpl, &iter.fsp_size) < 0)
+ if (H5Pget_file_space_page_size(fcpl, &iter.fsp_size) < 0)
warn_msg("Unable to retrieve file space page size\n");
/* get information for free-space sections */
- if(freespace_stats(fid, &iter) < 0)
+ if (freespace_stats(fid, &iter) < 0)
warn_msg("Unable to retrieve freespace info\n");
/* Walk the objects or all file */
- if(display_object) {
+ if (display_object) {
unsigned u;
- for(u = 0; u < hand->obj_count; u++) {
- if(h5trav_visit(fid, hand->obj[u], TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) < 0) {
+ for (u = 0; u < hand->obj_count; u++) {
+ if (h5trav_visit(fid, hand->obj[u], TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) <
+ 0) {
error_msg("unable to traverse object \"%s\"\n", hand->obj[u]);
h5tools_setstatus(EXIT_FAILURE);
}
else
print_statistics(hand->obj[u], &iter);
} /* end for */
- } /* end if */
+ } /* end if */
else {
- if(h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) < 0) {
+ if (h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) < 0) {
error_msg("unable to traverse objects/links in file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
}
else
print_statistics("/", &iter);
} /* end else */
- } /* end if */
+ } /* end if */
done:
hand_free(hand);
@@ -1927,11 +1824,10 @@ done:
}
}
- if(fid >= 0 && H5Fclose(fid) < 0) {
+ if (fid >= 0 && H5Fclose(fid) < 0) {
error_msg("unable to close file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
leave(h5tools_getstatus());
} /* end main() */
-
diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt
index 1e9cacc..8b6b9bb 100644
--- a/tools/src/misc/CMakeLists.txt
+++ b/tools/src/misc/CMakeLists.txt
@@ -7,7 +7,7 @@ project (HDF5_TOOLS_SRC_MISC C)
#-- Misc Executables
if (NOT ONLY_SHARED_LIBS)
add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c)
- target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5debug PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5debug STATIC)
target_link_libraries (h5debug PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -15,7 +15,7 @@ if (NOT ONLY_SHARED_LIBS)
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug")
add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c)
- target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5repart PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5repart STATIC)
target_link_libraries (h5repart PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -23,7 +23,7 @@ if (NOT ONLY_SHARED_LIBS)
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart")
add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c)
- target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5mkgrp PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5mkgrp STATIC)
target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -31,7 +31,7 @@ if (NOT ONLY_SHARED_LIBS)
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp")
add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c)
- target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5clear PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5clear STATIC)
target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -42,12 +42,12 @@ if (NOT ONLY_SHARED_LIBS)
h5debug
h5repart
h5mkgrp
- h5clear
+ h5clear
)
endif ()
if (BUILD_SHARED_LIBS)
add_executable (h5debug-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c)
- target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5debug-shared SHARED)
target_compile_options(h5debug-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
target_link_libraries (h5debug-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
@@ -55,7 +55,7 @@ if (BUILD_SHARED_LIBS)
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug-shared")
add_executable (h5repart-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c)
- target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5repart-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5repart-shared SHARED)
target_link_libraries (h5repart-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
@@ -63,7 +63,7 @@ if (BUILD_SHARED_LIBS)
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart-shared")
add_executable (h5mkgrp-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c)
- target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5mkgrp-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5mkgrp-shared SHARED)
target_link_libraries (h5mkgrp-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
@@ -71,7 +71,7 @@ if (BUILD_SHARED_LIBS)
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp-shared")
add_executable (h5clear-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c)
- target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_options(h5clear-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}")
TARGET_C_PROPERTIES (h5clear-shared SHARED)
target_link_libraries (h5clear-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
@@ -86,6 +86,23 @@ if (BUILD_SHARED_LIBS)
)
endif ()
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_H5DEBUG_SRC_FORMAT h5debug)
+ clang_format (HDF5_H5REPART_SRC_FORMAT h5repart)
+ clang_format (HDF5_H5MKGRP_SRC_FORMAT h5mkgrp)
+ clang_format (HDF5_H5CLEAR_SRC_FORMAT h5clear)
+ else ()
+ clang_format (HDF5_H5DEBUG_SRC_FORMAT h5debug-shared)
+ clang_format (HDF5_H5REPART_SRC_FORMAT h5repart-shared)
+ clang_format (HDF5_H5MKGRP_SRC_FORMAT h5mkgrp-shared)
+ clang_format (HDF5_H5CLEAR_SRC_FORMAT h5clear-shared)
+ endif ()
+endif ()
+
##############################################################################
##############################################################################
### I N S T A L L A T I O N ###
diff --git a/tools/src/misc/Makefile.am b/tools/src/misc/Makefile.am
index f1d2aaf..e8ee947 100644
--- a/tools/src/misc/Makefile.am
+++ b/tools/src/misc/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/src/misc/Makefile.in b/tools/src/misc/Makefile.in
index d04e1fe..67c294c 100644
--- a/tools/src/misc/Makefile.in
+++ b/tools/src/misc/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -441,12 +442,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -484,11 +485,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -520,8 +566,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -535,7 +579,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -545,6 +591,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -738,7 +785,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1299,8 +1346,9 @@ uninstall-am: uninstall-binPROGRAMS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c
index 96cbf9c..face2f0 100644
--- a/tools/src/misc/h5clear.c
+++ b/tools/src/misc/h5clear.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,64 +24,31 @@
#include "h5tools_utils.h"
/* Name of tool */
-#define PROGRAMNAME "h5clear"
+#define PROGRAMNAME "h5clear"
/* Make these private properties (defined in H5Fprivate.h) available to h5clear. */
-#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags"
-#define H5F_ACS_NULL_FSM_ADDR_NAME "null_fsm_addr"
-#define H5F_ACS_SKIP_EOF_CHECK_NAME "skip_eof_check"
+#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags"
+#define H5F_ACS_NULL_FSM_ADDR_NAME "null_fsm_addr"
+#define H5F_ACS_SKIP_EOF_CHECK_NAME "skip_eof_check"
/* Default increment is 1 megabytes for the --increment option */
-#define DEFAULT_INCREMENT 1024*1024
+#define DEFAULT_INCREMENT (1024 * 1024)
-static char *fname_g = NULL;
+static char * fname_g = NULL;
static hbool_t clear_status_flags = FALSE;
static hbool_t remove_cache_image = FALSE;
-static hbool_t print_filesize = FALSE;
-static hbool_t increment_eoa_eof = FALSE;
-static hsize_t increment = DEFAULT_INCREMENT;
+static hbool_t print_filesize = FALSE;
+static hbool_t increment_eoa_eof = FALSE;
+static hsize_t increment = DEFAULT_INCREMENT;
/*
* Command-line options: only publicize long options
*/
-static const char *s_opts = "hVsmzi*";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h'},
- { "he", no_arg, 'h'},
- { "version", no_arg, 'V' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "status", no_arg, 's' },
- { "statu", no_arg, 's' },
- { "stat", no_arg, 's' },
- { "sta", no_arg, 's' },
- { "st", no_arg, 's' },
- { "image", no_arg, 'm' },
- { "imag", no_arg, 'm' },
- { "ima", no_arg, 'm' },
- { "im", no_arg, 'm' },
- { "filesize", no_arg, 'z' },
- { "filesiz", no_arg, 'z' },
- { "filesi", no_arg, 'z' },
- { "files", no_arg, 'z' },
- { "file", no_arg, 'z' },
- { "fil", no_arg, 'z' },
- { "fi", no_arg, 'z' },
- { "increment", optional_arg, 'i' },
- { "incremen", optional_arg, 'i' },
- { "increme", optional_arg, 'i' },
- { "increm", optional_arg, 'i' },
- { "incre", optional_arg, 'i' },
- { "incr", optional_arg, 'i' },
- { "inc", optional_arg, 'i' },
- { "in", optional_arg, 'i' },
- { NULL, 0, '\0' }
-};
-
-
+static const char * s_opts = "hVsmzi*";
+static struct h5_long_options l_opts[] = {
+ {"help", no_arg, 'h'}, {"version", no_arg, 'V'}, {"status", no_arg, 's'},
+ {"image", no_arg, 'm'}, {"filesize", no_arg, 'z'}, {"increment", optional_arg, 'i'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -92,7 +59,8 @@ static struct long_options l_opts[] = {
*
*-------------------------------------------------------------------------
*/
-static void usage(const char *prog)
+static void
+usage(const char *prog)
{
HDfprintf(stdout, "usage: %s [OPTIONS] file_name\n", prog);
HDfprintf(stdout, " OPTIONS\n");
@@ -101,12 +69,17 @@ static void usage(const char *prog)
HDfprintf(stdout, " -s, --status Clear the status_flags field in the file's superblock\n");
HDfprintf(stdout, " -m, --image Remove the metadata cache image from the file\n");
HDfprintf(stdout, " --filesize Print the file's EOA and EOF\n");
- HDfprintf(stdout, " --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for\n");
+ HDfprintf(stdout,
+ " --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for\n");
HDfprintf(stdout, " the file <file_name>.\n");
- HDfprintf(stdout, " C is >= 0; C is optional and will default to 1M when not set.\n");
- HDfprintf(stdout, " This option helps to repair a crashed file where the stored EOA\n");
+ HDfprintf(stdout,
+ " C is >= 0; C is optional and will default to 1M when not set.\n");
+ HDfprintf(
+ stdout,
+ " This option helps to repair a crashed file where the stored EOA\n");
HDfprintf(stdout, " in the superblock is different from the actual EOF.\n");
- HDfprintf(stdout, " The file’s EOA and EOF will be the same after applying\n");
+ HDfprintf(stdout,
+ " The file’s EOA and EOF will be the same after applying\n");
HDfprintf(stdout, " this option to the file.\n");
HDfprintf(stdout, "\n");
HDfprintf(stdout, "Examples of use:\n");
@@ -124,7 +97,6 @@ static void usage(const char *prog)
HDfprintf(stdout, " Set the EOA to the maximum of (EOA, EOF) + 512 for the file <file_name>.\n");
} /* usage() */
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -141,7 +113,7 @@ parse_command_line(int argc, const char **argv)
{
int opt;
- /* no arguments */
+ /* no arguments */
if (argc == 1) {
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
@@ -149,8 +121,8 @@ parse_command_line(int argc, const char **argv)
}
/* parse command line options */
- while((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char)opt) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
case 'h':
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
@@ -175,12 +147,12 @@ parse_command_line(int argc, const char **argv)
case 'i':
increment_eoa_eof = TRUE;
- if(opt_arg != NULL) {
- if (HDatoi(opt_arg) < 0) {
+ if (H5_optarg != NULL) {
+ if (HDatoi(H5_optarg) < 0) {
usage(h5tools_getprogname());
goto done;
}
- increment = (hsize_t)HDatoi(opt_arg);
+ increment = (hsize_t)HDatoi(H5_optarg);
}
break;
@@ -189,20 +161,20 @@ parse_command_line(int argc, const char **argv)
h5tools_setstatus(EXIT_FAILURE);
goto error;
} /* end switch */
- } /* end while */
+ } /* end while */
/* check for file name to be processed */
- if(argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
goto error;
} /* end if */
- fname_g = HDstrdup(argv[opt_ind]);
+ fname_g = HDstrdup(argv[H5_optind]);
done:
- return(0);
+ return (0);
error:
return -1;
@@ -224,8 +196,6 @@ leave(int ret)
HDexit(ret);
} /* leave() */
-
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -254,14 +224,14 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- char *fname = NULL; /* File name */
- hid_t fapl = H5I_INVALID_HID; /* File access property list */
- hid_t fid = H5I_INVALID_HID; /* File ID */
- haddr_t image_addr;
- hsize_t image_len;
- unsigned flags = H5F_ACC_RDWR; /* file access flags */
+ char * fname = NULL; /* File name */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ haddr_t image_addr;
+ hsize_t image_len;
+ unsigned flags = H5F_ACC_RDWR; /* file access flags */
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -270,26 +240,24 @@ main (int argc, const char *argv[])
h5tools_init();
/* Parse command line options */
- if(parse_command_line(argc, argv) < 0)
+ if (parse_command_line(argc, argv) < 0)
goto done;
- if(fname_g == NULL)
+ if (fname_g == NULL)
goto done;
/* enable error reporting if command line option */
h5tools_error_report();
/* Print usage/exit if not using at least one of the options */
- if(!clear_status_flags && !remove_cache_image &&
- !increment_eoa_eof && !print_filesize) {
+ if (!clear_status_flags && !remove_cache_image && !increment_eoa_eof && !print_filesize) {
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Cannot combine the --filesize option with other options */
- if(print_filesize &&
- (clear_status_flags || remove_cache_image || increment_eoa_eof)) {
+ if (print_filesize && (clear_status_flags || remove_cache_image || increment_eoa_eof)) {
error_msg("Cannot combine --filesize with other options\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -299,17 +267,17 @@ main (int argc, const char *argv[])
fname = HDstrdup(fname_g);
/* Get a copy of the file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
error_msg("H5Pcreate\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
/* -s option */
- if(clear_status_flags) {
+ if (clear_status_flags) {
/* Set to clear the status_flags in the file's superblock */
/* Activate this private property */
- if(H5Pset(fapl, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear_status_flags) < 0) {
+ if (H5Pset(fapl, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear_status_flags) < 0) {
error_msg("H5Pset\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -317,15 +285,15 @@ main (int argc, const char *argv[])
}
/* --increment option */
- if(increment_eoa_eof) {
+ if (increment_eoa_eof) {
/* Activate this private property */
- if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &increment_eoa_eof) < 0) {
+ if (H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &increment_eoa_eof) < 0) {
error_msg("H5Pset\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Activate this private property */
- if(H5Pset(fapl, H5F_ACS_NULL_FSM_ADDR_NAME, &increment_eoa_eof) < 0) {
+ if (H5Pset(fapl, H5F_ACS_NULL_FSM_ADDR_NAME, &increment_eoa_eof) < 0) {
error_msg("H5Pset\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -333,9 +301,9 @@ main (int argc, const char *argv[])
}
/* --filesize option; open the file read-only */
- if(print_filesize) {
+ if (print_filesize) {
/* Activate this private property */
- if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &print_filesize) < 0) {
+ if (H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &print_filesize) < 0) {
error_msg("H5Pset\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -344,30 +312,30 @@ main (int argc, const char *argv[])
}
/* Open the file */
- if((fid = h5tools_fopen(fname, flags, fapl, FALSE, NULL, (size_t)0)) < 0) {
+ if ((fid = h5tools_fopen(fname, flags, fapl, FALSE, NULL, (size_t)0)) < 0) {
error_msg("h5tools_fopen\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* --filesize option */
- if(print_filesize) {
- h5_stat_t st; /* Stat info call */
- haddr_t eoa; /* The EOA value */
+ if (print_filesize) {
+ h5_stat_t st; /* Stat info call */
+ haddr_t eoa; /* The EOA value */
/* Get the file's EOA and EOF */
- if(H5Fget_eoa(fid, &eoa) < 0 || HDstat(fname, &st) < 0) {
+ if (H5Fget_eoa(fid, &eoa) < 0 || HDstat(fname, &st) < 0) {
error_msg("H5Fget_eoa or HDstat\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- HDfprintf(stdout, "EOA is %a; EOF is %a \n", eoa, st.st_size);
+ HDfprintf(stdout, "EOA is %" PRIuHADDR "; EOF is %" PRIuHADDR " \n", eoa, (haddr_t)st.st_size);
}
/* --increment option */
- if(increment_eoa_eof) {
+ if (increment_eoa_eof) {
/* Set the file's EOA to the maximum of (EOA, EOF) + increment */
- if(H5Fincrement_filesize(fid, increment) < 0) {
+ if (H5Fincrement_filesize(fid, increment) < 0) {
error_msg("H5Fset_eoa\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -375,29 +343,30 @@ main (int argc, const char *argv[])
}
/* -m option */
- if(remove_cache_image) {
- if(H5Fget_mdc_image_info(fid, &image_addr, &image_len) < 0) {
+ if (remove_cache_image) {
+ if (H5Fget_mdc_image_info(fid, &image_addr, &image_len) < 0) {
error_msg("H5Fget_mdc_image_info\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- if(image_addr == HADDR_UNDEF && image_len == 0)
+ if (image_addr == HADDR_UNDEF && image_len == 0)
warn_msg("No cache image in the file\n");
}
h5tools_setstatus(EXIT_SUCCESS);
done:
- if(fname)
+ if (fname)
HDfree(fname);
- if(fname_g)
+ if (fname_g)
HDfree(fname_g);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
leave(h5tools_getstatus());
} /* main() */
-
diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c
index bc7e9a3..95c81b7 100644
--- a/tools/src/misc/h5debug.c
+++ b/tools/src/misc/h5debug.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,42 +21,41 @@
*
*-------------------------------------------------------------------------
*/
-#define H5A_FRIEND /*suppress error about including H5Apkg */
-#define H5B2_FRIEND /*suppress error about including H5B2pkg */
-#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
-#define H5EA_FRIEND /*suppress error about including H5EApkg */
-#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/
-#define H5FA_FRIEND /*suppress error about including H5FApkg */
-#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
-#define H5HF_FRIEND /*suppress error about including H5HFpkg */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
-#define H5SM_FRIEND /*suppress error about including H5SMpkg */
-
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5B2pkg.h" /* v2 B-trees */
+#define H5A_FRIEND /*suppress error about including H5Apkg */
+#define H5B2_FRIEND /*suppress error about including H5B2pkg */
+#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5EA_FRIEND /*suppress error about including H5EApkg */
+#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/
+#define H5FA_FRIEND /*suppress error about including H5FApkg */
+#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5HF_FRIEND /*suppress error about including H5HFpkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5SM_FRIEND /*suppress error about including H5SMpkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5B2pkg.h" /* v2 B-trees */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-#include "H5FApkg.h" /* Fixed Arrays */
-#include "H5Fpkg.h" /* File access */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5FApkg.h" /* Fixed Arrays */
+#include "H5Fpkg.h" /* File access */
#include "H5FSprivate.h" /* Free space manager */
-#include "H5Gpkg.h" /* Groups */
-#include "H5HFpkg.h" /* Fractal heaps */
+#include "H5Gpkg.h" /* Groups */
+#include "H5HFpkg.h" /* Fractal heaps */
#include "H5HGprivate.h" /* Global Heaps */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Opkg.h" /* Object headers */
-#include "H5SMpkg.h" /* Implicitly shared messages */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Opkg.h" /* Object headers */
+#include "H5SMpkg.h" /* Implicitly shared messages */
/* File drivers */
#include "H5FDfamily.h"
-#define VCOL 50
-
+#define VCOL 50
/*-------------------------------------------------------------------------
* Function: get_H5B2_class
@@ -75,10 +74,10 @@
static const H5B2_class_t *
get_H5B2_class(const uint8_t *sig)
{
- H5B2_subid_t subtype = (H5B2_subid_t)sig[H5_SIZEOF_MAGIC + 1];
- const H5B2_class_t *cls = NULL;
+ H5B2_subid_t subtype = (H5B2_subid_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5B2_class_t *cls = NULL;
- switch(subtype) {
+ switch (subtype) {
case H5B2_TEST_ID:
cls = H5B2_TEST;
break;
@@ -136,10 +135,9 @@ get_H5B2_class(const uint8_t *sig)
HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype));
} /* end switch */
- return(cls);
+ return (cls);
} /* end get_H5B2_class() */
-
/*-------------------------------------------------------------------------
* Function: get_H5EA_class
*
@@ -157,10 +155,10 @@ get_H5B2_class(const uint8_t *sig)
static const H5EA_class_t *
get_H5EA_class(const uint8_t *sig)
{
- H5EA_cls_id_t clsid = (H5EA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
- const H5EA_class_t *cls = NULL;
+ H5EA_cls_id_t clsid = (H5EA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5EA_class_t *cls = NULL;
- switch(clsid) {
+ switch (clsid) {
case H5EA_CLS_TEST_ID:
cls = H5EA_CLS_TEST;
break;
@@ -178,10 +176,9 @@ get_H5EA_class(const uint8_t *sig)
HDfprintf(stderr, "Unknown extensible array class %u\n", (unsigned)(clsid));
} /* end switch */
- return(cls);
+ return (cls);
} /* end get_H5EA_class() */
-
/*-------------------------------------------------------------------------
* Function: get_H5FA_class
*
@@ -199,10 +196,10 @@ get_H5EA_class(const uint8_t *sig)
static const H5FA_class_t *
get_H5FA_class(const uint8_t *sig)
{
- H5FA_cls_id_t clsid = (H5FA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
- const H5FA_class_t *cls = NULL;
+ H5FA_cls_id_t clsid = (H5FA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5FA_class_t *cls = NULL;
- switch(clsid) {
+ switch (clsid) {
case H5FA_CLS_TEST_ID:
cls = H5FA_CLS_TEST;
break;
@@ -220,10 +217,9 @@ get_H5FA_class(const uint8_t *sig)
HDfprintf(stderr, "Unknown fixed array class %u\n", (unsigned)(clsid));
} /* end switch */
- return(cls);
+ return (cls);
} /* end get_H5FA_class() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -241,28 +237,28 @@ get_H5FA_class(const uint8_t *sig)
int
main(int argc, char *argv[])
{
- hid_t fid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
hid_t fapl = H5I_INVALID_HID;
- H5F_t *f;
- haddr_t addr = 0;
- int extra_count = 0; /* Number of extra arguments */
+ H5F_t * f;
+ haddr_t addr = 0;
+ int extra_count = 0; /* Number of extra arguments */
haddr_t extra[10];
uint8_t sig[H5F_SIGNATURE_LEN];
size_t u;
- H5E_auto2_t func;
- void *edata;
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- herr_t status = SUCCEED;
- int exit_value = 0;
+ H5E_auto2_t func = NULL;
+ void * edata = NULL;
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ herr_t status = SUCCEED;
+ int exit_value = 0;
- if(argc == 1) {
+ if (argc == 1) {
HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]*]\n", argv[0]);
exit_value = 1;
goto done;
} /* end if */
/* Initialize the library */
- if(H5open() < 0) {
+ if (H5open() < 0) {
HDfprintf(stderr, "cannot initialize the library\n");
exit_value = 1;
goto done;
@@ -275,39 +271,39 @@ main(int argc, char *argv[])
/*
* Open the file and get the file descriptor.
*/
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
HDfprintf(stderr, "cannot create file access property list\n");
exit_value = 1;
goto done;
} /* end if */
- if(HDstrchr(argv[1], '%'))
- if(H5Pset_fapl_family (fapl, (hsize_t)0, H5P_DEFAULT) < 0) {
+ if (HDstrchr(argv[1], '%'))
+ if (H5Pset_fapl_family(fapl, (hsize_t)0, H5P_DEFAULT) < 0) {
HDfprintf(stderr, "cannot set file access property list\n");
exit_value = 1;
goto done;
}
- if((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) {
+ if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) {
HDfprintf(stderr, "cannot open file\n");
exit_value = 1;
goto done;
} /* end if */
/* Push API context */
- if(H5CX_push() < 0) {
+ if (H5CX_push() < 0) {
HDfprintf(stderr, "cannot set API context\n");
exit_value = 1;
goto done;
}
api_ctx_pushed = TRUE;
- if(NULL == (f = (H5F_t *)H5I_object(fid))) {
+ if (NULL == (f = (H5F_t *)H5I_object(fid))) {
HDfprintf(stderr, "cannot obtain H5F_t pointer\n");
exit_value = 2;
goto done;
} /* end if */
/* Ignore metadata tags while using h5debug */
- if(H5AC_ignore_tags(f) < 0) {
+ if (H5AC_ignore_tags(f) < 0) {
HDfprintf(stderr, "cannot ignore metadata tags\n");
exit_value = 1;
goto done;
@@ -318,70 +314,69 @@ main(int argc, char *argv[])
*/
/* Primary data structure to dump */
- if(argc > 2)
+ if (argc > 2)
addr = (haddr_t)HDstrtoll(argv[2], NULL, 0);
/* Extra arguments for primary data structure */
HDmemset(extra, 0, sizeof(extra));
- if(argc > 3) {
+ if (argc > 3) {
/* Number of extra arguments */
extra_count = argc - 3;
/* Range check against 'extra' array size */
- if(extra_count > (int)(sizeof(extra) / sizeof(haddr_t))) {
- HDfprintf(stderr, "\nWARNING: Only using first %d extra parameters\n\n", (int)(sizeof(extra) / sizeof(haddr_t)));
+ if (extra_count > (int)(sizeof(extra) / sizeof(haddr_t))) {
+ HDfprintf(stderr, "\nWARNING: Only using first %d extra parameters\n\n",
+ (int)(sizeof(extra) / sizeof(haddr_t)));
extra_count = (int)(sizeof(extra) / sizeof(haddr_t));
} /* end if */
- for(u = 0; u < (size_t)extra_count; u++)
+ for (u = 0; u < (size_t)extra_count; u++)
extra[u] = (haddr_t)HDstrtoll(argv[u + 3], NULL, 0);
} /* end if */
/*
* Read the signature at the specified file position.
*/
- HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr);
- if(H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), sig) < 0) {
+ HDfprintf(stdout, "Reading signature at address %" PRIuHADDR " (rel)\n", addr);
+ if (H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), sig) < 0) {
HDfprintf(stderr, "cannot read signature\n");
exit_value = 3;
goto done;
}
- if(!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) {
+ if (!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) {
/*
* Debug the file's super block.
*/
status = H5F_debug(f, stdout, 0, VCOL);
-
- } else if(!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ }
+ else if (!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a local heap.
*/
status = H5HL_debug(f, addr, stdout, 0, VCOL);
-
}
- else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a global heap collection.
*/
status = H5HG_debug(f, addr, stdout, 0, VCOL);
-
}
- else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a symbol table node.
*/
/* Check for extra parameters */
- if(extra_count == 0 || extra[0] == 0) {
- HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n");
+ if (extra_count == 0 || extra[0] == 0) {
+ HDfprintf(stderr,
+ "\nWarning: Providing the group's local heap address will give more information\n");
HDfprintf(stderr, "Symbol table node usage:\n");
HDfprintf(stderr, "\th5debug <filename> <Symbol table node address> <address of local heap>\n\n");
} /* end if */
status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra[0]);
-
}
- else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a B-tree. B-trees are debugged through the B-tree
* subclass. The subclass identifier is the byte immediately
@@ -391,79 +386,87 @@ main(int argc, char *argv[])
unsigned ndims;
uint32_t dim[H5O_LAYOUT_NDIMS];
- switch(subtype) {
- case H5B_SNODE_ID:
- /* Check for extra parameters */
- if(extra_count == 0 || extra[0] == 0) {
- HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n");
- HDfprintf(stderr, "B-tree symbol table node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <address of local heap>\n\n");
- exit_value = 4;
- goto done;
- } /* end if */
-
- status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra[0]);
- break;
-
- case H5B_CHUNK_ID:
- /* Check for extra parameters */
- if(extra_count == 0 || extra[0] == 0) {
- HDfprintf(stderr, "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n");
- HDfprintf(stderr, "B-tree chunked storage node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n");
- exit_value = 4;
- goto done;
- } /* end if */
-
- /* Set # of dimensions */
- ndims = (unsigned)extra[0];
-
- /* Check for dimension error */
- if(ndims > 9) {
- HDfprintf(stderr, "ERROR: Only 9 dimensions support currently (fix h5debug)\n");
- HDfprintf(stderr, "B-tree chunked storage node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n");
- exit_value = 4;
- goto done;
- } /* end for */
+ switch (subtype) {
+ case H5B_SNODE_ID:
+ /* Check for extra parameters */
+ if (extra_count == 0 || extra[0] == 0) {
+ HDfprintf(
+ stderr,
+ "\nWarning: Providing the group's local heap address will give more information\n");
+ HDfprintf(stderr, "B-tree symbol table node usage:\n");
+ HDfprintf(stderr,
+ "\th5debug <filename> <B-tree node address> <address of local heap>\n\n");
+ exit_value = 4;
+ goto done;
+ } /* end if */
- /* Build array of chunk dimensions */
- for(u = 0; u < ndims; u++)
- dim[u] = (uint32_t)extra[u + 1];
+ status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra[0]);
+ break;
- /* Check for dimension error */
- for(u = 0; u < ndims; u++)
- if(0 == dim[u]) {
- HDfprintf(stderr, "ERROR: Chunk dimensions should be >0\n");
+ case H5B_CHUNK_ID:
+ /* Check for extra parameters */
+ if (extra_count == 0 || extra[0] == 0) {
+ HDfprintf(
+ stderr,
+ "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n");
HDfprintf(stderr, "B-tree chunked storage node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n");
+ HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest "
+ "chunk dim>...<fastest chunk dim>\n");
exit_value = 4;
goto done;
} /* end if */
- /* Set the last dimension (the element size) to zero */
- dim[ndims] = 0;
-
- status = H5D_btree_debug(f, addr, stdout, 0, VCOL, ndims, dim);
- break;
+ /* Set # of dimensions */
+ ndims = (unsigned)extra[0];
- case H5B_NUM_BTREE_ID:
- default:
- HDfprintf(stderr, "Unknown v1 B-tree subtype %u\n", (unsigned)(subtype));
- exit_value = 4;
- goto done;
+ /* Check for dimension error */
+ if (ndims > 9) {
+ HDfprintf(stderr, "ERROR: Only 9 dimensions support currently (fix h5debug)\n");
+ HDfprintf(stderr, "B-tree chunked storage node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest "
+ "chunk dim>...<fastest chunk dim>\n");
+ exit_value = 4;
+ goto done;
+ } /* end for */
+
+ /* Build array of chunk dimensions */
+ for (u = 0; u < ndims; u++)
+ dim[u] = (uint32_t)extra[u + 1];
+
+ /* Check for dimension error */
+ for (u = 0; u < ndims; u++)
+ if (0 == dim[u]) {
+ HDfprintf(stderr, "ERROR: Chunk dimensions should be >0\n");
+ HDfprintf(stderr, "B-tree chunked storage node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> "
+ "<slowest chunk dim>...<fastest chunk dim>\n");
+ exit_value = 4;
+ goto done;
+ } /* end if */
+
+ /* Set the last dimension (the element size) to zero */
+ dim[ndims] = 0;
+
+ status = H5D_btree_debug(f, addr, stdout, 0, VCOL, ndims, dim);
+ break;
+
+ case H5B_NUM_BTREE_ID:
+ default:
+ HDfprintf(stderr, "Unknown v1 B-tree subtype %u\n", (unsigned)(subtype));
+ exit_value = 4;
+ goto done;
}
-
}
- else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a v2 B-tree header.
- */
+ */
const H5B2_class_t *cls = get_H5B2_class(sig);
HDassert(cls);
- if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra_count == 0 || extra[0] == 0)) {
- HDfprintf(stderr, "ERROR: Need v2 B-tree header address and object header address containing the layout message in order to dump header\n");
+ if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra_count == 0 || extra[0] == 0)) {
+ HDfprintf(stderr, "ERROR: Need v2 B-tree header address and object header address containing the "
+ "layout message in order to dump header\n");
HDfprintf(stderr, "v2 B-tree hdr usage:\n");
HDfprintf(stderr, "\th5debug <filename> <v2 B-tree header address> <object header address>\n");
exit_value = 4;
@@ -471,9 +474,8 @@ main(int argc, char *argv[])
} /* end if */
status = H5B2__hdr_debug(f, addr, stdout, 0, VCOL, cls, (haddr_t)extra[0]);
-
}
- else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a v2 B-tree internal node.
*/
@@ -481,28 +483,35 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0 || extra[3] == 0)) {
- HDfprintf(stderr, "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object header address containing the layout message in order to dump internal node\n");
- HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
+ if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) &&
+ (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0 || extra[3] == 0)) {
+ HDfprintf(stderr,
+ "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object "
+ "header address containing the layout message in order to dump internal node\n");
+ HDfprintf(stderr,
+ "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
HDfprintf(stderr, "v2 B-tree internal node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> <number of records> <depth> <object header address>\n");
+ HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> "
+ "<number of records> <depth> <object header address>\n");
exit_value = 4;
goto done;
-
}
- else if(extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
- HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and depth in order to dump internal node\n");
- HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
+ else if (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
+ HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and "
+ "depth in order to dump internal node\n");
+ HDfprintf(stderr,
+ "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
HDfprintf(stderr, "v2 B-tree internal node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> <number of records> <depth>\n");
+ HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> "
+ "<number of records> <depth>\n");
exit_value = 4;
goto done;
} /* end if */
- status = H5B2__int_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], (unsigned)extra[2], (haddr_t)extra[3]);
-
+ status = H5B2__int_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1],
+ (unsigned)extra[2], (haddr_t)extra[3]);
}
- else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a v2 B-tree leaf node.
*/
@@ -510,118 +519,126 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0 )) {
+ if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) &&
+ (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0)) {
- HDfprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header address containing the layout message in order to dump leaf node\n");
+ HDfprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header "
+ "address containing the layout message in order to dump leaf node\n");
HDfprintf(stderr, "v2 B-tree leaf node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records> <object header address>\n");
+ HDfprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number "
+ "of records> <object header address>\n");
exit_value = 4;
goto done;
-
}
- else if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n");
+ else if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(
+ stderr,
+ "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n");
HDfprintf(stderr, "v2 B-tree leaf node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records>\n");
+ HDfprintf(
+ stderr,
+ "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records>\n");
exit_value = 4;
goto done;
} /* end if */
- status = H5B2__leaf_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], (haddr_t)extra[2]);
-
+ status =
+ H5B2__leaf_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], (haddr_t)extra[2]);
}
- else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fractal heap header.
*/
status = H5HF_hdr_debug(f, addr, stdout, 0, VCOL);
-
}
- else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fractal heap direct block.
*/
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need fractal heap header address and size of direct block in order to dump direct block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(stderr, "ERROR: Need fractal heap header address and size of direct block in order to "
+ "dump direct block\n");
HDfprintf(stderr, "Fractal heap direct block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <direct block address> <heap header address> <size of direct block>\n");
+ HDfprintf(
+ stderr,
+ "\th5debug <filename> <direct block address> <heap header address> <size of direct block>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5HF_dblock_debug(f, addr, stdout, 0, VCOL, extra[0], (size_t)extra[1]);
-
}
- else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fractal heap indirect block.
*/
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need fractal heap header address and number of rows in order to dump indirect block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(stderr, "ERROR: Need fractal heap header address and number of rows in order to dump "
+ "indirect block\n");
HDfprintf(stderr, "Fractal heap indirect block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <indirect block address> <heap header address> <number of rows>\n");
+ HDfprintf(
+ stderr,
+ "\th5debug <filename> <indirect block address> <heap header address> <number of rows>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5HF_iblock_debug(f, addr, stdout, 0, VCOL, extra[0], (unsigned)extra[1]);
-
}
- else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a free space header.
*/
status = H5FS_debug(f, addr, stdout, 0, VCOL);
-
}
- else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug free space serialized sections.
*/
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need free space header address and client address in order to dump serialized sections\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(stderr, "ERROR: Need free space header address and client address in order to dump "
+ "serialized sections\n");
HDfprintf(stderr, "Free space serialized sections usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <serialized sections address> <free space header address> <client address>\n");
+ HDfprintf(stderr, "\th5debug <filename> <serialized sections address> <free space header "
+ "address> <client address>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5FS_sects_debug(f, addr, stdout, 0, VCOL, extra[0], extra[1]);
-
}
- else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug shared message master table.
*/
- status = H5SM_table_debug(f, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL);
-
+ status = H5SM_table_debug(f, addr, stdout, 0, VCOL, UINT_MAX, UINT_MAX);
}
- else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug shared message list index.
*/
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0) {
+ if (extra_count == 0 || extra[0] == 0) {
HDfprintf(stderr, "ERROR: Need shared message header address in order to shared message list\n");
HDfprintf(stderr, "Shared message list usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <shared message list address> <shared message header address>\n");
+ HDfprintf(stderr,
+ "\th5debug <filename> <shared message list address> <shared message header address>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5SM_list_debug(f, addr, stdout, 0, VCOL, (haddr_t)extra[0]);
-
}
- else if(!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug an extensible aray header.
*/
@@ -629,18 +646,20 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0) {
- HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n");
+ if (extra_count == 0 || extra[0] == 0) {
+ HDfprintf(
+ stderr,
+ "ERROR: Need object header address containing the layout message in order to dump header\n");
HDfprintf(stderr, "Extensible array header block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <Extensible Array header address> <object header address>\n");
+ HDfprintf(stderr,
+ "\th5debug <filename> <Extensible Array header address> <object header address>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5EA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra[0]);
-
}
- else if(!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug an extensible aray index block.
*/
@@ -648,18 +667,20 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need extensible array header address and object header address containing the layout message in order to dump index block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(stderr, "ERROR: Need extensible array header address and object header address "
+ "containing the layout message in order to dump index block\n");
HDfprintf(stderr, "Extensible array index block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <index block address> <array header address> <object header address\n");
+ HDfprintf(
+ stderr,
+ "\th5debug <filename> <index block address> <array header address> <object header address\n");
exit_value = 4;
goto done;
} /* end if */
status = H5EA__iblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], extra[1]);
-
}
- else if(!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug an extensible aray super block.
*/
@@ -667,18 +688,19 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
- HDfprintf(stderr, "ERROR: Need extensible array header address, super block index and object header address containing the layout message in order to dump super block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
+ HDfprintf(stderr, "ERROR: Need extensible array header address, super block index and object "
+ "header address containing the layout message in order to dump super block\n");
HDfprintf(stderr, "Extensible array super block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super block index> <object header address>\n");
+ HDfprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super "
+ "block index> <object header address>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5EA__sblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], extra[2]);
-
}
- else if(!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug an extensible aray data block.
*/
@@ -686,18 +708,20 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
- HDfprintf(stderr, "ERROR: Need extensible array header address, # of elements in data block and object header address containing the layout message in order to dump data block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
+ HDfprintf(stderr,
+ "ERROR: Need extensible array header address, # of elements in data block and object "
+ "header address containing the layout message in order to dump data block\n");
HDfprintf(stderr, "Extensible array data block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of elements in data block> <object header address\n");
+ HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of "
+ "elements in data block> <object header address\n");
exit_value = 4;
goto done;
} /* end if */
status = H5EA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (size_t)extra[1], extra[2]);
-
}
- else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fixed array header.
*/
@@ -705,8 +729,10 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0) {
- HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n");
+ if (extra_count == 0 || extra[0] == 0) {
+ HDfprintf(
+ stderr,
+ "ERROR: Need object header address containing the layout message in order to dump header\n");
HDfprintf(stderr, "Fixed array header block usage:\n");
HDfprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n");
exit_value = 4;
@@ -714,9 +740,8 @@ main(int argc, char *argv[])
} /* end if */
status = H5FA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra[0]);
-
}
- else if(!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fixed array data block.
*/
@@ -724,32 +749,32 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need fixed array header address and object header address containing the layout message in order to dump data block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(stderr, "ERROR: Need fixed array header address and object header address containing "
+ "the layout message in order to dump data block\n");
HDfprintf(stderr, "fixed array data block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <object header address>\n");
+ HDfprintf(
+ stderr,
+ "\th5debug <filename> <data block address> <array header address> <object header address>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5FA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], extra[1]);
-
}
- else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug v2 object header (which have signatures).
*/
status = H5O_debug(f, addr, stdout, 0, VCOL);
-
}
- else if(sig[0] == H5O_VERSION_1) {
+ else if (sig[0] == H5O_VERSION_1) {
/*
* This could be a v1 object header. Since they don't have a signature
* it's a somewhat "ify" detection.
*/
status = H5O_debug(f, addr, stdout, 0, VCOL);
-
}
else {
/*
@@ -774,7 +799,7 @@ main(int argc, char *argv[])
} /* end else */
/* Check for an error when dumping information */
- if(status < 0) {
+ if (status < 0) {
HDfprintf(stderr, "An error occurred!\n");
H5Eprint2(H5E_DEFAULT, stderr);
exit_value = 5;
@@ -782,14 +807,16 @@ main(int argc, char *argv[])
} /* end if */
done:
- if(fapl > 0) H5Pclose(fapl);
- if(fid > 0) H5Fclose(fid);
+ if (fapl > 0)
+ H5Pclose(fapl);
+ if (fid > 0)
+ H5Fclose(fid);
/* Pop API context */
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
H5Eset_auto2(H5E_DEFAULT, func, edata);
return exit_value;
} /* main() */
-
diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c
index 2046373..6e4f0a6 100644
--- a/tools/src/misc/h5mkgrp.c
+++ b/tools/src/misc/h5mkgrp.c
@@ -6,12 +6,11 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#include "H5private.h"
#include "h5tools.h"
#include "h5tools_utils.h"
@@ -23,30 +22,24 @@
int d_status = EXIT_SUCCESS;
/* command-line options: short and long-named parameters */
-static const char *s_opts = "hlpvV";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "latest", no_arg, 'l' },
- { "parents", no_arg, 'p' },
- { "verbose", no_arg, 'v' },
- { "version", no_arg, 'V' },
- { NULL, 0, '\0' }
-};
+static const char * s_opts = "hlpvV";
+static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"latest", no_arg, 'l'},
+ {"parents", no_arg, 'p'}, {"verbose", no_arg, 'v'},
+ {"version", no_arg, 'V'}, {NULL, 0, '\0'}};
/* Command line parameter settings */
typedef struct mkgrp_opt_t {
- char *fname; /* File name to operate on */
- hbool_t latest; /* Whether file should use latest format versions */
- hbool_t verbose; /* Whether output should be verbose */
- hbool_t parents; /* Whether to create intermediate groups */
- size_t ngroups; /* Number of groups to create */
- char **groups; /* Pointer to array of group names */
- hid_t fapl_id; /* fapl to use when opening the file */
+ char * fname; /* File name to operate on */
+ hbool_t latest; /* Whether file should use latest format versions */
+ hbool_t verbose; /* Whether output should be verbose */
+ hbool_t parents; /* Whether to create intermediate groups */
+ size_t ngroups; /* Number of groups to create */
+ char ** groups; /* Pointer to array of group names */
+ hid_t fapl_id; /* fapl to use when opening the file */
} mkgrp_opt_t;
-mkgrp_opt_t params_g; /* Command line parameter settings */
+mkgrp_opt_t params_g; /* Command line parameter settings */
-
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -78,7 +71,6 @@ leave(int ret)
HDexit(ret);
} /* end leave() */
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -97,14 +89,15 @@ usage(const char *prog)
PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] FILE GROUP...\n", prog);
PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
- PRINTVALSTREAM(rawoutstream, " -l, --latest Use latest version of file format to create groups\n");
- PRINTVALSTREAM(rawoutstream, " -p, --parents No error if existing, make parent groups as needed\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -l, --latest Use latest version of file format to create groups\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -p, --parents No error if existing, make parent groups as needed\n");
PRINTVALSTREAM(rawoutstream, " -v, --verbose Print information about OBJECTS and OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, "\n");
} /* end usage() */
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -121,18 +114,18 @@ usage(const char *prog)
static int
parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
{
- int opt; /* Option from command line */
- size_t curr_group; /* Current group name to copy */
+ int opt; /* Option from command line */
+ size_t curr_group; /* Current group name to copy */
/* Check for empty command line */
- if(argc == 1) {
+ if (argc == 1) {
usage(h5tools_getprogname());
leave(EXIT_SUCCESS);
}
/* Parse command line options */
- while((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char)opt) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
/* Display 'help' */
case 'h':
usage(h5tools_getprogname());
@@ -165,42 +158,41 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
usage(h5tools_getprogname());
leave(EXIT_FAILURE);
} /* end switch */
- } /* end while */
+ } /* end while */
/* Check for file name to be processed */
- if(argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
/* Retrieve file name */
- options->fname = HDstrdup(argv[opt_ind]);
- opt_ind++;
+ options->fname = HDstrdup(argv[H5_optind]);
+ H5_optind++;
/* Check for group(s) to be created */
- if(argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing group name(s)\n");
usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
/* Allocate space for the group name pointers */
- options->ngroups = (size_t)(argc - opt_ind);
- options->groups = (char **)HDmalloc(options->ngroups * sizeof(char *));
+ options->ngroups = (size_t)(argc - H5_optind);
+ options->groups = (char **)HDmalloc(options->ngroups * sizeof(char *));
/* Retrieve the group names */
curr_group = 0;
- while(opt_ind < argc) {
- options->groups[curr_group] = HDstrdup(argv[opt_ind]);
+ while (H5_optind < argc) {
+ options->groups[curr_group] = HDstrdup(argv[H5_optind]);
curr_group++;
- opt_ind++;
+ H5_optind++;
}
return 0;
} /* parse_command_line() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -213,9 +205,9 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
int
main(int argc, const char *argv[])
{
- hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
- hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list ID */
- size_t curr_group; /* Current group to create */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list ID */
+ size_t curr_group; /* Current group to create */
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -227,13 +219,13 @@ main(int argc, const char *argv[])
HDmemset(&params_g, 0, sizeof(params_g));
/* Create file access property list */
- if((params_g.fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((params_g.fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
error_msg("Could not create file access property list\n");
leave(EXIT_FAILURE);
}
/* Parse command line */
- if(parse_command_line(argc, argv, &params_g) < 0) {
+ if (parse_command_line(argc, argv, &params_g) < 0) {
error_msg("unable to parse command line arguments\n");
leave(EXIT_FAILURE);
}
@@ -242,15 +234,15 @@ main(int argc, const char *argv[])
h5tools_error_report();
/* Check for creating groups with new format version */
- if(params_g.latest) {
+ if (params_g.latest) {
/* Set the "use the latest version of the format" bounds */
- if(H5Pset_libver_bounds(params_g.fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ if (H5Pset_libver_bounds(params_g.fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
error_msg("Could not set property for using latest version of the format\n");
leave(EXIT_FAILURE);
}
/* Display some output if requested */
- if(params_g.verbose)
+ if (params_g.verbose)
HDprintf("%s: Creating groups with latest version of the format\n", h5tools_getprogname());
}
@@ -259,67 +251,66 @@ main(int argc, const char *argv[])
/* If we couldn't open an existing file, try creating file */
/* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */
- if(fid < 0)
+ if (fid < 0)
fid = H5Fcreate(params_g.fname, H5F_ACC_EXCL, H5P_DEFAULT, params_g.fapl_id);
/* Test for error in opening file */
- if(fid < 0) {
+ if (fid < 0) {
error_msg("Could not open output file '%s'\n", params_g.fname);
leave(EXIT_FAILURE);
}
/* Create link creation property list */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
error_msg("Could not create link creation property list\n");
leave(EXIT_FAILURE);
}
/* Check for creating intermediate groups */
- if(params_g.parents) {
+ if (params_g.parents) {
/* Set the intermediate group creation property */
- if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) {
+ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) {
error_msg("Could not set property for creating parent groups\n");
leave(EXIT_FAILURE);
}
/* Display some output if requested */
- if(params_g.verbose)
+ if (params_g.verbose)
HDprintf("%s: Creating parent groups\n", h5tools_getprogname());
}
/* Loop over creating requested groups */
- for(curr_group = 0; curr_group < params_g.ngroups; curr_group++) {
- hid_t gid; /* Group ID */
+ for (curr_group = 0; curr_group < params_g.ngroups; curr_group++) {
+ hid_t gid; /* Group ID */
/* Attempt to create a group */
- if((gid = H5Gcreate2(fid, params_g.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ if ((gid = H5Gcreate2(fid, params_g.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
error_msg("Could not create group '%s'\n", params_g.groups[curr_group]);
leave(EXIT_FAILURE);
}
/* Close the group */
- if(H5Gclose(gid) < 0) {
+ if (H5Gclose(gid) < 0) {
error_msg("Could not close group '%s'??\n", params_g.groups[curr_group]);
leave(EXIT_FAILURE);
}
/* Display some output if requested */
- if(params_g.verbose)
+ if (params_g.verbose)
HDprintf("%s: created group '%s'\n", h5tools_getprogname(), params_g.groups[curr_group]);
} /* end for */
/* Close link creation property list */
- if(H5Pclose(lcpl_id) < 0) {
+ if (H5Pclose(lcpl_id) < 0) {
error_msg("Could not close link creation property list\n");
leave(EXIT_FAILURE);
}
/* Close file */
- if(H5Fclose(fid) < 0) {
+ if (H5Fclose(fid) < 0) {
error_msg("Could not close output file '%s'??\n", params_g.fname);
leave(EXIT_FAILURE);
}
leave(EXIT_SUCCESS);
} /* end main() */
-
diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c
index 371cf2c..f4cef6a 100644
--- a/tools/src/misc/h5repart.c
+++ b/tools/src/misc/h5repart.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -26,16 +26,15 @@
#include "hdf5.h"
#include "H5private.h"
-#define NAMELEN 4096
-#define GB *1024*1024*1024
+#define NAMELEN 4096
+#define GB *1024 * 1024 * 1024
/* Make these 2 private properties(defined in H5Fprivate.h) available to h5repart.
* The first one updates the member file size in the superblock. The second one
* change file driver from family to a single file driver.
*/
-#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize"
-#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single"
-
+#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize"
+#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single"
/*-------------------------------------------------------------------------
* Function: usage
@@ -52,26 +51,26 @@
*-------------------------------------------------------------------------
*/
static void
-usage (const char *progname)
+usage(const char *progname)
{
HDfprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2|-family_to_single] SRC DST\n",
- progname);
+ progname);
HDfprintf(stderr, " -v Produce verbose output\n");
HDfprintf(stderr, " -V Print a version number and exit\n");
HDfprintf(stderr, " -b N The I/O block size, defaults to 1kB\n");
HDfprintf(stderr, " -m N The destination member size or 1GB\n");
HDfprintf(stderr, " -family_to_sec2 Deprecated version of -family_to_single (below)\n");
- HDfprintf(stderr, " -family_to_single Change file driver from family to the default single-file VFD (windows or sec2)\n");
+ HDfprintf(stderr, " -family_to_single Change file driver from family to the default single-file VFD "
+ "(windows or sec2)\n");
HDfprintf(stderr, " SRC The name of the source file\n");
HDfprintf(stderr, " DST The name of the destination files\n");
- HDfprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or "
- "`k' for kB.\n");
+ HDfprintf(stderr, "Sizes may be suffixed with 'g' for GB, 'm' for MB or "
+ "'k' for kB.\n");
HDfprintf(stderr, "File family names include an integer printf "
- "format such as `%%d'\n");
- HDexit (EXIT_FAILURE);
+ "format such as '%%d'\n");
+ HDexit(EXIT_FAILURE);
}
-
/*-------------------------------------------------------------------------
* Function: get_size
*
@@ -95,48 +94,47 @@ usage (const char *progname)
*-------------------------------------------------------------------------
*/
static off_t
-get_size (const char *progname, int *argno, int argc, char *argv[])
+get_size(const char *progname, int *argno, int argc, char *argv[])
{
- off_t retval=-1;
- char *suffix;
+ off_t retval = -1;
+ char *suffix = NULL;
- if (isdigit ((int)(argv[*argno][2]))) {
- retval = HDstrtol(argv[*argno]+2, &suffix, 10);
+ if (isdigit((int)(argv[*argno][2]))) {
+ retval = HDstrtol(argv[*argno] + 2, &suffix, 10);
(*argno)++;
}
- else if (argv[*argno][2] || *argno+1>=argc) {
- usage (progname);
+ else if (argv[*argno][2] || *argno + 1 >= argc) {
+ usage(progname);
}
else {
- retval = HDstrtol(argv[*argno+1], &suffix, 0);
- if (suffix == argv[*argno+1])
- usage (progname);
+ retval = HDstrtol(argv[*argno + 1], &suffix, 0);
+ if (suffix == argv[*argno + 1])
+ usage(progname);
*argno += 2;
}
if (suffix && suffix[0] && !suffix[1]) {
switch (*suffix) {
- case 'G':
- case 'g':
- retval *= 1024 * 1024 * 1024;
- break;
- case 'M':
- case 'm':
- retval *= 1024 * 1024;
- break;
- case 'k':
- retval *= 1024;
- break;
- default:
- usage(progname);
+ case 'G':
+ case 'g':
+ retval *= 1024 * 1024 * 1024;
+ break;
+ case 'M':
+ case 'm':
+ retval *= 1024 * 1024;
+ break;
+ case 'k':
+ retval *= 1024;
+ break;
+ default:
+ usage(progname);
}
}
else if (suffix && suffix[0]) {
- usage (progname);
+ usage(progname);
}
return retval;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -154,47 +152,47 @@ get_size (const char *progname, int *argno, int argc, char *argv[])
*-------------------------------------------------------------------------
*/
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
- const char *prog_name; /*program name */
- size_t blk_size=1024; /*size of each I/O block */
- char *buf=NULL; /*I/O block buffer */
- size_t n, i; /*counters */
- ssize_t nio; /*I/O return value */
- int argno=1; /*program argument number */
- int src, dst=-1; /*source & destination files */
- int need_seek=FALSE; /*destination needs to seek? */
- int need_write; /*data needs to be written? */
- h5_stat_t sb; /*temporary file stat buffer */
-
- int verbose=FALSE; /*display file names? */
-
- const char *src_gen_name; /*general source name */
- char *src_name=NULL; /*source member name */
-
- int src_is_family; /*is source name a family name? */
- int src_membno=0; /*source member number */
-
- const char *dst_gen_name; /*general destination name */
- char *dst_name=NULL; /*destination member name */
- int dst_is_family; /*is dst name a family name? */
- int dst_membno=0; /*destination member number */
-
- off_t left_overs=0; /*amount of zeros left over */
- off_t src_offset=0; /*offset in source member */
- off_t dst_offset=0; /*offset in destination member */
- off_t src_size; /*source logical member size */
- off_t src_act_size; /*source actual member size */
- off_t dst_size=1 GB; /*destination logical memb size */
- hid_t fapl; /*file access property list */
- hid_t file;
- hsize_t hdsize; /*destination logical memb size */
- hbool_t family_to_single = FALSE; /*change family to single file driver? */
+ const char *prog_name; /*program name */
+ size_t blk_size = 1024; /*size of each I/O block */
+ char * buf = NULL; /*I/O block buffer */
+ size_t n, i; /*counters */
+ ssize_t nio; /*I/O return value */
+ int argno = 1; /*program argument number */
+ int src, dst = -1; /*source & destination files */
+ int need_seek = FALSE; /*destination needs to seek? */
+ int need_write; /*data needs to be written? */
+ h5_stat_t sb; /*temporary file stat buffer */
+
+ int verbose = FALSE; /*display file names? */
+
+ const char *src_gen_name; /*general source name */
+ char * src_name = NULL; /*source member name */
+
+ int src_is_family; /*is source name a family name? */
+ int src_membno = 0; /*source member number */
+
+ const char *dst_gen_name; /*general destination name */
+ char * dst_name = NULL; /*destination member name */
+ int dst_is_family; /*is dst name a family name? */
+ int dst_membno = 0; /*destination member number */
+
+ off_t left_overs = 0; /*amount of zeros left over */
+ off_t src_offset = 0; /*offset in source member */
+ off_t dst_offset = 0; /*offset in destination member */
+ off_t src_size; /*source logical member size */
+ off_t src_act_size; /*source actual member size */
+ off_t dst_size = 1 GB; /*destination logical memb size */
+ hid_t fapl; /*file access property list */
+ hid_t file;
+ hsize_t hdsize; /*destination logical memb size */
+ hbool_t family_to_single = FALSE; /*change family to single file driver? */
/*
* Get the program name from argv[0]. Use only the last component.
*/
- if ((prog_name = HDstrrchr (argv[0], '/')))
+ if ((prog_name = HDstrrchr(argv[0], '/')))
prog_name++;
else
prog_name = argv[0];
@@ -206,28 +204,35 @@ main (int argc, char *argv[])
if (!HDstrcmp(argv[argno], "-v")) {
verbose = TRUE;
argno++;
- } else if (!HDstrcmp(argv[argno], "-V")) {
- HDprintf("This is %s version %u.%u release %u\n", prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
+ }
+ else if (!HDstrcmp(argv[argno], "-V")) {
+ HDprintf("This is %s version %u.%u release %u\n", prog_name, H5_VERS_MAJOR, H5_VERS_MINOR,
+ H5_VERS_RELEASE);
HDexit(EXIT_SUCCESS);
- } else if (!HDstrcmp(argv[argno], "-family_to_sec2")) {
+ }
+ else if (!HDstrcmp(argv[argno], "-family_to_sec2")) {
family_to_single = TRUE;
argno++;
- } else if (!HDstrcmp(argv[argno], "-family_to_single")) {
+ }
+ else if (!HDstrcmp(argv[argno], "-family_to_single")) {
family_to_single = TRUE;
argno++;
- } else if ('b' == argv[argno][1]) {
- blk_size = (size_t) get_size(prog_name, &argno, argc, argv);
- } else if ('m' == argv[argno][1]) {
+ }
+ else if ('b' == argv[argno][1]) {
+ blk_size = (size_t)get_size(prog_name, &argno, argc, argv);
+ }
+ else if ('m' == argv[argno][1]) {
dst_size = get_size(prog_name, &argno, argc, argv);
- } else {
+ }
+ else {
usage(prog_name);
} /* end if */
- } /* end while */
+ } /* end while */
/* allocate names */
- if(NULL == (src_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
+ if (NULL == (src_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
HDexit(EXIT_FAILURE);
- if(NULL == (dst_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
+ if (NULL == (dst_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
HDexit(EXIT_FAILURE);
/*
@@ -238,7 +243,7 @@ main (int argc, char *argv[])
usage(prog_name);
src_gen_name = argv[argno++];
HDsprintf(src_name, src_gen_name, src_membno);
- src_is_family = strcmp (src_name, src_gen_name);
+ src_is_family = strcmp(src_name, src_gen_name);
if ((src = HDopen(src_name, O_RDONLY)) < 0) {
HDperror(src_name);
@@ -256,13 +261,13 @@ main (int argc, char *argv[])
/*
* Get the name for the destination file and open the first member.
*/
- if (argno>=argc)
- usage (prog_name);
+ if (argno >= argc)
+ usage(prog_name);
dst_gen_name = argv[argno++];
HDsprintf(dst_name, dst_gen_name, dst_membno);
dst_is_family = HDstrcmp(dst_name, dst_gen_name);
- if ((dst = HDopen(dst_name, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) {
+ if ((dst = HDopen(dst_name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) {
HDperror(dst_name);
HDexit(EXIT_FAILURE);
}
@@ -271,32 +276,32 @@ main (int argc, char *argv[])
/* No more arguments */
if (argno < argc)
- usage (prog_name);
+ usage(prog_name);
/* Now the real work, split the file */
buf = (char *)HDmalloc(blk_size);
- while (src_offset<src_size) {
+ while (src_offset < src_size) {
- /* Read a block. The amount to read is the minimum of:
- * 1. The I/O block size
- * 2. What's left to write in the destination member
- * 3. Left over zeros or what's left in the source member.
- */
+ /* Read a block. The amount to read is the minimum of:
+ * 1. The I/O block size
+ * 2. What's left to write in the destination member
+ * 3. Left over zeros or what's left in the source member.
+ */
n = blk_size;
if (dst_is_family)
- n = (size_t)MIN((off_t)n, dst_size-dst_offset);
+ n = (size_t)MIN((off_t)n, dst_size - dst_offset);
if (left_overs) {
- n = (size_t)MIN((off_t)n, left_overs);
- left_overs = left_overs - (off_t) n;
+ n = (size_t)MIN((off_t)n, left_overs);
+ left_overs = left_overs - (off_t)n;
need_write = FALSE;
}
else if (src_offset < src_act_size) {
- n = (size_t)MIN((off_t)n, src_act_size-src_offset);
+ n = (size_t)MIN((off_t)n, src_act_size - src_offset);
if ((nio = HDread(src, buf, n)) < 0) {
HDperror("read");
HDexit(EXIT_FAILURE);
}
- else if ((size_t) nio != n) {
+ else if ((size_t)nio != n) {
HDfprintf(stderr, "%s: short read\n", src_name);
HDexit(EXIT_FAILURE);
}
@@ -307,18 +312,18 @@ main (int argc, char *argv[])
need_write = (i < n);
}
else {
- n = 0;
+ n = 0;
left_overs = src_size - src_act_size;
need_write = FALSE;
}
- /*
- * If the block contains non-zero data then write it to the
- * destination, otherwise just remember that we'll have to do a seek
- * later in the destination when we finally get non-zero data.
- */
+ /*
+ * If the block contains non-zero data then write it to the
+ * destination, otherwise just remember that we'll have to do a seek
+ * later in the destination when we finally get non-zero data.
+ */
if (need_write) {
- if (need_seek && HDlseek (dst, dst_offset, SEEK_SET) < 0) {
+ if (need_seek && HDlseek(dst, dst_offset, SEEK_SET) < 0) {
HDperror("HDlseek");
HDexit(EXIT_FAILURE);
}
@@ -326,7 +331,7 @@ main (int argc, char *argv[])
HDperror("write");
HDexit(EXIT_FAILURE);
}
- else if ((size_t) nio != n) {
+ else if ((size_t)nio != n) {
HDfprintf(stderr, "%s: short write\n", dst_name);
HDexit(EXIT_FAILURE);
}
@@ -336,64 +341,64 @@ main (int argc, char *argv[])
need_seek = TRUE;
}
- /*
- * Update the source offset and open the next source family member if
- * necessary. The source stream ends at the first member which
- * cannot be opened because it doesn't exist. At the end of the
- * source stream, update the destination offset and break out of the
- * loop. The destination offset must be updated so we can fix
- * trailing holes.
- */
- src_offset = src_offset + (off_t) n;
+ /*
+ * Update the source offset and open the next source family member if
+ * necessary. The source stream ends at the first member which
+ * cannot be opened because it doesn't exist. At the end of the
+ * source stream, update the destination offset and break out of the
+ * loop. The destination offset must be updated so we can fix
+ * trailing holes.
+ */
+ src_offset = src_offset + (off_t)n;
if (src_offset == src_act_size) {
HDclose(src);
if (!src_is_family) {
- dst_offset = dst_offset + (off_t) n;
+ dst_offset = dst_offset + (off_t)n;
break;
}
HDsprintf(src_name, src_gen_name, ++src_membno);
if ((src = HDopen(src_name, O_RDONLY)) < 0 && ENOENT == errno) {
- dst_offset = dst_offset + (off_t) n;
+ dst_offset = dst_offset + (off_t)n;
break;
}
else if (src < 0) {
HDperror(src_name);
HDexit(EXIT_FAILURE);
}
- if (HDfstat (src, &sb) < 0) {
+ if (HDfstat(src, &sb) < 0) {
HDperror("fstat");
HDexit(EXIT_FAILURE);
}
src_act_size = sb.st_size;
if (src_act_size > src_size) {
- HDfprintf(stderr, "%s: member truncated to %lu bytes\n", src_name, (unsigned long) src_size);
+ HDfprintf(stderr, "%s: member truncated to %lu bytes\n", src_name, (unsigned long)src_size);
}
src_offset = 0;
if (verbose)
HDfprintf(stderr, "< %s\n", src_name);
}
- /*
- * Update the destination offset, opening a new member if one will be
- * needed. The first member is extended to the logical member size
- * but other members might be smaller if they end with a hole.
- */
- dst_offset = dst_offset + (off_t) n;
+ /*
+ * Update the destination offset, opening a new member if one will be
+ * needed. The first member is extended to the logical member size
+ * but other members might be smaller if they end with a hole.
+ */
+ dst_offset = dst_offset + (off_t)n;
if (dst_is_family && dst_offset == dst_size) {
if (0 == dst_membno) {
- if (HDlseek (dst, dst_size-1, SEEK_SET) < 0) {
+ if (HDlseek(dst, dst_size - 1, SEEK_SET) < 0) {
HDperror("HDHDlseek");
HDexit(EXIT_FAILURE);
}
- if (HDread (dst, buf, 1) < 0) {
+ if (HDread(dst, buf, 1) < 0) {
HDperror("read");
HDexit(EXIT_FAILURE);
}
- if (HDlseek (dst, dst_size-1, SEEK_SET) < 0) {
+ if (HDlseek(dst, dst_size - 1, SEEK_SET) < 0) {
HDperror("HDlseek");
HDexit(EXIT_FAILURE);
}
- if (HDwrite (dst, buf, 1) < 0) {
+ if (HDwrite(dst, buf, 1) < 0) {
HDperror("write");
HDexit(EXIT_FAILURE);
}
@@ -405,7 +410,7 @@ main (int argc, char *argv[])
HDexit(EXIT_FAILURE);
}
dst_offset = 0;
- need_seek = FALSE;
+ need_seek = FALSE;
if (verbose)
HDfprintf(stderr, "> %s\n", dst_name);
}
@@ -417,56 +422,56 @@ main (int argc, char *argv[])
* family has been truncated.
*/
if (need_seek) {
- if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) {
- HDperror ("HDlseek");
- HDexit (EXIT_FAILURE);
+ if (HDlseek(dst, dst_offset - 1, SEEK_SET) < 0) {
+ HDperror("HDlseek");
+ HDexit(EXIT_FAILURE);
}
- if (HDread (dst, buf, 1)<0) {
- HDperror ("read");
- HDexit (EXIT_FAILURE);
+ if (HDread(dst, buf, 1) < 0) {
+ HDperror("read");
+ HDexit(EXIT_FAILURE);
}
- if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) {
- HDperror ("HDlseek");
- HDexit (EXIT_FAILURE);
+ if (HDlseek(dst, dst_offset - 1, SEEK_SET) < 0) {
+ HDperror("HDlseek");
+ HDexit(EXIT_FAILURE);
}
- if (HDwrite (dst, buf, 1)<0) {
- HDperror ("write");
- HDexit (EXIT_FAILURE);
+ if (HDwrite(dst, buf, 1) < 0) {
+ HDperror("write");
+ HDexit(EXIT_FAILURE);
}
}
- HDclose (dst);
+ HDclose(dst);
/* Modify family driver information saved in superblock through private property.
* These private properties are for this tool only. */
- if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- HDperror ("H5Pcreate");
- HDexit (EXIT_FAILURE);
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ HDperror("H5Pcreate");
+ HDexit(EXIT_FAILURE);
}
- if(family_to_single) {
+ if (family_to_single) {
/* The user wants to change file driver from family to a single-file VFD.
* Open the file with the sec2, windows, etc. driver. This property signals
* the library to ignore the family driver information saved in the superblock.
*/
- if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SINGLE_NAME, &family_to_single) < 0) {
- HDperror ("H5Pset");
- HDexit (EXIT_FAILURE);
+ if (H5Pset(fapl, H5F_ACS_FAMILY_TO_SINGLE_NAME, &family_to_single) < 0) {
+ HDperror("H5Pset");
+ HDexit(EXIT_FAILURE);
}
}
else {
/* Modify family size saved in superblock through private property. It signals
* library to save the new member size(specified in command line) in superblock.
* This private property is for this tool only. */
- if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) {
- HDperror ("H5Pset_fapl_family");
- HDexit (EXIT_FAILURE);
+ if (H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) {
+ HDperror("H5Pset_fapl_family");
+ HDexit(EXIT_FAILURE);
}
/* Set the property of the new member size as hsize_t */
hdsize = (hsize_t)dst_size;
- if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) {
- HDperror ("H5Pset");
- HDexit (EXIT_FAILURE);
+ if (H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) {
+ HDperror("H5Pset");
+ HDexit(EXIT_FAILURE);
}
}
@@ -478,18 +483,20 @@ main (int argc, char *argv[])
* file and the new file can only be a single file, reopen the new file should fail.
* There's nothing to do in this case.
*/
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
file = H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- if(file >= 0) {
- if(H5Fclose(file) < 0) {
+ if (file >= 0) {
+ if (H5Fclose(file) < 0) {
HDperror("H5Fclose");
HDexit(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
- if(H5Pclose(fapl) < 0) {
+ if (H5Pclose(fapl) < 0) {
HDperror("H5Pclose");
HDexit(EXIT_FAILURE);
} /* end if */
diff --git a/tools/test/Makefile.am b/tools/test/Makefile.am
index 19bb047..1e4e09b 100644
--- a/tools/test/Makefile.am
+++ b/tools/test/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/Makefile.in b/tools/test/Makefile.in
index 9e180cb..dd1cb98 100644
--- a/tools/test/Makefile.in
+++ b/tools/test/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -113,6 +113,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -423,9 +424,9 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -463,11 +464,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -499,8 +545,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -514,7 +558,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -524,6 +570,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -717,7 +764,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1241,8 +1288,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt
index 034c8d3..f63eb84 100644
--- a/tools/test/h5copy/CMakeLists.txt
+++ b/tools/test/h5copy/CMakeLists.txt
@@ -6,11 +6,18 @@ project (HDF5_TOOLS_TEST_H5COPY C)
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c)
- target_include_directories (h5copygentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5copygentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5copygentest STATIC)
target_link_libraries (h5copygentest PRIVATE ${HDF5_LIB_TARGET})
set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools)
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5COPY_FORMAT h5copygentest)
+ endif ()
+
#add_test (NAME h5copygentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5copygentest>)
endif ()
@@ -23,13 +30,21 @@ if (BUILD_SHARED_LIBS)
set (H5COPY_TOOL_PLUGIN_LIB_TARGET ${H5COPY_TOOL_PLUGIN_LIB_CORENAME})
add_library (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c)
- target_include_directories (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED)
- target_link_libraries (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ target_link_libraries (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${H5COPY_TOOL_PLUGIN_LIB_TARGET} ${H5COPY_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5COPY_PLUGIN_FORMAT ${H5COPY_TOOL_PLUGIN_LIB_TARGET})
+ endif ()
+
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
+
#-----------------------------------------------------------------------------
# Copy plugin library to a plugins folder
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake
index 4ce0318..e9b36fe 100644
--- a/tools/test/h5copy/CMakeTests.cmake
+++ b/tools/test/h5copy/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -76,13 +76,13 @@
endif ()
# resultcode=2 will cause the test to skip the diff test
- if (NOT ${resultcode} EQUAL 2)
+ if (NOT "${resultcode}" STREQUAL "2")
add_test (
NAME H5COPY_F-${testname}-DIFF
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname})
- if (${resultcode} EQUAL 1)
+ if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
endif ()
@@ -110,13 +110,13 @@
endif ()
# resultcode=2 will cause the test to skip the diff test
- if (NOT ${resultcode} EQUAL 2)
+ if (NOT "${resultcode}" STREQUAL "2")
add_test (
NAME H5COPY-${testname}-DIFF
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
- if (${resultcode} EQUAL 1)
+ if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
endif ()
@@ -159,13 +159,13 @@
)
set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill)
# resultcode=2 will cause the test to skip the diff test
- if (NOT ${resultcode} EQUAL 2)
+ if (NOT "${resultcode}" STREQUAL "2")
add_test (
NAME H5COPY-${testname}-DIFF
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
- if (${resultcode} EQUAL 1)
+ if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
endif ()
@@ -198,13 +198,13 @@
)
set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill)
# resultcode=2 will cause the test to skip the diff test
- if (NOT ${resultcode} EQUAL 2)
+ if (NOT "${resultcode}" STREQUAL "2")
add_test (
NAME H5COPY_SAME-${testname}-DIFF
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname})
- if (${resultcode} EQUAL 1)
+ if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
endif ()
@@ -218,7 +218,7 @@
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5COPY-CMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5copy${tgt_file_ext}> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN})
- if (${resultcode} EQUAL 1)
+ if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true")
endif ()
if (last_test)
@@ -255,7 +255,7 @@
NAME H5COPY_UD-${testname}-clear-objects
COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.out.h5
)
- if (${resultcode} EQUAL 2)
+ if ("${resultcode}" STREQUAL "2")
add_test (
NAME H5COPY_UD-${testname}
COMMAND "${CMAKE_COMMAND}"
@@ -318,7 +318,7 @@
NAME H5COPY_UD_ERR-${testname}-clearall-objects
COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}_ERR.out.h5
)
- if (${resultcode} EQUAL 2)
+ if ("${resultcode}" STREQUAL "2")
add_test (
NAME H5COPY_UD_ERR-${testname}
COMMAND "${CMAKE_COMMAND}"
diff --git a/tools/test/h5copy/Makefile.am b/tools/test/h5copy/Makefile.am
index 5fda4a0..804fc56 100644
--- a/tools/test/h5copy/Makefile.am
+++ b/tools/test/h5copy/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/h5copy/Makefile.in b/tools/test/h5copy/Makefile.in
index c84f6b9..c00be5b 100644
--- a/tools/test/h5copy/Makefile.in
+++ b/tools/test/h5copy/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -114,6 +114,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -417,12 +418,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -460,11 +461,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -496,8 +542,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -511,7 +555,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -521,6 +567,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -714,7 +761,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1233,8 +1280,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/h5copy/dynlib_copy.c b/tools/test/h5copy/dynlib_copy.c
index 571452e..b954a22 100644
--- a/tools/test/h5copy/dynlib_copy.c
+++ b/tools/test/h5copy/dynlib_copy.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,25 +17,33 @@
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIBUD 300
-#define MULTIPLIER 3
+#define H5Z_FILTER_DYNLIBUD 300
+#define MULTIPLIER 3
-static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIBUD, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlibud", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIBUD, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlibud", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ H5Z_filter_dynlibud, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return H5Z_DYNLIBUD;
+}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlibud
@@ -51,39 +59,37 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- char *int_ptr = (char *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ char * int_ptr = (char *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
- if(cd_nelmts > 0)
- return(0);
+ if (cd_nelmts > 0)
+ return (0);
/* Assignment to eliminate unused parameter warning. */
- cd_values = cd_values;
+ (void)cd_values;
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = temp - MULTIPLIER;
+ *int_ptr = temp - MULTIPLIER;
int_ptr++;
buf_left -= sizeof(*int_ptr);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = temp + MULTIPLIER;
+ *int_ptr = temp + MULTIPLIER;
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlibud() */
-
diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c
index 8c8a890..bc66bcf 100644
--- a/tools/test/h5copy/h5copygentest.c
+++ b/tools/test/h5copy/h5copygentest.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,35 +18,34 @@
#include "H5private.h"
/* HDF file names */
-#define HDF_FILE1 "h5copytst.h5"
-#define HDF_FILE1_NEW "h5copytst_new.h5"
-#define HDF_FILE2 "h5copy_ref.h5"
-#define HDF_EXT_SRC_FILE "h5copy_extlinks_src.h5"
-#define HDF_EXT_TRG_FILE "h5copy_extlinks_trg.h5"
+#define HDF_FILE1 "h5copytst.h5"
+#define HDF_FILE1_NEW "h5copytst_new.h5"
+#define HDF_FILE2 "h5copy_ref.h5"
+#define HDF_EXT_SRC_FILE "h5copy_extlinks_src.h5"
+#define HDF_EXT_TRG_FILE "h5copy_extlinks_trg.h5"
/* objects in HDF_FILE1 */
-#define DATASET_SIMPLE "simple"
-#define DATASET_CHUNK "chunk"
-#define DATASET_COMPACT "compact"
-#define DATASET_COMPOUND "compound"
-#define DATASET_COMPRESSED "compressed"
-#define DATASET_NAMED_VL "named_vl"
-#define DATASET_NESTED_VL "nested_vl"
-#define DATASET_ATTR "dset_attr"
-#define ATTR "attr"
-#define GROUP_EMPTY "grp_empty"
-#define GROUP_DATASETS "grp_dsets"
-#define GROUP_NESTED "grp_nested"
-#define GROUP_ATTR "grp_attr"
+#define DATASET_SIMPLE "simple"
+#define DATASET_CHUNK "chunk"
+#define DATASET_COMPACT "compact"
+#define DATASET_COMPOUND "compound"
+#define DATASET_COMPRESSED "compressed"
+#define DATASET_NAMED_VL "named_vl"
+#define DATASET_NESTED_VL "nested_vl"
+#define DATASET_ATTR "dset_attr"
+#define ATTR "attr"
+#define GROUP_EMPTY "grp_empty"
+#define GROUP_DATASETS "grp_dsets"
+#define GROUP_NESTED "grp_nested"
+#define GROUP_ATTR "grp_attr"
/* Obj reference */
-#define OBJ_REF_DS "Dset1"
+#define OBJ_REF_DS "Dset1"
#define OBJ_REF_GRP "Group"
/* Region reference */
#define REG_REF_DS1 "Dset_REGREF"
#define REG_REF_DS2 "Dset2"
-
/*-------------------------------------------------------------------------
* Function: gent_simple
*
@@ -54,11 +53,12 @@
*
*-------------------------------------------------------------------------
*/
-static void gent_simple(hid_t loc_id)
+static void
+gent_simple(hid_t loc_id)
{
hid_t sid, did;
hsize_t dims[1] = {6};
- int buf[6] = {1,2,3,4,5,6};
+ int buf[6] = {1, 2, 3, 4, 5, 6};
/* create dataspace */
sid = H5Screate_simple(1, dims, NULL);
@@ -81,12 +81,13 @@ static void gent_simple(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_chunked(hid_t loc_id)
+static void
+gent_chunked(hid_t loc_id)
{
hid_t sid, did, pid;
- hsize_t dims[1] = {6};
+ hsize_t dims[1] = {6};
hsize_t chunk_dims[1] = {2};
- int buf[6] = {1,2,3,4,5,6};
+ int buf[6] = {1, 2, 3, 4, 5, 6};
/* create dataspace */
sid = H5Screate_simple(1, dims, NULL);
@@ -107,7 +108,6 @@ static void gent_chunked(hid_t loc_id)
H5Pclose(pid);
}
-
/*-------------------------------------------------------------------------
* Function: gent_compact
*
@@ -115,18 +115,19 @@ static void gent_chunked(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_compact(hid_t loc_id)
+static void
+gent_compact(hid_t loc_id)
{
hid_t sid, did, pid;
hsize_t dims[1] = {6};
- int buf[6] = {1,2,3,4,5,6};
+ int buf[6] = {1, 2, 3, 4, 5, 6};
/* create dataspace */
sid = H5Screate_simple(1, dims, NULL);
/* create property plist */
pid = H5Pcreate(H5P_DATASET_CREATE);
- H5Pset_layout (pid,H5D_COMPACT);
+ H5Pset_layout(pid, H5D_COMPACT);
/* create dataset */
did = H5Dcreate2(loc_id, DATASET_COMPACT, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT);
@@ -140,7 +141,6 @@ static void gent_compact(hid_t loc_id)
H5Pclose(pid);
}
-
/*-------------------------------------------------------------------------
* Function: gent_compound
*
@@ -148,10 +148,10 @@ static void gent_compact(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_compound(hid_t loc_id)
+static void
+gent_compound(hid_t loc_id)
{
- typedef struct s_t
- {
+ typedef struct s_t {
char str1[20];
char str2[20];
} s_t;
@@ -167,8 +167,8 @@ static void gent_compound(hid_t loc_id)
tid_s = H5Tcopy(H5T_C_S1);
H5Tset_size(tid_s, 20);
- H5Tinsert(tid_c, "str1", HOFFSET(s_t,str1), tid_s);
- H5Tinsert(tid_c, "str2", HOFFSET(s_t,str2), tid_s);
+ H5Tinsert(tid_c, "str1", HOFFSET(s_t, str1), tid_s);
+ H5Tinsert(tid_c, "str2", HOFFSET(s_t, str2), tid_s);
/* create dataset */
did = H5Dcreate2(loc_id, DATASET_COMPOUND, tid_c, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -190,12 +190,13 @@ static void gent_compound(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_compressed(hid_t loc_id)
+static void
+gent_compressed(hid_t loc_id)
{
hid_t sid, did, pid;
- hsize_t dims[1] = {6};
+ hsize_t dims[1] = {6};
hsize_t chunk_dims[1] = {2};
- int buf[6] = {1,2,3,4,5,6};
+ int buf[6] = {1, 2, 3, 4, 5, 6};
/* create dataspace */
sid = H5Screate_simple(1, dims, NULL);
@@ -205,7 +206,7 @@ static void gent_compressed(hid_t loc_id)
H5Pset_chunk(pid, 1, chunk_dims);
/* set the deflate filter */
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
H5Pset_deflate(pid, 1);
#endif
@@ -221,7 +222,6 @@ static void gent_compressed(hid_t loc_id)
H5Pclose(pid);
}
-
/*-------------------------------------------------------------------------
* Function: gent_named_vl
*
@@ -230,20 +230,21 @@ static void gent_compressed(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_named_vl(hid_t loc_id)
+static void
+gent_named_vl(hid_t loc_id)
{
hid_t sid, did, tid;
hsize_t dims[1] = {2};
hvl_t buf[2];
/* allocate and initialize VL dataset to write */
- buf[0].len = 1;
- buf[0].p = HDmalloc( 1 * sizeof(int));
- ((int *)buf[0].p)[0]=1;
- buf[1].len = 2;
- buf[1].p = HDmalloc( 2 * sizeof(int));
- ((int *)buf[1].p)[0]=2;
- ((int *)buf[1].p)[1]=3;
+ buf[0].len = 1;
+ buf[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf[0].p)[0] = 1;
+ buf[1].len = 2;
+ buf[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf[1].p)[0] = 2;
+ ((int *)buf[1].p)[1] = 3;
/* create dataspace */
sid = H5Screate_simple(1, dims, NULL);
@@ -261,13 +262,12 @@ static void gent_named_vl(hid_t loc_id)
H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
/* close */
- H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf);
+ H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
H5Sclose(sid);
H5Dclose(did);
H5Tclose(tid);
}
-
/*-------------------------------------------------------------------------
* Function: gent_nested_vl
*
@@ -275,28 +275,29 @@ static void gent_named_vl(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_nested_vl(hid_t loc_id)
+static void
+gent_nested_vl(hid_t loc_id)
{
hid_t sid, did, tid1, tid2;
hsize_t dims[1] = {2};
hvl_t buf[2];
- hvl_t *tvl;
+ hvl_t * tvl;
/* allocate and initialize VL dataset to write */
- buf[0].len = 1;
- buf[0].p = HDmalloc( 1 * sizeof(hvl_t));
- tvl = (hvl_t *)buf[0].p;
- tvl->p = HDmalloc( 1 * sizeof(int) );
- tvl->len = 1;
- ((int *)tvl->p)[0]=1;
-
- buf[1].len = 1;
- buf[1].p = HDmalloc( 1 * sizeof(hvl_t));
- tvl = (hvl_t *)buf[1].p;
- tvl->p = HDmalloc( 2 * sizeof(int) );
- tvl->len = 2;
- ((int *)tvl->p)[0]=2;
- ((int *)tvl->p)[1]=3;
+ buf[0].len = 1;
+ buf[0].p = HDmalloc(1 * sizeof(hvl_t));
+ tvl = (hvl_t *)buf[0].p;
+ tvl->p = HDmalloc(1 * sizeof(int));
+ tvl->len = 1;
+ ((int *)tvl->p)[0] = 1;
+
+ buf[1].len = 1;
+ buf[1].p = HDmalloc(1 * sizeof(hvl_t));
+ tvl = (hvl_t *)buf[1].p;
+ tvl->p = HDmalloc(2 * sizeof(int));
+ tvl->len = 2;
+ ((int *)tvl->p)[0] = 2;
+ ((int *)tvl->p)[1] = 3;
/* create dataspace */
sid = H5Screate_simple(1, dims, NULL);
@@ -314,14 +315,13 @@ static void gent_nested_vl(hid_t loc_id)
H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
/* close */
- H5Dvlen_reclaim(tid2,sid,H5P_DEFAULT,buf);
+ H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf);
H5Sclose(sid);
H5Dclose(did);
H5Tclose(tid1);
H5Tclose(tid2);
}
-
/*-------------------------------------------------------------------------
* Function: gent_att_compound_vlstr
*
@@ -331,22 +331,23 @@ static void gent_nested_vl(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_att_compound_vlstr(hid_t loc_id)
+static void
+gent_att_compound_vlstr(hid_t loc_id)
{
typedef struct { /* Compound structure for the attribute */
- int i;
+ int i;
const char *v;
} s1;
- hsize_t dim[1] = {1}; /* Dimension size */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hid_t tid = H5I_INVALID_HID; /* Datatype ID */
- hid_t aid = H5I_INVALID_HID; /* Attribute ID */
- hid_t did = H5I_INVALID_HID; /* Dataset ID */
- hid_t gid = H5I_INVALID_HID; /* Group ID */
- hid_t vl_str_tid = H5I_INVALID_HID; /* Variable length datatype ID */
- hid_t cmpd_tid = H5I_INVALID_HID; /* Compound datatype ID */
- hid_t null_sid = H5I_INVALID_HID; /* Null dataspace ID */
- s1 buf; /* Buffer */
+ hsize_t dim[1] = {1}; /* Dimension size */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t tid = H5I_INVALID_HID; /* Datatype ID */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t vl_str_tid = H5I_INVALID_HID; /* Variable length datatype ID */
+ hid_t cmpd_tid = H5I_INVALID_HID; /* Compound datatype ID */
+ hid_t null_sid = H5I_INVALID_HID; /* Null dataspace ID */
+ s1 buf; /* Buffer */
buf.i = 9;
buf.v = "ThisIsAString";
@@ -409,7 +410,8 @@ static void gent_att_compound_vlstr(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_datasets(hid_t loc_id)
+static void
+gent_datasets(hid_t loc_id)
{
gent_simple(loc_id);
gent_chunked(loc_id);
@@ -427,9 +429,10 @@ static void gent_datasets(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_empty_group(hid_t loc_id)
+static void
+gent_empty_group(hid_t loc_id)
{
- hid_t gid;
+ hid_t gid;
/* Create group in location */
gid = H5Gcreate2(loc_id, GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -446,9 +449,10 @@ static void gent_empty_group(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_nested_datasets(hid_t loc_id)
+static void
+gent_nested_datasets(hid_t loc_id)
{
- hid_t gid;
+ hid_t gid;
/* Create group in location */
gid = H5Gcreate2(loc_id, GROUP_DATASETS, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -468,9 +472,10 @@ static void gent_nested_datasets(hid_t loc_id)
*
*-------------------------------------------------------------------------
*/
-static void gent_nested_group(hid_t loc_id)
+static void
+gent_nested_group(hid_t loc_id)
{
- hid_t gid;
+ hid_t gid;
/* Create group in location */
gid = H5Gcreate2(loc_id, GROUP_NESTED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -482,7 +487,6 @@ static void gent_nested_group(hid_t loc_id)
H5Gclose(gid);
}
-
/*-------------------------------------------------------------------------
* Function: gen_obj_ref
*
@@ -490,41 +494,39 @@ static void gent_nested_group(hid_t loc_id)
*
* Programmer: Jonathan Kim (Feb 23, 2010)
*------------------------------------------------------------------------*/
-static herr_t gen_obj_ref(hid_t loc_id)
+static herr_t
+gen_obj_ref(hid_t loc_id)
{
- hid_t sid=0, oid=0;
- hsize_t dims1[1]={3};
- hsize_t dims2[1]={2};
- int data[3] = {10,20,30};
- int status;
+ hid_t sid = 0, oid = 0;
+ hsize_t dims1[1] = {3};
+ hsize_t dims2[1] = {2};
+ int data[3] = {10, 20, 30};
+ int status;
/*---------------------
* create obj references to the previously created objects.
* Passing -1 as reference is an object.*/
- hobj_ref_t or_data[2]; /* write buffer */
- herr_t ret = SUCCEED;
+ hobj_ref_t or_data[2]; /* write buffer */
+ herr_t ret = SUCCEED;
/*--------------
* add dataset */
sid = H5Screate_simple(1, dims1, NULL);
- if (sid < 0)
- {
+ if (sid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- oid = H5Dcreate2 (loc_id, OBJ_REF_DS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (oid < 0)
- {
+ oid = H5Dcreate2(loc_id, OBJ_REF_DS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
status = H5Dwrite(oid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -535,64 +537,57 @@ static herr_t gen_obj_ref(hid_t loc_id)
/*--------------
* add group */
- oid = H5Gcreate2 (loc_id, OBJ_REF_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (oid < 0)
- {
+ oid = H5Gcreate2(loc_id, OBJ_REF_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
H5Gclose(oid);
- status = H5Rcreate (&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
+ status = H5Rcreate(&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- status = H5Rcreate (&or_data[1], loc_id, OBJ_REF_GRP, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
+ status = H5Rcreate(&or_data[1], loc_id, OBJ_REF_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- sid = H5Screate_simple (1, dims2, NULL);
- if (sid < 0)
- {
+ sid = H5Screate_simple(1, dims2, NULL);
+ if (sid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
- if (oid < 0)
- {
+ oid = H5Dcreate2(loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, or_data);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
out:
- if(oid > 0)
+ if (oid > 0)
H5Dclose(oid);
- if(sid > 0)
+ if (sid > 0)
H5Sclose(sid);
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: gen_region_ref
*
@@ -600,107 +595,98 @@ out:
*
* Programmer: Jonathan Kim (Feb 23, 2010)
*------------------------------------------------------------------------*/
-static herr_t gen_region_ref(hid_t loc_id)
+static herr_t
+gen_region_ref(hid_t loc_id)
{
- hid_t sid=0, oid1=0, oid2=0;
- int status;
- herr_t ret = SUCCEED;
- char data[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
- hsize_t dims2[2] = {3,16};
- hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} };
- hdset_reg_ref_t rr_data[2];
- hsize_t start[2] = {0,0};
- hsize_t stride[2] = {2,11};
- hsize_t count[2] = {2,2};
- hsize_t block[2] = {1,3};
- hsize_t dims1[1] = {2};
-
- sid = H5Screate_simple (2, dims2, NULL);
- if (sid < 0)
- {
+ hid_t sid = 0, oid1 = 0, oid2 = 0;
+ int status;
+ herr_t ret = SUCCEED;
+ char data[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
+ hsize_t dims2[2] = {3, 16};
+ hsize_t coords[4][2] = {{0, 1}, {2, 11}, {1, 0}, {2, 4}};
+ hdset_reg_ref_t rr_data[2];
+ hsize_t start[2] = {0, 0};
+ hsize_t stride[2] = {2, 11};
+ hsize_t count[2] = {2, 2};
+ hsize_t block[2] = {1, 3};
+ hsize_t dims1[1] = {2};
+
+ sid = H5Screate_simple(2, dims2, NULL);
+ if (sid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create normal dataset which is refered */
- oid2 = H5Dcreate2 (loc_id, REG_REF_DS2, H5T_STD_I8LE, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
- if (oid2 < 0)
- {
+ oid2 = H5Dcreate2(loc_id, REG_REF_DS2, H5T_STD_I8LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid2 < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* write values to dataset */
- status = H5Dwrite (oid2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- if (status < 0)
- {
+ status = H5Dwrite(oid2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* select elements space for reference */
- status = H5Sselect_elements (sid, H5S_SELECT_SET, 4, coords[0]);
- if (status < 0)
- {
+ status = H5Sselect_elements(sid, H5S_SELECT_SET, 4, coords[0]);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference from elements space */
- status = H5Rcreate (&rr_data[0], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
- if (status < 0)
- {
+ status = H5Rcreate(&rr_data[0], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* select hyperslab space for reference */
- status = H5Sselect_hyperslab (sid, H5S_SELECT_SET, start, stride, count, block);
- if (status < 0)
- {
+ status = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference from hyperslab space */
- status = H5Rcreate (&rr_data[1], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
- if (status < 0)
- {
+ status = H5Rcreate(&rr_data[1], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- H5Sclose (sid);
+ H5Sclose(sid);
/* Create dataspace. */
- sid = H5Screate_simple (1, dims1, NULL);
- if (sid < 0)
- {
+ sid = H5Screate_simple(1, dims1, NULL);
+ if (sid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference dataset */
- oid1 = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
- if (oid1 < 0)
- {
+ oid1 = H5Dcreate2(loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid1 < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* write data as region references */
- status = H5Dwrite (oid1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
- if (status < 0)
- {
+ status = H5Dwrite(oid1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -708,11 +694,11 @@ static herr_t gen_region_ref(hid_t loc_id)
out:
if (oid1 > 0)
- H5Dclose (oid1);
+ H5Dclose(oid1);
if (oid2 > 0)
- H5Dclose (oid2);
+ H5Dclose(oid2);
if (sid > 0)
- H5Sclose (sid);
+ H5Sclose(sid);
return ret;
}
@@ -723,31 +709,32 @@ out:
* Purpose: Testing with various objects
*
*------------------------------------------------------------------------*/
-static void Test_Obj_Copy(void)
+static void
+Test_Obj_Copy(void)
{
- hid_t fid = H5I_INVALID_HID; /* File id */
- hid_t fapl_new = (-1); /* File access property id */
- unsigned new_format; /* New format or old format */
+ hid_t fid = H5I_INVALID_HID; /* File id */
+ hid_t fapl_new = (-1); /* File access property id */
+ unsigned new_format; /* New format or old format */
- if((fapl_new = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((fapl_new = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
HDfprintf(stderr, "Error: H5Pcreate failed.\n");
goto out;
}
- if(H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ if (H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
HDfprintf(stderr, "Error: H5Pset_libver_bounds failed.\n");
goto out;
}
/* Test with old & new format groups */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
/* Set the FAPL for the type of format */
/* Create source file */
- if(new_format)
+ if (new_format)
fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new);
else
fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(fid < 0) {
+ if (fid < 0) {
HDfprintf(stderr, "Error: H5Fcreate failed.\n");
goto out;
}
@@ -764,11 +751,11 @@ static void Test_Obj_Copy(void)
out:
/*-----------------------------------------------------------------------
- * Close
- *------------------------------------------------------------------------*/
- if(fid > 0)
+ * Close
+ *------------------------------------------------------------------------*/
+ if (fid > 0)
H5Fclose(fid);
- if(fapl_new > 0)
+ if (fapl_new > 0)
H5Pclose(fapl_new);
}
@@ -778,14 +765,14 @@ out:
* Purpose: Testing with various references
*
*------------------------------------------------------------------------*/
-static void Test_Ref_Copy(void)
+static void
+Test_Ref_Copy(void)
{
- hid_t fid=0;
+ hid_t fid = 0;
herr_t status;
- fid = H5Fcreate (HDF_FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if (fid < 0)
- {
+ fid = H5Fcreate(HDF_FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_FILE2);
goto out;
}
@@ -802,9 +789,9 @@ static void Test_Ref_Copy(void)
out:
/*-----------------------------------------------------------------------
- * Close
- *------------------------------------------------------------------------*/
- if(fid > 0)
+ * Close
+ *------------------------------------------------------------------------*/
+ if (fid > 0)
H5Fclose(fid);
}
@@ -815,20 +802,20 @@ out:
*
* Programmer: Jonathan Kim (March 03, 2010)
*------------------------------------------------------------------------*/
-static herr_t gen_extlink_trg(hid_t loc_id)
+static herr_t
+gen_extlink_trg(hid_t loc_id)
{
- hid_t gid=0, tid=0;
- int status;
+ hid_t gid = 0, tid = 0;
+ int status;
herr_t ret = SUCCEED;
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
/*--------------
* target file */
gid = H5Gcreate2(loc_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (gid < 0)
- {
+ if (gid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -836,24 +823,23 @@ static herr_t gen_extlink_trg(hid_t loc_id)
/*--------------
* add dataset */
- gent_simple(loc_id);
+ gent_simple(loc_id);
/*--------------------
* add named datatype
*/
- tid = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tcommit2(loc_id, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(loc_id, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
out:
- if(gid > 0)
+ if (gid > 0)
H5Gclose(gid);
- if(tid > 0)
+ if (tid > 0)
H5Tclose(tid);
return ret;
@@ -866,30 +852,29 @@ out:
*
* Programmer: Jonathan Kim (March 03, 2010)
*------------------------------------------------------------------------*/
-static herr_t gen_extlink_src(hid_t loc_id)
+static herr_t
+gen_extlink_src(hid_t loc_id)
{
- hid_t gid=0;
- int status;
+ hid_t gid = 0;
+ int status;
herr_t ret = SUCCEED;
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
gid = H5Gcreate2(loc_id, "/group_ext", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (gid < 0)
- {
+ if (gid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/*-----------------------------------------------------------------------
- * External links
- *------------------------------------------------------------------------*/
+ * External links
+ *------------------------------------------------------------------------*/
/* link to dataset */
status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/simple", gid, "extlink_dset", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -897,17 +882,16 @@ static herr_t gen_extlink_src(hid_t loc_id)
/* link to group */
status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/group", gid, "extlink_grp", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* link to datatype */
- status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/datatype", gid, "extlink_datatype", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ status =
+ H5Lcreate_external(HDF_EXT_TRG_FILE, "/datatype", gid, "extlink_datatype", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -915,8 +899,7 @@ static herr_t gen_extlink_src(hid_t loc_id)
/* dangling link - no obj*/
status = H5Lcreate_external(HDF_EXT_TRG_FILE, "notyet", gid, "extlink_notyet1", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -924,15 +907,14 @@ static herr_t gen_extlink_src(hid_t loc_id)
/* dangling link - no file */
status = H5Lcreate_external("notyet_file.h5", "notyet", gid, "extlink_notyet2", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
out:
- if(gid > 0)
+ if (gid > 0)
H5Gclose(gid);
return ret;
@@ -944,22 +926,21 @@ out:
* Purpose: gerenate external link files
*
*------------------------------------------------------------------------*/
-static void Test_Extlink_Copy(void)
+static void
+Test_Extlink_Copy(void)
{
- hid_t fid1=0;
- hid_t fid2=0;
+ hid_t fid1 = 0;
+ hid_t fid2 = 0;
herr_t status;
- fid1 = H5Fcreate (HDF_EXT_SRC_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if (fid1 < 0)
- {
+ fid1 = H5Fcreate(HDF_EXT_SRC_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_SRC_FILE);
goto out;
}
- fid2 = H5Fcreate (HDF_EXT_TRG_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if (fid2 < 0)
- {
+ fid2 = H5Fcreate(HDF_EXT_TRG_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_TRG_FILE);
goto out;
}
@@ -976,11 +957,11 @@ static void Test_Extlink_Copy(void)
out:
/*-----------------------------------------------------------------------
- * Close
- *------------------------------------------------------------------------*/
- if(fid1 > 0)
+ * Close
+ *------------------------------------------------------------------------*/
+ if (fid1 > 0)
H5Fclose(fid1);
- if(fid2 > 0)
+ if (fid2 > 0)
H5Fclose(fid2);
}
@@ -990,7 +971,8 @@ out:
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
Test_Obj_Copy();
Test_Ref_Copy();
@@ -998,4 +980,3 @@ int main(void)
return 0;
}
-
diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in
index ebbcb6c..79b6fd5 100644
--- a/tools/test/h5copy/testh5copy.sh.in
+++ b/tools/test/h5copy/testh5copy.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt
index e4bfc99..f74db0f 100644
--- a/tools/test/h5diff/CMakeLists.txt
+++ b/tools/test/h5diff/CMakeLists.txt
@@ -6,11 +6,18 @@ project (HDF5_TOOLS_TEST_H5DIFF C)
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5diffgentest ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/h5diffgentest.c)
- target_include_directories (h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5diffgentest STATIC)
target_link_libraries (h5diffgentest PRIVATE ${HDF5_LIB_TARGET})
set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools)
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5DIFF_FORMAT h5diffgentest)
+ endif ()
+
#add_test (NAME h5diffgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diffgentest>)
endif ()
@@ -23,11 +30,18 @@ if (BUILD_SHARED_LIBS)
set (H5DIFF_TOOL_PLUGIN_LIB_TARGET ${H5DIFF_TOOL_PLUGIN_LIB_CORENAME})
add_library (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c)
- target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED)
- target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} ${H5DIFF_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5DIFF_PLUGIN_FORMAT ${H5DIFF_TOOL_PLUGIN_LIB_TARGET})
+ endif ()
+
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake
index ab15b02..4561306 100644
--- a/tools/test/h5diff/CMakeTests.cmake
+++ b/tools/test/h5diff/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -282,6 +282,7 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_80.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_800.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_801.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_830.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt
@@ -363,40 +364,44 @@
macro (ADD_H5_TEST resultfile resultcode)
if (HDF5_TEST_SERIAL)
- # If using memchecker add tests without using scripts
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> ${ARGN})
- set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (${resultcode})
- set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
- endif ()
- if (last_test)
- set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- else ()
- add_test (
- NAME H5DIFF-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_file_ext}>"
- -D "TEST_ARGS:STRING=${ARGN}"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
- -D "TEST_OUTPUT=${resultfile}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=${resultfile}.txt"
- -D "TEST_APPEND=EXIT CODE:"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- if (last_test)
- set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- endif ()
+ ADD_SH5_TEST (${resultfile} ${resultcode} ${ARGN})
endif ()
if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN})
endif ()
endmacro ()
+ macro (ADD_SH5_TEST resultfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> ${ARGN})
+ set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ if (${resultcode})
+ set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif ()
+ if (last_test)
+ set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ else ()
+ add_test (
+ NAME H5DIFF-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_file_ext}>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.txt"
+ -D "TEST_APPEND=EXIT CODE:"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ if (last_test)
+ set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ endif ()
+ endmacro ()
+
macro (ADD_PH5_TEST resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
@@ -433,7 +438,7 @@
macro (ADD_H5_UD_TEST testname resultcode resultfile)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
- if (${resultcode} EQUAL 2)
+ if ("${resultcode}" STREQUAL "2")
add_test (
NAME H5DIFF_UD-${testname}
COMMAND "${CMAKE_COMMAND}"
@@ -907,6 +912,8 @@
h5diff_800.out.err
h5diff_801.out
h5diff_801.out.err
+ h5diff_830.out
+ h5diff_830.out.err
h5diff_8625.out
h5diff_8625.out.err
h5diff_8639.out
@@ -1530,6 +1537,12 @@ ADD_H5_TEST (h5diff_800 1 -v ${FILE7} ${FILE8} /g1/array /g1/array)
ADD_H5_TEST (h5diff_801 1 -v ${FILE7} ${FILE8A} /g1/array /g1/array)
# ##############################################################################
+# # dataset subsets
+# ##############################################################################
+#serial only
+ADD_SH5_TEST (h5diff_830 1 --enable-error-stack -v ${FILE7} ${FILE8} /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;])
+
+# ##############################################################################
# # VDS tests
# ##############################################################################
ADD_H5_TEST (h5diff_v1 0 -v ${FILEV1} ${FILEV2})
diff --git a/tools/test/h5diff/Makefile.am b/tools/test/h5diff/Makefile.am
index 3a88573..17af61b 100644
--- a/tools/test/h5diff/Makefile.am
+++ b/tools/test/h5diff/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/h5diff/Makefile.in b/tools/test/h5diff/Makefile.in
index a6f75ef..cdc6a2d 100644
--- a/tools/test/h5diff/Makefile.in
+++ b/tools/test/h5diff/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -432,12 +433,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -475,11 +476,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -511,8 +557,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -526,7 +570,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -536,6 +582,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -729,7 +776,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1281,8 +1328,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c
index 661a6dc..433522d 100644
--- a/tools/test/h5diff/dynlib_diff.c
+++ b/tools/test/h5diff/dynlib_diff.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,25 +17,33 @@
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIBUD 300
-#define MULTIPLIER 3
+#define H5Z_FILTER_DYNLIBUD 300
+#define MULTIPLIER 3
-static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIBUD, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlibud", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIBUD, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlibud", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ H5Z_filter_dynlibud, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return H5Z_DYNLIBUD;
+}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlibud
@@ -51,39 +59,37 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- char *int_ptr = (char *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ char * int_ptr = (char *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
- if(cd_nelmts > 0)
- return(0);
+ if (cd_nelmts > 0)
+ return (0);
/* Assignment to eliminate unused parameter warning. */
- cd_values = cd_values;
+ (void)cd_values;
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp - MULTIPLIER);
+ *int_ptr = (int8_t)(temp - MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp + MULTIPLIER);
+ *int_ptr = (int8_t)(temp + MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlibud() */
-
diff --git a/tools/test/h5diff/h5diff_plugin.sh.in b/tools/test/h5diff/h5diff_plugin.sh.in
index ffc43da..0ab169a 100644
--- a/tools/test/h5diff/h5diff_plugin.sh.in
+++ b/tools/test/h5diff/h5diff_plugin.sh.in
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c
index 6bf68ac..bb87fb8 100644
--- a/tools/test/h5diff/h5diffgentest.c
+++ b/tools/test/h5diff/h5diffgentest.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -38,58 +38,58 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
*-------------------------------------------------------------------------
*/
-#define FILE1 "h5diff_basic1.h5"
-#define FILE2 "h5diff_basic2.h5"
-#define FILE3 "h5diff_types.h5"
-#define FILE4 "h5diff_dtypes.h5"
-#define FILE5 "h5diff_attr1.h5"
-#define FILE6 "h5diff_attr2.h5"
-#define FILE6a "h5diff_attr3.h5"
-#define FILE7 "h5diff_dset1.h5"
-#define FILE8 "h5diff_dset2.h5"
-#define FILE8A "h5diff_dset3.h5"
-#define FILE9 "h5diff_hyper1.h5"
-#define FILE10 "h5diff_hyper2.h5"
-#define FILE11 "h5diff_empty.h5"
-#define FILE12 "h5diff_links.h5"
-#define FILE13 "h5diff_softlinks.h5"
-#define FILE14 "h5diff_linked_softlink.h5"
-#define FILE15 "h5diff_extlink_src.h5"
-#define FILE16 "h5diff_extlink_trg.h5"
-#define FILE17 "h5diff_ext2softlink_src.h5"
-#define FILE18 "h5diff_ext2softlink_trg.h5"
-#define FILE19 "h5diff_dset_zero_dim_size1.h5"
-#define FILE20 "h5diff_dset_zero_dim_size2.h5"
-#define FILE21 "h5diff_dset_idx1.h5"
-#define FILE22 "h5diff_dset_idx2.h5"
-#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5"
-#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.h5"
-#define GRP_RECURSE_FILE1 "h5diff_grp_recurse1.h5"
-#define GRP_RECURSE_FILE2 "h5diff_grp_recurse2.h5"
+#define FILE1 "h5diff_basic1.h5"
+#define FILE2 "h5diff_basic2.h5"
+#define FILE3 "h5diff_types.h5"
+#define FILE4 "h5diff_dtypes.h5"
+#define FILE5 "h5diff_attr1.h5"
+#define FILE6 "h5diff_attr2.h5"
+#define FILE6a "h5diff_attr3.h5"
+#define FILE7 "h5diff_dset1.h5"
+#define FILE8 "h5diff_dset2.h5"
+#define FILE8A "h5diff_dset3.h5"
+#define FILE9 "h5diff_hyper1.h5"
+#define FILE10 "h5diff_hyper2.h5"
+#define FILE11 "h5diff_empty.h5"
+#define FILE12 "h5diff_links.h5"
+#define FILE13 "h5diff_softlinks.h5"
+#define FILE14 "h5diff_linked_softlink.h5"
+#define FILE15 "h5diff_extlink_src.h5"
+#define FILE16 "h5diff_extlink_trg.h5"
+#define FILE17 "h5diff_ext2softlink_src.h5"
+#define FILE18 "h5diff_ext2softlink_trg.h5"
+#define FILE19 "h5diff_dset_zero_dim_size1.h5"
+#define FILE20 "h5diff_dset_zero_dim_size2.h5"
+#define FILE21 "h5diff_dset_idx1.h5"
+#define FILE22 "h5diff_dset_idx2.h5"
+#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5"
+#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.h5"
+#define GRP_RECURSE_FILE1 "h5diff_grp_recurse1.h5"
+#define GRP_RECURSE_FILE2 "h5diff_grp_recurse2.h5"
/* same structure via external links through files */
-#define GRP_RECURSE1_EXT "h5diff_grp_recurse_ext1.h5"
-#define GRP_RECURSE2_EXT1 "h5diff_grp_recurse_ext2-1.h5"
-#define GRP_RECURSE2_EXT2 "h5diff_grp_recurse_ext2-2.h5"
-#define GRP_RECURSE2_EXT3 "h5diff_grp_recurse_ext2-3.h5"
+#define GRP_RECURSE1_EXT "h5diff_grp_recurse_ext1.h5"
+#define GRP_RECURSE2_EXT1 "h5diff_grp_recurse_ext2-1.h5"
+#define GRP_RECURSE2_EXT2 "h5diff_grp_recurse_ext2-2.h5"
+#define GRP_RECURSE2_EXT3 "h5diff_grp_recurse_ext2-3.h5"
/* same structure, same obj name with different value */
-#define EXCLUDE_FILE1_1 "h5diff_exclude1-1.h5"
-#define EXCLUDE_FILE1_2 "h5diff_exclude1-2.h5"
+#define EXCLUDE_FILE1_1 "h5diff_exclude1-1.h5"
+#define EXCLUDE_FILE1_2 "h5diff_exclude1-2.h5"
/* different structure and obj names */
-#define EXCLUDE_FILE2_1 "h5diff_exclude2-1.h5"
-#define EXCLUDE_FILE2_2 "h5diff_exclude2-2.h5"
+#define EXCLUDE_FILE2_1 "h5diff_exclude2-1.h5"
+#define EXCLUDE_FILE2_2 "h5diff_exclude2-2.h5"
/* only one file has unique objs */
-#define EXCLUDE_FILE3_1 "h5diff_exclude3-1.h5"
-#define EXCLUDE_FILE3_2 "h5diff_exclude3-2.h5"
+#define EXCLUDE_FILE3_1 "h5diff_exclude3-1.h5"
+#define EXCLUDE_FILE3_2 "h5diff_exclude3-2.h5"
/* compound type with multiple vlen string types */
-#define COMP_VL_STRS_FILE "h5diff_comp_vl_strs.h5"
+#define COMP_VL_STRS_FILE "h5diff_comp_vl_strs.h5"
/* attribute compre with verbose level */
#define ATTR_VERBOSE_LEVEL_FILE1 "h5diff_attr_v_level1.h5"
#define ATTR_VERBOSE_LEVEL_FILE2 "h5diff_attr_v_level2.h5"
/* file containing valid/invalid enum value mix */
#define ENUM_INVALID_VALUES "h5diff_enum_invalid_values.h5"
/* file with container types (array,vlen) with multiple compounds */
-#define COMPS_COMPLEX1 "compounds_array_vlen1.h5"
-#define COMPS_COMPLEX2 "compounds_array_vlen2.h5"
+#define COMPS_COMPLEX1 "compounds_array_vlen1.h5"
+#define COMPS_COMPLEX2 "compounds_array_vlen2.h5"
/* non-comparable dataset and attribute */
#define NON_COMPARBLES1 "non_comparables1.h5"
#define NON_COMPARBLES2 "non_comparables2.h5"
@@ -102,7 +102,7 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
#define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */
#define STR_SIZE 3
-#define GBLL ((unsigned long long) 1024 * 1024 *1024 )
+#define GBLL ((unsigned long long)1024 * 1024 * 1024)
#define MY_LINKCLASS 187
@@ -112,80 +112,82 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
#define SPACE1_DIM2 0
/* Error macros */
-#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC);
-#define PROGRAM_ERROR do {AT(); goto error;} while(0)
+#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC);
+#define PROGRAM_ERROR \
+ do { \
+ AT(); \
+ goto error; \
+ } while (0)
/* A UD link traversal function. Shouldn't actually be called. */
static hid_t
-UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group,
- H5_ATTR_UNUSED const void * udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id,
- H5_ATTR_UNUSED hid_t dxpl_id)
+UD_traverse(H5_ATTR_UNUSED const char *link_name, H5_ATTR_UNUSED hid_t cur_group,
+ H5_ATTR_UNUSED const void *udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id,
+ H5_ATTR_UNUSED hid_t dxpl_id)
{
return -1;
}
const H5L_class_t UD_link_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)MY_LINKCLASS, /* Link type id number */
- "UD link class", /* name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_traverse, /* The actual traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
+ (H5L_type_t)MY_LINKCLASS, /* Link type id number */
+ "UD link class", /* name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
}};
-
/*-------------------------------------------------------------------------
* prototypes
*-------------------------------------------------------------------------
*/
/* tests called in main() */
-static int test_basic(const char *fname1, const char *fname2, const char *fname3);
-static int test_types(const char *fname);
-static int test_datatypes(const char *fname);
-static int test_attributes(const char *fname, int make_diffs);
-static int test_datasets(const char *fname, int make_diffs);
-static int test_special_datasets(const char *fname, int make_diffs);
-static int test_hyperslab(const char *fname, int make_diffs);
-static int test_link_name(const char *fname1);
-static int test_soft_links(const char *fname1);
-static int test_linked_softlinks(const char *fname1);
-static int test_external_links(const char *fname1, const char *fname2);
-static int test_ext2soft_links(const char *fname1, const char *fname2);
-static int test_dangle_links(const char *fname1, const char *fname2);
-static int test_group_recurse(const char *fname1, const char *fname2);
-static int test_group_recurse2(void);
-static int test_exclude_obj1(const char *fname1, const char *fname2);
-static int test_exclude_obj2(const char *fname1, const char *fname2);
-static int test_exclude_obj3(const char *fname1, const char *fname2);
-static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new);
-static int test_attributes_verbose_level(const char *fname1, const char *fname2);
-static int test_enums(const char *fname);
-static void test_comps_array(const char *fname, const char *dset,
- const char *attr, int diff, int is_file_new);
-static void test_comps_vlen(const char *fname, const char *dset,
- const char *attr, int diff, int is_file_new);
-static void test_comps_array_vlen(const char *fname, const char *dset,
- const char *attr, int diff, int is_file_new);
-static void test_comps_vlen_arry(const char *fname, const char *dset,
- const char *attr, int diff, int is_file_new);
+static int test_basic(const char *fname1, const char *fname2, const char *fname3);
+static int test_types(const char *fname);
+static int test_datatypes(const char *fname);
+static int test_attributes(const char *fname, int make_diffs);
+static int test_datasets(const char *fname, int make_diffs);
+static int test_special_datasets(const char *fname, int make_diffs);
+static int test_hyperslab(const char *fname, int make_diffs);
+static int test_link_name(const char *fname1);
+static int test_soft_links(const char *fname1);
+static int test_linked_softlinks(const char *fname1);
+static int test_external_links(const char *fname1, const char *fname2);
+static int test_ext2soft_links(const char *fname1, const char *fname2);
+static int test_dangle_links(const char *fname1, const char *fname2);
+static int test_group_recurse(const char *fname1, const char *fname2);
+static int test_group_recurse2(void);
+static int test_exclude_obj1(const char *fname1, const char *fname2);
+static int test_exclude_obj2(const char *fname1, const char *fname2);
+static int test_exclude_obj3(const char *fname1, const char *fname2);
+static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new);
+static int test_attributes_verbose_level(const char *fname1, const char *fname2);
+static int test_enums(const char *fname);
+static void test_comps_array(const char *fname, const char *dset, const char *attr, int diff,
+ int is_file_new);
+static void test_comps_vlen(const char *fname, const char *dset, const char *attr, int diff, int is_file_new);
+static void test_comps_array_vlen(const char *fname, const char *dset, const char *attr, int diff,
+ int is_file_new);
+static void test_comps_vlen_arry(const char *fname, const char *dset, const char *attr, int diff,
+ int is_file_new);
static void test_data_nocomparables(const char *fname, int diff);
static void test_objs_nocomparables(const char *fname1, const char *fname2);
static void test_objs_strings(const char *fname, const char *fname2);
static void test_double_epsilon(const char *fname1, const char *fname2);
/* called by test_attributes() and test_datasets() */
-static void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs);
-static void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs);
-static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs);
+static void write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs);
+static void write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs);
+static void write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs);
static void gen_datareg(hid_t fid, int make_diffs);
/* utilities */
-static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf);
+static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf);
static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf);
-static int gen_dataset_idx(const char *file, int format);
+static int gen_dataset_idx(const char *file, int format);
/*-------------------------------------------------------------------------
* Function: main
@@ -195,7 +197,8 @@ static int gen_dataset_idx(const char *file, int format);
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
test_basic(FILE1, FILE2, FILE11);
@@ -235,11 +238,11 @@ int main(void)
test_special_datasets(FILE20, 1);
/*
- * Generate 2 files: FILE21 with old format; FILE22 with new format
- * Create 2 datasets in each file:
- * One dataset: chunked layout, w/o filters, fixed dimension
- * One dataset: chunked layout, w/ filters, fixed dimension
- */
+ * Generate 2 files: FILE21 with old format; FILE22 with new format
+ * Create 2 datasets in each file:
+ * One dataset: chunked layout, w/o filters, fixed dimension
+ * One dataset: chunked layout, w/ filters, fixed dimension
+ */
gen_dataset_idx(FILE21, 0);
gen_dataset_idx(FILE22, 1);
@@ -257,16 +260,16 @@ int main(void)
test_comp_vlen_strings(COMP_VL_STRS_FILE, "group_copy", 0);
/* diff when invalid enum values are present.
- * This will probably grow to involve more extensive testing of
- * enums so it has been given its own test file and test (apart
- * from the basic type testing).
- */
+ * This will probably grow to involve more extensive testing of
+ * enums so it has been given its own test file and test (apart
+ * from the basic type testing).
+ */
test_enums(ENUM_INVALID_VALUES);
/* -------------------------------------------------
- * Create test files with dataset and attribute with container types
- * (array, vlen) with multiple nested compound types.
- */
+ * Create test files with dataset and attribute with container types
+ * (array, vlen) with multiple nested compound types.
+ */
/* file1 */
test_comps_array(COMPS_COMPLEX1, "dset1", "attr1", 0, 1);
test_comps_vlen(COMPS_COMPLEX1, "dset2", "attr2", 0, 0);
@@ -279,10 +282,10 @@ int main(void)
test_comps_vlen_arry(COMPS_COMPLEX2, "dset4", "attr4", 5, 0);
/*-------------------------------------------------
- * Create test files with non-comparable dataset and attributes with
- * comparable datasets and attributes. All the comparables should display
- * differences.
- */
+ * Create test files with non-comparable dataset and attributes with
+ * comparable datasets and attributes. All the comparables should display
+ * differences.
+ */
test_data_nocomparables(NON_COMPARBLES1, 0);
test_data_nocomparables(NON_COMPARBLES2, 5);
@@ -307,13 +310,13 @@ int main(void)
*-------------------------------------------------------------------------
*/
-static
-int test_basic(const char *fname1, const char *fname2, const char *fname3)
+static int
+test_basic(const char *fname1, const char *fname2, const char *fname3)
{
- hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID, gid3 = H5I_INVALID_HID;
- hsize_t dims1[1] = { 6 };
- hsize_t dims2[2] = { 3, 2 };
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID, gid3 = H5I_INVALID_HID;
+ hsize_t dims1[1] = {6};
+ hsize_t dims2[2] = {3, 2};
/* create the empty file */
if ((fid1 = H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
@@ -326,9 +329,9 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
}
/*-------------------------------------------------------------------------
- * create two files
- *-------------------------------------------------------------------------
- */
+ * create two files
+ *-------------------------------------------------------------------------
+ */
if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
@@ -336,156 +339,141 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
goto out;
/*-------------------------------------------------------------------------
- * create groups
- *-------------------------------------------------------------------------
- */
+ * create groups
+ *-------------------------------------------------------------------------
+ */
gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
gid2 = H5Gcreate2(fid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
gid3 = H5Gcreate2(fid2, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * tests:
- * # 1.1 normal mode
- * # 1.2 normal mode with objects
- * # 1.3 report mode
- * # 1.4 report mode with objects
- * # 1.5 with -d
- *-------------------------------------------------------------------------
- */
+ * tests:
+ * # 1.1 normal mode
+ * # 1.2 normal mode with objects
+ * # 1.3 report mode
+ * # 1.4 report mode with objects
+ * # 1.5 with -d
+ *-------------------------------------------------------------------------
+ */
{
- double data1[3][2] =
- { { 1.0F, 1.0F }, { 1.00F, 1.000F }, { 0.0F, 0.0F } };
- double data2[3][2] =
- { { 0.0F, 1.1F }, { 1.01F, 1.001F }, { 0.0F, 1.0F } };
- double data3[3][2] = { { 100.0F, 100.0F }, { 100.00F, 100.000F }, {
- 100.0F, 100.0F } };
- double data4[3][2] = { { 105.0F, 120.0F }, { 160.00F, 95.000F }, {
- 80.0F, 40.0F } };
+ double data1[3][2] = {{1.0F, 1.0F}, {1.00F, 1.000F}, {0.0F, 0.0F}};
+ double data2[3][2] = {{0.0F, 1.1F}, {1.01F, 1.001F}, {0.0F, 1.0F}};
+ double data3[3][2] = {{100.0F, 100.0F}, {100.00F, 100.000F}, {100.0F, 100.0F}};
+ double data4[3][2] = {{105.0F, 120.0F}, {160.00F, 95.000F}, {80.0F, 40.0F}};
write_dset(gid1, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data1);
write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_DOUBLE, data2);
write_dset(gid1, 2, dims2, "dset3", H5T_NATIVE_DOUBLE, data3);
write_dset(gid2, 2, dims2, "dset4", H5T_NATIVE_DOUBLE, data4);
write_dset(gid2, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data2);
-
}
/*-------------------------------------------------------------------------
- * relative error, compare divide by zero, both zero
- * # 1.6.1 with -p (int)
- *-------------------------------------------------------------------------
- */
+ * relative error, compare divide by zero, both zero
+ * # 1.6.1 with -p (int)
+ *-------------------------------------------------------------------------
+ */
{
- int data5[3][2] = { { 100, 100 }, { 100, 0 }, { 0, 100 } };
- int data6[3][2] = { { 120, 80 }, { 0, 100 }, { 0, 50 } };
+ int data5[3][2] = {{100, 100}, {100, 0}, {0, 100}};
+ int data6[3][2] = {{120, 80}, {0, 100}, {0, 50}};
write_dset(gid1, 2, dims2, "dset5", H5T_NATIVE_INT, data5);
write_dset(gid1, 2, dims2, "dset6", H5T_NATIVE_INT, data6);
-
}
/*-------------------------------------------------------------------------
- * relative error, compare divide by zero, both zero
- * # 1.6.2 with -p (unsigned long long)
- *-------------------------------------------------------------------------
- */
+ * relative error, compare divide by zero, both zero
+ * # 1.6.2 with -p (unsigned long long)
+ *-------------------------------------------------------------------------
+ */
{
- unsigned long long data7[3][2] =
- { { 100, 100 }, { 100, 0 }, { 0, 100 } };
- unsigned long long data8[3][2] = { { 120, 80 }, { 0, 100 }, { 0, 50 } };
+ unsigned long long data7[3][2] = {{100, 100}, {100, 0}, {0, 100}};
+ unsigned long long data8[3][2] = {{120, 80}, {0, 100}, {0, 50}};
write_dset(gid1, 2, dims2, "dset7", H5T_NATIVE_ULLONG, data7);
write_dset(gid1, 2, dims2, "dset8", H5T_NATIVE_ULLONG, data8);
-
}
/*-------------------------------------------------------------------------
- * relative error, compare divide by zero, both zero
- * # 1.6.3 with -p (double)
- *
- * A B 1-B/A %
- * 100 120 0.2 20
- * 100 80 0.2 20
- * 100 0 1 100
- * 0 100 #DIV/0! #DIV/0!
- * 0 0 #DIV/0! #DIV/0!
- * 100 50 0.5 50
- *-------------------------------------------------------------------------
- */
+ * relative error, compare divide by zero, both zero
+ * # 1.6.3 with -p (double)
+ *
+ * A B 1-B/A %
+ * 100 120 0.2 20
+ * 100 80 0.2 20
+ * 100 0 1 100
+ * 0 100 #DIV/0! #DIV/0!
+ * 0 0 #DIV/0! #DIV/0!
+ * 100 50 0.5 50
+ *-------------------------------------------------------------------------
+ */
{
- double data9[3][2] = { { 100.0F, 100.0F }, { 100.0F, 0.0F }, { 0.0F,
- 100.0F } };
- double data10[3][2] = { { 120.0F, 80.0F }, { 0.0F, 100.0F }, { 0.0F,
- 50.0F } };
+ double data9[3][2] = {{100.0F, 100.0F}, {100.0F, 0.0F}, {0.0F, 100.0F}};
+ double data10[3][2] = {{120.0F, 80.0F}, {0.0F, 100.0F}, {0.0F, 50.0F}};
write_dset(gid1, 2, dims2, "dset9", H5T_NATIVE_DOUBLE, data9);
write_dset(gid1, 2, dims2, "dset10", H5T_NATIVE_DOUBLE, data10);
-
}
/*-------------------------------------------------------------------------
- * test floating point comparison
- *-------------------------------------------------------------------------
- */
+ * test floating point comparison
+ *-------------------------------------------------------------------------
+ */
{
/* epsilon = 0.0000001 = 1e-7
- * system epsilon for float : FLT_EPSILON = 1.19209E-07
- */
- float data11[3][2] = { { 0.000000f, 0.0000001f }, { 0.0000001f,
- 0.00000022f }, { 0.0000001f, 0.0000001f } };
- float data12[3][2] = { { 0.000000f, 0.0000002f }, { 0.0000003f,
- 0.0000001f }, { 0.000000f, 0.0000001f } };
+ * system epsilon for float : FLT_EPSILON = 1.19209E-07
+ */
+ float data11[3][2] = {{0.000000f, 0.0000001f}, {0.0000001f, 0.00000022f}, {0.0000001f, 0.0000001f}};
+ float data12[3][2] = {{0.000000f, 0.0000002f}, {0.0000003f, 0.0000001f}, {0.000000f, 0.0000001f}};
/* epsilon = 0.0000000000000001 = 1e-16
- * system epsilon for double : DBL_EPSILON = 2.22045E-16
- */
- double data13[3][2] = { { 0.0000000000000000, 0.0000000000000001 },
- { 0.0000000000000001, 0.0000000000000000 },
- { 0.00000000000000033, 0.0000000000000001 } };
- double data14[3][2] = { { 0.0000000000000000, 0.0000000000000004 },
- { 0.0000000000000002, 0.0000000000000001 },
- { 0.0000000000000001, 0.00000000000000000 } };
+ * system epsilon for double : DBL_EPSILON = 2.22045E-16
+ */
+ double data13[3][2] = {{0.0000000000000000, 0.0000000000000001},
+ {0.0000000000000001, 0.0000000000000000},
+ {0.00000000000000033, 0.0000000000000001}};
+ double data14[3][2] = {{0.0000000000000000, 0.0000000000000004},
+ {0.0000000000000002, 0.0000000000000001},
+ {0.0000000000000001, 0.00000000000000000}};
write_dset(gid1, 2, dims2, "fp1", H5T_NATIVE_FLOAT, data11);
write_dset(gid1, 2, dims2, "fp2", H5T_NATIVE_FLOAT, data12);
write_dset(gid1, 2, dims2, "d1", H5T_NATIVE_DOUBLE, data13);
write_dset(gid1, 2, dims2, "d2", H5T_NATIVE_DOUBLE, data14);
-
}
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
{
/*-------------------------------------------------------------------------
- * H5T_NATIVE_LDOUBLE
- *-------------------------------------------------------------------------
- */
-
- long double data15[3][2] = { {1.0L,1.0L}, {1.0L,1.0L}, {1.0L,1.0L}};
+ * H5T_NATIVE_LDOUBLE
+ *-------------------------------------------------------------------------
+ */
- write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15);
+ long double data15[3][2] = {{1.0L, 1.0L}, {1.0L, 1.0L}, {1.0L, 1.0L}};
+ write_dset(gid1, 2, dims2, "ld", H5T_NATIVE_LDOUBLE, data15);
}
#endif
/*-------------------------------------------------------------------------
- * NaNs in H5T_NATIVE_FLOAT
- *-------------------------------------------------------------------------
- */
+ * NaNs in H5T_NATIVE_FLOAT
+ *-------------------------------------------------------------------------
+ */
{
float data15[6];
float data16[6];
- data15[0] = (float) HDsqrt(-1.0F);
+ data15[0] = (float)HDsqrt(-1.0);
data15[1] = 1.0F;
- data15[2] = (float) HDsqrt(-1.0F);
+ data15[2] = (float)HDsqrt(-1.0);
data15[3] = 1.0F;
data15[4] = 1.0F;
data15[5] = 1.0F;
- data16[0] = (float) HDsqrt(-1.0F);
- data16[1] = (float) HDsqrt(-1.0F);
+ data16[0] = (float)HDsqrt(-1.0);
+ data16[1] = (float)HDsqrt(-1.0);
data16[2] = 1.0F;
data16[3] = 1.0F;
data16[4] = 1.0F;
@@ -493,31 +481,30 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1, 1, dims1, "fp15", H5T_NATIVE_FLOAT, data15);
write_dset(gid1, 1, dims1, "fp16", H5T_NATIVE_FLOAT, data16);
-
}
/*-------------------------------------------------------------------------
- * NaNs in H5T_NATIVE_DOUBLE
- *-------------------------------------------------------------------------
- */
+ * NaNs in H5T_NATIVE_DOUBLE
+ *-------------------------------------------------------------------------
+ */
{
double data17[6];
double data18[6];
- data17[0] = HDsqrt(-1.0F);
- data17[1] = 1.0F;
- data17[2] = HDsqrt(-1.0F);
- data17[3] = 1.0F;
- data17[4] = 1.0F;
- data17[5] = 1.0F;
+ data17[0] = HDsqrt(-1.0);
+ data17[1] = 1.0;
+ data17[2] = HDsqrt(-1.0);
+ data17[3] = 1.0;
+ data17[4] = 1.0;
+ data17[5] = 1.0;
- data18[0] = HDsqrt(-1.0F);
- data18[1] = HDsqrt(-10000.0F);
- data18[2] = 1.0F;
- data18[3] = 1.0F;
- data18[4] = 1.0F;
- data18[5] = 1.0F;
+ data18[0] = HDsqrt(-1.0);
+ data18[1] = HDsqrt(-10000.0);
+ data18[2] = 1.0;
+ data18[3] = 1.0;
+ data18[4] = 1.0;
+ data18[5] = 1.0;
write_dset(gid1, 1, dims1, "fp17", H5T_NATIVE_DOUBLE, data17);
write_dset(gid1, 1, dims1, "fp18", H5T_NATIVE_DOUBLE, data18);
@@ -525,18 +512,18 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
}
/*------------------------------------------------------------------------
- * INFINITY values
- *------------------------------------------------------------------------
- */
+ * INFINITY values
+ *------------------------------------------------------------------------
+ */
{
- float data19[6];
+ float data19[6];
double data20[6];
- data19[0] = data19[1] = data19[2] = (float) HDlog(0.0F);
- data19[3] = data19[4] = data19[5] = (float) -HDlog(0.0F);
+ data19[0] = data19[1] = data19[2] = (float)HDlog(0.0);
+ data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0);
- data20[0] = data20[1] = data20[2] = HDlog(0.0F);
- data20[3] = data20[4] = data20[5] = -HDlog(0.0F);
+ data20[0] = data20[1] = data20[2] = HDlog(0.0);
+ data20[3] = data20[4] = data20[5] = -HDlog(0.0);
write_dset(gid1, 1, dims1, "fp19", H5T_NATIVE_FLOAT, data19);
write_dset(gid1, 1, dims1, "fp19_COPY", H5T_NATIVE_FLOAT, data19);
@@ -545,39 +532,38 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
}
/*-------------------------------------------------------------------------
- * NaNs in H5T_NATIVE_DOUBLE and H5T_NATIVE_FLOAT inside H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * NaNs in H5T_NATIVE_DOUBLE and H5T_NATIVE_FLOAT inside H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
{
typedef struct cmp1_t {
double d;
- float f;
+ float f;
} cmp1_t;
- cmp1_t buf1[2];
- cmp1_t buf2[2];
- hsize_t dims[1] = { 2 };
- size_t type_size;
- hid_t tid;
+ cmp1_t buf1[2];
+ cmp1_t buf2[2];
+ hsize_t dims[1] = {2};
+ size_t type_size;
+ hid_t tid;
- buf1[0].d = HDsqrt(-1.0F);
- buf1[0].f = (float) HDsqrt(-1.0F);
- buf2[0].d = HDsqrt(-1.0F);
- buf2[0].f = (float) HDsqrt(-1.0F);
+ buf1[0].d = HDsqrt(-1.0);
+ buf1[0].f = (float)HDsqrt(-1.0);
+ buf2[0].d = HDsqrt(-1.0);
+ buf2[0].f = (float)HDsqrt(-1.0);
- buf1[1].d = HDsqrt(-1.0F);
- buf1[1].f = (float) HDsqrt(-1.0F);
+ buf1[1].d = HDsqrt(-1.0);
+ buf1[1].f = (float)HDsqrt(-1.0);
buf2[1].d = 0.0F;
buf2[1].f = 0.0F;
type_size = sizeof(cmp1_t);
- tid = H5Tcreate(H5T_COMPOUND, type_size);
+ tid = H5Tcreate(H5T_COMPOUND, type_size);
H5Tinsert(tid, "d", HOFFSET(cmp1_t, d), H5T_NATIVE_DOUBLE);
H5Tinsert(tid, "f", HOFFSET(cmp1_t, f), H5T_NATIVE_FLOAT);
write_dset(gid1, 1, dims, "dset11", tid, buf1);
write_dset(gid1, 1, dims, "dset12", tid, buf2);
H5Tclose(tid);
-
}
/* not comparable objects */
@@ -585,11 +571,11 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
typedef struct cmp1_t {
double d;
- int i;
+ int i;
} cmp1_t;
typedef struct cmp2_t {
- int i;
+ int i;
double d;
} cmp2_t;
@@ -597,17 +583,17 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
int i;
} cmp3_t;
- double data2[6] = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F };
- int data3[6] = { 0, 0, 0, 0, 0, 0 };
- int data4[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } };
- int data5[2][2] = { { 0, 0 }, { 0, 0 } };
- unsigned int data6[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } };
- cmp1_t data7[1] = { { 1.0f, 2 } };
- cmp2_t data8[1] = { { 1, 2.0f } };
- hsize_t dims3[2] = { 2, 2 };
- hsize_t dims4[1] = { 1 };
- size_t type_size;
- hid_t tid;
+ double data2[6] = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
+ int data3[6] = {0, 0, 0, 0, 0, 0};
+ int data4[3][2] = {{0, 0}, {0, 0}, {0, 0}};
+ int data5[2][2] = {{0, 0}, {0, 0}};
+ unsigned int data6[3][2] = {{0, 0}, {0, 0}, {0, 0}};
+ cmp1_t data7[1] = {{1.0f, 2}};
+ cmp2_t data8[1] = {{1, 2.0f}};
+ hsize_t dims3[2] = {2, 2};
+ hsize_t dims4[1] = {1};
+ size_t type_size;
+ hid_t tid;
write_dset(gid3, 1, dims1, "dset1", H5T_NATIVE_DOUBLE, NULL);
write_dset(gid3, 1, dims1, "dset2", H5T_NATIVE_DOUBLE, data2);
@@ -618,14 +604,14 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
/* case of compound with different type members */
type_size = sizeof(cmp1_t);
- tid = H5Tcreate(H5T_COMPOUND, type_size);
+ tid = H5Tcreate(H5T_COMPOUND, type_size);
H5Tinsert(tid, "d", HOFFSET(cmp1_t, d), H5T_NATIVE_DOUBLE);
H5Tinsert(tid, "i", HOFFSET(cmp1_t, i), H5T_NATIVE_INT);
write_dset(gid3, 1, dims4, "dset7", tid, data7);
H5Tclose(tid);
type_size = sizeof(cmp2_t);
- tid = H5Tcreate(H5T_COMPOUND, type_size);
+ tid = H5Tcreate(H5T_COMPOUND, type_size);
H5Tinsert(tid, "i", HOFFSET(cmp2_t, i), H5T_NATIVE_INT);
H5Tinsert(tid, "d", HOFFSET(cmp2_t, d), H5T_NATIVE_DOUBLE);
write_dset(gid3, 1, dims4, "dset8", tid, data8);
@@ -633,17 +619,16 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
/* case of compound with different number of members */
type_size = sizeof(cmp3_t);
- tid = H5Tcreate(H5T_COMPOUND, type_size);
+ tid = H5Tcreate(H5T_COMPOUND, type_size);
H5Tinsert(tid, "i", HOFFSET(cmp2_t, i), H5T_NATIVE_INT);
write_dset(gid3, 1, dims4, "dset9", tid, NULL);
H5Tclose(tid);
-
}
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
+ * close
+ *-------------------------------------------------------------------------
+ */
H5Gclose(gid1);
H5Gclose(gid2);
H5Gclose(gid3);
@@ -664,18 +649,18 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
-int test_types(const char *fname)
+static int
+test_types(const char *fname)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hid_t tid1 = H5I_INVALID_HID;
- hid_t tid2 = H5I_INVALID_HID;
- herr_t status;
- hsize_t dims[1] = { 1 };
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t tid1 = H5I_INVALID_HID;
+ hid_t tid2 = H5I_INVALID_HID;
+ herr_t status;
+ hsize_t dims[1] = {1};
typedef struct s1_t {
- int a;
+ int a;
float b;
} s1_t;
typedef struct s2_t {
@@ -683,30 +668,30 @@ int test_types(const char *fname)
} s2_t;
/*-------------------------------------------------------------------------
- * Create one file
- *-------------------------------------------------------------------------
- */
+ * Create one file
+ *-------------------------------------------------------------------------
+ */
fid1 = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * H5G_DATASET
- *-------------------------------------------------------------------------
- */
+ * H5G_DATASET
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 1, dims, "dset", H5T_NATIVE_INT, 0);
/*-------------------------------------------------------------------------
- * H5G_GROUP
- *-------------------------------------------------------------------------
- */
- gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ * H5G_GROUP
+ *-------------------------------------------------------------------------
+ */
+ gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Gclose(gid1);
- gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Gclose(gid2);
/*-------------------------------------------------------------------------
- * H5G_TYPE
- *-------------------------------------------------------------------------
- */
+ * H5G_TYPE
+ *-------------------------------------------------------------------------
+ */
/* create and commit datatype 1 */
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
@@ -721,25 +706,25 @@ int test_types(const char *fname)
H5Tclose(tid2);
/*-------------------------------------------------------------------------
- * H5G_LINK
- *-------------------------------------------------------------------------
- */
+ * H5G_LINK
+ *-------------------------------------------------------------------------
+ */
status = H5Lcreate_soft("g1", fid1, "l1", H5P_DEFAULT, H5P_DEFAULT);
status = H5Lcreate_soft("g2", fid1, "l2", H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * H5G_UDLINK
- *-------------------------------------------------------------------------
- */
+ * H5G_UDLINK
+ *-------------------------------------------------------------------------
+ */
H5Lcreate_external("filename", "objname", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT);
H5Lregister(UD_link_class);
- H5Lcreate_ud(fid1, "ud_link", (H5L_type_t) MY_LINKCLASS, NULL, (size_t) 0, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_ud(fid1, "ud_link", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * Close
- *-------------------------------------------------------------------------
- */
+ * Close
+ *-------------------------------------------------------------------------
+ */
status = H5Fclose(fid1);
return status;
}
@@ -789,138 +774,138 @@ int test_types(const char *fname)
*
*-------------------------------------------------------------------------
*/
-static
-int test_datatypes(const char *fname)
+static int
+test_datatypes(const char *fname)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t dset = H5I_INVALID_HID;
- hsize_t dims[2] = { 3, 2 };
- herr_t status;
- char buf1a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- char buf1b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
- short buf2a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- short buf2b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
- int buf3a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- int buf3b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
- long buf4a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- long buf4b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
- float buf5a[3][2] = { { 1.0F, 1.0F }, { 1.0F, 1.0F }, { 1.0F, 1.0F } };
- float buf5b[3][2] = { { 1.0F, 1.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } };
- double buf6a[3][2] = { { 1.0F, 1.0F }, { 1.0F, 1.0F }, { 1.0F, 1.0F } };
- double buf6b[3][2] = { { 1.0F, 1.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } };
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hsize_t dims[2] = {3, 2};
+ herr_t status;
+ char buf1a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ char buf1b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
+ short buf2a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ short buf2b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
+ int buf3a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ int buf3b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
+ long buf4a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ long buf4b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
+ float buf5a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}};
+ float buf5b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}};
+ double buf6a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}};
+ double buf6b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}};
/*unsigned/signed test
signed char -128 to 127
unsigned char 0 to 255
*/
- char buf7a[3][2] = { { -1, -128 }, { -1, -1 }, { -1, -1 } };
- unsigned char buf7b[3][2] = { { 1, 128 }, { 1, 1 }, { 1, 1 } };
+ char buf7a[3][2] = {{-1, -128}, {-1, -1}, {-1, -1}};
+ unsigned char buf7b[3][2] = {{1, 128}, {1, 1}, {1, 1}};
/* long long test */
- long long buf8a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- long long buf8b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
- unsigned long long buf9a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- unsigned long long buf9b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
+ long long buf8a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ long long buf8b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
+ unsigned long long buf9a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ unsigned long long buf9b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
- unsigned int buf10a[3][2] = { { UIMAX, 1 }, { 1, 1 }, { 1, 1 } };
- unsigned int buf10b[3][2] = { { UIMAX - 1, 1 }, { 3, 4 }, { 5, 6 } };
+ unsigned int buf10a[3][2] = {{UIMAX, 1}, {1, 1}, {1, 1}};
+ unsigned int buf10b[3][2] = {{UIMAX - 1, 1}, {3, 4}, {5, 6}};
- unsigned short buf11a[3][2] = { { 204, 205 }, { 2, 3 }, { 1, 1 } };
- unsigned int buf11b[3][2] = { { 204, 205 }, { 2, 3 }, { 1, 1 } };
+ unsigned short buf11a[3][2] = {{204, 205}, {2, 3}, {1, 1}};
+ unsigned int buf11b[3][2] = {{204, 205}, {2, 3}, {1, 1}};
/*-------------------------------------------------------------------------
- * Create a file
- *-------------------------------------------------------------------------
- */
+ * Create a file
+ *-------------------------------------------------------------------------
+ */
fid1 = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * Check for different storage order. Give a warning if they are different
- *-------------------------------------------------------------------------
- */
+ * Check for different storage order. Give a warning if they are different
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset0a", H5T_STD_I16LE, buf2a);
write_dset(fid1, 2, dims, "dset0b", H5T_STD_I32LE, buf3b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_CHAR
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_CHAR
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset1a", H5T_NATIVE_CHAR, buf1a);
write_dset(fid1, 2, dims, "dset1b", H5T_NATIVE_CHAR, buf1b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_SHORT
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_SHORT
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset2a", H5T_NATIVE_SHORT, buf2a);
write_dset(fid1, 2, dims, "dset2b", H5T_NATIVE_SHORT, buf2b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_INT
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_INT
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset3a", H5T_NATIVE_INT, buf3a);
write_dset(fid1, 2, dims, "dset3b", H5T_NATIVE_INT, buf3b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_LONG
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_LONG
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset4a", H5T_NATIVE_LONG, buf4a);
write_dset(fid1, 2, dims, "dset4b", H5T_NATIVE_LONG, buf4b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_FLOAT
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset5a", H5T_NATIVE_FLOAT, buf5a);
write_dset(fid1, 2, dims, "dset5b", H5T_NATIVE_FLOAT, buf5b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_DOUBLE
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_DOUBLE
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset6a", H5T_NATIVE_DOUBLE, buf6a);
write_dset(fid1, 2, dims, "dset6b", H5T_NATIVE_DOUBLE, buf6b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset7a", H5T_NATIVE_CHAR, buf7a);
write_dset(fid1, 2, dims, "dset7b", H5T_NATIVE_UCHAR, buf7b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_LLONG
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_LLONG
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset8a", H5T_NATIVE_LLONG, buf8a);
write_dset(fid1, 2, dims, "dset8b", H5T_NATIVE_LLONG, buf8b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_ULLONG
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_ULLONG
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset9a", H5T_NATIVE_ULLONG, buf9a);
write_dset(fid1, 2, dims, "dset9b", H5T_NATIVE_ULLONG, buf9b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_INT
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_INT
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset10a", H5T_NATIVE_UINT, buf10a);
write_dset(fid1, 2, dims, "dset10b", H5T_NATIVE_UINT, buf10b);
/*-------------------------------------------------------------------------
- * Same type class, different size
- *-------------------------------------------------------------------------
- */
+ * Same type class, different size
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset11a", H5T_STD_U16LE, buf11a);
dset = H5Dopen2(fid1, "dset11a", H5P_DEFAULT);
write_attr(dset, 2, dims, "attr", H5T_STD_U16LE, buf11a);
@@ -932,9 +917,9 @@ int test_datatypes(const char *fname)
H5Dclose(dset);
/*-------------------------------------------------------------------------
- * Close
- *-------------------------------------------------------------------------
- */
+ * Close
+ *-------------------------------------------------------------------------
+ */
status = H5Fclose(fid1);
return status;
}
@@ -979,44 +964,44 @@ int test_datatypes(const char *fname)
*
*-------------------------------------------------------------------------
*/
-static
-int test_attributes(const char *file, int make_diffs /* flag to modify data buffers */)
+static int
+test_attributes(const char *file, int make_diffs /* flag to modify data buffers */)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t root_id = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hsize_t dims[1] = { 2 };
- herr_t status;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t root_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hsize_t dims[1] = {2};
+ herr_t status;
/* Create a file */
if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
/* Create a 1D dataset */
- sid = H5Screate_simple(1, dims, NULL);
- did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Sclose(sid);
assert(status >= 0);
/* Create groups */
- gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
root_id = H5Gopen2(fid, "/", H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * write a series of attributes on the dataset, group, and root group
- *-------------------------------------------------------------------------
- */
+ * write a series of attributes on the dataset, group, and root group
+ *-------------------------------------------------------------------------
+ */
if (make_diffs > 1) {
write_attr_strings(did, "dset", fid, make_diffs);
- write_attr_strings(gid, NULL, (hid_t) 0, make_diffs);
- write_attr_strings(root_id, NULL, (hid_t) 0, make_diffs);
+ write_attr_strings(gid, NULL, (hid_t)0, make_diffs);
+ write_attr_strings(root_id, NULL, (hid_t)0, make_diffs);
}
else {
write_attr_in(did, "dset", fid, make_diffs);
- write_attr_in(gid, NULL, (hid_t) 0, make_diffs);
- write_attr_in(root_id, NULL, (hid_t) 0, make_diffs);
+ write_attr_in(gid, NULL, (hid_t)0, make_diffs);
+ write_attr_in(root_id, NULL, (hid_t)0, make_diffs);
}
/* Close */
@@ -1041,34 +1026,35 @@ int test_attributes(const char *file, int make_diffs /* flag to modify data buff
*
*-------------------------------------------------------------------------
*/
-static int test_attributes_verbose_level(const char *fname1, const char *fname2)
+static int
+test_attributes_verbose_level(const char *fname1, const char *fname2)
{
herr_t status = SUCCEED;
- hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
- hid_t f1_gid = H5I_INVALID_HID, f2_gid = H5I_INVALID_HID;
- hid_t f1_gid2 = H5I_INVALID_HID, f2_gid2 = H5I_INVALID_HID;
- hid_t f1_gid3 = H5I_INVALID_HID, f2_gid3 = H5I_INVALID_HID;
- hid_t f1_gid4 = H5I_INVALID_HID, f2_gid4 = H5I_INVALID_HID;
- hid_t f1_did = H5I_INVALID_HID, f2_did = H5I_INVALID_HID;
- hid_t f1_sid = H5I_INVALID_HID, f2_sid = H5I_INVALID_HID;
- hid_t f1_tid = H5I_INVALID_HID, f2_tid = H5I_INVALID_HID;
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
+ hid_t f1_gid = H5I_INVALID_HID, f2_gid = H5I_INVALID_HID;
+ hid_t f1_gid2 = H5I_INVALID_HID, f2_gid2 = H5I_INVALID_HID;
+ hid_t f1_gid3 = H5I_INVALID_HID, f2_gid3 = H5I_INVALID_HID;
+ hid_t f1_gid4 = H5I_INVALID_HID, f2_gid4 = H5I_INVALID_HID;
+ hid_t f1_did = H5I_INVALID_HID, f2_did = H5I_INVALID_HID;
+ hid_t f1_sid = H5I_INVALID_HID, f2_sid = H5I_INVALID_HID;
+ hid_t f1_tid = H5I_INVALID_HID, f2_tid = H5I_INVALID_HID;
/* dset */
- hsize_t dset_dims[1] = { 3 };
- int dset_data[3] = { 0, 1, 2 };
+ hsize_t dset_dims[1] = {3};
+ int dset_data[3] = {0, 1, 2};
/* common attrs dim */
- hsize_t attr_dims[1] = { 2 };
+ hsize_t attr_dims[1] = {2};
/* file1 attr */
- int f1_attr_idata[2] = { 1, 2 }; /* integer */
- float f1_attr_fdata[2] = { 1.1F, 2.2F }; /* float */
+ int f1_attr_idata[2] = {1, 2}; /* integer */
+ float f1_attr_fdata[2] = {1.1F, 2.2F}; /* float */
/* file2 attr */
- int f2_attr_idata[2] = { 2, 3 }; /* integer */
- float f2_attr_fdata[2] = { 2.1F, 3.2F }; /* float */
+ int f2_attr_idata[2] = {2, 3}; /* integer */
+ float f2_attr_fdata[2] = {2.1F, 3.2F}; /* float */
/*----------------------------------------------------------------------
- * Create file1
- *-----------------------------------------------------------------------*/
+ * Create file1
+ *-----------------------------------------------------------------------*/
if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
status = FAIL;
@@ -1076,8 +1062,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Groups
- */
+ * Groups
+ */
f1_gid = H5Gcreate2(fid1, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (f1_gid < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
@@ -1107,8 +1093,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Datasets
- */
+ * Datasets
+ */
f1_sid = H5Screate_simple(1, dset_dims, NULL);
f1_did = H5Dcreate2(fid1, "dset", H5T_NATIVE_INT, f1_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (f1_did == FAIL) {
@@ -1124,8 +1110,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Named Datatype
- */
+ * Named Datatype
+ */
f1_tid = H5Tcopy(H5T_NATIVE_INT);
status = H5Tcommit2(fid1, "ntype", f1_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -1135,8 +1121,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------------------------------------------
- * Create file2
- *-----------------------------------------------------------------------*/
+ * Create file2
+ *-----------------------------------------------------------------------*/
if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
status = FAIL;
@@ -1144,8 +1130,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Groups
- */
+ * Groups
+ */
f2_gid = H5Gcreate2(fid2, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (f2_gid < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
@@ -1175,8 +1161,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Datasets
- */
+ * Datasets
+ */
f2_sid = H5Screate_simple(1, dset_dims, NULL);
f2_did = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, f2_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (f2_did == FAIL) {
@@ -1192,8 +1178,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Named Datatype
- */
+ * Named Datatype
+ */
f2_tid = H5Tcopy(H5T_NATIVE_INT);
status = H5Tcommit2(fid2, "ntype", f2_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -1203,9 +1189,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * CASE1 - Same attr number, all Same attr name
- * add attr to group
- */
+ * CASE1 - Same attr number, all Same attr name
+ * add attr to group
+ */
write_attr(f1_gid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata);
write_attr(f1_gid, 1, attr_dims, "float1", H5T_NATIVE_FLOAT, f1_attr_fdata);
@@ -1213,9 +1199,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_gid, 1, attr_dims, "float1", H5T_NATIVE_FLOAT, f2_attr_fdata);
/*----------------------------------
- * CASE2 - Same attr number, some Same attr name
- * add attr to dset
- */
+ * CASE2 - Same attr number, some Same attr name
+ * add attr to dset
+ */
write_attr(f1_did, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata);
write_attr(f1_did, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata);
@@ -1223,9 +1209,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_did, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f2_attr_fdata);
/*----------------------------------
- * CASE3 - Same attr number, all different attr name
- * add attr to ntype
- */
+ * CASE3 - Same attr number, all different attr name
+ * add attr to ntype
+ */
write_attr(f1_tid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata);
write_attr(f1_tid, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata);
write_attr(f1_tid, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f1_attr_fdata);
@@ -1235,9 +1221,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_tid, 1, attr_dims, "float6", H5T_NATIVE_FLOAT, f2_attr_fdata);
/*----------------------------------
- * CASE4 - Different attr number, some same attr name (vs file2-g2)
- * add attr to g2
- */
+ * CASE4 - Different attr number, some same attr name (vs file2-g2)
+ * add attr to g2
+ */
write_attr(f1_gid2, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata);
write_attr(f1_gid2, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata);
write_attr(f1_gid2, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f1_attr_fdata);
@@ -1246,9 +1232,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_gid2, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f2_attr_fdata);
/*----------------------------------
- * CASE5 - Different attr number, all different attr name
- * add attr to g3
- */
+ * CASE5 - Different attr number, all different attr name
+ * add attr to g3
+ */
write_attr(f1_gid3, 1, attr_dims, "integer10", H5T_NATIVE_INT, f1_attr_idata);
write_attr(f1_gid3, 1, attr_dims, "float11", H5T_NATIVE_FLOAT, f1_attr_fdata);
write_attr(f1_gid3, 1, attr_dims, "float12", H5T_NATIVE_FLOAT, f1_attr_fdata);
@@ -1258,8 +1244,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1 > 0)
H5Fclose(fid1);
if (fid2 > 0)
@@ -1306,16 +1292,16 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
-int test_datasets(const char *file, int make_diffs /* flag to modify data buffers */)
+static int
+test_datasets(const char *file, int make_diffs /* flag to modify data buffers */)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hsize_t dims[1] = { 2 };
- herr_t status;
- int buf[2] = { 1, 2 };
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hsize_t dims[1] = {2};
+ herr_t status;
+ int buf[2] = {1, 2};
if (make_diffs > 0)
memset(buf, 0, sizeof buf);
@@ -1325,8 +1311,8 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer
return -1;
/* Create a 1D dataset */
- sid = H5Screate_simple(1, dims, NULL);
- did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
status = H5Sclose(sid);
assert(status >= 0);
@@ -1335,9 +1321,9 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer
gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * write a series of datasets on the group
- *-------------------------------------------------------------------------
- */
+ * write a series of datasets on the group
+ *-------------------------------------------------------------------------
+ */
write_dset_in(gid, "/dset", fid, make_diffs);
@@ -1359,16 +1345,16 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer
* Purpose: Check datasets with datasapce of zero dimension size.
*-------------------------------------------------------------------------
*/
-static
-int test_special_datasets(const char *file, int make_diffs /* flag to modify data buffers */)
+static int
+test_special_datasets(const char *file, int make_diffs /* flag to modify data buffers */)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t sid0 = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hsize_t dims0[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 };
- hsize_t dims[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 };
- herr_t status;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid0 = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hsize_t dims0[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2};
+ hsize_t dims[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2};
+ herr_t status;
/* Create a file */
if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -1376,7 +1362,7 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat
/* Create a dataset with zero dimension size */
sid0 = H5Screate_simple(SPACE1_RANK, dims0, NULL);
- did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* close dataset */
status = H5Dclose(did);
@@ -1387,7 +1373,7 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat
assert(status >= 0);
/* Create a dataset with zero dimension size in one file but the other one
- * has a dataset with a non-zero dimension size */
+ * has a dataset with a non-zero dimension size */
if (make_diffs)
dims[1] = SPACE1_DIM2 + 4;
@@ -1416,16 +1402,17 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_link_name(const char *fname1)
+static int
+test_link_name(const char *fname1)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -1434,16 +1421,15 @@ static int test_link_name(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
gid1 = H5Gcreate2(fid1, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
status = FAIL;
goto out;
}
- gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT);
+ gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid2 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
@@ -1452,8 +1438,8 @@ static int test_link_name(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Soft Links
- *------------------------------------------------------------------------*/
+ * Soft Links
+ *------------------------------------------------------------------------*/
status = H5Lcreate_soft("group", fid1, "link_g1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
@@ -1470,8 +1456,8 @@ static int test_link_name(const char *fname1)
out:
/*-----------------------------------------------------------------------
- * Close
- *------------------------------------------------------------------------*/
+ * Close
+ *------------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (gid1)
@@ -1489,18 +1475,19 @@ out:
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_soft_links(const char *fname1)
+static int
+test_soft_links(const char *fname1)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -1509,8 +1496,8 @@ static int test_soft_links(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
@@ -1519,8 +1506,8 @@ static int test_soft_links(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -1544,8 +1531,8 @@ static int test_soft_links(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Soft Links
- *------------------------------------------------------------------------*/
+ * Soft Links
+ *------------------------------------------------------------------------*/
/* file 1 */
status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -1591,8 +1578,8 @@ static int test_soft_links(const char *fname1)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (gid1)
@@ -1608,20 +1595,21 @@ out:
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_linked_softlinks(const char *fname1)
+static int
+test_linked_softlinks(const char *fname1)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hid_t gid3 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t gid3 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -1630,8 +1618,8 @@ static int test_linked_softlinks(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
@@ -1654,8 +1642,8 @@ static int test_linked_softlinks(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -1678,10 +1666,10 @@ static int test_linked_softlinks(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Soft Links (Linked)
- *------------------------------------------------------------------------*/
+ * Soft Links (Linked)
+ *------------------------------------------------------------------------*/
/*---------
- * file 1 */
+ * file 1 */
status = H5Lcreate_soft("/target_dset1", fid1, "softlink1_to_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
@@ -1768,8 +1756,8 @@ static int test_linked_softlinks(const char *fname1)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (gid1)
@@ -1789,20 +1777,21 @@ out:
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_external_links(const char *fname1, const char *fname2)
+static int
+test_external_links(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
/* source file */
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
@@ -1820,10 +1809,10 @@ static int test_external_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
/*--------------
- * target file */
+ * target file */
gid1 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
@@ -1838,10 +1827,10 @@ static int test_external_links(const char *fname1, const char *fname2)
goto out;
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/*--------------
- * target file */
+ * target file */
status = write_dset(fid2, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2);
@@ -1864,18 +1853,20 @@ static int test_external_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * External Links
- *------------------------------------------------------------------------*/
+ * External Links
+ *------------------------------------------------------------------------*/
/*--------------*/
/* source file */
- status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ status =
+ H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
status = FAIL;
goto out;
}
- status = H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ status =
+ H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
status = FAIL;
@@ -1912,8 +1903,8 @@ static int test_external_links(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -1934,19 +1925,20 @@ out:
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_ext2soft_links(const char *fname1, const char *fname2)
+static int
+test_ext2soft_links(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
/* source file */
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
@@ -1964,8 +1956,8 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
/* target file */
gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid2 < 0) {
@@ -1975,10 +1967,10 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/*--------------
- * target file */
+ * target file */
status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data2);
if (status == FAIL) {
HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2);
@@ -1994,10 +1986,10 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Soft Links (Linked)
- *------------------------------------------------------------------------*/
+ * Soft Links (Linked)
+ *------------------------------------------------------------------------*/
/*---------------
- * target file */
+ * target file */
status = H5Lcreate_soft("/dset1", fid2, "softlink_to_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
@@ -2013,10 +2005,10 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * External Links
- *------------------------------------------------------------------------*/
+ * External Links
+ *------------------------------------------------------------------------*/
/*---------------
- * source file */
+ * source file */
status = H5Lcreate_external(fname2, "/target_group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
@@ -2024,14 +2016,16 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
goto out;
}
- status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT,
+ H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
status = FAIL;
goto out;
}
- status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT,
+ H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
status = FAIL;
@@ -2040,8 +2034,8 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -2062,20 +2056,20 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
-int gen_dataset_idx(const char *file, int format)
+static int
+gen_dataset_idx(const char *file, int format)
{
- hid_t fid = H5I_INVALID_HID; /* file id */
- hid_t did = H5I_INVALID_HID;
- hid_t did2 = H5I_INVALID_HID; /* dataset id */
- hid_t sid = H5I_INVALID_HID; /* space id */
- hid_t fapl = H5I_INVALID_HID; /* file access property id */
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
- hsize_t dims[1] = { 10 }; /* dataset dimension */
- hsize_t c_dims[1] = { 2 }; /* chunk dimension */
- herr_t status; /* return status */
- int buf[10]; /* data buffer */
- int i; /* local index variable */
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t did = H5I_INVALID_HID;
+ hid_t did2 = H5I_INVALID_HID; /* dataset id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t fapl = H5I_INVALID_HID; /* file access property id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
+ hsize_t dims[1] = {10}; /* dataset dimension */
+ hsize_t c_dims[1] = {2}; /* chunk dimension */
+ herr_t status; /* return status */
+ int buf[10]; /* data buffer */
+ int i; /* local index variable */
/* Get a copy of the file aaccess property */
fapl = H5Pcreate(H5P_FILE_ACCESS);
@@ -2095,7 +2089,7 @@ int gen_dataset_idx(const char *file, int format)
buf[i] = i;
/* Set chunk */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
status = H5Pset_chunk(dcpl, 1, c_dims);
assert(status >= 0);
@@ -2107,13 +2101,13 @@ int gen_dataset_idx(const char *file, int format)
status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
assert(status >= 0);
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
status = H5Pset_deflate(dcpl, 9);
assert(status >= 0);
/* Create and write the dataset */
- did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
status = H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
assert(status >= 0);
@@ -2149,18 +2143,19 @@ int gen_dataset_idx(const char *file, int format)
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_dangle_links(const char *fname1, const char *fname2)
+static int
+test_dangle_links(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -2176,8 +2171,8 @@ static int test_dangle_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -2209,8 +2204,8 @@ static int test_dangle_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Soft Links
- *------------------------------------------------------------------------*/
+ * Soft Links
+ *------------------------------------------------------------------------*/
/* file 1 */
status = H5Lcreate_soft("no_obj", fid1, "soft_link1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2270,8 +2265,8 @@ static int test_dangle_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * External Links
- *------------------------------------------------------------------------*/
+ * External Links
+ *------------------------------------------------------------------------*/
/* file1 */
status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2332,8 +2327,8 @@ static int test_dangle_links(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -2349,21 +2344,24 @@ out:
* Programmer: Jonathan Kim (Aug 19, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_group_recurse(const char *fname1, const char *fname2)
+static int
+test_group_recurse(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid1_f1 = H5I_INVALID_HID, gid2_f1 = H5I_INVALID_HID, gid3_f1 = H5I_INVALID_HID, gid10_f1 = H5I_INVALID_HID;
- hid_t gid1_f2 = H5I_INVALID_HID, gid2_f2 = H5I_INVALID_HID, gid3_f2 = H5I_INVALID_HID, gid11_f2 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 0, 1 }, { 1, 0 }, { 1, 0 } };
- int data2[4][2] = { { 0, 2 }, { 0, 2 }, { 2, 0 }, { 2, 0 } };
- int data3[4][2] = { { 0, 3 }, { 0, 3 }, { 3, 0 }, { 3, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1_f1 = H5I_INVALID_HID, gid2_f1 = H5I_INVALID_HID, gid3_f1 = H5I_INVALID_HID,
+ gid10_f1 = H5I_INVALID_HID;
+ hid_t gid1_f2 = H5I_INVALID_HID, gid2_f2 = H5I_INVALID_HID, gid3_f2 = H5I_INVALID_HID,
+ gid11_f2 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {0, 1}, {1, 0}, {1, 0}};
+ int data2[4][2] = {{0, 2}, {0, 2}, {2, 0}, {2, 0}};
+ int data3[4][2] = {{0, 3}, {0, 3}, {3, 0}, {3, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -2379,8 +2377,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
/* file1 */
gid1_f1 = H5Gcreate2(fid1, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1_f1 < 0) {
@@ -2440,8 +2438,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets under root
- *------------------------------------------------------------------------*/
+ * Datasets under root
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -2487,8 +2485,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets under group
- *------------------------------------------------------------------------*/
+ * Datasets under group
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(gid1_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -2600,8 +2598,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Soft Links
- *------------------------------------------------------------------------*/
+ * Soft Links
+ *------------------------------------------------------------------------*/
/* file 1 */
status = H5Lcreate_soft("/grp1", fid1, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2661,8 +2659,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * External Links
- *------------------------------------------------------------------------*/
+ * External Links
+ *------------------------------------------------------------------------*/
/* file1 */
status = H5Lcreate_external(fname2, "/grp1", fid1, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2708,9 +2706,9 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*------------------------------
- * external circle route test
- * file1/grp11 <-> file2/grp10 via elink_grp_circle link
- */
+ * external circle route test
+ * file1/grp11 <-> file2/grp10 via elink_grp_circle link
+ */
/* file1 */
status = H5Lcreate_external(fname2, "/grp11", gid10_f1, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2728,8 +2726,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -2761,38 +2759,39 @@ out:
*-------------------------------------------------------------------------*/
#define GRP_R_DSETNAME1 "dset1"
#define GRP_R_DSETNAME2 "dset2"
-static int test_group_recurse2(void)
+static int
+test_group_recurse2(void)
{
- hid_t fileid1 = H5I_INVALID_HID;
- hid_t grp1 = H5I_INVALID_HID;
- hid_t grp2 = H5I_INVALID_HID;
- hid_t grp3 = H5I_INVALID_HID;
- hid_t grp4 = H5I_INVALID_HID;
- hid_t dset1 = H5I_INVALID_HID;
- hid_t dset2 = H5I_INVALID_HID;
- hid_t datatype = H5I_INVALID_HID;
- hid_t dataspace = H5I_INVALID_HID;
- hid_t fileid2 = H5I_INVALID_HID;
- hid_t fileid3 = H5I_INVALID_HID;
- hid_t fileid4 = H5I_INVALID_HID;
+ hid_t fileid1 = H5I_INVALID_HID;
+ hid_t grp1 = H5I_INVALID_HID;
+ hid_t grp2 = H5I_INVALID_HID;
+ hid_t grp3 = H5I_INVALID_HID;
+ hid_t grp4 = H5I_INVALID_HID;
+ hid_t dset1 = H5I_INVALID_HID;
+ hid_t dset2 = H5I_INVALID_HID;
+ hid_t datatype = H5I_INVALID_HID;
+ hid_t dataspace = H5I_INVALID_HID;
+ hid_t fileid2 = H5I_INVALID_HID;
+ hid_t fileid3 = H5I_INVALID_HID;
+ hid_t fileid4 = H5I_INVALID_HID;
hsize_t dimsf[2]; /* dataset dimensions */
- herr_t status = 0;
- int data1[4][2] = { { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 } };
- int data2[4][2] = { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 3, 3 } };
+ herr_t status = 0;
+ int data1[4][2] = {{0, 0}, {1, 1}, {2, 2}, {3, 3}};
+ int data2[4][2] = {{0, 0}, {0, 1}, {0, 2}, {3, 3}};
/*-----------------------------------------------------------------------
- * FILE 1
- *------------------------------------------------------------------------*/
+ * FILE 1
+ *------------------------------------------------------------------------*/
/*
- * Create a new file using H5F_ACC_TRUNC access,
- * default file creation properties, and default file
- * access properties.
- */
+ * Create a new file using H5F_ACC_TRUNC access,
+ * default file creation properties, and default file
+ * access properties.
+ */
fileid1 = H5Fcreate(GRP_RECURSE1_EXT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
grp1 = H5Gcreate2(fileid1, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT);
@@ -2822,72 +2821,72 @@ static int test_group_recurse2(void)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/*
- * Describe the size of the array and create the data space for fixed
- * size dataset.
- */
- dimsf[0] = 4;
- dimsf[1] = 2;
+ * Describe the size of the array and create the data space for fixed
+ * size dataset.
+ */
+ dimsf[0] = 4;
+ dimsf[1] = 2;
dataspace = H5Screate_simple(2, dimsf, NULL);
/*
- * Define datatype for the data in the file.
- * We will store little endian INT numbers.
- */
+ * Define datatype for the data in the file.
+ * We will store little endian INT numbers.
+ */
datatype = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tset_order(datatype, H5T_ORDER_LE);
+ status = H5Tset_order(datatype, H5T_ORDER_LE);
/*---------------
- * dset1
- */
+ * dset1
+ */
/*
- * Create a new dataset within the file using defined dataspace and
- * datatype and default dataset creation properties.
- */
+ * Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
dset1 = H5Dcreate2(fileid1, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
H5Dclose(dset1);
/*---------------
- * dset1
- */
+ * dset1
+ */
/*
- * Create a new dataset within the file using defined dataspace and
- * datatype and default dataset creation properties.
- */
+ * Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
/*---------------
- * dset2
- */
+ * dset2
+ */
/*
- * Create a new dataset within the fileid1 using defined dataspace and
- * datatype and default dataset creation properties.
- */
+ * Create a new dataset within the fileid1 using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
/*-----------------------------------------------------------------------
- * Soft links
- *------------------------------------------------------------------------*/
+ * Soft links
+ *------------------------------------------------------------------------*/
/*
- * under '/' root
- */
+ * under '/' root
+ */
/* link to dset1 */
status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2904,15 +2903,15 @@ static int test_group_recurse2(void)
H5Gclose(grp4);
/*-----------------------------------------------------------------------
- * FILE 2-3
- *------------------------------------------------------------------------*/
+ * FILE 2-3
+ *------------------------------------------------------------------------*/
/* crate target file */
fileid4 = H5Fcreate(GRP_RECURSE2_EXT3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------
- * Groups
- */
+ * Groups
+ */
grp4 = H5Gcreate2(fileid4, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp4 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT3);
@@ -2921,32 +2920,32 @@ static int test_group_recurse2(void)
}
/*---------------
- * dset2
- */
+ * dset2
+ */
/*
- * Create a new dataset within the fileid1 using defined dataspace and
- * datatype and default dataset creation properties.
- */
+ * Create a new dataset within the fileid1 using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
H5Gclose(grp4);
H5Dclose(dset2);
/*-----------------------------------------------------------------------
- * FILE 2-2
- *------------------------------------------------------------------------*/
+ * FILE 2-2
+ *------------------------------------------------------------------------*/
/* crate target file */
fileid3 = H5Fcreate(GRP_RECURSE2_EXT2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------
- * Groups
- */
+ * Groups
+ */
grp2 = H5Gcreate2(fileid3, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp2 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2);
@@ -2962,22 +2961,22 @@ static int test_group_recurse2(void)
}
/*---------------
- * dset1
- */
+ * dset1
+ */
/*
- * Create a new dataset within the fileid1 using defined dataspace and
- * datatype and default dataset creation properties.
- */
+ * Create a new dataset within the fileid1 using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
/*-----------------------------------------------
- * extlink to $GRP_RECURSE2_EXT3/g4
- */
+ * extlink to $GRP_RECURSE2_EXT3/g4
+ */
status = H5Lcreate_external(GRP_RECURSE2_EXT3, "/g4", fileid3, "/g2/g3/g4", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT2);
@@ -2990,15 +2989,15 @@ static int test_group_recurse2(void)
H5Gclose(grp3);
/*-----------------------------------------------------------------------
- * FILE 2-1
- *------------------------------------------------------------------------*/
+ * FILE 2-1
+ *------------------------------------------------------------------------*/
/* crate target file */
fileid2 = H5Fcreate(GRP_RECURSE2_EXT1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------
- * Groups
- */
+ * Groups
+ */
grp1 = H5Gcreate2(fileid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT);
@@ -3007,21 +3006,21 @@ static int test_group_recurse2(void)
}
/*---------------
- * dset1
- */
+ * dset1
+ */
dset1 = H5Dcreate2(fileid2, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
/*-----------------------------------------------------------------------
- * Soft links
- *------------------------------------------------------------------------*/
+ * Soft links
+ *------------------------------------------------------------------------*/
/*
- * under '/' root
- */
+ * under '/' root
+ */
/* link to dset1 */
status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid2, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -3031,8 +3030,8 @@ static int test_group_recurse2(void)
}
/*-----------------------------------------------
- * extlink to $GRP_RECURSE2_EXT2/g2
- */
+ * extlink to $GRP_RECURSE2_EXT2/g2
+ */
status = H5Lcreate_external(GRP_RECURSE2_EXT2, "/g2", fileid2, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT1);
@@ -3045,8 +3044,8 @@ static int test_group_recurse2(void)
out:
/*
- * Close/release resources.
- */
+ * Close/release resources.
+ */
if (dataspace > 0)
H5Sclose(dataspace);
if (datatype > 0)
@@ -3072,20 +3071,21 @@ out:
* Programmer: Jonathan Kim (July, 21, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_exclude_obj1(const char *fname1, const char *fname2)
+static int
+test_exclude_obj1(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ int data2[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -3101,8 +3101,8 @@ static int test_exclude_obj1(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Group
- *------------------------------------------------------------------------*/
+ * Group
+ *------------------------------------------------------------------------*/
/* file1 */
gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
@@ -3121,8 +3121,8 @@ static int test_exclude_obj1(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -3169,8 +3169,8 @@ static int test_exclude_obj1(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -3192,21 +3192,22 @@ out:
* Programmer: Jonathan Kim (July, 21, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_exclude_obj2(const char *fname1, const char *fname2)
+static int
+test_exclude_obj2(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hid_t gid3 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t gid3 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ int data2[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -3222,8 +3223,8 @@ static int test_exclude_obj2(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Group
- *------------------------------------------------------------------------*/
+ * Group
+ *------------------------------------------------------------------------*/
/* file1 */
gid1 = H5Gcreate2(fid1, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
@@ -3250,8 +3251,8 @@ static int test_exclude_obj2(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "dset10", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -3298,8 +3299,8 @@ static int test_exclude_obj2(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -3323,18 +3324,19 @@ out:
* Programmer: Jonathan Kim (Mar, 19, 2012)
*
*-------------------------------------------------------------------------*/
-static int test_exclude_obj3(const char *fname1, const char *fname2)
+static int
+test_exclude_obj3(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -3350,8 +3352,8 @@ static int test_exclude_obj3(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Group
- *------------------------------------------------------------------------*/
+ * Group
+ *------------------------------------------------------------------------*/
/* file1 */
gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
@@ -3361,8 +3363,8 @@ static int test_exclude_obj3(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -3388,8 +3390,8 @@ static int test_exclude_obj3(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -3409,182 +3411,181 @@ out:
* Programmer: Jonathan Kim (Oct, 26, 2010)
*
*-------------------------------------------------------------------------*/
-#define STR_RANK 1
-#define VLEN_STR_DIM 1
-#define FIXLEN_STR_SIZE 21
-#define FIXLEN_STR_DIM 1
-#define VLEN_STR_ARRY_DIM 3
-#define FIXLEN_STR_ARRY_DIM 3
+#define STR_RANK 1
+#define VLEN_STR_DIM 1
+#define FIXLEN_STR_SIZE 21
+#define FIXLEN_STR_DIM 1
+#define VLEN_STR_ARRY_DIM 3
+#define FIXLEN_STR_ARRY_DIM 3
#define FIXLEN_STR_ARRY_SIZE 30
-#define COMP_RANK 1
-#define COMP_DIM 1
-static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new)
+#define COMP_RANK 1
+#define COMP_DIM 1
+static int
+test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new)
{
- int i;
+ int i;
hid_t fid1 = H5I_INVALID_HID; /* file id */
- hid_t gid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
/* compound1 datatype */
typedef struct comp1_t {
- char *str_vlen; /* vlen string */
- char *str_vlen_repeat; /* vlen string */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char * str_vlen; /* vlen string */
+ char * str_vlen_repeat; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
} comp1_t;
/* compound2 datatype */
typedef struct comp2_t {
- char *str_vlen; /* vlen string */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen_repeat; /* vlen string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char * str_vlen; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen_repeat; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
} comp2_t;
/* compound3 datatype */
typedef struct comp3_t {
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen; /* vlen string */
- char *str_vlen_repeat; /* vlen string */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen; /* vlen string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
} comp3_t;
/* compound4 datatype */
typedef struct comp4_t {
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen; /* vlen string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen_repeat; /* vlen string */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen_repeat; /* vlen string */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
} comp4_t;
/* compound5 datatype */
typedef struct comp5_t {
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- char *str_vlen; /* vlen string */
- char *str_vlen_repeat; /* vlen string */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_vlen; /* vlen string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
} comp5_t;
/* compound6 datatype */
typedef struct comp6_t {
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- char *str_vlen; /* vlen string */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen_repeat; /* vlen string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_vlen; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
} comp6_t;
/* compound7 datatype */
typedef struct comp7_t {
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen; /* vlen string */
- char *str_vlen_repeat; /* vlen string */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen; /* vlen string */
+ char * str_vlen_repeat; /* vlen string */
} comp7_t;
/* compound8 datatype */
typedef struct comp8_t {
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen; /* vlen string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen_repeat; /* vlen string */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen_repeat; /* vlen string */
} comp8_t;
/* compound9 datatype */
typedef struct comp9_t {
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- int int_data1;
- hobj_ref_t objref1; /* reference */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- hobj_ref_t objref2; /* reference */
- char *str_vlen; /* vlen string */
- int int_data2;
- char *str_vlen_repeat; /* vlen string */
- hobj_ref_t objref3; /* reference */
- int int_data3;
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ int int_data1;
+ hobj_ref_t objref1; /* reference */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ hobj_ref_t objref2; /* reference */
+ char * str_vlen; /* vlen string */
+ int int_data2;
+ char * str_vlen_repeat; /* vlen string */
+ hobj_ref_t objref3; /* reference */
+ int int_data3;
} comp9_t;
/* vlen string */
- hid_t sid_vlen_str = H5I_INVALID_HID; /* dataspace ID */
- hid_t tid_vlen_str = H5I_INVALID_HID; /* datatype ID */
- char vlen_str_buf[] = { "Variable length string" };
- hsize_t dims_vlen_str[] = { VLEN_STR_DIM };
+ hid_t sid_vlen_str = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_vlen_str = H5I_INVALID_HID; /* datatype ID */
+ char vlen_str_buf[] = {"Variable length string"};
+ hsize_t dims_vlen_str[] = {VLEN_STR_DIM};
/* fixlen string */
- hid_t sid_fixlen_str = H5I_INVALID_HID; /* dataspace ID */
- hid_t tid_fixlen_str = H5I_INVALID_HID; /* datatype ID */
- const char fixlen_str_buf[FIXLEN_STR_SIZE] = { "Fixed length string" };
- hsize_t dims_fixlen_str[] = { FIXLEN_STR_DIM };
+ hid_t sid_fixlen_str = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_fixlen_str = H5I_INVALID_HID; /* datatype ID */
+ const char fixlen_str_buf[FIXLEN_STR_SIZE] = {"Fixed length string"};
+ hsize_t dims_fixlen_str[] = {FIXLEN_STR_DIM};
/* vlen string array */
- hid_t sid_vlen_str_array = H5I_INVALID_HID; /* dataspace ID */
- hid_t tid_vlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */
- hid_t tid_vlen_str_array = H5I_INVALID_HID; /* datatype ID */
- const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM] =
- { "1 - Variable length string Array",
- "2 - Testing variable length string array in compound type",
- "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation," };
- hsize_t dims_vlen_str_array[] = { VLEN_STR_ARRY_DIM };
+ hid_t sid_vlen_str_array = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_vlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid_vlen_str_array = H5I_INVALID_HID; /* datatype ID */
+ const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM] = {
+ "1 - Variable length string Array", "2 - Testing variable length string array in compound type",
+ "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation,"};
+ hsize_t dims_vlen_str_array[] = {VLEN_STR_ARRY_DIM};
/* fixlen string array */
- hid_t sid_fixlen_str_array = H5I_INVALID_HID; /* dataspace ID */
- hid_t tid_fixlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */
- hid_t tid_fixlen_str_array = H5I_INVALID_HID; /* datatype ID */
+ hid_t sid_fixlen_str_array = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_fixlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid_fixlen_str_array = H5I_INVALID_HID; /* datatype ID */
const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM] = {
- "1 - Fixed length string Array", "2 - Fixed length string Array",
- "3 - Fixed length string Array" };
- hsize_t dims_fixlen_str_array[] = { FIXLEN_STR_ARRY_DIM };
+ "1 - Fixed length string Array", "2 - Fixed length string Array", "3 - Fixed length string Array"};
+ hsize_t dims_fixlen_str_array[] = {FIXLEN_STR_ARRY_DIM};
/*------------------------------------------
- * compound dataset
- *------------------------------------------*/
- hid_t sid_comp = H5I_INVALID_HID; /* dataspace ID */
- hid_t tid1_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid2_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid3_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid4_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid5_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid6_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid7_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid8_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid9_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t did_comp = H5I_INVALID_HID; /* dataset ID */
- hsize_t dims_comp[] = { COMP_DIM };
- herr_t status = SUCCEED;
+ * compound dataset
+ *------------------------------------------*/
+ hid_t sid_comp = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid1_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid2_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid3_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid4_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid5_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid6_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid7_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid8_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid9_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t did_comp = H5I_INVALID_HID; /* dataset ID */
+ hsize_t dims_comp[] = {COMP_DIM};
+ herr_t status = SUCCEED;
/* make compound strings data */
comp1_t comp1_buf;
@@ -3641,25 +3642,15 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* copy vlen string array data to compound buffers */
for (i = 0; i < VLEN_STR_ARRY_DIM; i++) {
- comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
-
+ comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
}
/* copy fixlen string attay data to compound buffers */
@@ -3698,8 +3689,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
comp9_buf.int_data3 = 30;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
if (is_file_new == 1) {
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
@@ -3718,8 +3709,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Create group
- *------------------------------------------------------------------------*/
+ * Create group
+ *------------------------------------------------------------------------*/
gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
@@ -3728,8 +3719,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Variable length String1 - Create space and type
- *------------------------------------------------------------------------*/
+ * Variable length String1 - Create space and type
+ *------------------------------------------------------------------------*/
sid_vlen_str = H5Screate_simple(STR_RANK, dims_vlen_str, NULL);
if (sid_vlen_str < 0) {
HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
@@ -3738,7 +3729,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
tid_vlen_str = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid_vlen_str, H5T_VARIABLE);
+ status = H5Tset_size(tid_vlen_str, H5T_VARIABLE);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
status = FAIL;
@@ -3746,8 +3737,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Fixed length String2 - Create space and type
- *------------------------------------------------------------------------*/
+ * Fixed length String2 - Create space and type
+ *------------------------------------------------------------------------*/
sid_fixlen_str = H5Screate_simple(STR_RANK, dims_fixlen_str, NULL);
if (sid_fixlen_str < 0) {
HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
@@ -3756,7 +3747,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
tid_fixlen_str = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE);
+ status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
status = FAIL;
@@ -3764,8 +3755,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Fixed length String3 array - Create space and type
- *------------------------------------------------------------------------*/
+ * Fixed length String3 array - Create space and type
+ *------------------------------------------------------------------------*/
sid_vlen_str_array = H5Screate_simple(STR_RANK, dims_vlen_str_array, NULL);
if (sid_vlen_str_array < 0) {
HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
@@ -3774,7 +3765,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
tid_vlen_str_array_pre = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE);
+ status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
status = FAIL;
@@ -3790,8 +3781,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Variable length String4 array - Create space and type
- *------------------------------------------------------------------------*/
+ * Variable length String4 array - Create space and type
+ *------------------------------------------------------------------------*/
sid_fixlen_str_array = H5Screate_simple(STR_RANK, dims_fixlen_str_array, NULL);
if (sid_fixlen_str_array < 0) {
HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
@@ -3800,7 +3791,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
tid_fixlen_str_array_pre = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE);
+ status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
status = FAIL;
@@ -3815,8 +3806,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-------------------------------------------------------------------------
- * Compound dataset
- *------------------------------------------------------------------------*/
+ * Compound dataset
+ *------------------------------------------------------------------------*/
sid_comp = H5Screate_simple(COMP_RANK, dims_comp, NULL);
if (sid_comp < 0) {
HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
@@ -3879,7 +3870,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
H5Tinsert(tid5_comp, "FIXLEN_STR1", HOFFSET(comp5_t, str_fixlen), tid_fixlen_str);
H5Tinsert(tid5_comp, "FIXLEN_STR2", HOFFSET(comp5_t, str_fixlen_repeat), tid_fixlen_str);
H5Tinsert(tid5_comp, "VLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_vlen), tid_vlen_str_array);
- H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array);
H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_fixlen), tid_fixlen_str_array);
H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp5_t, str_fixlen_array_again), tid_fixlen_str_array);
@@ -3931,7 +3922,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 1 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset1", tid1_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf);
+ status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3941,7 +3932,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 2 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset2", tid2_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf);
+ status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3951,7 +3942,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 3 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset3", tid3_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf);
+ status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3961,7 +3952,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 4 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset4", tid4_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf);
+ status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3971,7 +3962,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 5 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset5", tid5_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf);
+ status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3981,7 +3972,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 6 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset6", tid6_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf);
+ status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3991,7 +3982,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 7 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset7", tid7_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf);
+ status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -4001,7 +3992,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 8 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset8", tid8_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf);
+ status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -4013,9 +4004,9 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
did_comp = H5Dcreate2(gid, "Compound_dset9", tid9_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* obj references */
- status = H5Rcreate(&(comp9_buf.objref1), gid, "Compound_dset2", H5R_OBJECT, (hid_t) -1);
- status = H5Rcreate(&(comp9_buf.objref2), gid, "Compound_dset3", H5R_OBJECT, (hid_t) -1);
- status = H5Rcreate(&(comp9_buf.objref3), gid, "Compound_dset4", H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&(comp9_buf.objref1), gid, "Compound_dset2", H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&(comp9_buf.objref2), gid, "Compound_dset3", H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&(comp9_buf.objref3), gid, "Compound_dset4", H5R_OBJECT, (hid_t)-1);
status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf);
if (status < 0) {
@@ -4029,8 +4020,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1 > 0)
H5Fclose(fid1);
if (gid > 0)
@@ -4094,59 +4085,60 @@ out:
*
*-------------------------------------------------------------------------*/
-static int test_enums(const char *fname)
+static int
+test_enums(const char *fname)
{
hid_t fid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- int enum_val = -1;
+ hid_t tid = H5I_INVALID_HID;
+ int enum_val = -1;
/* The data in the two arrays cover the following cases:
- *
- * V = valid enum value, I = invalid enum value
- *
- * 0: I-I (same value)
- * 1: V-I
- * 2: I-V
- * 3: V-V (same value)
- * 4: I-I (different values) SKIPPED FOR NOW
- * 5: V-V (different values)
- */
+ *
+ * V = valid enum value, I = invalid enum value
+ *
+ * 0: I-I (same value)
+ * 1: V-I
+ * 2: I-V
+ * 3: V-V (same value)
+ * 4: I-I (different values) SKIPPED FOR NOW
+ * 5: V-V (different values)
+ */
/* *** NOTE ***
- *
- * There is a bug in H5Dread() where invalid enum values are always
- * returned as -1 so two different invalid enum values cannot be
- * properly compared. Test 4 has been adjusted to pass here
- * while we fix the issue.
- */
- int data1[6] = { 9, 0, 9, 0, 9, 0 };
+ *
+ * There is a bug in H5Dread() where invalid enum values are always
+ * returned as -1 so two different invalid enum values cannot be
+ * properly compared. Test 4 has been adjusted to pass here
+ * while we fix the issue.
+ */
+ int data1[6] = {9, 0, 9, 0, 9, 0};
/*int data1[6] = {9, 0, 9, 0, 8, 0}; */
- int data2[6] = { 9, 9, 0, 0, 9, 1 };
+ int data2[6] = {9, 9, 0, 0, 9, 1};
hsize_t dims = 6;
herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create the file
- *---------------------------------------------------------------------*/
+ * Create the file
+ *---------------------------------------------------------------------*/
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------------------------------
- * Create enum types
- *---------------------------------------------------------------------*/
+ * Create enum types
+ *---------------------------------------------------------------------*/
- tid = H5Tenum_create(H5T_NATIVE_INT);
+ tid = H5Tenum_create(H5T_NATIVE_INT);
enum_val = 0;
- status = H5Tenum_insert(tid, "YIN", &enum_val);
+ status = H5Tenum_insert(tid, "YIN", &enum_val);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname);
status = FAIL;
goto out;
}
enum_val = 1;
- status = H5Tenum_insert(tid, "YANG", &enum_val);
+ status = H5Tenum_insert(tid, "YANG", &enum_val);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname);
status = FAIL;
@@ -4154,8 +4146,8 @@ static int test_enums(const char *fname)
}
/*-----------------------------------------------------------------------
- * Create datasets containing enum data.
- *---------------------------------------------------------------------*/
+ * Create datasets containing enum data.
+ *---------------------------------------------------------------------*/
status = write_dset(fid, 1, &dims, "dset1", tid, data1);
if (status < 0) {
@@ -4172,8 +4164,8 @@ static int test_enums(const char *fname)
out:
/*-----------------------------------------------------------------------
- * Close
- *---------------------------------------------------------------------*/
+ * Close
+ *---------------------------------------------------------------------*/
if (fid)
H5Fclose(fid);
if (tid)
@@ -4203,35 +4195,36 @@ out:
* Programmer: Jonathan Kim (Sep, 1, 2011)
*
*-------------------------------------------------------------------------*/
-#define SDIM_DSET 2
+#define SDIM_DSET 2
#define SDIM_CMPD_ARRAY 2
-static void test_comps_array(const char *fname, const char *dset, const char *attr, int diff, int is_file_new)
+static void
+test_comps_array(const char *fname, const char *dset, const char *attr, int diff, int is_file_new)
{
/* sub compound 2 */
typedef struct {
- int i2;
+ int i2;
float f2;
} cmpd2_t;
/* top compound 1 */
typedef struct {
- int i1;
+ int i1;
cmpd2_t cmpd2[SDIM_CMPD_ARRAY];
} cmpd1_t;
cmpd1_t wdata[SDIM_DSET]; /* dataset with compound1 */
- hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */
- hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t sid_dset = H5I_INVALID_HID; /* Dataset space ID */
- hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 type ID */
- hid_t tid_arry1 = H5I_INVALID_HID; /* Array type ID in compound1 */
- hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 type ID */
- hid_t tid_attr = H5I_INVALID_HID;
- hsize_t sdims_dset[] = { SDIM_DSET };
- hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY };
- int i, j;
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */
+ hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* Dataset space ID */
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 type ID */
+ hid_t tid_arry1 = H5I_INVALID_HID; /* Array type ID in compound1 */
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 type ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hsize_t sdims_dset[] = {SDIM_DSET};
+ hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY};
+ int i, j;
herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Initialize array data to write */
@@ -4239,20 +4232,20 @@ static void test_comps_array(const char *fname, const char *dset, const char *at
wdata[i].i1 = i;
for (j = 0; j < SDIM_CMPD_ARRAY; j++) {
wdata[i].cmpd2[j].i2 = i * 10 + diff;
- wdata[i].cmpd2[j].f2 = (float) i * 10.5F + (float) diff;
+ wdata[i].cmpd2[j].f2 = (float)i * 10.5F + (float)diff;
} /* end for */
}
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
if (is_file_new == 1)
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
else
fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
/* -------------------------------
- * Create a sub compound2 datatype */
+ * Create a sub compound2 datatype */
tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
/* Insert integer field */
@@ -4264,8 +4257,8 @@ static void test_comps_array(const char *fname, const char *dset, const char *at
assert(ret >= 0);
/*-----------------------------------
- * Create a top compound1.
- */
+ * Create a top compound1.
+ */
tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t));
ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT);
@@ -4278,8 +4271,8 @@ static void test_comps_array(const char *fname, const char *dset, const char *at
assert(ret >= 0);
/* -------------------
- * Create a dataset
- */
+ * Create a dataset
+ */
/* Create dataspace for datasets */
sid_dset = H5Screate_simple(1, sdims_dset, NULL);
@@ -4290,15 +4283,15 @@ static void test_comps_array(const char *fname, const char *dset, const char *at
assert(ret >= 0);
/*-----------------------------------
- * Create an attribute in root group
- */
+ * Create an attribute in root group
+ */
tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
assert(tid_attr > 0);
ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
assert(ret >= 0);
/* ----------------
- * Close Dataset */
+ * Close Dataset */
ret = H5Aclose(tid_attr);
assert(ret >= 0);
ret = H5Tclose(tid_arry1);
@@ -4315,57 +4308,56 @@ static void test_comps_array(const char *fname, const char *dset, const char *at
assert(ret >= 0);
}
-static void test_comps_vlen(const char * fname, const char *dset, const char *attr, int diff, int is_file_new)
+static void
+test_comps_vlen(const char *fname, const char *dset, const char *attr, int diff, int is_file_new)
{
/* sub compound 2 */
typedef struct {
- int i2;
+ int i2;
float f2;
} cmpd2_t;
/* top compound 1 */
typedef struct {
- int i1;
+ int i1;
hvl_t vl; /* VL information for compound2 */
} cmpd1_t;
cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */
- hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
- hid_t did_dset = H5I_INVALID_HID; /* dataset ID */
- hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */
- hid_t tid_attr = H5I_INVALID_HID;
- hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */
- hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */
- hid_t tid_cmpd1_vlen = H5I_INVALID_HID;
- hsize_t sdims_dset[] = { SDIM_DSET };
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
+ hid_t did_dset = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */
+ hid_t tid_cmpd1_vlen = H5I_INVALID_HID;
+ hsize_t sdims_dset[] = {SDIM_DSET};
- unsigned i, j; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ unsigned i, j; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Allocate and initialize VL data to write */
for (i = 0; i < SDIM_DSET; i++) {
- wdata[i].i1 = (int) i;
- wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
+ wdata[i].i1 = (int)i;
+ wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
wdata[i].vl.len = i + 1;
for (j = 0; j < (i + 1); j++) {
- ((cmpd2_t *) wdata[i].vl.p)[j].i2 =
- (int) (i * 10 + (unsigned) diff);
- ((cmpd2_t *) wdata[i].vl.p)[j].f2 = (float) i * 10.5F
- + (float) diff;
+ ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)(i * 10 + (unsigned)diff);
+ ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)i * 10.5F + (float)diff;
} /* end for */
- } /* end for */
+ } /* end for */
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
if (is_file_new == 1)
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
else
fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
/* -----------------------------
- * Create sub compound2 type */
+ * Create sub compound2 type */
tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
/* Insert fields */
@@ -4375,7 +4367,7 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
assert(ret >= 0);
/* ---------------------------
- * Create top compound1 type */
+ * Create top compound1 type */
tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t));
/* Insert fields */
ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT);
@@ -4387,8 +4379,8 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
assert(ret >= 0);
/* -------------------------------
- * Create dataset with compound1
- */
+ * Create dataset with compound1
+ */
/* Create dataspace for dataset */
sid_dset = H5Screate_simple(1, sdims_dset, NULL);
@@ -4400,8 +4392,8 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
assert(ret >= 0);
/*-----------------------------------
- * Create an attribute in root group
- */
+ * Create an attribute in root group
+ */
tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
assert(tid_attr > 0);
ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
@@ -4412,7 +4404,7 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
assert(ret >= 0);
/* ----------------
- * Close IDs */
+ * Close IDs */
ret = H5Aclose(tid_attr);
assert(ret >= 0);
ret = H5Dclose(did_dset);
@@ -4429,60 +4421,59 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
assert(ret >= 0);
}
-static void test_comps_array_vlen(const char * fname, const char *dset, const char *attr, int diff, int is_file_new)
+static void
+test_comps_array_vlen(const char *fname, const char *dset, const char *attr, int diff, int is_file_new)
{
typedef struct {
- int i3;
+ int i3;
float f3;
} cmpd3_t;
typedef struct { /* Typedef for compound datatype */
- int i2;
+ int i2;
hvl_t vl; /* VL information to write */
} cmpd2_t;
typedef struct {
- int i1;
+ int i1;
cmpd2_t cmpd2[SDIM_CMPD_ARRAY];
} cmpd1_t;
- cmpd1_t wdata[SDIM_DSET]; /* Information to write */
- hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */
- hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t sid_dset = H5I_INVALID_HID; /* Dataspace ID */
- hid_t tid_attr = H5I_INVALID_HID;
- hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 Datatype ID */
- hid_t tid_arry1 = H5I_INVALID_HID; /* Array Datatype ID */
- hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 Datatype ID */
- hid_t tid_cmpd2_vlen = H5I_INVALID_HID;
- hid_t tid_cmpd3 = H5I_INVALID_HID; /* Compound3 Datatype ID */
- hsize_t sdims_dset[] = { SDIM_DSET };
- hsize_t sdims_arry[] = { SDIM_CMPD_ARRAY };
- unsigned i, j, k; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ cmpd1_t wdata[SDIM_DSET]; /* Information to write */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */
+ hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 Datatype ID */
+ hid_t tid_arry1 = H5I_INVALID_HID; /* Array Datatype ID */
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 Datatype ID */
+ hid_t tid_cmpd2_vlen = H5I_INVALID_HID;
+ hid_t tid_cmpd3 = H5I_INVALID_HID; /* Compound3 Datatype ID */
+ hsize_t sdims_dset[] = {SDIM_DSET};
+ hsize_t sdims_arry[] = {SDIM_CMPD_ARRAY};
+ unsigned i, j, k; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Initialize array data to write in compound1 */
for (i = 0; i < SDIM_DSET; i++) {
- wdata[i].i1 = (int) i;
+ wdata[i].i1 = (int)i;
/* Allocate and initialize VL data to write in compound2 */
for (j = 0; j < SDIM_CMPD_ARRAY; j++) {
- wdata[i].cmpd2[j].i2 = (int) (j * 10);
- wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t));
+ wdata[i].cmpd2[j].i2 = (int)(j * 10);
+ wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t));
wdata[i].cmpd2[j].vl.len = j + 1;
for (k = 0; k < (j + 1); k++) {
/* Initialize data of compound3 */
- ((cmpd3_t *) wdata[i].cmpd2[j].vl.p)[k].i3 = (int) j * 10
- + diff;
- ((cmpd3_t *) wdata[i].cmpd2[j].vl.p)[k].f3 = (float) j * 10.5F
- + (float) diff;
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = (int)j * 10 + diff;
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)j * 10.5F + (float)diff;
} /* end for */
- } /* end for */
+ } /* end for */
}
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
if (is_file_new == 1)
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
else
@@ -4492,7 +4483,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
sid_dset = H5Screate_simple(1, sdims_dset, NULL);
/*-------------------------------------
- * Create a sub compound3 datatype */
+ * Create a sub compound3 datatype */
tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t));
/* Insert integer field */
@@ -4504,7 +4495,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
assert(ret >= 0);
/*-------------------------------------
- * Create a sub compound2 datatype */
+ * Create a sub compound2 datatype */
tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
/* Insert integer field */
@@ -4512,12 +4503,12 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
assert(ret >= 0);
/* Create a VL datatype */
tid_cmpd2_vlen = H5Tvlen_create(tid_cmpd3);
- ret = H5Tinsert(tid_cmpd2, "vlen", HOFFSET(cmpd2_t, vl), tid_cmpd2_vlen);
+ ret = H5Tinsert(tid_cmpd2, "vlen", HOFFSET(cmpd2_t, vl), tid_cmpd2_vlen);
assert(ret >= 0);
/*-----------------------------------
- * Create a top compound1 datatype for dataset.
- */
+ * Create a top compound1 datatype for dataset.
+ */
tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t));
/* Create an array datatype */
@@ -4526,7 +4517,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
H5Tinsert(tid_cmpd1, "array_comp", HOFFSET(cmpd1_t, cmpd2), tid_arry1);
/* ----------------------
- * Create a dataset */
+ * Create a dataset */
did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write dataset to disk */
@@ -4534,8 +4525,8 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
assert(ret >= 0);
/*-----------------------------------
- * Create an attribute in root group
- */
+ * Create an attribute in root group
+ */
tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
assert(tid_attr > 0);
ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
@@ -4546,7 +4537,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
assert(ret >= 0);
/*-------------------
- * Close IDs */
+ * Close IDs */
ret = H5Aclose(tid_attr);
assert(ret >= 0);
ret = H5Tclose(tid_arry1);
@@ -4567,70 +4558,71 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
assert(ret >= 0);
}
-static void test_comps_vlen_arry(const char * fname, const char *dset, const char *attr, int diff, int is_file_new)
+static void
+test_comps_vlen_arry(const char *fname, const char *dset, const char *attr, int diff, int is_file_new)
{
/* sub compound 3 */
typedef struct {
- int i3;
+ int i3;
float f3;
} cmpd3_t;
/* sub compound 2 */
typedef struct {
- int i2;
+ int i2;
cmpd3_t cmpd3[SDIM_CMPD_ARRAY];
} cmpd2_t;
/* top compound 1 */
typedef struct {
- int i1;
+ int i1;
hvl_t vl; /* VL information for compound2 */
} cmpd1_t;
cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */
- hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
- hid_t did_dset = H5I_INVALID_HID; /* dataset ID */
- hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */
- hid_t tid_attr = H5I_INVALID_HID;
- hid_t tid_cmpd3 = H5I_INVALID_HID; /* compound3 type ID */
- hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */
- hid_t tid_cmpd2_arry = H5I_INVALID_HID;
- hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */
- hid_t tid_cmpd1_vlen = H5I_INVALID_HID;
- hsize_t sdims_dset[] = { SDIM_DSET };
- hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY };
-
- unsigned i, j, k; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
+ hid_t did_dset = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hid_t tid_cmpd3 = H5I_INVALID_HID; /* compound3 type ID */
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */
+ hid_t tid_cmpd2_arry = H5I_INVALID_HID;
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */
+ hid_t tid_cmpd1_vlen = H5I_INVALID_HID;
+ hsize_t sdims_dset[] = {SDIM_DSET};
+ hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY};
+
+ unsigned i, j, k; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Allocate and initialize VL data to write */
for (i = 0; i < SDIM_DSET; i++) {
/* compound 1 data */
- wdata[i].i1 = (int) i;
- wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
+ wdata[i].i1 = (int)i;
+ wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
wdata[i].vl.len = i + 1;
for (j = 0; j < (i + 1); j++) {
/* compound2 data */
- ((cmpd2_t *) wdata[i].vl.p)[j].i2 = (int) i * 10 + diff;
+ ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)i * 10 + diff;
for (k = 0; k < SDIM_CMPD_ARRAY; k++) {
/* compound 3 data */
- ((cmpd2_t *) (wdata[i].vl.p))[j].cmpd3[k].i3 = (int) ((float) k * 10.5F) + diff;
- ((cmpd2_t *) (wdata[i].vl.p))[j].cmpd3[k].f3 = (float) k * 10.5F + (float) diff;
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = (int)((float)k * 10.5F) + diff;
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)k * 10.5F + (float)diff;
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
if (is_file_new == 1)
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
else
fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
/* -----------------------------
- * Create sub compound3 type */
+ * Create sub compound3 type */
tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t));
/* Insert fields */
@@ -4640,45 +4632,44 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha
assert(ret >= 0);
/* -----------------------------
- * Create sub compound2 type */
+ * Create sub compound2 type */
tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
ret = H5Tinsert(tid_cmpd2, "int2", HOFFSET(cmpd2_t, i2), H5T_NATIVE_INT);
assert(ret >= 0);
tid_cmpd2_arry = H5Tarray_create2(tid_cmpd3, 1, sdims_cmpd_arry);
- ret = H5Tinsert(tid_cmpd2, "array_cmpd2", HOFFSET(cmpd2_t, cmpd3), tid_cmpd2_arry);
+ ret = H5Tinsert(tid_cmpd2, "array_cmpd2", HOFFSET(cmpd2_t, cmpd3), tid_cmpd2_arry);
assert(ret >= 0);
/* ---------------------------
- * Create top compound1 type
- */
+ * Create top compound1 type
+ */
/* Create a VL datatype */
tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t));
/* Insert fields */
ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT);
assert(ret >= 0);
tid_cmpd1_vlen = H5Tvlen_create(tid_cmpd2);
- ret = H5Tinsert(tid_cmpd1, "vlen_cmpd1", HOFFSET(cmpd1_t, vl), tid_cmpd1_vlen);
+ ret = H5Tinsert(tid_cmpd1, "vlen_cmpd1", HOFFSET(cmpd1_t, vl), tid_cmpd1_vlen);
assert(ret >= 0);
/* -------------------------------
- * Create dataset with compound1
- */
+ * Create dataset with compound1
+ */
/* Create dataspace for dataset */
sid_dset = H5Screate_simple(1, sdims_dset, NULL);
/* Create a dataset */
- did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write dataset to disk */
ret = H5Dwrite(did_dset, tid_cmpd1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
assert(ret >= 0);
/*-----------------------------------
- * Create an attribute in root group
- */
+ * Create an attribute in root group
+ */
tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
assert(tid_attr > 0);
ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
@@ -4689,7 +4680,7 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha
assert(ret >= 0);
/* ----------------
- * Close IDs */
+ * Close IDs */
ret = H5Aclose(tid_attr);
assert(ret >= 0);
ret = H5Dclose(did_dset);
@@ -4720,83 +4711,83 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha
*
*-------------------------------------------------------------------------*/
#define DIM_ARRY 3
-static void test_data_nocomparables(const char * fname, int make_diffs)
+static void
+test_data_nocomparables(const char *fname, int make_diffs)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hid_t did1 = H5I_INVALID_HID;
- hid_t did2 = H5I_INVALID_HID;
- hid_t sid1 = H5I_INVALID_HID;
- hid_t tid_dset1 = H5I_INVALID_HID;
- hid_t tid_attr1 = H5I_INVALID_HID;
- hsize_t dims1_1[1] = { DIM_ARRY };
- hsize_t dims1_2[1] = { DIM_ARRY + 1 };
- hsize_t dims2[2] = { DIM_ARRY, 1 };
- int data1[DIM_ARRY] = { 0, 0, 0 };
- int data2[DIM_ARRY] = { 1, 1, 1 };
- int data3[DIM_ARRY + 1] = { 1, 1, 1, 1 };
- int data1_dim2[DIM_ARRY][1] = { { 0 }, { 0 }, { 0 } };
- int rank_attr;
- char data1_str[DIM_ARRY][STR_SIZE] = { "ab", "cd", "ef" };
- herr_t status = SUCCEED;
- void *dset_data_ptr1 = NULL;
- void *dset_data_ptr2 = NULL;
- void *dset_data_ptr3 = NULL;
- void *attr_data_ptr1 = NULL;
- void *attr_data_ptr2 = NULL;
- void *attr_data_ptr3 = NULL;
- void *attr_data_ptr4 = NULL;
- void *attr2_dim_ptr = NULL;
- void *attr3_dim_ptr = NULL;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t did1 = H5I_INVALID_HID;
+ hid_t did2 = H5I_INVALID_HID;
+ hid_t sid1 = H5I_INVALID_HID;
+ hid_t tid_dset1 = H5I_INVALID_HID;
+ hid_t tid_attr1 = H5I_INVALID_HID;
+ hsize_t dims1_1[1] = {DIM_ARRY};
+ hsize_t dims1_2[1] = {DIM_ARRY + 1};
+ hsize_t dims2[2] = {DIM_ARRY, 1};
+ int data1[DIM_ARRY] = {0, 0, 0};
+ int data2[DIM_ARRY] = {1, 1, 1};
+ int data3[DIM_ARRY + 1] = {1, 1, 1, 1};
+ int data1_dim2[DIM_ARRY][1] = {{0}, {0}, {0}};
+ int rank_attr;
+ char data1_str[DIM_ARRY][STR_SIZE] = {"ab", "cd", "ef"};
+ herr_t status = SUCCEED;
+ void * dset_data_ptr1 = NULL;
+ void * dset_data_ptr2 = NULL;
+ void * dset_data_ptr3 = NULL;
+ void * attr_data_ptr1 = NULL;
+ void * attr_data_ptr2 = NULL;
+ void * attr_data_ptr3 = NULL;
+ void * attr_data_ptr4 = NULL;
+ void * attr2_dim_ptr = NULL;
+ void * attr3_dim_ptr = NULL;
/* init */
- tid_dset1 = H5Tcopy(H5T_NATIVE_INT);
- dset_data_ptr1 = (int*) &data1;
- dset_data_ptr2 = (int*) &data1;
- dset_data_ptr3 = (int*) &data1;
- tid_attr1 = H5Tcopy(H5T_NATIVE_INT);
- attr_data_ptr1 = (int*) &data1;
- attr_data_ptr3 = (int*) &data1;
- attr_data_ptr4 = (int*) &data1;
- attr2_dim_ptr = (hsize_t*) &dims1_1;
- attr3_dim_ptr = (hsize_t*) &dims1_1;
- rank_attr = 1;
+ tid_dset1 = H5Tcopy(H5T_NATIVE_INT);
+ dset_data_ptr1 = (int *)&data1;
+ dset_data_ptr2 = (int *)&data1;
+ dset_data_ptr3 = (int *)&data1;
+ tid_attr1 = H5Tcopy(H5T_NATIVE_INT);
+ attr_data_ptr1 = (int *)&data1;
+ attr_data_ptr3 = (int *)&data1;
+ attr_data_ptr4 = (int *)&data1;
+ attr2_dim_ptr = (hsize_t *)&dims1_1;
+ attr3_dim_ptr = (hsize_t *)&dims1_1;
+ rank_attr = 1;
if (make_diffs) {
/* ------------
- * group1 */
+ * group1 */
tid_dset1 = H5Tcopy(H5T_C_S1);
- H5Tset_size(tid_dset1, (size_t) STR_SIZE);
- dset_data_ptr1 = (char*) &data1_str;
- dset_data_ptr2 = (int*) &data2;
- attr_data_ptr1 = (int*) &data2;
+ H5Tset_size(tid_dset1, (size_t)STR_SIZE);
+ dset_data_ptr1 = (char *)&data1_str;
+ dset_data_ptr2 = (int *)&data2;
+ attr_data_ptr1 = (int *)&data2;
/* -----------
- * group2
- */
- dset_data_ptr3 = (int*) &data2;
+ * group2
+ */
+ dset_data_ptr3 = (int *)&data2;
/* dset1/attr1 */
tid_attr1 = H5Tcopy(H5T_C_S1);
- H5Tset_size(tid_attr1, (size_t) STR_SIZE);
- attr_data_ptr2 = (char*) &data1_str;
+ H5Tset_size(tid_attr1, (size_t)STR_SIZE);
+ attr_data_ptr2 = (char *)&data1_str;
/* dset1/attr2 */
- attr2_dim_ptr = (hsize_t*) &dims1_2;
+ attr2_dim_ptr = (hsize_t *)&dims1_2;
/* dset1/attr3 */
- attr_data_ptr3 = (int*) &data1_dim2;
- attr3_dim_ptr = (hsize_t*) &dims2;
- rank_attr = 2;
+ attr_data_ptr3 = (int *)&data1_dim2;
+ attr3_dim_ptr = (hsize_t *)&dims2;
+ rank_attr = 2;
/* dset1/attr4 */
- attr_data_ptr4 = (int*) &data2;
-
+ attr_data_ptr4 = (int *)&data2;
}
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname);
@@ -4805,8 +4796,8 @@ static void test_data_nocomparables(const char * fname, int make_diffs)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
gid1 = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname);
@@ -4822,8 +4813,8 @@ static void test_data_nocomparables(const char * fname, int make_diffs)
}
/*-----------------------------------------------------------------------
- * Datasets in /g1
- *------------------------------------------------------------------------*/
+ * Datasets in /g1
+ *------------------------------------------------------------------------*/
if ((sid1 = H5Screate_simple(1, dims1_1, NULL)) < 0)
goto out;
@@ -4849,10 +4840,10 @@ static void test_data_nocomparables(const char * fname, int make_diffs)
}
/*-----------------------------------------------------------------------
- * Datasets in /g2
- *------------------------------------------------------------------------*/
+ * Datasets in /g2
+ *------------------------------------------------------------------------*/
/* ---------
- * dset1 */
+ * dset1 */
if ((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1");
status = FAIL;
@@ -4868,16 +4859,16 @@ static void test_data_nocomparables(const char * fname, int make_diffs)
write_attr(did2, 1, dims1_1, "attr1", tid_attr1, attr_data_ptr2);
/* attr2 - non-compatible : same rank, different dimention */
- write_attr(did2, 1, (hsize_t *) attr2_dim_ptr, "attr2", H5T_NATIVE_INT, data3);
+ write_attr(did2, 1, (hsize_t *)attr2_dim_ptr, "attr2", H5T_NATIVE_INT, data3);
/* attr3 - non-compatible : different rank */
- write_attr(did2, rank_attr, (hsize_t *) attr3_dim_ptr, "attr3", H5T_NATIVE_INT, attr_data_ptr3);
+ write_attr(did2, rank_attr, (hsize_t *)attr3_dim_ptr, "attr3", H5T_NATIVE_INT, attr_data_ptr3);
/* attr4 - compatible : different data values */
write_attr(did2, 1, dims1_1, "attr4", H5T_NATIVE_INT, attr_data_ptr4);
/*----------
- * dset2 */
+ * dset2 */
status = write_dset(gid2, 1, dims1_1, "dset2", H5T_NATIVE_INT, dset_data_ptr3);
if (status == FAIL) {
HDfprintf(stderr, "Error: %s> write_dset failed\n", fname);
@@ -4887,8 +4878,8 @@ static void test_data_nocomparables(const char * fname, int make_diffs)
out:
/*-----------------------------------------------------------------------
- * Close IDs
- *-----------------------------------------------------------------------*/
+ * Close IDs
+ *-----------------------------------------------------------------------*/
if (fid)
H5Fclose(fid);
if (gid1)
@@ -4918,95 +4909,96 @@ out:
static void
test_objs_nocomparables(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t topgid1 = H5I_INVALID_HID;
- hid_t topgid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t tid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hid_t tid2 = H5I_INVALID_HID;
- hsize_t dims[1] = { DIM_ARRY };
- int data1[DIM_ARRY] = { 1, 1, 1 };
- int data2[DIM_ARRY] = { 2, 2, 2 };
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t topgid1 = H5I_INVALID_HID;
+ hid_t topgid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t tid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t tid2 = H5I_INVALID_HID;
+ hsize_t dims[1] = {DIM_ARRY};
+ int data1[DIM_ARRY] = {1, 1, 1};
+ int data2[DIM_ARRY] = {2, 2, 2};
/*-----------------------------------------------------------------------
- * Open file(s) to add objects
- *------------------------------------------------------------------------*/
+ * Open file(s) to add objects
+ *------------------------------------------------------------------------*/
/* file1 */
- if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
PROGRAM_ERROR;
/* file2 */
- if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
PROGRAM_ERROR;
/*-----------------------------------------------------------------------
- * in file1 : add member objects
- *------------------------------------------------------------------------*/
+ * in file1 : add member objects
+ *------------------------------------------------------------------------*/
/* parent group */
- if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR;
/* dataset */
- if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0)
+ if (write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0)
PROGRAM_ERROR;
/* group */
- if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR;
/* committed type */
- if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
PROGRAM_ERROR;
- if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
PROGRAM_ERROR;
/*-----------------------------------------------------------------------
- * in file2 : add member objects
- *------------------------------------------------------------------------*/
+ * in file2 : add member objects
+ *------------------------------------------------------------------------*/
/* parent group */
- if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR;
/* group */
- if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR;
/* committed type */
- if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0)
PROGRAM_ERROR;
- if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
PROGRAM_ERROR;
/* dataset */
- if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0)
+ if (write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0)
PROGRAM_ERROR;
/*-----------------------------------------------------------------------
- * Close IDs
- *-----------------------------------------------------------------------*/
- if(H5Fclose(fid1) < 0)
+ * Close IDs
+ *-----------------------------------------------------------------------*/
+ if (H5Fclose(fid1) < 0)
PROGRAM_ERROR;
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
PROGRAM_ERROR;
- if(H5Gclose(topgid1) < 0)
+ if (H5Gclose(topgid1) < 0)
PROGRAM_ERROR;
- if(H5Gclose(topgid2) < 0)
+ if (H5Gclose(topgid2) < 0)
PROGRAM_ERROR;
- if(H5Gclose(gid1) < 0)
+ if (H5Gclose(gid1) < 0)
PROGRAM_ERROR;
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
PROGRAM_ERROR;
- if(H5Tclose(tid1) < 0)
+ if (H5Tclose(tid1) < 0)
PROGRAM_ERROR;
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
PROGRAM_ERROR;
return;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid1);
H5Fclose(fid2);
H5Gclose(topgid1);
@@ -5015,18 +5007,18 @@ error:
H5Gclose(gid2);
H5Tclose(tid1);
H5Tclose(tid2);
- } H5E_END_TRY;
-
- return;
+ }
+ H5E_END_TRY;
}
-static hid_t mkstr(int size, H5T_str_t pad)
+static hid_t
+mkstr(int size, H5T_str_t pad)
{
hid_t type;
if ((type = H5Tcopy(H5T_C_S1)) < 0)
return -1;
- if (H5Tset_size(type, (size_t) size) < 0)
+ if (H5Tset_size(type, (size_t)size) < 0)
return -1;
if (H5Tset_strpad(type, pad) < 0)
return -1;
@@ -5042,51 +5034,44 @@ static hid_t mkstr(int size, H5T_str_t pad)
* types.
* h5diff should show differences output from these common objects.
*-------------------------------------------------------------------------*/
-static void test_objs_strings(const char *fname1, const char *fname2)
+static void
+test_objs_strings(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t f_type = H5I_INVALID_HID;
- hid_t m_type = H5I_INVALID_HID;
- hsize_t dims1[] = { 3, 4 };
- char string1A[12][3] = { "s1", "s2", "s3", "s4", "s5", "s6", "s", "s", "s9",
- "s0", "s1", "s2" };
- char string1B[12][3] = { "s1", "s2", "s3", "s4", "s", "s", "s7", "s8", "s9",
- "s0", "s1", "s2" };
-
- hsize_t dims2[] = { 20 };
- char string2A[20][10] = { "ab cd ef1", "ab cd ef2", "ab cd ef3",
- "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8",
- "ab cd 9", "ab cd 0", "ab cd 1", "ab cd 2", "ab cd ef3",
- "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8",
- "ab cd ef9", "ab cd ef0" };
- char string2B[20][10] = { "ab cd ef1", "ab cd ef2", "ab cd ef3",
- "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8",
- "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", "ab cd 3",
- "ab cd 4", "ab cd 5", "ab cd 6", "ab cd ef7", "ab cd ef8",
- "ab cd ef9", "ab cd ef0" };
-
- hsize_t dims3[] = { 27 };
- char string3A[27][6] = { "abcd0", "abcd1", "abcd2", "abcd3", "abcd4",
- "abcd5", "abcd6", "abcd7", "abcd8", "abcd9", "abcd0", "abcd1",
- "abd2", "abc3", "bcd4", "acd5", "abcd6", "abcd7", "abcd8", "abcd9",
- "abcd0", "abcd1", "abcd2", "abcd3", "abc4", "abc5", "abc6" };
- char string3B[27][6] = { "abcd0", "abcd1", "abcd2", "abcd3", "abcd4",
- "abcd5", "abcd6", "abcd7", "abcd8", "abcd9", "abcd0", "abcd1",
- "abcd2", "abcd3", "abcd4", "abcd5", "abd6", "abc7", "bcd8", "acd9",
- "abcd0", "abcd1", "abcd2", "abcd3", "abd4", "abd5", "abd6" };
-
- hsize_t dims4[] = { 3 };
- char string4A[3][21] = { "s1234567890123456789", "s1234567890123456789",
- "s12345678901234567" };
- char string4B[3][21] = { "s1234567890123456789", "s12345678901234567",
- "s1234567890123456789" };
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t f_type = H5I_INVALID_HID;
+ hid_t m_type = H5I_INVALID_HID;
+ hsize_t dims1[] = {3, 4};
+ char string1A[12][3] = {"s1", "s2", "s3", "s4", "s5", "s6", "s", "s", "s9", "s0", "s1", "s2"};
+ char string1B[12][3] = {"s1", "s2", "s3", "s4", "s", "s", "s7", "s8", "s9", "s0", "s1", "s2"};
+
+ hsize_t dims2[] = {20};
+ char string2A[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", "ab cd ef5",
+ "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd 9", "ab cd 0",
+ "ab cd 1", "ab cd 2", "ab cd ef3", "ab cd ef4", "ab cd ef5",
+ "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"};
+ char string2B[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", "ab cd ef5",
+ "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0",
+ "ab cd ef1", "ab cd ef2", "ab cd 3", "ab cd 4", "ab cd 5",
+ "ab cd 6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"};
+
+ hsize_t dims3[] = {27};
+ char string3A[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6", "abcd7", "abcd8",
+ "abcd9", "abcd0", "abcd1", "abd2", "abc3", "bcd4", "acd5", "abcd6", "abcd7",
+ "abcd8", "abcd9", "abcd0", "abcd1", "abcd2", "abcd3", "abc4", "abc5", "abc6"};
+ char string3B[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6", "abcd7", "abcd8",
+ "abcd9", "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abd6", "abc7",
+ "bcd8", "acd9", "abcd0", "abcd1", "abcd2", "abcd3", "abd4", "abd5", "abd6"};
+
+ hsize_t dims4[] = {3};
+ char string4A[3][21] = {"s1234567890123456789", "s1234567890123456789", "s12345678901234567"};
+ char string4B[3][21] = {"s1234567890123456789", "s12345678901234567", "s1234567890123456789"};
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
/* file1 */
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
@@ -5102,9 +5087,9 @@ static void test_objs_strings(const char *fname1, const char *fname2)
}
/* string 1 : nullterm string */
- space = H5Screate_simple(2, dims1, NULL);
- f_type = mkstr(5, H5T_STR_NULLTERM);
- m_type = mkstr(3, H5T_STR_NULLTERM);
+ space = H5Screate_simple(2, dims1, NULL);
+ f_type = mkstr(5, H5T_STR_NULLTERM);
+ m_type = mkstr(3, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid1, "/string1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string1A);
H5Dclose(dataset);
@@ -5116,9 +5101,9 @@ static void test_objs_strings(const char *fname1, const char *fname2)
H5Dclose(dataset);
/* string 2 : space pad string */
- space = H5Screate_simple(1, dims2, NULL);
- f_type = mkstr(11, H5T_STR_SPACEPAD);
- m_type = mkstr(10, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims2, NULL);
+ f_type = mkstr(11, H5T_STR_SPACEPAD);
+ m_type = mkstr(10, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid1, "/string2", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string2A);
H5Dclose(dataset);
@@ -5130,9 +5115,9 @@ static void test_objs_strings(const char *fname1, const char *fname2)
H5Dclose(dataset);
/* string 3 : null pad string */
- space = H5Screate_simple(1, dims3, NULL);
- f_type = mkstr(8, H5T_STR_NULLPAD);
- m_type = mkstr(6, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims3, NULL);
+ f_type = mkstr(8, H5T_STR_NULLPAD);
+ m_type = mkstr(6, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid1, "/string3", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string3A);
H5Dclose(dataset);
@@ -5144,9 +5129,9 @@ static void test_objs_strings(const char *fname1, const char *fname2)
H5Dclose(dataset);
/* string 4 : space pad long string */
- space = H5Screate_simple(1, dims4, NULL);
- f_type = mkstr(168, H5T_STR_SPACEPAD);
- m_type = mkstr(21, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims4, NULL);
+ f_type = mkstr(168, H5T_STR_SPACEPAD);
+ m_type = mkstr(21, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid1, "/string4", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4A);
H5Dclose(dataset);
@@ -5172,10 +5157,10 @@ static void test_objs_strings(const char *fname1, const char *fname2)
string4B[2][11] = 'a';
string4B[2][12] = 'B';
string4B[2][13] = 'c';
- space = H5Screate_simple(1, dims4, NULL);
- f_type = mkstr(168, H5T_STR_NULLTERM);
- m_type = mkstr(21, H5T_STR_NULLTERM);
- dataset = H5Dcreate2(fid1, "/string5", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims4, NULL);
+ f_type = mkstr(168, H5T_STR_NULLTERM);
+ m_type = mkstr(21, H5T_STR_NULLTERM);
+ dataset = H5Dcreate2(fid1, "/string5", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4A);
H5Dclose(dataset);
dataset = H5Dcreate2(fid2, "/string5", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -5187,8 +5172,8 @@ static void test_objs_strings(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close IDs
- *-----------------------------------------------------------------------*/
+ * Close IDs
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -5203,78 +5188,77 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
-void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */)
+static void
+write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid,
+ int make_diffs /* flag to modify data buffers */)
{
/* Compound datatype */
typedef struct s_t {
- char a;
+ char a;
double b;
} s_t;
- typedef enum {
- RED, GREEN
- } e_t;
+ typedef enum { RED, GREEN } e_t;
- hid_t aid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
herr_t H5_ATTR_NDEBUG_UNUSED status;
- int val, i, j, k, l, n;
- float f;
+ int val, i, j, k, l, n;
+ float f;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1] = { 2 };
- char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */
- char *buf1a[2]; /* VL string */
- char buf2[2] = { 1, 2 }; /* bitfield, opaque */
- s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- e_t buf45[2] = { RED, RED }; /* enum */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1] = { 3 }; /* array dimension */
- int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */
- int buf7[2] = { 1, 2 }; /* integer */
- float buf8[2] = { 1.0F, 2.0F }; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */
+ char * buf1a[2]; /* VL string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2.0F}, {3, 4.0F}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2] = {RED, RED}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1.0F, 2.0F}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2] = { 3, 2 };
- char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */
- char *buf12a[3][2]; /* VL string */
- char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */
- s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- e_t buf452[3][2]; /* enum */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */
- int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */
- float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */
+ char * buf12a[3][2]; /* VL string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2.0F}, {3, 4.0F}, {5, 6.0F}, {7, 8.0F}, {9, 10.0F}, {11, 12.0F}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ e_t buf452[3][2]; /* enum */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1.0F, 2.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3] = { 4, 3, 2 };
- char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } },
- { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } },
- { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } },
- { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */
- char *buf13a[4][3][2]; /* VL string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- e_t buf453[4][3][2]; /* enum */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
- /*-------------------------------------------------------------------------
- * 1D attributes
- *-------------------------------------------------------------------------
- */
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[4][3][2][STR_SIZE] = {{{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}},
+ {{"mn", "pq"}, {"rs", "tu"}, {"vw", "xz"}},
+ {{"AB", "CD"}, {"EF", "GH"}, {"IJ", "KL"}},
+ {{"MN", "PQ"}, {"RS", "TU"}, {"VW", "XZ"}}}; /* string */
+ char * buf13a[4][3][2]; /* VL string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ e_t buf453[4][3][2]; /* enum */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+ /*-------------------------------------------------------------------------
+ * 1D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -5296,20 +5280,20 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
for (i = 0; i < 2; i++)
buf1a[i] = buf1[i];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 1, dims, "string", tid, buf1a);
status = H5Tclose(tid);
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 1, dims, "VLstring", tid, buf1);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -5331,9 +5315,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
/*
buf2[2]= {1,2};
@@ -5347,15 +5331,15 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
[ 1 ] 2 0 2
*/
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 1, dims, "opaque", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++) {
@@ -5383,13 +5367,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
- status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1);
- status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4);
}
@@ -5423,18 +5407,18 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc(1 * sizeof(int));
- ((int *) buf5[0].p)[0] = 1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc(2 * sizeof(int));
- ((int *) buf5[1].p)[0] = 2;
- ((int *) buf5[1].p)[1] = 3;
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
if (make_diffs) {
- ((int *) buf5[0].p)[0] = 0;
- ((int *) buf5[1].p)[0] = 0;
- ((int *) buf5[1].p)[1] = 0;
+ ((int *)buf5[0].p)[0] = 0;
+ ((int *)buf5[1].p)[0] = 0;
+ ((int *)buf5[1].p)[1] = 0;
}
/*
$h5diff file7.h5 file6.h5 g1 g1 -v
@@ -5446,9 +5430,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
[ 1 ] 3 0 3
*/
- sid = H5Screate_simple(1, dims, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf5);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
@@ -5550,13 +5534,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
for (j = 0; j < 2; j++)
buf12a[i][j] = buf12[i][j];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 2, dims2, "string2D", tid, buf12a);
status = H5Tclose(tid);
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 2, dims2, "VLstring2D", tid, buf12);
status = H5Tclose(tid);
@@ -5603,7 +5587,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
[ 2 0 ] 5 0 5
[ 2 1 ] 6 0 6
*/
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22);
status = H5Tclose(tid);
@@ -5643,8 +5627,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
if (dset_name) {
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++)
- status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT,
- (hid_t) -1);
+ status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42);
}
@@ -5686,13 +5669,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
n = 0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 2; j++) {
- buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
if (make_diffs)
- ((int *) buf52[i][j].p)[l] = 0;
+ ((int *)buf52[i][j].p)[l] = 0;
else
- ((int *) buf52[i][j].p)[l] = n++;
+ ((int *)buf52[i][j].p)[l] = n++;
}
}
@@ -5712,9 +5695,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
[ 2 1 ] 11 0 11
*/
- sid = H5Screate_simple(2, dims2, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf52);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
@@ -5873,13 +5856,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
for (k = 0; k < 2; k++)
buf13a[i][j][k] = buf13[i][j][k];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 3, dims3, "string3D", tid, buf13a);
status = H5Tclose(tid);
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 3, dims3, "VLstring3D", tid, buf13);
status = H5Tclose(tid);
@@ -5895,7 +5878,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
if (make_diffs)
buf23[i][j][k] = 0;
else
- buf23[i][j][k] = (char) n++;
+ buf23[i][j][k] = (char)n++;
/*
position bitfield3D of </g1> bitfield3D of </g1> difference
@@ -5934,7 +5917,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23);
status = H5Tclose(tid);
@@ -5951,8 +5934,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
if (make_diffs) {
buf33[i][j][k].a = 0;
buf33[i][j][k].b = 0.0F;
- } else {
- buf33[i][j][k].a = (char) n++;
+ }
+ else {
+ buf33[i][j][k].a = (char)n++;
buf33[i][j][k].b = n++;
}
/*position compound3D of </g1> compound3D of </g1> difference
@@ -6022,8 +6006,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
- status = H5Rcreate(&buf43[i][j][k], fid, dset_name,
- H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43);
}
@@ -6085,13 +6068,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++) {
- buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
if (make_diffs)
- ((int *) buf53[i][j][k].p)[l] = 0;
+ ((int *)buf53[i][j][k].p)[l] = 0;
else
- ((int *) buf53[i][j][k].p)[l] = n++;
+ ((int *)buf53[i][j][k].p)[l] = n++;
}
/*
position vlen3D of </g1> vlen3D of </g1> difference
@@ -6108,9 +6091,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
[ 1 1 0 ] 10 0 10
etc
*/
- sid = H5Screate_simple(3, dims3, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf53);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
@@ -6125,7 +6108,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
*/
n = 1;
for (i = 0; i < 24; i++) {
- for (j = 0; j < (int) dimarray[0]; j++) {
+ for (j = 0; j < (int)dimarray[0]; j++) {
if (make_diffs)
buf63[i][j] = 0;
else
@@ -6194,78 +6177,77 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
*
*-------------------------------------------------------------------------
*/
-static
-void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */)
+static void
+write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid,
+ int make_diffs /* flag to modify data buffers */)
{
/* Compound datatype */
typedef struct s_t {
- char a;
+ char a;
double b;
} s_t;
- typedef enum {
- RED, GREEN
- } e_t;
+ typedef enum { RED, GREEN } e_t;
- hid_t aid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
herr_t H5_ATTR_NDEBUG_UNUSED status;
- int val, i, j, k, l, n;
- float f;
+ int val, i, j, k, l, n;
+ float f;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1] = { 2 };
- char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */
- char *buf1a[2]; /* VL string */
- char buf2[2] = { 1, 2 }; /* bitfield, opaque */
- s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- e_t buf45[2] = { RED, RED }; /* enum */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1] = { 3 }; /* array dimension */
- int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */
- int buf7[2] = { 1, 2 }; /* integer */
- float buf8[2] = { 1.0F, 2.0F }; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */
+ char * buf1a[2]; /* VL string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2.0F}, {3, 4.0F}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2] = {RED, RED}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1.0F, 2.0F}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2] = { 3, 2 };
- char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */
- char *buf12a[3][2]; /* VL string */
- char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */
- s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- e_t buf452[3][2]; /* enum */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */
- int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */
- float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */
+ char * buf12a[3][2]; /* VL string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2.0F}, {3, 4.0F}, {5, 6.0F}, {7, 8.0F}, {9, 10.0F}, {11, 12.0F}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ e_t buf452[3][2]; /* enum */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1.0F, 2.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3] = { 4, 3, 2 };
- char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } },
- { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } },
- { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } },
- { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */
- char *buf13a[4][3][2]; /* VL string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- e_t buf453[4][3][2]; /* enum */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
- /*-------------------------------------------------------------------------
- * 1D attributes
- *-------------------------------------------------------------------------
- */
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[4][3][2][STR_SIZE] = {{{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}},
+ {{"mn", "pq"}, {"rs", "tu"}, {"vw", "xz"}},
+ {{"AB", "CD"}, {"EF", "GH"}, {"IJ", "KL"}},
+ {{"MN", "PQ"}, {"RS", "TU"}, {"VW", "XZ"}}}; /* string */
+ char * buf13a[4][3][2]; /* VL string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ e_t buf453[4][3][2]; /* enum */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+ /*-------------------------------------------------------------------------
+ * 1D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -6283,22 +6265,22 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 1 ] d z
[ 1 ] e z
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 1, dims, "string", tid, buf1);
status = H5Tclose(tid);
for (i = 0; i < 2; i++)
buf1a[i] = buf1[i];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 1, dims, "VLstring", tid, buf1a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -6320,9 +6302,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
/*
buf2[2]= {1,2};
@@ -6336,15 +6318,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 1 ] 2 0 2
*/
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 1, dims, "opaque", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++) {
@@ -6371,20 +6353,20 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
- status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1);
- status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4);
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
buf45[i] = GREEN;
@@ -6405,24 +6387,24 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc(1 * sizeof(int));
- ((int *) buf5[0].p)[0] = 1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc(2 * sizeof(int));
- ((int *) buf5[1].p)[0] = 2;
- ((int *) buf5[1].p)[1] = 3;
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
if (make_diffs) {
- ((int *) buf5[0].p)[0] = 0;
- ((int *) buf5[1].p)[0] = 0;
- ((int *) buf5[1].p)[1] = 0;
+ ((int *)buf5[0].p)[0] = 0;
+ ((int *)buf5[1].p)[0] = 0;
+ ((int *)buf5[1].p)[1] = 0;
}
/*
$h5diff file7.h5 file6.h5 g1 g1 -v
@@ -6434,9 +6416,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 1 ] 3 0 3
*/
- sid = H5Screate_simple(1, dims, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf5);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
@@ -6446,9 +6428,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 2; i++)
@@ -6474,9 +6456,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 2; i++) {
@@ -6502,14 +6484,14 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8);
/*-------------------------------------------------------------------------
- * 2D attributes
- *-------------------------------------------------------------------------
- */
+ * 2D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++)
@@ -6537,8 +6519,8 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 2 1 ] l z
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 2, dims2, "string2D", tid, buf12);
status = H5Tclose(tid);
@@ -6546,15 +6528,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
for (j = 0; j < 2; j++)
buf12a[i][j] = buf12[i][j];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 2, dims2, "VLstring2D", tid, buf12a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf22, 0, sizeof buf22);
@@ -6577,9 +6559,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
/*
buf22[3][2]= {{1,2},{3,4},{5,6}};
@@ -6594,15 +6576,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 2 0 ] 5 0 5
[ 2 1 ] 6 0 6
*/
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf32, 0, sizeof buf32);
/*
@@ -6626,21 +6608,21 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++)
- status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42);
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++) {
if (make_diffs)
@@ -6668,21 +6650,21 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 2; j++) {
- buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
if (make_diffs)
- ((int *) buf52[i][j].p)[l] = 0;
+ ((int *)buf52[i][j].p)[l] = 0;
else
- ((int *) buf52[i][j].p)[l] = n++;
+ ((int *)buf52[i][j].p)[l] = n++;
}
}
@@ -6702,9 +6684,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 2 1 ] 11 0 11
*/
- sid = H5Screate_simple(2, dims2, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf52);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
@@ -6714,9 +6696,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf62, 0, sizeof buf62);
@@ -6751,9 +6733,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
memset(buf72, 0, sizeof buf72);
@@ -6785,14 +6767,14 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82);
/*-------------------------------------------------------------------------
- * 3D attributes
- *-------------------------------------------------------------------------
- */
+ * 3D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 4; i++)
@@ -6859,8 +6841,8 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 3 2 1 ] Z z
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 3, dims3, "string3D", tid, buf13);
status = H5Tclose(tid);
@@ -6868,15 +6850,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
buf13a[i][j][k] = buf13[i][j][k];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 3, dims3, "VLstring3D", tid, buf13a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 4; i++)
@@ -6885,7 +6867,7 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
if (make_diffs)
buf23[i][j][k] = 0;
else
- buf23[i][j][k] = (char) n++;
+ buf23[i][j][k] = (char)n++;
}
/*
position bitfield3D of </g1> bitfield3D of </g1> difference
@@ -6921,18 +6903,18 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 4; i++)
@@ -6943,7 +6925,7 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
buf33[i][j][k].b = 0.0F;
}
else {
- buf33[i][j][k].a = (char) n++;
+ buf33[i][j][k].a = (char)n++;
buf33[i][j][k].b = n++;
}
}
@@ -7006,23 +6988,22 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
- status = H5Rcreate(&buf43[i][j][k], fid, dset_name,
- H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43);
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
@@ -7068,22 +7049,22 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++) {
- buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
if (make_diffs)
- ((int *) buf53[i][j][k].p)[l] = 0;
+ ((int *)buf53[i][j][k].p)[l] = 0;
else
- ((int *) buf53[i][j][k].p)[l] = n++;
+ ((int *)buf53[i][j][k].p)[l] = n++;
}
/*
position vlen3D of </g1> vlen3D of </g1> difference
@@ -7100,9 +7081,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 1 1 0 ] 10 0 10
etc
*/
- sid = H5Screate_simple(3, dims3, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf53);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
@@ -7112,12 +7093,12 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 24; i++)
- for (j = 0; j < (int) dimarray[0]; j++) {
+ for (j = 0; j < (int)dimarray[0]; j++) {
if (make_diffs)
buf63[i][j] = 0;
else
@@ -7141,9 +7122,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
n = 1;
f = 1;
for (i = 0; i < 4; i++)
@@ -7185,77 +7166,76 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
*
*-------------------------------------------------------------------------
*/
-static
-void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */)
+static void
+write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid,
+ int make_diffs /* flag to modify data buffers */)
{
/* Compound datatype */
typedef struct s_t {
- char a;
+ char a;
double b;
} s_t;
- typedef enum {
- RED, GREEN
- } e_t;
+ typedef enum { RED, GREEN } e_t;
- hid_t did = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- hid_t dcpl = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
herr_t H5_ATTR_NDEBUG_UNUSED status;
- int val, i, j, k, l, n;
- float f;
- int fillvalue = 2;
- int scalar_data = 2;
+ int val, i, j, k, l, n;
+ float f;
+ int fillvalue = 2;
+ int scalar_data = 2;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1] = { 2 };
- char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */
- char *buf1a[2]; /* VL string */
- char buf2[2] = { 1, 2 }; /* bitfield, opaque */
- s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- e_t buf45[2] = { RED, GREEN }; /* enum */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1] = { 3 }; /* array dimension */
- int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */
- int buf7[2] = { 1, 2 }; /* integer */
- float buf8[2] = { 1.0F, 2.0F }; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */
+ char * buf1a[2]; /* VL string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2.0F}, {3, 4.0F}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2] = {RED, GREEN}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1.0F, 2.0F}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2] = { 3, 2 };
- char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */
- char *buf12a[3][2]; /* VL string */
- char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */
- s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */
- int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */
- float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */
+ char * buf12a[3][2]; /* VL string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2.0F}, {3, 4.0F}, {5, 6.0F}, {7, 8.0F}, {9, 10.0F}, {11, 12.0F}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1.0F, 2.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3] = { 4, 3, 2 };
- char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } },
- { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } },
- { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } },
- { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */
- char *buf13a[4][3][2]; /* VL string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[4][3][2][STR_SIZE] = {{{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}},
+ {{"mn", "pq"}, {"rs", "tu"}, {"vw", "xz"}},
+ {{"AB", "CD"}, {"EF", "GH"}, {"IJ", "KL"}},
+ {{"MN", "PQ"}, {"RS", "TU"}, {"VW", "XZ"}}}; /* string */
+ char * buf13a[4][3][2]; /* VL string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
if (make_diffs == 2)
dimarray[0] = 4;
/*-------------------------------------------------------------------------
- * H5S_SCALAR
- *-------------------------------------------------------------------------
- */
+ * H5S_SCALAR
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
scalar_data = 1;
@@ -7274,37 +7254,37 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
H5Sclose(sid);
/*-------------------------------------------------------------------------
- * 1D
- *-------------------------------------------------------------------------
- */
+ * 1D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
buf1[i][j] = 'z';
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_dset(loc_id, 1, dims, "string", tid, buf1);
status = H5Tclose(tid);
for (i = 0; i < 2; i++)
buf1a[i] = buf1[i];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_dset(loc_id, 1, dims, "VLstring", tid, buf1a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -7315,9 +7295,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++) {
@@ -7325,15 +7305,15 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
buf3[i].b = 0;
}
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_dset(loc_id, 1, dims, "opaque", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -7346,27 +7326,27 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
- status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1);
- status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_dset(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4);
}
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_DATASET_REGION dataset region reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_DATASET_REGION dataset region reference)
+ *-------------------------------------------------------------------------
+ */
gen_datareg(fid, make_diffs);
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
@@ -7374,30 +7354,29 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc(1 * sizeof(int));
- ((int *) buf5[0].p)[0] = 1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc(2 * sizeof(int));
- ((int *) buf5[1].p)[0] = 2;
- ((int *) buf5[1].p)[1] = 3;
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
if (make_diffs) {
- ((int *) buf5[0].p)[0] = 0;
- ((int *) buf5[1].p)[0] = 0;
- ((int *) buf5[1].p)[1] = 0;
+ ((int *)buf5[0].p)[0] = 0;
+ ((int *)buf5[1].p)[0] = 0;
+ ((int *)buf5[1].p)[1] = 0;
}
- sid = H5Screate_simple(1, dims, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
@@ -7407,9 +7386,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -7421,21 +7400,21 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
{
- double *dbuf; /* information to write */
- hid_t ldid = H5I_INVALID_HID; /* dataset ID */
- hid_t lsid = H5I_INVALID_HID; /* dataspace ID */
- hid_t ltid = H5I_INVALID_HID; /* datatype ID */
- size_t size;
- hsize_t sdims[] = { 1 };
- hsize_t tdims[] = { H5TOOLS_MALLOCSIZE / sizeof(double) + 1 };
- size_t jj;
+ double *dbuf; /* information to write */
+ hid_t ldid = H5I_INVALID_HID; /* dataset ID */
+ hid_t lsid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t ltid = H5I_INVALID_HID; /* datatype ID */
+ size_t size;
+ hsize_t sdims[] = {1};
+ hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1};
+ size_t jj;
/* allocate and initialize array data to write */
size = (H5TOOLS_MALLOCSIZE / sizeof(double) + 1) * sizeof(double);
- dbuf = (double *) HDmalloc(size);
+ dbuf = (double *)HDmalloc(size);
for (jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++)
- dbuf[jj] = (double) jj;
+ dbuf[jj] = (double)jj;
if (make_diffs) {
dbuf[5] = 0;
@@ -7459,9 +7438,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
}
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++) {
@@ -7473,14 +7452,14 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
write_dset(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8);
/*-------------------------------------------------------------------------
- * 2D
- *-------------------------------------------------------------------------
- */
+ * 2D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 3; i++)
@@ -7489,8 +7468,8 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
buf12[i][j][k] = 'z';
}
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_dset(loc_id, 2, dims2, "string2D", tid, buf12);
status = H5Tclose(tid);
@@ -7498,15 +7477,15 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
for (j = 0; j < 2; j++)
buf12a[i][j] = buf12[i][j];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_dset(loc_id, 2, dims2, "VLstring2D", tid, buf12a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf22, 0, sizeof buf22);
@@ -7516,18 +7495,18 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_dset(loc_id, 2, dims2, "opaque2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf32, 0, sizeof buf32);
@@ -7539,21 +7518,21 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++)
- status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_dset(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42);
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(tid, "RED", (val = 0, &val));
@@ -7562,27 +7541,27 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++) {
- buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++) {
if (make_diffs)
- ((int *) buf52[i][j].p)[l] = 0;
+ ((int *)buf52[i][j].p)[l] = 0;
else
- ((int *) buf52[i][j].p)[l] = n++;
+ ((int *)buf52[i][j].p)[l] = n++;
}
}
- sid = H5Screate_simple(2, dims2, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
@@ -7592,9 +7571,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf62, 0, sizeof buf62);
@@ -7604,40 +7583,40 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_INTEGER, write a fill value
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
memset(buf72, 0, sizeof buf72);
memset(buf82, 0, sizeof buf82);
}
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
status = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue);
- sid = H5Screate_simple(2, dims2, NULL);
- did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72);
status = H5Pclose(dcpl);
status = H5Dclose(did);
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82);
/*-------------------------------------------------------------------------
- * 3D
- *-------------------------------------------------------------------------
- */
+ * 3D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 4; i++)
@@ -7647,8 +7626,8 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
buf13[i][j][k][l] = 'z';
}
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_dset(loc_id, 3, dims3, "string3D", tid, buf13);
status = H5Tclose(tid);
@@ -7657,15 +7636,15 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
for (k = 0; k < 2; k++)
buf13a[i][j][k] = buf13[i][j][k];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_dset(loc_id, 3, dims3, "VLstring3D", tid, buf13a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 4; i++)
@@ -7674,7 +7653,7 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
if (make_diffs)
buf23[i][j][k] = 0;
else
- buf23[i][j][k] = (char) n++;
+ buf23[i][j][k] = (char)n++;
}
tid = H5Tcopy(H5T_STD_B8LE);
@@ -7682,18 +7661,18 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_dset(loc_id, 3, dims3, "opaque3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 4; i++)
@@ -7704,7 +7683,7 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
buf33[i][j][k].b = 0.0F;
}
else {
- buf33[i][j][k].a = (char) n++;
+ buf33[i][j][k].a = (char)n++;
buf33[i][j][k].b = n++;
}
}
@@ -7716,22 +7695,22 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
- status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_dset(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43);
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(tid, "RED", (val = 0, &val));
@@ -7740,28 +7719,28 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++) {
- buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++) {
if (make_diffs)
- ((int *) buf53[i][j][k].p)[l] = 0;
+ ((int *)buf53[i][j][k].p)[l] = 0;
else
- ((int *) buf53[i][j][k].p)[l] = n++;
+ ((int *)buf53[i][j][k].p)[l] = n++;
}
}
- sid = H5Screate_simple(3, dims3, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
@@ -7771,9 +7750,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 24; i++)
@@ -7789,9 +7768,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
n = 1;
f = 1;
for (i = 0; i < 4; i++)
@@ -7821,44 +7800,43 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
*-------------------------------------------------------------------------
*/
-static
-void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */)
+static void
+gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */)
{
/* data dataset */
- hid_t did1 = H5I_INVALID_HID; /* dataset ID */
- hid_t sid1 = H5I_INVALID_HID; /* dataspace ID */
- hsize_t dims1[2] = { 10, 10 };/* dimensions */
- int *buf; /* dataset buffer */
+ hid_t did1 = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid1 = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims1[2] = {10, 10}; /* dimensions */
+ int * buf; /* dataset buffer */
/* reference dataset */
- hid_t did2 = H5I_INVALID_HID; /* dataset ID */
- hid_t sid2 = H5I_INVALID_HID; /* dataspace ID */
- hsize_t dims2[] = { 2 }; /* 2 references */
- hdset_reg_ref_t *rbuf; /* buffer for write the references */
- hsize_t start[10]; /* starting location of hyperslab */
- hsize_t count[10]; /* element count of hyperslab */
- hsize_t coord[5][2]; /* coordinates for point selection */
+ hid_t did2 = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid2 = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims2[] = {2}; /* 2 references */
+ hdset_reg_ref_t * rbuf; /* buffer for write the references */
+ hsize_t start[10]; /* starting location of hyperslab */
+ hsize_t count[10]; /* element count of hyperslab */
+ hsize_t coord[5][2]; /* coordinates for point selection */
herr_t H5_ATTR_NDEBUG_UNUSED status;
- int i;
+ int i;
/* allocate the buffer for write the references */
- rbuf = (hdset_reg_ref_t *) HDcalloc((size_t )2, sizeof(hdset_reg_ref_t));
+ rbuf = (hdset_reg_ref_t *)HDcalloc((size_t)2, sizeof(hdset_reg_ref_t));
/* allocate the buffer for write the data dataset */
- buf = (int *) HDmalloc(10 * 10 * sizeof(int));
+ buf = (int *)HDmalloc(10 * 10 * sizeof(int));
for (i = 0; i < 10 * 10; i++)
buf[i] = i;
/* create the data dataset */
- sid1 = H5Screate_simple(2, dims1, NULL);
- did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid1 = H5Screate_simple(2, dims1, NULL);
+ did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
HDassert(status >= 0);
/* create the reference dataset */
sid2 = H5Screate_simple(1, dims2, NULL);
- did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* create the references */
/* select hyperslab for first reference */
@@ -7901,7 +7879,7 @@ void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */)
coord[4][0] = 1;
coord[4][1] = 7;
}
- H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t) 5, (const hsize_t *) coord);
+ H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)5, (const hsize_t *)coord);
H5Sget_select_npoints(sid1);
/* store second dataset region */
@@ -7933,25 +7911,25 @@ void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */)
*
*-------------------------------------------------------------------------
*/
-static
-int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */)
+static int
+test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */)
{
- hid_t did = H5I_INVALID_HID;
- hid_t fid = H5I_INVALID_HID;
- hid_t f_sid = H5I_INVALID_HID;
- hid_t m_sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- hid_t dcpl = H5I_INVALID_HID;
- hsize_t dims[1] = { GBLL }; /* dataset dimensions */
- hsize_t hs_size[1] = { GBLL / (1024 * 1024) }; /* hyperslab dimensions */
- hsize_t chunk_dims[1] = { GBLL / 1024 }; /* chunk dimensions */
+ hid_t did = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t f_sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hsize_t dims[1] = {GBLL}; /* dataset dimensions */
+ hsize_t hs_size[1] = {GBLL / (1024 * 1024)}; /* hyperslab dimensions */
+ hsize_t chunk_dims[1] = {GBLL / 1024}; /* chunk dimensions */
hsize_t hs_start[1];
- size_t size;
- size_t nelmts = (size_t)GBLL / (1024 * 1024); /* elements in each hyperslab */
- char fillvalue = -1;
- char *buf = NULL;
- int i, j, s;
- char c;
+ size_t size;
+ size_t nelmts = (size_t)GBLL / (1024 * 1024); /* elements in each hyperslab */
+ char fillvalue = -1;
+ char * buf = NULL;
+ int i, j, s;
+ char c;
/* create */
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -7973,8 +7951,8 @@ int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buff
goto out;
/* create a evenly divided buffer from 0 to 127 */
- buf = (char *) HDmalloc((size_t)(nelmts * size));
- s = 1024 * 1024 / 127;
+ buf = (char *)HDmalloc((size_t)(nelmts * size));
+ s = 1024 * 1024 / 127;
for (i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) {
if (j == s) {
c++;
@@ -7988,7 +7966,7 @@ int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buff
if (make_diffs && i == 512 * 512)
HDmemset(buf, 0, nelmts);
- hs_start[0] = (unsigned long long) i * GBLL / (1024 * 1024);
+ hs_start[0] = (unsigned long long)i * GBLL / (1024 * 1024);
if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0)
goto out;
@@ -8015,13 +7993,15 @@ int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buff
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(f_sid);
H5Sclose(m_sid);
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
@@ -8030,52 +8010,52 @@ out:
*
* Purpose: Create test files to compare data with epsilion
*/
-static
-void test_double_epsilon(const char *fname1, const char *fname2)
+static void
+test_double_epsilon(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
- hsize_t dims1[2] = { 4, 7 };
- double wdata[4][7];
- int i, j;
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
+ hsize_t dims1[2] = {4, 7};
+ double wdata[4][7];
+ int i, j;
/*-------------------------------------------------------------------------
- * create two files
- *-------------------------------------------------------------------------
- */
+ * create two files
+ *-------------------------------------------------------------------------
+ */
if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR;
if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR;
/*
- * Initialize data.
- */
- for (i=0; i<4; i++)
- for (j=0; j<7; j++)
+ * Initialize data.
+ */
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 7; j++)
wdata[i][j] = 0.0;
/* dataset */
- if(write_dset(fid1, 2, dims1, "dataset", H5T_IEEE_F64LE, wdata) < 0)
+ if (write_dset(fid1, 2, dims1, "dataset", H5T_IEEE_F64LE, wdata) < 0)
PROGRAM_ERROR;
/*
- * Initialize data.
- */
- for (i=0; i<4; i++)
- for (j=0; j<7; j++)
+ * Initialize data.
+ */
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 7; j++)
wdata[i][j] = (double)1.e-19;
/* dataset */
- if(write_dset(fid2, 2, dims1, "dataset", H5T_IEEE_F64LE, wdata) < 0)
+ if (write_dset(fid2, 2, dims1, "dataset", H5T_IEEE_F64LE, wdata) < 0)
PROGRAM_ERROR;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid1);
H5Fclose(fid2);
- } H5E_END_TRY;
-
- return;
+ }
+ H5E_END_TRY;
}
/*-------------------------------------------------------------------------
@@ -8085,8 +8065,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-static
-int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf)
+static int
+write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf)
{
hid_t aid = H5I_INVALID_HID;
hid_t sid = H5I_INVALID_HID;
@@ -8132,33 +8112,34 @@ write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, v
hid_t sid = H5I_INVALID_HID;
/* create a space */
- if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
PROGRAM_ERROR;
/* create the dataset */
- if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR;
/* write */
- if(buf)
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (buf)
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
PROGRAM_ERROR;
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
PROGRAM_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
PROGRAM_ERROR;
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end write_dset() */
-
diff --git a/tools/test/h5diff/testfiles/h5diff_10.txt b/tools/test/h5diff/testfiles/h5diff_10.txt
index 0618705..5804ac3 100644
--- a/tools/test/h5diff/testfiles/h5diff_10.txt
+++ b/tools/test/h5diff/testfiles/h5diff_10.txt
@@ -131,6 +131,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
(The option --follow-symlinks overrides the default behavior when
symbolic links are compared.).
+ Subsetting options:
+ Subsetting is available by using the fcompact form of subsetting, as follows:
+ obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]
+ It is not required to use all parameters, but until the last parameter value used,
+ all of the semicolons (;) are required, even when a parameter value is not specified. Example:
+ obj1 /foo/mydataset[START;;COUNT;BLOCK]
+ obj1 /foo/mydataset[START]
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+ Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with
+ one integer for each dimension of the dataset.
+
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt
index 98c80be..fa7447b 100644
--- a/tools/test/h5diff/testfiles/h5diff_600.txt
+++ b/tools/test/h5diff/testfiles/h5diff_600.txt
@@ -131,6 +131,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
(The option --follow-symlinks overrides the default behavior when
symbolic links are compared.).
+ Subsetting options:
+ Subsetting is available by using the fcompact form of subsetting, as follows:
+ obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]
+ It is not required to use all parameters, but until the last parameter value used,
+ all of the semicolons (;) are required, even when a parameter value is not specified. Example:
+ obj1 /foo/mydataset[START;;COUNT;BLOCK]
+ obj1 /foo/mydataset[START]
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+ Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with
+ one integer for each dimension of the dataset.
+
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/test/h5diff/testfiles/h5diff_603.txt b/tools/test/h5diff/testfiles/h5diff_603.txt
index a5bb805..9e1dc89 100644
--- a/tools/test/h5diff/testfiles/h5diff_603.txt
+++ b/tools/test/h5diff/testfiles/h5diff_603.txt
@@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
(The option --follow-symlinks overrides the default behavior when
symbolic links are compared.).
+ Subsetting options:
+ Subsetting is available by using the fcompact form of subsetting, as follows:
+ obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]
+ It is not required to use all parameters, but until the last parameter value used,
+ all of the semicolons (;) are required, even when a parameter value is not specified. Example:
+ obj1 /foo/mydataset[START;;COUNT;BLOCK]
+ obj1 /foo/mydataset[START]
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+ Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with
+ one integer for each dimension of the dataset.
+
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/test/h5diff/testfiles/h5diff_606.txt b/tools/test/h5diff/testfiles/h5diff_606.txt
index 4782e17..146b944 100644
--- a/tools/test/h5diff/testfiles/h5diff_606.txt
+++ b/tools/test/h5diff/testfiles/h5diff_606.txt
@@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
(The option --follow-symlinks overrides the default behavior when
symbolic links are compared.).
+ Subsetting options:
+ Subsetting is available by using the fcompact form of subsetting, as follows:
+ obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]
+ It is not required to use all parameters, but until the last parameter value used,
+ all of the semicolons (;) are required, even when a parameter value is not specified. Example:
+ obj1 /foo/mydataset[START;;COUNT;BLOCK]
+ obj1 /foo/mydataset[START]
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+ Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with
+ one integer for each dimension of the dataset.
+
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/test/h5diff/testfiles/h5diff_612.txt b/tools/test/h5diff/testfiles/h5diff_612.txt
index ee40713..511e693 100644
--- a/tools/test/h5diff/testfiles/h5diff_612.txt
+++ b/tools/test/h5diff/testfiles/h5diff_612.txt
@@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
(The option --follow-symlinks overrides the default behavior when
symbolic links are compared.).
+ Subsetting options:
+ Subsetting is available by using the fcompact form of subsetting, as follows:
+ obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]
+ It is not required to use all parameters, but until the last parameter value used,
+ all of the semicolons (;) are required, even when a parameter value is not specified. Example:
+ obj1 /foo/mydataset[START;;COUNT;BLOCK]
+ obj1 /foo/mydataset[START]
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+ Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with
+ one integer for each dimension of the dataset.
+
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/test/h5diff/testfiles/h5diff_615.txt b/tools/test/h5diff/testfiles/h5diff_615.txt
index 5504812..c4b41f9 100644
--- a/tools/test/h5diff/testfiles/h5diff_615.txt
+++ b/tools/test/h5diff/testfiles/h5diff_615.txt
@@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
(The option --follow-symlinks overrides the default behavior when
symbolic links are compared.).
+ Subsetting options:
+ Subsetting is available by using the fcompact form of subsetting, as follows:
+ obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]
+ It is not required to use all parameters, but until the last parameter value used,
+ all of the semicolons (;) are required, even when a parameter value is not specified. Example:
+ obj1 /foo/mydataset[START;;COUNT;BLOCK]
+ obj1 /foo/mydataset[START]
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+ Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with
+ one integer for each dimension of the dataset.
+
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/test/h5diff/testfiles/h5diff_621.txt b/tools/test/h5diff/testfiles/h5diff_621.txt
index e4dba56..9dd312d 100644
--- a/tools/test/h5diff/testfiles/h5diff_621.txt
+++ b/tools/test/h5diff/testfiles/h5diff_621.txt
@@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
(The option --follow-symlinks overrides the default behavior when
symbolic links are compared.).
+ Subsetting options:
+ Subsetting is available by using the fcompact form of subsetting, as follows:
+ obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]
+ It is not required to use all parameters, but until the last parameter value used,
+ all of the semicolons (;) are required, even when a parameter value is not specified. Example:
+ obj1 /foo/mydataset[START;;COUNT;BLOCK]
+ obj1 /foo/mydataset[START]
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+ Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with
+ one integer for each dimension of the dataset.
+
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/test/h5diff/testfiles/h5diff_622.txt b/tools/test/h5diff/testfiles/h5diff_622.txt
index 0e7ffa3..0f7c4af 100644
--- a/tools/test/h5diff/testfiles/h5diff_622.txt
+++ b/tools/test/h5diff/testfiles/h5diff_622.txt
@@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
(The option --follow-symlinks overrides the default behavior when
symbolic links are compared.).
+ Subsetting options:
+ Subsetting is available by using the fcompact form of subsetting, as follows:
+ obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]
+ It is not required to use all parameters, but until the last parameter value used,
+ all of the semicolons (;) are required, even when a parameter value is not specified. Example:
+ obj1 /foo/mydataset[START;;COUNT;BLOCK]
+ obj1 /foo/mydataset[START]
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+ Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with
+ one integer for each dimension of the dataset.
+
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/test/h5diff/testfiles/h5diff_623.txt b/tools/test/h5diff/testfiles/h5diff_623.txt
index bb70458..3e1b5f3 100644
--- a/tools/test/h5diff/testfiles/h5diff_623.txt
+++ b/tools/test/h5diff/testfiles/h5diff_623.txt
@@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
(The option --follow-symlinks overrides the default behavior when
symbolic links are compared.).
+ Subsetting options:
+ Subsetting is available by using the fcompact form of subsetting, as follows:
+ obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]
+ It is not required to use all parameters, but until the last parameter value used,
+ all of the semicolons (;) are required, even when a parameter value is not specified. Example:
+ obj1 /foo/mydataset[START;;COUNT;BLOCK]
+ obj1 /foo/mydataset[START]
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+ Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with
+ one integer for each dimension of the dataset.
+
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/test/h5diff/testfiles/h5diff_624.txt b/tools/test/h5diff/testfiles/h5diff_624.txt
index cb30023..0645961 100644
--- a/tools/test/h5diff/testfiles/h5diff_624.txt
+++ b/tools/test/h5diff/testfiles/h5diff_624.txt
@@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
(The option --follow-symlinks overrides the default behavior when
symbolic links are compared.).
+ Subsetting options:
+ Subsetting is available by using the fcompact form of subsetting, as follows:
+ obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]
+ It is not required to use all parameters, but until the last parameter value used,
+ all of the semicolons (;) are required, even when a parameter value is not specified. Example:
+ obj1 /foo/mydataset[START;;COUNT;BLOCK]
+ obj1 /foo/mydataset[START]
+ The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in
+ each dimension. START is optional and will default to 0 in each dimension.
+ Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with
+ one integer for each dimension of the dataset.
+
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/test/h5diff/testfiles/h5diff_830.txt b/tools/test/h5diff/testfiles/h5diff_830.txt
new file mode 100644
index 0000000..8f00d8b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_830.txt
@@ -0,0 +1,30 @@
+dataset: </g1/array3D> and </g1/array3D>
+size: [4x3x2] [4x3x2]
+position array3D array3D difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+24 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in
index efc2722..d34896c 100644
--- a/tools/test/h5diff/testh5diff.sh.in
+++ b/tools/test/h5diff/testh5diff.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -341,6 +341,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_710.txt
$SRC_H5DIFF_TESTFILES/h5diff_80.txt
$SRC_H5DIFF_TESTFILES/h5diff_800.txt
$SRC_H5DIFF_TESTFILES/h5diff_801.txt
+$SRC_H5DIFF_TESTFILES/h5diff_830.txt
$SRC_H5DIFF_TESTFILES/h5diff_90.txt
$SRC_H5DIFF_TESTFILES/h5diff_8625.txt
$SRC_H5DIFF_TESTFILES/h5diff_8639.txt
@@ -1186,6 +1187,11 @@ TOOLTEST h5diff_800.txt -v h5diff_dset1.h5 h5diff_dset2.h5 /g1/array /g1/array
TOOLTEST h5diff_801.txt -v h5diff_dset1.h5 h5diff_dset3.h5 /g1/array /g1/array
# ##############################################################################
+# # dataset subsets
+# ##############################################################################
+#TOOLTEST h5diff_830.txt --enable-error-stack -v h5diff_dset1.h5 h5diff_dset2.h5 "/g1/array3D[0,0,0;2,2,1;2,2,2;]" "/g1/array3D[0,0,0;2,2,1;2,2,2;]"
+
+# ##############################################################################
# VDS tests
# ##############################################################################
TOOLTEST h5diff_v1.txt -v 1_vds.h5 2_vds.h5
diff --git a/tools/test/h5diff/testph5diff.sh.in b/tools/test/h5diff/testph5diff.sh.in
index b726a80..5bb6e52 100644
--- a/tools/test/h5diff/testph5diff.sh.in
+++ b/tools/test/h5diff/testph5diff.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt
index 8a83699..a7b4846 100644
--- a/tools/test/h5dump/CMakeLists.txt
+++ b/tools/test/h5dump/CMakeLists.txt
@@ -10,11 +10,18 @@ if (BUILD_SHARED_LIBS)
set (H5DUMP_TOOL_PLUGIN_LIB_TARGET ${H5DUMP_TOOL_PLUGIN_LIB_CORENAME})
add_library (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c)
- target_include_directories (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED)
- target_link_libraries (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ target_link_libraries (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} ${H5DUMP_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5DUMP_PLUGIN_FORMAT ${H5DUMP_TOOL_PLUGIN_LIB_TARGET})
+ endif ()
+
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
#-----------------------------------------------------------------------------
@@ -35,11 +42,18 @@ endif ()
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c)
- target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5dumpgentest STATIC)
target_link_libraries (h5dumpgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools)
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5DUMP_FORMAT h5dumpgentest)
+ endif ()
+
#add_test (NAME h5dumpgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dumpgentest>)
endif ()
diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake
index a1219bb..53355e0 100644
--- a/tools/test/h5dump/CMakeTests.cmake
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -100,6 +100,8 @@
${HDF5_TOOLS_DIR}/testfiles/tfamily.ddl
${HDF5_TOOLS_DIR}/testfiles/tfill.ddl
${HDF5_TOOLS_DIR}/testfiles/tfletcher32.ddl
+ #${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.ddl #native
+ #${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.wddl #special for windows
${HDF5_TOOLS_DIR}/testfiles/tfpformat.ddl
${HDF5_TOOLS_DIR}/testfiles/tgroup-1.ddl
${HDF5_TOOLS_DIR}/testfiles/tgroup-2.ddl
@@ -126,7 +128,8 @@
${HDF5_TOOLS_DIR}/testfiles/tintsattrs.ddl
${HDF5_TOOLS_DIR}/testfiles/tintsnodata.ddl
${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.ddl
- #${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.ddl
${HDF5_TOOLS_DIR}/testfiles/tlonglinks.ddl
${HDF5_TOOLS_DIR}/testfiles/tloop-1.ddl
${HDF5_TOOLS_DIR}/testfiles/tmulti.ddl
@@ -270,6 +273,7 @@
${HDF5_TOOLS_DIR}/testfiles/tfcontents1.h5
${HDF5_TOOLS_DIR}/testfiles/tfcontents2.h5
${HDF5_TOOLS_DIR}/testfiles/tfilters.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.h5
${HDF5_TOOLS_DIR}/testfiles/tfpformat.h5
${HDF5_TOOLS_DIR}/testfiles/tfvalues.h5
${HDF5_TOOLS_DIR}/testfiles/tgroup.h5
@@ -281,7 +285,8 @@
${HDF5_TOOLS_DIR}/testfiles/tintsattrs.h5
${HDF5_TOOLS_DIR}/testfiles/tintsnodata.h5
${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.h5
- #${HDF5_TOOLS_DIR}/testfiles/tldouble.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tldouble.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tldouble_scalar.h5
${HDF5_TOOLS_DIR}/testfiles/tlonglinks.h5
${HDF5_TOOLS_DIR}/testfiles/tloop.h5
${HDF5_TOOLS_DIR}/testfiles/tmulti-b.h5
@@ -319,6 +324,8 @@
${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5
${HDF5_TOOLS_DIR}/testfiles/tvms.h5
${HDF5_TOOLS_DIR}/testfiles/t128bit_float.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tCVE_2018_11206_fill_old.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tCVE_2018_11206_fill_new.h5
${HDF5_TOOLS_DIR}/testfiles/zerodim.h5
)
set (HDF5_ERROR_REFERENCE_TEST_FILES
@@ -378,12 +385,14 @@
# --------------------------------------------------------------------
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbin1.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl" "h5dump_std_files")
- if (WIN32 OR MINGW)
+ if (WIN32)
configure_file(${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp NEWLINE_STYLE CRLF)
#file (READ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp TEST_STREAM)
#file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}")
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.wddl" "${PROJECT_BINARY_DIR}/testfiles/std/tfloatsattrs.ddl" "h5dump_std_files")
else ()
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp" "${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp" "h5dump_std_files")
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tfloatsattrs.ddl" "h5dump_std_files")
endif ()
add_custom_target(h5dump_std_files ALL COMMENT "Copying files needed by h5dump_std tests" DEPENDS ${h5dump_std_files_list})
@@ -1058,7 +1067,9 @@
ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5)
# test for long double (some systems do not have long double)
- #ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5)
+ ADD_H5_TEST (tfloatsattrs 0 -p --enable-error-stack tfloatsattrs.h5)
+ ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5)
+ ADD_H5_TEST (tldouble_scalar 0 -p --enable-error-stack tldouble_scalar.h5)
# test for vms
ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5)
@@ -1129,7 +1140,11 @@
ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5)
# test to verify HDFFV-9407: long double full precision
- ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lf t128bit_float.h5)
+# ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lg t128bit_float.h5)
+
+ # test to verify HDFFV-10480: out of bounds read in H5O_fill_new[old]_decode
+ ADD_H5_TEST (tCVE_2018_11206_fill_old 1 tCVE_2018_11206_fill_old.h5)
+ ADD_H5_TEST (tCVE_2018_11206_fill_new 1 tCVE_2018_11206_fill_new.h5)
##############################################################################
### P L U G I N T E S T S
diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake
index 1e16875..06be332 100644
--- a/tools/test/h5dump/CMakeTestsPBITS.cmake
+++ b/tools/test/h5dump/CMakeTestsPBITS.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake
index ae7193c..88df9ad 100644
--- a/tools/test/h5dump/CMakeTestsVDS.cmake
+++ b/tools/test/h5dump/CMakeTestsVDS.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake
index 985d940..d735257 100644
--- a/tools/test/h5dump/CMakeTestsXML.cmake
+++ b/tools/test/h5dump/CMakeTestsXML.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5dump/CMakeVFDTests.cmake b/tools/test/h5dump/CMakeVFDTests.cmake
index 337cfe2..01834b3 100644
--- a/tools/test/h5dump/CMakeVFDTests.cmake
+++ b/tools/test/h5dump/CMakeVFDTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -26,7 +26,7 @@ set (VFD_H5DUMP_LIST
family
)
-if (DIRECT_VFD)
+if (H5_HAVE_DIRECT)
set (VFD_H5DUMP_LIST ${VFD_H5DUMP_LIST} direct)
endif ()
diff --git a/tools/test/h5dump/Makefile.am b/tools/test/h5dump/Makefile.am
index 21560fb..2651320 100644
--- a/tools/test/h5dump/Makefile.am
+++ b/tools/test/h5dump/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/h5dump/Makefile.in b/tools/test/h5dump/Makefile.in
index 0f4868d..e5377c3 100644
--- a/tools/test/h5dump/Makefile.in
+++ b/tools/test/h5dump/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -438,12 +439,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include files in /src directory and /tools/lib directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -481,11 +482,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -517,8 +563,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -532,7 +576,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -542,6 +588,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -735,7 +782,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1286,8 +1333,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/h5dump/binread.c b/tools/test/h5dump/binread.c
index 6165cd8..d6206ca 100644
--- a/tools/test/h5dump/binread.c
+++ b/tools/test/h5dump/binread.c
@@ -7,7 +7,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -27,9 +27,9 @@
*/
-#define NELMTS 6
-#define TYPE int
-#define FORMAT "%d "
+#define NELMTS 6
+#define TYPE int
+#define FORMAT "%d "
/*-------------------------------------------------------------------------
* Function: usage
@@ -45,7 +45,7 @@
*-------------------------------------------------------------------------
*/
static void
-usage (void)
+usage(void)
{
fprintf(stderr, "usage: binread FILE_NAME\n");
}
@@ -59,13 +59,13 @@ usage (void)
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- FILE *stream;
+ FILE * stream;
size_t numread;
TYPE buf[NELMTS];
size_t i, nelmts = NELMTS;
- char *fname=NULL;
+ char * fname = NULL;
if (argc != 2) {
usage();
@@ -74,12 +74,12 @@ main (int argc, const char *argv[])
fname = strdup(argv[1]);
- if((stream = fopen(fname, "rb")) != NULL) {
- numread = fread(buf, sizeof( TYPE ), nelmts, stream);
+ if ((stream = fopen(fname, "rb")) != NULL) {
+ numread = fread(buf, sizeof(TYPE), nelmts, stream);
printf("Number of items read = %llu\n", (unsigned long long)numread);
for (i = 0; i < nelmts; i++) {
- printf(FORMAT,buf[i]);
+ printf(FORMAT, buf[i]);
}
printf("\n");
@@ -92,4 +92,3 @@ main (int argc, const char *argv[])
return 0;
}
-
diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c
index 661a6dc..433522d 100644
--- a/tools/test/h5dump/dynlib_dump.c
+++ b/tools/test/h5dump/dynlib_dump.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,25 +17,33 @@
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIBUD 300
-#define MULTIPLIER 3
+#define H5Z_FILTER_DYNLIBUD 300
+#define MULTIPLIER 3
-static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIBUD, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlibud", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIBUD, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlibud", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ H5Z_filter_dynlibud, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return H5Z_DYNLIBUD;
+}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlibud
@@ -51,39 +59,37 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- char *int_ptr = (char *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ char * int_ptr = (char *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
- if(cd_nelmts > 0)
- return(0);
+ if (cd_nelmts > 0)
+ return (0);
/* Assignment to eliminate unused parameter warning. */
- cd_values = cd_values;
+ (void)cd_values;
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp - MULTIPLIER);
+ *int_ptr = (int8_t)(temp - MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp + MULTIPLIER);
+ *int_ptr = (int8_t)(temp + MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlibud() */
-
diff --git a/tools/test/h5dump/h5dump_plugin.sh.in b/tools/test/h5dump/h5dump_plugin.sh.in
index d940ab3..a552f60 100644
--- a/tools/test/h5dump/h5dump_plugin.sh.in
+++ b/tools/test/h5dump/h5dump_plugin.sh.in
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c
index 78aa668..4b423c4 100644
--- a/tools/test/h5dump/h5dumpgentest.c
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -25,95 +25,97 @@
#include "h5test.h"
#include "h5tools.h"
-#define FILE1 "tgroup.h5"
-#define FILE2 "tdset.h5"
-#define FILE3 "tattr.h5"
-#define FILE4 "tslink.h5"
-#define FILE4_1 "tsoftlinks.h5"
-#define FILE5 "thlink.h5"
-#define FILE6 "tcompound.h5"
-#define FILE7 "tall.h5"
-#define FILE8 "tdset2.h5"
-#define FILE9 "tcompound2.h5"
-#define FILE10 "tloop.h5"
-#define FILE11 "tloop2.h5"
-#define FILE12 "tmany.h5"
-#define FILE13 "tstr.h5"
-#define FILE14 "tstr2.h5"
-#define FILE15 "tenum.h5"
-#define FILE16 "tobjref.h5"
-#define FILE17 "tdatareg.h5"
-#define FILE18 "tnestedcomp.h5"
-#define FILE19 "topaque.h5"
-#define FILE20 "tbitfields.h5"
-#define FILE21 "tvldtypes1.h5"
-#define FILE22 "tvldtypes2.h5"
-#define FILE23 "tvldtypes3.h5"
-#define FILE24 "tvldtypes4.h5"
-#define FILE25 "tarray1.h5"
+#define FILE1 "tgroup.h5"
+#define FILE2 "tdset.h5"
+#define FILE3 "tattr.h5"
+#define FILE4 "tslink.h5"
+#define FILE4_1 "tsoftlinks.h5"
+#define FILE5 "thlink.h5"
+#define FILE6 "tcompound.h5"
+#define FILE7 "tall.h5"
+#define FILE8 "tdset2.h5"
+#define FILE9 "tcompound2.h5"
+#define FILE10 "tloop.h5"
+#define FILE11 "tloop2.h5"
+#define FILE12 "tmany.h5"
+#define FILE13 "tstr.h5"
+#define FILE14 "tstr2.h5"
+#define FILE15 "tenum.h5"
+#define FILE16 "tobjref.h5"
+#define FILE17 "tdatareg.h5"
+#define FILE18 "tnestedcomp.h5"
+#define FILE19 "topaque.h5"
+#define FILE20 "tbitfields.h5"
+#define FILE21 "tvldtypes1.h5"
+#define FILE22 "tvldtypes2.h5"
+#define FILE23 "tvldtypes3.h5"
+#define FILE24 "tvldtypes4.h5"
+#define FILE25 "tarray1.h5"
#define FILE25_BIG "tarray1_big.h5"
-#define FILE26 "tarray2.h5"
-#define FILE27 "tarray3.h5"
-#define FILE28 "tarray4.h5"
-#define FILE29 "tarray5.h5"
-#define FILE30 "tarray6.h5"
-#define FILE31 "tarray7.h5"
-#define FILE32 "tempty.h5"
-#define FILE33 "tgrp_comments.h5"
-#define FILE34 "tsplit_file"
-#define FILE35 "tfamily%05d.h5"
-#define FILE36 "tmulti"
-#define FILE37 "tlarge_objname.h5"
-#define FILE38 "tvlstr.h5"
-#define FILE39 "tchar.h5"
-#define FILE40 "tattr2.h5"
-#define FILE41 "tcompound_complex.h5"
-#define FILE42 "tnamed_dtype_attr.h5"
-#define FILE43 "tvldtypes5.h5"
-#define FILE44 "tfilters.h5"
-#define FILE45 "tnullspace.h5"
-#define FILE46 "tfcontents1.h5"
-#define FILE47 "tfcontents2.h5"
-#define FILE48 "tfvalues.h5"
-#define FILE49 "tstr3.h5"
-#define FILE50 "taindices.h5"
-#define FILE51 "tlonglinks.h5"
-#define FILE52 "tldouble.h5"
-#define FILE53 "textlink.h5"
-#define FILE54 "tudlink.h5"
-#define FILE55 "tbinary.h5"
-#define FILE56 "tbigdims.h5"
-#define FILE57 "thyperslab.h5"
-#define FILE58 "tordergr.h5"
-#define FILE59 "torderattr.h5"
-#define FILE60 "tfpformat.h5"
-#define FILE61 "textlinksrc.h5"
-#define FILE62 "textlinktar.h5"
-#define FILE63 "textlinkfar.h5"
-#define FILE64 "tattrreg.h5"
-#define FILE65 "file_space.h5"
-#define FILE66 "packedbits.h5"
-#define FILE67 "zerodim.h5"
-#define FILE68 "charsets.h5"
-#define FILE68a "tdset_idx.h5"
-#define FILE69 "tattrintsize.h5"
-#define FILE70 "tcmpdintsize.h5"
-#define FILE71 "tcmpdattrintsize.h5"
-#define FILE72 "tnestedcmpddt.h5"
-#define FILE73 "tscalarintsize.h5"
-#define FILE74 "tscalarattrintsize.h5"
-#define FILE75 "tscalarstring.h5"
-#define FILE76 "tcmpdintarray.h5"
-#define FILE77 "tcmpdints.h5"
-#define FILE78 "tscalarintattrsize.h5"
-#define FILE79 "tintsattrs.h5"
-#define FILE80 "tbitnopaque.h5"
-#define FILE81 "tints4dims.h5"
-#define FILE82 "tcompound_complex2.h5"
-#define FILE83 "tvlenstr_array.h5"
-#define FILE84 "tudfilter.h5"
-#define FILE85 "tgrpnullspace.h5"
-#define FILE87 "tintsnodata.h5"
+#define FILE26 "tarray2.h5"
+#define FILE27 "tarray3.h5"
+#define FILE28 "tarray4.h5"
+#define FILE29 "tarray5.h5"
+#define FILE30 "tarray6.h5"
+#define FILE31 "tarray7.h5"
+#define FILE32 "tempty.h5"
+#define FILE33 "tgrp_comments.h5"
+#define FILE34 "tsplit_file"
+#define FILE35 "tfamily%05d.h5"
+#define FILE36 "tmulti"
+#define FILE37 "tlarge_objname.h5"
+#define FILE38 "tvlstr.h5"
+#define FILE39 "tchar.h5"
+#define FILE40 "tattr2.h5"
+#define FILE41 "tcompound_complex.h5"
+#define FILE42 "tnamed_dtype_attr.h5"
+#define FILE43 "tvldtypes5.h5"
+#define FILE44 "tfilters.h5"
+#define FILE45 "tnullspace.h5"
+#define FILE46 "tfcontents1.h5"
+#define FILE47 "tfcontents2.h5"
+#define FILE48 "tfvalues.h5"
+#define FILE49 "tstr3.h5"
+#define FILE50 "taindices.h5"
+#define FILE51 "tlonglinks.h5"
+#define FILE52 "tldouble.h5"
+#define FILE53 "textlink.h5"
+#define FILE54 "tudlink.h5"
+#define FILE55 "tbinary.h5"
+#define FILE56 "tbigdims.h5"
+#define FILE57 "thyperslab.h5"
+#define FILE58 "tordergr.h5"
+#define FILE59 "torderattr.h5"
+#define FILE60 "tfpformat.h5"
+#define FILE61 "textlinksrc.h5"
+#define FILE62 "textlinktar.h5"
+#define FILE63 "textlinkfar.h5"
+#define FILE64 "tattrreg.h5"
+#define FILE65 "file_space.h5"
+#define FILE66 "packedbits.h5"
+#define FILE67 "zerodim.h5"
+#define FILE68 "charsets.h5"
+#define FILE68a "tdset_idx.h5"
+#define FILE69 "tattrintsize.h5"
+#define FILE70 "tcmpdintsize.h5"
+#define FILE71 "tcmpdattrintsize.h5"
+#define FILE72 "tnestedcmpddt.h5"
+#define FILE73 "tscalarintsize.h5"
+#define FILE74 "tscalarattrintsize.h5"
+#define FILE75 "tscalarstring.h5"
+#define FILE76 "tcmpdintarray.h5"
+#define FILE77 "tcmpdints.h5"
+#define FILE78 "tscalarintattrsize.h5"
+#define FILE79 "tintsattrs.h5"
+#define FILE80 "tbitnopaque.h5"
+#define FILE81 "tints4dims.h5"
+#define FILE82 "tcompound_complex2.h5"
+#define FILE83 "tvlenstr_array.h5"
+#define FILE84 "tudfilter.h5"
+#define FILE85 "tgrpnullspace.h5"
+#define FILE87 "tintsnodata.h5"
+#define FILE88 "tldouble_scalar.h5"
+#define FILE89 "tfloatsattrs.h5"
/*-------------------------------------------------------------------------
* prototypes
@@ -121,60 +123,51 @@
*/
/* utility functions */
-static int
-make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t tid, hid_t dcpl, void *buf);
-static int
-write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
- hid_t tid, void *buf);
-static int
-write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
- hid_t tid, void *buf );
+static int make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t tid, hid_t dcpl, void *buf);
+static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t tid, void *buf);
+static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t tid, void *buf);
/* a filter operation callback function */
-static size_t
-myfilter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf);
+static size_t myfilter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
+ size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf);
/* a "set local" callback */
-static herr_t
-set_local_myfilter(hid_t dcpl_id, hid_t tid, hid_t H5_ATTR_UNUSED sid);
+static herr_t set_local_myfilter(hid_t dcpl_id, hid_t tid, hid_t H5_ATTR_UNUSED sid);
#define MYFILTER_ID 405
/* This message derives from H5Z */
const H5Z_class2_t H5Z_MYFILTER[1] = {{
- H5Z_CLASS_T_VERS,
- MYFILTER_ID, /* Filter id number */
- 1, 1,
- "myfilter", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- set_local_myfilter, /* The "set local" callback */
- myfilter, /* The actual filter function */
+ H5Z_CLASS_T_VERS, MYFILTER_ID, /* Filter id number */
+ 1, 1, "myfilter", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ set_local_myfilter, /* The "set local" callback */
+ myfilter, /* The actual filter function */
}};
-#define H5Z_FILTER_DYNLIBUD 300
-#define MULTIPLIER 3
+#define H5Z_FILTER_DYNLIBUD 300
+#define MULTIPLIER 3
-static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIBUD, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlibud", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIBUD, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlibud", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ H5Z_filter_dynlibud, /* The actual filter function */
}};
-
/* A UD link traversal function. Shouldn't actually be called. */
-static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group,
- H5_ATTR_UNUSED const void * udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id,
- H5_ATTR_UNUSED hid_t dxpl_id)
+static hid_t
+UD_traverse(H5_ATTR_UNUSED const char *link_name, H5_ATTR_UNUSED hid_t cur_group,
+ H5_ATTR_UNUSED const void *udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id,
+ H5_ATTR_UNUSED hid_t dxpl_id)
{
return -1;
}
@@ -182,20 +175,19 @@ static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED h
#define MY_LINKCLASS 187
const H5L_class_t UD_link_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)MY_LINKCLASS, /* Link type id number */
- "UD link class", /* name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_traverse, /* The actual traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)MY_LINKCLASS, /* Link type id number */
+ "UD link class", /* name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
}};
-
#define LENSTR 50
-#define LENSTR2 11
+#define LENSTR2 11
#define SPACE2_RANK 2
#define SPACE2_DIM1 10
@@ -206,8 +198,8 @@ const H5L_class_t UD_link_class[1] = {{
#define DIM1 20
#define DIM2 10
-#define CDIM1 DIM1/2
-#define CDIM2 DIM2/2
+#define CDIM1 (DIM1 / 2)
+#define CDIM2 (DIM2 / 2)
#define RANK 2
/* Dataspace of 0 dimension size */
@@ -218,22 +210,15 @@ const H5L_class_t UD_link_class[1] = {{
/* Element selection information */
#define POINT1_NPOINTS 10
-typedef enum{
- RED,
- GREEN,
- BLUE,
- WHITE,
- BLACK
-} enumtype;
+typedef enum { RED, GREEN, BLUE, WHITE, BLACK } enumtype;
/* Compound datatype */
typedef struct s1_t {
- unsigned int a;
- unsigned int b;
- float c;
+ unsigned int a;
+ unsigned int b;
+ float c;
} s1_t;
-
/* 1-D array datatype */
#define ARRAY1_RANK 1
#define ARRAY1_DIM1 4
@@ -255,17 +240,17 @@ typedef struct s1_t {
/* "File 41" macros */
/* Name of dataset to create in datafile */
-#define F41_DATASETNAME "CompoundComplex"
+#define F41_DATASETNAME "CompoundComplex"
/* Dataset dimensions */
-#define F41_LENGTH 6
-#define F41_RANK 1
-#define F41_ARRAY_RANK 1
-#define F41_ARRAY_RANKd 2
-#define F41_DIMb 4
-#define F41_ARRAY_DIMc 6
-#define F41_ARRAY_DIMd1 5
-#define F41_ARRAY_DIMd2 6
-#define F41_ARRAY_DIMf 10
+#define F41_LENGTH 6
+#define F41_RANK 1
+#define F41_ARRAY_RANK 1
+#define F41_ARRAY_RANKd 2
+#define F41_DIMb 4
+#define F41_ARRAY_DIMc 6
+#define F41_ARRAY_DIMd1 5
+#define F41_ARRAY_DIMd2 6
+#define F41_ARRAY_DIMf 10
/* "File 42" macros */
/* Name of dataset to create in datafile */
@@ -279,113 +264,113 @@ typedef struct s1_t {
#define F43_DSETNAME "Dataset"
/* "File 51" macros */
-#define F51_MAX_NAME_LEN ((64*1024)+1024)
+#define F51_MAX_NAME_LEN ((64 * 1024) + 1024)
/* "File 64" macros */
-#define F64_FILE "tarray8.h5"
-#define F64_DATASET "DS1"
-#define F64_DIM0 1
-#define F64_ARRAY_BUF_LEN (4*1024)
-#define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1)
+#define F64_FILE "tarray8.h5"
+#define F64_DATASET "DS1"
+#define F64_DIM0 1
+#define F64_ARRAY_BUF_LEN (4 * 1024)
+#define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1)
/* File 65 macros */
-#define STRATEGY H5F_FSPACE_STRATEGY_NONE /* File space handling strategy */
-#define THRESHOLD10 10 /* Free-space section threshold */
-#define FSPACE_PAGE_SIZE 8192 /* File space page size */
+#define STRATEGY H5F_FSPACE_STRATEGY_NONE /* File space handling strategy */
+#define THRESHOLD10 10 /* Free-space section threshold */
+#define FSPACE_PAGE_SIZE 8192 /* File space page size */
/* "FILE66" macros and for FILE69, FILE87 */
-#define F66_XDIM 8
-#define F66_DATASETU08 "DU08BITS"
-#define F66_DATASETS08 "DS08BITS"
-#define F66_YDIM8 8
-#define F66_DATASETU16 "DU16BITS"
-#define F66_DATASETS16 "DS16BITS"
-#define F66_YDIM16 16
-#define F66_DATASETU32 "DU32BITS"
-#define F66_DATASETS32 "DS32BITS"
-#define F66_YDIM32 32
-#define F66_DATASETU64 "DU64BITS"
-#define F66_DATASETS64 "DS64BITS"
-#define F66_YDIM64 64
-#define F66_DUMMYDBL "DummyDBL"
+#define F66_XDIM 8
+#define F66_DATASETU08 "DU08BITS"
+#define F66_DATASETS08 "DS08BITS"
+#define F66_YDIM8 8
+#define F66_DATASETU16 "DU16BITS"
+#define F66_DATASETS16 "DS16BITS"
+#define F66_YDIM16 16
+#define F66_DATASETU32 "DU32BITS"
+#define F66_DATASETS32 "DS32BITS"
+#define F66_YDIM32 32
+#define F66_DATASETU64 "DU64BITS"
+#define F66_DATASETS64 "DS64BITS"
+#define F66_YDIM64 64
+#define F66_DUMMYDBL "DummyDBL"
/* Declarations for gent_dataset_idx() for "FILE68a" */
#define F68a_DSET_FIXED "dset_fixed"
-#define F68a_DSET_FIXED_FILTER "dset_filter"
+#define F68a_DSET_FIXED_FILTER "dset_filter"
#define F68a_DSET_BTREE "dset_btree"
-#define F68a_DIM200 200
-#define F68a_DIM100 100
-#define F68a_DIM20 20
-#define F68a_DIM10 10
-#define F68a_CHUNK 5
+#define F68a_DIM200 200
+#define F68a_DIM100 100
+#define F68a_DIM20 20
+#define F68a_DIM10 10
+#define F68a_CHUNK 5
/* "FILE70" macros and for FILE71 */
/* Name of dataset to create in datafile */
-#define F70_DATASETNAME "CompoundIntSize"
+#define F70_DATASETNAME "CompoundIntSize"
#define F70_LENGTH 4
#define F70_RANK 1
#define F70_ARRAY_RANK 2
#define F70_XDIM 8
-#define F70_DATASETU08 "DU08BITS"
-#define F70_DATASETS08 "DS08BITS"
+#define F70_DATASETU08 "DU08BITS"
+#define F70_DATASETS08 "DS08BITS"
#define F70_YDIM8 8
-#define F70_DATASETU16 "DU16BITS"
-#define F70_DATASETS16 "DS16BITS"
+#define F70_DATASETU16 "DU16BITS"
+#define F70_DATASETS16 "DS16BITS"
#define F70_YDIM16 16
-#define F70_DATASETU32 "DU32BITS"
-#define F70_DATASETS32 "DS32BITS"
+#define F70_DATASETU32 "DU32BITS"
+#define F70_DATASETS32 "DS32BITS"
#define F70_YDIM32 32
-#define F70_DATASETU64 "DU64BITS"
-#define F70_DATASETS64 "DS64BITS"
+#define F70_DATASETU64 "DU64BITS"
+#define F70_DATASETS64 "DS64BITS"
#define F70_YDIM64 64
-#define F70_DUMMYDBL "DummyDBL"
+#define F70_DUMMYDBL "DummyDBL"
/* Name of dataset to create in datafile */
-#define F71_DATASETNAME "CompoundAttrIntSize"
+#define F71_DATASETNAME "CompoundAttrIntSize"
/* "FILE73" macros and for FILE69 and FILE78 */
-#define F73_ARRAY_RANK 2
-#define F73_XDIM 8
-#define F73_DATASETU08 "DU08BITS"
-#define F73_DATASETS08 "DS08BITS"
-#define F73_YDIM8 8
-#define F73_DATASETU16 "DU16BITS"
-#define F73_DATASETS16 "DS16BITS"
-#define F73_YDIM16 16
-#define F73_DATASETU32 "DU32BITS"
-#define F73_DATASETS32 "DS32BITS"
-#define F73_YDIM32 32
-#define F73_DATASETU64 "DU64BITS"
-#define F73_DATASETS64 "DS64BITS"
-#define F73_YDIM64 64
-#define F73_DUMMYDBL "DummyDBL"
+#define F73_ARRAY_RANK 2
+#define F73_XDIM 8
+#define F73_DATASETU08 "DU08BITS"
+#define F73_DATASETS08 "DS08BITS"
+#define F73_YDIM8 8
+#define F73_DATASETU16 "DU16BITS"
+#define F73_DATASETS16 "DS16BITS"
+#define F73_YDIM16 16
+#define F73_DATASETU32 "DU32BITS"
+#define F73_DATASETS32 "DS32BITS"
+#define F73_YDIM32 32
+#define F73_DATASETU64 "DU64BITS"
+#define F73_DATASETS64 "DS64BITS"
+#define F73_YDIM64 64
+#define F73_DUMMYDBL "DummyDBL"
/* "FILE76 and FILE77 */
/* Name of dataset to create in datafile */
-#define F76_DATASETNAME "CompoundIntArray"
+#define F76_DATASETNAME "CompoundIntArray"
#define F76_LENGTH 4
#define F76_RANK 1
#define F76_ARRAY_RANK 1
-#define F76_DATASETU08 "DU08BITS"
-#define F76_DATASETS08 "DS08BITS"
-#define F76_DIM8 8
-#define F76_DATASETU16 "DU16BITS"
-#define F76_DATASETS16 "DS16BITS"
-#define F76_DIM16 16
-#define F76_DATASETU32 "DU32BITS"
-#define F76_DATASETS32 "DS32BITS"
-#define F76_DIM32 32
-#define F76_DATASETU64 "DU64BITS"
-#define F76_DATASETS64 "DS64BITS"
-#define F76_DIM64 64
-#define F76_DUMMYDBL "DummyDBL"
+#define F76_DATASETU08 "DU08BITS"
+#define F76_DATASETS08 "DS08BITS"
+#define F76_DIM8 8
+#define F76_DATASETU16 "DU16BITS"
+#define F76_DATASETS16 "DS16BITS"
+#define F76_DIM16 16
+#define F76_DATASETU32 "DU32BITS"
+#define F76_DATASETS32 "DS32BITS"
+#define F76_DIM32 32
+#define F76_DATASETU64 "DU64BITS"
+#define F76_DATASETS64 "DS64BITS"
+#define F76_DIM64 64
+#define F76_DUMMYDBL "DummyDBL"
/* Name of dataset to create in datafile */
-#define F77_DATASETNAME1 "CompoundInts"
-#define F77_DATASETNAME2 "CompoundRInts"
-#define F77_LENGTH 64
+#define F77_DATASETNAME1 "CompoundInts"
+#define F77_DATASETNAME2 "CompoundRInts"
+#define F77_LENGTH 64
-#define F80_DIM32 32
+#define F80_DIM32 32
-#define F81_DATASETNAME "FourDimInts"
+#define F81_DATASETNAME "FourDimInts"
#define F81_RANK 4
#define F81_WDIM 10
#define F81_XDIM 8
@@ -394,22 +379,31 @@ typedef struct s1_t {
/* "File 82" macros */
/* Name of dataset to create in datafile */
-#define F82_DATASETNAME "CompoundComplex1D"
+#define F82_DATASETNAME "CompoundComplex1D"
/* Dataset dimensions */
-#define F82_DIM32 32
-#define F82_RANK 1
+#define F82_DIM32 32
+#define F82_RANK 1
/* #define F82_RANK2 2 */
/* #define F82_RANK3 3 */
/* #define F82_RANK4 4 */
/* "File 83" macros */
/* Name of dataset to create in datafile */
-#define F83_DATASETNAME "ScalarArrayOfVlenStr"
-#define F83_DATASETNAME2 "CompoundArrayOfVlenStr"
+#define F83_DATASETNAME "ScalarArrayOfVlenStr"
+#define F83_DATASETNAME2 "CompoundArrayOfVlenStr"
/* Dataset dimensions */
-#define F83_DIM 5
-#define F83_RANK 1
-#define F83_ARRAYDIM 3
+#define F83_DIM 5
+#define F83_RANK 1
+#define F83_ARRAYDIM 3
+
+/* "FILE89" macros */
+#define F89_XDIM 8
+#define F89_DATASETF32 "DS32BITS"
+#define F89_YDIM32 32
+#define F89_DATASETF64 "DS64BITS"
+#define F89_YDIM64 64
+#define F89_DATASETF128 "DS128BITS"
+#define F89_YDIM128 128
static void
gent_group(void)
@@ -460,34 +454,35 @@ gent_group(void)
static void
gent_dataset(void)
{
- hid_t fid, dataset, space;
- hsize_t dims[2];
- int **dset1 = NULL;
- int *dset1_data = NULL;
- double **dset2 = NULL;
- double *dset2_data = NULL;
- int i, j;
+ hid_t fid, dataset, space;
+ hsize_t dims[2];
+ int ** dset1 = NULL;
+ int * dset1_data = NULL;
+ double **dset2 = NULL;
+ double * dset2_data = NULL;
+ int i, j;
/* Set up data arrays */
dset1_data = (int *)HDcalloc(10 * 20, sizeof(int));
- dset1 = (int **)HDcalloc(10, sizeof(dset1_data));
+ dset1 = (int **)HDcalloc(10, sizeof(dset1_data));
for (i = 0; i < 10; i++)
dset1[i] = dset1_data + (i * 20);
dset2_data = (double *)HDcalloc(30 * 20, sizeof(double));
- dset2 = (double **)HDcalloc(30, sizeof(dset2_data));
+ dset2 = (double **)HDcalloc(30, sizeof(dset2_data));
for (i = 0; i < 30; i++)
dset2[i] = dset2_data + (i * 20);
fid = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* dset1 */
- dims[0] = 10; dims[1] = 20;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 10;
+ dims[1] = 20;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 20; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 20; j++)
dset1[i][j] = j + i;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1_data);
@@ -495,12 +490,13 @@ gent_dataset(void)
H5Dclose(dataset);
/* dset2 */
- dims[0] = 30; dims[1] = 20;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 30;
+ dims[1] = 20;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, "/dset2", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 30; i++)
- for(j = 0; j < 20; j++)
+ for (i = 0; i < 30; i++)
+ for (j = 0; j < 20; j++)
dset2[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_data);
@@ -518,26 +514,29 @@ gent_dataset(void)
static void
gent_dataset2(void)
{
- hid_t fid, dataset, space, create_plist;
+ hid_t fid, dataset, space, create_plist;
hsize_t dims[2];
hsize_t maxdims[2];
- int dset1[10][20];
- double dset2[30][10];
- int i, j;
+ int dset1[10][20];
+ double dset2[30][10];
+ int i, j;
- fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
create_plist = H5Pcreate(H5P_DATASET_CREATE);
- dims[0] = 5; dims[1] = 5;
+ dims[0] = 5;
+ dims[1] = 5;
H5Pset_chunk(create_plist, 2, dims);
/* dset1 */
- dims[0] = 10; dims[1] = 20;
- maxdims[0] = H5S_UNLIMITED; maxdims[1] = 20;
- space = H5Screate_simple(2, dims, maxdims);
- dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+ dims[0] = 10;
+ dims[1] = 20;
+ maxdims[0] = H5S_UNLIMITED;
+ maxdims[1] = 20;
+ space = H5Screate_simple(2, dims, maxdims);
+ dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 20; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 20; j++)
dset1[i][j] = j;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
@@ -545,13 +544,15 @@ gent_dataset2(void)
H5Dclose(dataset);
/* dset2 */
- dims[0] = 30; dims[1] = 10;
- maxdims[0] = 30; maxdims[1] = H5S_UNLIMITED;
- space = H5Screate_simple(2, dims, maxdims);
- dataset = H5Dcreate2(fid, "/dset2", H5T_IEEE_F64BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+ dims[0] = 30;
+ dims[1] = 10;
+ maxdims[0] = 30;
+ maxdims[1] = H5S_UNLIMITED;
+ space = H5Screate_simple(2, dims, maxdims);
+ dataset = H5Dcreate2(fid, "/dset2", H5T_IEEE_F64BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- for(i = 0; i < 30; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 30; i++)
+ for (j = 0; j < 10; j++)
dset2[i][j] = j;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
@@ -565,21 +566,21 @@ gent_dataset2(void)
static void
gent_attribute(void)
{
- hid_t fid, root, space, attr, type;
+ hid_t fid, root, space, attr, type;
hsize_t dims[2];
- char buf[60];
- int i, data[10];
- double d[10];
- char string[]= "string attribute";
- int point = 100;
+ char buf[60];
+ int i, data[10];
+ double d[10];
+ char string[] = "string attribute";
+ int point = 100;
- fid = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* attribute 1 */
dims[0] = 24;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(root, "/attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "/attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
HDsprintf(buf, "attribute of root group");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@@ -587,10 +588,11 @@ gent_attribute(void)
/* attribute 2 */
dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(root, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++) data[i] = i+1;
+ for (i = 0; i < 10; i++)
+ data[i] = i + 1;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space);
@@ -598,10 +600,11 @@ gent_attribute(void)
/* attribute 3 */
dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++) d[i] = 0.1F * (float)i;
+ for (i = 0; i < 10; i++)
+ d[i] = 0.1F * (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
H5Sclose(space);
@@ -609,14 +612,14 @@ gent_attribute(void)
/* attribute 4 */
space = H5Screate(H5S_SCALAR);
- attr = H5Acreate2(root, "attr4", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ attr = H5Acreate2(root, "attr4", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT, &point);
H5Sclose(space);
H5Aclose(attr);
/* attribute 5 */
space = H5Screate(H5S_SCALAR);
- type = H5Tcopy(H5T_C_S1);
+ type = H5Tcopy(H5T_C_S1);
H5Tset_size(type, 17);
attr = H5Acreate2(root, "attr5", type, space, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, type, string);
@@ -628,11 +631,12 @@ gent_attribute(void)
H5Fclose(fid);
}
-static void gent_softlink(void)
+static void
+gent_softlink(void)
{
hid_t fid, root;
- fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
H5Lcreate_soft("somevalue", root, "slink1", H5P_DEFAULT, H5P_DEFAULT);
H5Lcreate_soft("linkvalue", root, "slink2", H5P_DEFAULT, H5P_DEFAULT);
@@ -653,25 +657,25 @@ static void gent_softlink(void)
*-------------------------------------------------------------------------*/
#define NX 4
#define NY 2
-static int gent_softlink2(void)
+static int
+gent_softlink2(void)
{
- hid_t fileid1 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID;
- hid_t datatype = H5I_INVALID_HID;
- hid_t dset1 = H5I_INVALID_HID, dset2 = H5I_INVALID_HID;
- hid_t dataspace = H5I_INVALID_HID;
- hsize_t dimsf[2]; /* dataset dimensions */
- int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}};
- int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}};
- herr_t status = SUCCEED;
+ hid_t fileid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID;
+ hid_t datatype = H5I_INVALID_HID;
+ hid_t dset1 = H5I_INVALID_HID, dset2 = H5I_INVALID_HID;
+ hid_t dataspace = H5I_INVALID_HID;
+ hsize_t dimsf[2]; /* dataset dimensions */
+ int data1[NX][NY] = {{0, 0}, {1, 1}, {2, 2}, {3, 3}};
+ int data2[NX][NY] = {{0, 0}, {0, 1}, {0, 2}, {3, 3}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
* FILE
*------------------------------------------------------------------------*/
/* Create a new file */
fileid1 = H5Fcreate(FILE4_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if (fileid1 < 0)
- {
+ if (fileid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -681,16 +685,14 @@ static int gent_softlink2(void)
* Groups
*------------------------------------------------------------------------*/
gid1 = H5Gcreate2(fileid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (gid1 < 0)
- {
+ if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1);
status = FAIL;
goto out;
}
gid2 = H5Gcreate2(fileid1, "group_empty", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (gid2 < 0)
- {
+ if (gid2 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -700,9 +702,8 @@ static int gent_softlink2(void)
* Named datatype
*------------------------------------------------------------------------*/
datatype = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -715,8 +716,8 @@ static int gent_softlink2(void)
* Describe the size of the array and create the data space for fixed
* size dataset.
*/
- dimsf[0] = NX;
- dimsf[1] = NY;
+ dimsf[0] = NX;
+ dimsf[1] = NY;
dataspace = H5Screate_simple(2, dimsf, NULL);
/*
@@ -727,18 +728,15 @@ static int gent_softlink2(void)
* dset1
*/
/* Create a new dataset as sample object */
- dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (dset1 < 0)
- {
+ dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset1 < 0) {
HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1);
status = FAIL;
goto out;
}
status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -748,18 +746,15 @@ static int gent_softlink2(void)
* dset2
*/
/* Create a new dataset as sample object */
- dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (dset2 < 0)
- {
+ dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset2 < 0) {
HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1);
status = FAIL;
goto out;
}
status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -773,8 +768,7 @@ static int gent_softlink2(void)
*/
/* link to dset1 */
status = H5Lcreate_soft("/dset1", fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -782,8 +776,7 @@ static int gent_softlink2(void)
/* link to data type */
status = H5Lcreate_soft("/dtype", fileid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -791,8 +784,7 @@ static int gent_softlink2(void)
/* link to group1 */
status = H5Lcreate_soft("/group1", fileid1, "soft_group1", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -800,8 +792,7 @@ static int gent_softlink2(void)
/* link to empty group */
status = H5Lcreate_soft("/group_empty", fileid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -809,8 +800,7 @@ static int gent_softlink2(void)
/* dangling link */
status = H5Lcreate_soft("not_yet", fileid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -821,8 +811,7 @@ static int gent_softlink2(void)
*/
/* link to dset1 */
status = H5Lcreate_soft("/dset1", gid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -830,8 +819,7 @@ static int gent_softlink2(void)
/* link to dset2 */
status = H5Lcreate_soft("/dset2", gid1, "soft_dset2", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -839,8 +827,7 @@ static int gent_softlink2(void)
/* link to data type */
status = H5Lcreate_soft("/dtype", gid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -848,8 +835,7 @@ static int gent_softlink2(void)
/* link to empty group */
status = H5Lcreate_soft("/group_empty", gid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
@@ -857,42 +843,41 @@ static int gent_softlink2(void)
/* dangling link */
status = H5Lcreate_soft("not_yet", gid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
status = FAIL;
goto out;
}
- out:
+out:
/*
* Close/release resources.
*/
- if(dataspace >= 0 && H5Sclose(dataspace) < 0) {
+ if (dataspace >= 0 && H5Sclose(dataspace) < 0) {
HDfprintf(stderr, "Error: %s> H5Sclose failed.\n", FILE4_1);
status = FAIL;
}
- if(gid1 >= 0 && H5Gclose(gid1) < 0) {
+ if (gid1 >= 0 && H5Gclose(gid1) < 0) {
HDfprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
status = FAIL;
}
- if(gid2 >= 0 && H5Gclose(gid2) < 0) {
+ if (gid2 >= 0 && H5Gclose(gid2) < 0) {
HDfprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
status = FAIL;
}
- if(datatype >= 0 && H5Tclose(datatype) < 0) {
+ if (datatype >= 0 && H5Tclose(datatype) < 0) {
HDfprintf(stderr, "Error: %s> H5Tclose failed.\n", FILE4_1);
status = FAIL;
}
- if(dset1 >= 0 && H5Dclose(dset1) < 0) {
+ if (dset1 >= 0 && H5Dclose(dset1) < 0) {
HDfprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
status = FAIL;
}
- if(dset2 >= 0 && H5Dclose(dset2) < 0) {
+ if (dset2 >= 0 && H5Dclose(dset2) < 0) {
HDfprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
status = FAIL;
}
- if(fileid1 >= 0 && H5Fclose(fileid1) < 0) {
+ if (fileid1 >= 0 && H5Fclose(fileid1) < 0) {
HDfprintf(stderr, "Error: %s> H5Fclose failed.\n", FILE4_1);
status = FAIL;
}
@@ -913,18 +898,20 @@ static int gent_softlink2(void)
dset3
*/
-static void gent_hardlink(void)
+static void
+gent_hardlink(void)
{
- hid_t fid, group, dataset, space;
+ hid_t fid, group, dataset, space;
hsize_t dim = 5;
- int i, dset[5];
+ int i, dset[5];
fid = H5Fcreate(FILE5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- space = H5Screate_simple(1, &dim, NULL);
+ space = H5Screate_simple(1, &dim, NULL);
dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 5; i++) dset[i] = i;
+ for (i = 0; i < 5; i++)
+ dset[i] = i;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
H5Sclose(space);
@@ -947,7 +934,8 @@ static void gent_hardlink(void)
H5Fclose(fid);
}
-static void gent_extlink(void)
+static void
+gent_extlink(void)
{
hid_t fid;
@@ -959,10 +947,11 @@ static void gent_extlink(void)
H5Fclose(fid);
}
-static void gent_udlink(void)
+static void
+gent_udlink(void)
{
hid_t fid;
- char buf[4];
+ char buf[4];
H5Lregister(UD_link_class);
@@ -975,7 +964,6 @@ static void gent_udlink(void)
H5Fclose(fid);
}
-
/*
/
/ | \ \
@@ -984,69 +972,69 @@ static void gent_udlink(void)
dset2
*/
-static void gent_compound_dt(void) { /* test compound data type */
+static void
+gent_compound_dt(void)
+{ /* test compound data type */
hid_t fid, group, dataset, space, space3, type, type2;
hid_t array_dt;
typedef struct {
- int a;
- float b;
- double c;
+ int a;
+ float b;
+ double c;
} dset1_t;
dset1_t dset1[5];
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset2_t;
dset2_t dset2[5];
typedef struct {
- int a[4];
- float b[5][6];
+ int a[4];
+ float b[5][6];
} dset3_t;
dset3_t dset3[3][6];
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset4_t;
dset4_t dset4[5];
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset5_t;
dset5_t dset5[5];
- int i, j, k, l;
+ int i, j, k, l;
unsigned ndims;
- hsize_t dim[2];
+ hsize_t dim[2];
hsize_t sdim = 5;
hsize_t dset3_dim[2];
-
- for(i = 0; i < (int)sdim; i++) {
+ for (i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
- dset1[i].b = (float)(i*i);
- dset1[i].c = (float)(1.0F/(float)(i+1));
+ dset1[i].b = (float)(i * i);
+ dset1[i].c = (float)(1.0F / (float)(i + 1));
dset2[i].a = i;
- dset2[i].b = (float)((float)i+ (float)i*0.1F);
+ dset2[i].b = (float)((float)i + (float)i * 0.1F);
dset4[i].a = i;
- dset4[i].b = (float)(i+3);
+ dset4[i].b = (float)(i + 3);
dset5[i].a = i;
- dset5[i].b = (float)((float)i*0.1F);
+ dset5[i].b = (float)((float)i * 0.1F);
}
-
fid = H5Fcreate(FILE6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
space = H5Screate_simple(1, &sdim, NULL);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE);
H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE);
@@ -1061,11 +1049,11 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Dclose(dataset);
/* shared data type 1 */
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset2_t));
H5Tinsert(type, "int_name", HOFFSET(dset2_t, a), H5T_STD_I32BE);
H5Tinsert(type, "float_name", HOFFSET(dset2_t, b), H5T_IEEE_F32BE);
H5Tcommit2(fid, "type1", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset2_t));
H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT);
group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -1076,12 +1064,12 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Tclose(type);
H5Dclose(dataset);
-
/* shared data type 2 */
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset3_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset3_t));
- ndims = 1; dim[0] = 4;
+ ndims = 1;
+ dim[0] = 4;
array_dt = H5Tarray_create2(H5T_STD_I32BE, ndims, dim);
H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt);
@@ -1091,7 +1079,9 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Tinsert(type2, "int_array", HOFFSET(dset3_t, a), array_dt);
H5Tclose(array_dt);
- ndims = 2; dim[0] = 5; dim[1] = 6;
+ ndims = 2;
+ dim[0] = 5;
+ dim[1] = 6;
array_dt = H5Tarray_create2(H5T_IEEE_F32BE, ndims, dim);
H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt);
@@ -1103,16 +1093,16 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Tcommit2(fid, "type2", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- dset3_dim[0] = 3; dset3_dim[1] = 6;
- space3 = H5Screate_simple(2, dset3_dim, NULL);
- dataset = H5Dcreate2(group, "dset3", type, space3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < (int)dset3_dim[0]; i++)
- for(j = 0; j < (int)dset3_dim[1]; j++) {
- for(k = 0; k < 4; k++)
+ dset3_dim[0] = 3;
+ dset3_dim[1] = 6;
+ space3 = H5Screate_simple(2, dset3_dim, NULL);
+ dataset = H5Dcreate2(group, "dset3", type, space3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (i = 0; i < (int)dset3_dim[0]; i++)
+ for (j = 0; j < (int)dset3_dim[1]; j++) {
+ for (k = 0; k < 4; k++)
dset3[i][j].a[k] = k + j + i;
- for(k = 0; k < 5; k++)
- for(l = 0; l < 6; l++)
+ for (k = 0; k < 5; k++)
+ for (l = 0; l < 6; l++)
dset3[i][j].b[k][l] = (float)((k + 1) + l + j + i);
}
H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
@@ -1122,8 +1112,8 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Dclose(dataset);
/* shared data type 3 */
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t));
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset4_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset4_t));
H5Tinsert(type, "int", HOFFSET(dset4_t, a), H5T_STD_I32BE);
H5Tinsert(type, "float", HOFFSET(dset4_t, b), H5T_IEEE_F32BE);
H5Tcommit2(group, "type3", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -1137,7 +1127,6 @@ static void gent_compound_dt(void) { /* test compound data type */
H5Dclose(dataset);
H5Gclose(group);
-
/* unamed data type */
group = H5Gcreate2(fid, "/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -1170,51 +1159,53 @@ static void gent_compound_dt(void) { /* test compound data type */
dset2
*/
-static void gent_compound_dt2(void) { /* test compound data type */
+static void
+gent_compound_dt2(void)
+{ /* test compound data type */
hid_t fid, group, dataset, space, type, create_plist, type2;
hid_t array_dt;
typedef struct {
- int a;
- float b;
- double c;
+ int a;
+ float b;
+ double c;
} dset1_t;
dset1_t dset1[10];
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset2_t;
dset2_t dset2[10];
typedef struct {
- int a[4];
- float b[5][6];
+ int a[4];
+ float b[5][6];
} dset3_t;
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset4_t;
dset4_t dset4[10];
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset5_t;
dset5_t dset5[10];
- int i;
+ int i;
unsigned ndims;
- hsize_t dim[2];
+ hsize_t dim[2];
hsize_t sdim, maxdim;
sdim = 10;
- for(i = 0; i < (int)sdim; i++) {
+ for (i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
- dset1[i].b = (float)(i*i);
- dset1[i].c = (float)(1.0F / (float)(i+ 1));
+ dset1[i].b = (float)(i * i);
+ dset1[i].c = (float)(1.0F / (float)(i + 1));
dset2[i].a = i;
dset2[i].b = (float)((float)i + (float)i * 0.1F);
@@ -1233,12 +1224,12 @@ static void gent_compound_dt2(void) { /* test compound data type */
sdim = 2;
H5Pset_chunk(create_plist, 1, &sdim);
- sdim = 6;
+ sdim = 6;
maxdim = H5S_UNLIMITED;
space = H5Screate_simple(1, &sdim, &maxdim);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE);
H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE);
@@ -1246,7 +1237,7 @@ static void gent_compound_dt2(void) { /* test compound data type */
dataset = H5Dcreate2(fid, "/dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
H5Tinsert(type2, "a_name", HOFFSET(dset1_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "b_name", HOFFSET(dset1_t, b), H5T_NATIVE_FLOAT);
@@ -1259,7 +1250,7 @@ static void gent_compound_dt2(void) { /* test compound data type */
H5Sclose(space);
H5Dclose(dataset);
- sdim = 6;
+ sdim = 6;
maxdim = 10;
space = H5Screate_simple(1, &sdim, &maxdim);
@@ -1274,7 +1265,7 @@ static void gent_compound_dt2(void) { /* test compound data type */
dataset = H5Dcreate2(group, "dset2", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset2_t));
H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT);
H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
@@ -1283,16 +1274,18 @@ static void gent_compound_dt2(void) { /* test compound data type */
H5Tclose(type2);
H5Dclose(dataset);
-
/* shared data type 2 */
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset3_t));
- ndims = 1; dim[0] = 4;
+ ndims = 1;
+ dim[0] = 4;
array_dt = H5Tarray_create2(H5T_STD_I32BE, ndims, dim);
H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt);
H5Tclose(array_dt);
- ndims = 2; dim[0] = 5; dim[1] = 6;
+ ndims = 2;
+ dim[0] = 5;
+ dim[1] = 6;
array_dt = H5Tarray_create2(H5T_IEEE_F32BE, ndims, dim);
H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt);
H5Tclose(array_dt);
@@ -1308,7 +1301,7 @@ static void gent_compound_dt2(void) { /* test compound data type */
dataset = H5Dcreate2(group, "dset4", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset4_t));
H5Tinsert(type2, "int", HOFFSET(dset4_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "float", HOFFSET(dset4_t, b), H5T_NATIVE_FLOAT);
H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset4);
@@ -1318,7 +1311,6 @@ static void gent_compound_dt2(void) { /* test compound data type */
H5Dclose(dataset);
H5Gclose(group);
-
/* unamed data type */
group = H5Gcreate2(fid, "/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -1327,7 +1319,7 @@ static void gent_compound_dt2(void) { /* test compound data type */
H5Tinsert(type, "float", HOFFSET(dset5_t, b), H5T_IEEE_F32BE);
H5Tcommit2(group, "type4", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset5", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset5_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset5_t));
H5Tinsert(type2, "int", HOFFSET(dset5_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "float", HOFFSET(dset5_t, b), H5T_NATIVE_FLOAT);
H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset5);
@@ -1342,10 +1334,8 @@ static void gent_compound_dt2(void) { /* test compound data type */
H5Pclose(create_plist);
H5Fclose(fid);
-
}
-
/*
/ : g1 g2 attr1 attr2
@@ -1357,14 +1347,15 @@ g2 : dset2.1 dset2.2 udlink
*/
-static void gent_all(void)
+static void
+gent_all(void)
{
- hid_t fid, group, attr, dataset, space;
+ hid_t fid, group, attr, dataset, space;
hsize_t dims[2];
- int data[2][2], dset1[10][10], dset2[20];
- char buf[60];
- int i, j;
- float dset2_1[10], dset2_2[3][5];
+ int data[2][2], dset1[10][10], dset2[20];
+ char buf[60];
+ int i, j;
+ float dset2_1[10], dset2_2[3][5];
fid = H5Fcreate(FILE7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1388,17 +1379,21 @@ static void gent_all(void)
group = H5Gopen2(fid, "/", H5P_DEFAULT);
dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
HDsprintf(buf, "abcdefghi");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
H5Aclose(attr);
- dims[0] = 2; dims[1] = 2;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
- data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
+ dims[0] = 2;
+ dims[1] = 2;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0;
+ data[0][1] = 1;
+ data[1][0] = 2;
+ data[1][1] = 3;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space);
H5Aclose(attr);
@@ -1408,27 +1403,28 @@ static void gent_all(void)
group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT);
/* dset1.1.1 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 10;
+ dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(group, "dset1.1.1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
dset1[i][j] = j * i;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
H5Sclose(space);
/* attributes of dset1.1.1 */
dims[0] = 27;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
HDsprintf(buf, "1st attribute of dset1.1.1");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
H5Aclose(attr);
dims[0] = 27;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
HDsprintf(buf, "2nd attribute of dset1.1.1");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@@ -1438,9 +1434,9 @@ static void gent_all(void)
/* dset1.1.2 */
dims[0] = 20;
- space = H5Screate_simple(1, dims, NULL);
+ space = H5Screate_simple(1, dims, NULL);
dataset = H5Dcreate2(group, "dset1.1.2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 20; i++)
+ for (i = 0; i < 20; i++)
dset2[i] = i;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
H5Sclose(space);
@@ -1460,20 +1456,21 @@ static void gent_all(void)
/* dset2.1 */
dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
+ space = H5Screate_simple(1, dims, NULL);
dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
dset2_1[i] = (float)((float)i * 0.1F + 1);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
H5Sclose(space);
H5Dclose(dataset);
/* dset2.2 */
- dims[0] = 3; dims[1] = 5;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 3;
+ dims[1] = 5;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 3; i++)
- for(j = 0; j < 5; j++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 5; j++)
dset2_2[i][j] = (float)((float)(i + 1) * (float)j * 0.1F);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2);
H5Sclose(space);
@@ -1499,7 +1496,9 @@ o - group objects
*/
-static void gent_loop(void) {
+static void
+gent_loop(void)
+{
hid_t fid, group;
fid = H5Fcreate(FILE10, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1515,7 +1514,8 @@ static void gent_loop(void) {
H5Fclose(fid);
}
-static void gent_loop2(void)
+static void
+gent_loop2(void)
{
hid_t fid, group;
@@ -1552,25 +1552,25 @@ static void gent_loop2(void)
static void
gent_many(void)
{
- hid_t fid, group, attr, dataset, space, space2, type, create_plist, type2;
- hid_t array_dt;
+ hid_t fid, group, attr, dataset, space, space2, type, create_plist, type2;
+ hid_t array_dt;
hsize_t dims[2];
- int data[2][2], dset2[10][10], dset3[10][10];
- double d[10];
+ int data[2][2], dset2[10][10], dset3[10][10];
+ double d[10];
- char buf[60];
- int i, j;
- int i0, i1, i2, i3;
+ char buf[60];
+ int i, j;
+ int i0, i1, i2, i3;
hsize_t sdim, maxdim;
- typedef struct { /* compound type has members with rank > 1 */
- int a[2][2][2][2]; /* arrays are 2x2x2x2 */
- double b[2][2][2][2];
- double c[2][2][2][2];
+ typedef struct { /* compound type has members with rank > 1 */
+ int a[2][2][2][2]; /* arrays are 2x2x2x2 */
+ double b[2][2][2][2];
+ double c[2][2][2][2];
} dset1_t;
dset1_t dset1[6];
- hsize_t dim[4];
+ hsize_t dim[4];
herr_t H5_ATTR_NDEBUG_UNUSED ret;
fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1585,10 +1585,10 @@ gent_many(void)
group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
dim[0] = dim[1] = dim[2] = dim[3] = 2;
- array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
+ array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt);
H5Tclose(array_dt);
@@ -1600,7 +1600,7 @@ gent_many(void)
H5Tinsert(type, "c_array", HOFFSET(dset1_t, c), array_dt);
H5Tclose(array_dt);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 4, dim);
H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt);
@@ -1614,44 +1614,47 @@ gent_many(void)
H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt);
H5Tclose(array_dt);
-
/* dset1 */
- sdim = 6;
- maxdim = H5S_UNLIMITED;
- space = H5Screate_simple(1, &sdim, &maxdim);
+ sdim = 6;
+ maxdim = H5S_UNLIMITED;
+ space = H5Screate_simple(1, &sdim, &maxdim);
dataset = H5Dcreate2(group, "dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
/* add attributes to dset1 */
dims[0] = 10;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
HDsprintf(buf, "abcdefghi");
H5Awrite(attr, H5T_NATIVE_CHAR, buf);
H5Sclose(space2);
H5Aclose(attr);
- dims[0] = 2; dims[1] = 2;
- space2 = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
+ dims[0] = 2;
+ dims[1] = 2;
+ space2 = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0;
+ data[0][1] = 1;
+ data[1][0] = 2;
+ data[1][1] = 3;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space2);
H5Aclose(attr);
dims[0] = 10;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ for (i = 0; i < 10; i++)
d[i] = 0.1F * (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
H5Sclose(space2);
H5Aclose(attr);
- for(j=0; j<(int)sdim; j++) {
- for(i3 = 0; i3 < 2; i3++) {
- for(i2 = 0; i2 < 2; i2++) {
- for(i1 = 0; i1 < 2; i1++) {
- for(i0 = 0; i0 < 2; i0++) {
+ for (j = 0; j < (int)sdim; j++) {
+ for (i3 = 0; i3 < 2; i3++) {
+ for (i2 = 0; i2 < 2; i2++) {
+ for (i1 = 0; i1 < 2; i1++) {
+ for (i0 = 0; i0 < 2; i0++) {
dset1[j].a[i3][i2][i1][i0] = i0 + j;
dset1[j].b[i3][i2][i1][i0] = (double)(i0 + j);
dset1[j].c[i3][i2][i1][i0] = (double)((hsize_t)i0 + (hsize_t)j + sdim);
@@ -1684,12 +1687,13 @@ gent_many(void)
group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* dset2 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 10;
+ dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(group, "dset2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
dset2[i][j] = j;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
@@ -1707,12 +1711,13 @@ gent_many(void)
group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* dset3 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = 10;
+ dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(group, "dset3", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
dset3[i][j] = i;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
@@ -1745,68 +1750,68 @@ gent_many(void)
H5Fclose(fid);
}
-static hid_t mkstr(int size, H5T_str_t pad) {
+static hid_t
+mkstr(int size, H5T_str_t pad)
+{
hid_t type;
- if((type=H5Tcopy(H5T_C_S1)) < 0) return -1;
- if(H5Tset_size(type, (size_t)size) < 0) return -1;
- if(H5Tset_strpad(type, pad) < 0) return -1;
+ if ((type = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if (H5Tset_size(type, (size_t)size) < 0)
+ return -1;
+ if (H5Tset_strpad(type, pad) < 0)
+ return -1;
return type;
}
-static void gent_str(void) {
+static void
+gent_str(void)
+{
hid_t fid, dataset, space, f_type, m_type, str_type, f_type2;
hid_t array_dt;
- hsize_t dims1[] = { 3, 4};
- char string1[12][3] = {"s1","s2","s3","s4","s5","s6","s7","s8","s9",
- "s0","s1","s2"};
-
- hsize_t dims2[]={20};
- char string2[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4",
- "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8",
- "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2",
- "ab cd ef3", "ab cd ef4", "ab cd ef5", "ab cd ef6",
- "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"};
-
- hsize_t dims3[] = { 27};
- char string3[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3",
- "abcd4", "abcd5", "abcd6", "abcd7",
- "abcd8", "abcd9", "abcd0", "abcd1",
- "abcd2", "abcd3", "abcd4", "abcd5",
- "abcd6", "abcd7", "abcd8", "abcd9",
- "abcd0", "abcd1", "abcd2", "abcd3",
- "abcd4", "abcd5", "abcd6"};
+ hsize_t dims1[] = {3, 4};
+ char string1[12][3] = {"s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s0", "s1", "s2"};
+
+ hsize_t dims2[] = {20};
+ char string2[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", "ab cd ef5",
+ "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0",
+ "ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", "ab cd ef5",
+ "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"};
+
+ hsize_t dims3[] = {27};
+ char string3[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6", "abcd7", "abcd8",
+ "abcd9", "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6", "abcd7",
+ "abcd8", "abcd9", "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6"};
int i, j, k, l;
- hsize_t dims4[] = { 3 };
- char string4[3][21] = { "s1234567890123456789", "s1234567890123456789",
- "s1234567890123456789"};
+ hsize_t dims4[] = {3};
+ char string4[3][21] = {"s1234567890123456789", "s1234567890123456789", "s1234567890123456789"};
- hsize_t dims5[] = { 3, 6};
+ hsize_t dims5[] = {3, 6};
typedef struct {
- int a[8][10];
- char s[12][33];
+ int a[8][10];
+ char s[12][33];
} compound_t;
- compound_t **comp1 = NULL;
- compound_t *comp1_data = NULL;
- hsize_t mdims[2];
+ compound_t **comp1 = NULL;
+ compound_t * comp1_data = NULL;
+ hsize_t mdims[2];
/* Set up data array */
comp1_data = (compound_t *)HDcalloc(3 * 6, sizeof(compound_t));
- comp1 = (compound_t **)HDcalloc(3, sizeof(comp1_data));
+ comp1 = (compound_t **)HDcalloc(3, sizeof(comp1_data));
for (i = 0; i < 3; i++)
comp1[i] = comp1_data + (i * 6);
fid = H5Fcreate(FILE13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* string 1 : nullterm string */
- space = H5Screate_simple(2, dims1, NULL);
- f_type = mkstr(5, H5T_STR_NULLTERM);
- m_type = mkstr(3, H5T_STR_NULLTERM);
+ space = H5Screate_simple(2, dims1, NULL);
+ f_type = mkstr(5, H5T_STR_NULLTERM);
+ m_type = mkstr(3, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid, "/string1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string1);
H5Tclose(m_type);
@@ -1815,9 +1820,9 @@ static void gent_str(void) {
H5Dclose(dataset);
/* string 2 : space pad string */
- space = H5Screate_simple(1, dims2, NULL);
- f_type = mkstr(11, H5T_STR_SPACEPAD);
- m_type = mkstr(10, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims2, NULL);
+ f_type = mkstr(11, H5T_STR_SPACEPAD);
+ m_type = mkstr(10, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid, "/string2", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string2);
H5Tclose(m_type);
@@ -1826,9 +1831,9 @@ static void gent_str(void) {
H5Dclose(dataset);
/* string 3 : null pad string */
- space = H5Screate_simple(1, dims3, NULL);
- f_type = mkstr(8, H5T_STR_NULLPAD);
- m_type = mkstr(6, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims3, NULL);
+ f_type = mkstr(8, H5T_STR_NULLPAD);
+ m_type = mkstr(6, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid, "/string3", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string3);
H5Tclose(m_type);
@@ -1837,9 +1842,9 @@ static void gent_str(void) {
H5Dclose(dataset);
/* string 4 : space pad long string */
- space = H5Screate_simple(1, dims4, NULL);
- f_type = mkstr(168, H5T_STR_SPACEPAD);
- m_type = mkstr(21, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims4, NULL);
+ f_type = mkstr(168, H5T_STR_SPACEPAD);
+ m_type = mkstr(21, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid, "/string4", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4);
H5Tclose(m_type);
@@ -1848,11 +1853,12 @@ static void gent_str(void) {
H5Dclose(dataset);
/* compound data */
- space = H5Screate_simple(2, dims5, NULL);
- f_type = H5Tcreate (H5T_COMPOUND, sizeof(compound_t));
- f_type2 = H5Tcreate (H5T_COMPOUND, sizeof(compound_t));
+ space = H5Screate_simple(2, dims5, NULL);
+ f_type = H5Tcreate(H5T_COMPOUND, sizeof(compound_t));
+ f_type2 = H5Tcreate(H5T_COMPOUND, sizeof(compound_t));
- mdims[0] = 8; mdims[1] = 10;
+ mdims[0] = 8;
+ mdims[1] = 10;
array_dt = H5Tarray_create2(H5T_STD_I32BE, 2, mdims);
H5Tinsert(f_type, "int_array", HOFFSET(compound_t, a), array_dt);
@@ -1862,7 +1868,8 @@ static void gent_str(void) {
H5Tinsert(f_type2, "int_array", HOFFSET(compound_t, a), array_dt);
H5Tclose(array_dt);
- mdims[0] = 3; mdims[1] = 4;
+ mdims[0] = 3;
+ mdims[1] = 4;
str_type = mkstr(32, H5T_STR_SPACEPAD);
array_dt = H5Tarray_create2(str_type, 2, mdims);
@@ -1876,12 +1883,12 @@ static void gent_str(void) {
H5Tclose(array_dt);
H5Tclose(str_type);
- for(i = 0; i < 3; i++)
- for(j = 0; j < 6; j++) {
- for(k = 0 ; k < 8; k++)
- for(l = 0; l < 10; l++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 6; j++) {
+ for (k = 0; k < 8; k++)
+ for (l = 0; l < 10; l++)
comp1[i][j].a[k][l] = (l + j + k) * (l + j + k);
- for(k = 0 ; k < 12; k++)
+ for (k = 0; k < 12; k++)
HDstrcpy(comp1[i][j].s[k], "abcdefgh12345678abcdefgh12345678");
}
@@ -1908,17 +1915,17 @@ static void gent_str(void) {
string2 string4 string6
*/
-static void gent_str2(void)
+static void
+gent_str2(void)
{
- hid_t fid, group, attr, dataset, space, space2, mem_space, hyper_space;
- hid_t fxdlenstr, fxdlenstr2, memtype;
+ hid_t fid, group, attr, dataset, space, space2, mem_space, hyper_space;
+ hid_t fxdlenstr, fxdlenstr2, memtype;
hsize_t dims[1], size[1], stride[1], count[1], block[1];
hsize_t start[1];
-
- int i;
- char buf[LENSTR+20];
- char buf2[3*LENSTR2];
+ int i;
+ char buf[LENSTR + 20];
+ char buf2[3 * LENSTR2];
hsize_t sdim;
fid = H5Fcreate(FILE14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1933,16 +1940,16 @@ static void gent_str2(void)
H5Tset_cset(memtype, H5T_CSET_ASCII);
H5Tset_strpad(memtype, H5T_STR_NULLTERM);
- sdim = 10;
- size[0] = sdim;
- space = H5Screate_simple(1, size, NULL);
- size[0] = 1;
- mem_space = H5Screate_simple(1,size,NULL);
+ sdim = 10;
+ size[0] = sdim;
+ space = H5Screate_simple(1, size, NULL);
+ size[0] = 1;
+ mem_space = H5Screate_simple(1, size, NULL);
hyper_space = H5Scopy(space);
/* dset1 */
- group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset1", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* add attributes to dset1 */
@@ -1953,71 +1960,69 @@ static void gent_str2(void)
H5Tset_strpad(fxdlenstr2, H5T_STR_NULLTERM);
dims[0] = 3;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT);
- HDsprintf(&(buf2[0*LENSTR2]), "0123456789");
- HDsprintf(&(buf2[1*LENSTR2]), "abcdefghij");
- HDsprintf(&(buf2[2*LENSTR2]), "ABCDEFGHIJ");
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT);
+ HDsprintf(&(buf2[0 * LENSTR2]), "0123456789");
+ HDsprintf(&(buf2[1 * LENSTR2]), "abcdefghij");
+ HDsprintf(&(buf2[2 * LENSTR2]), "ABCDEFGHIJ");
H5Awrite(attr, fxdlenstr2, buf2);
H5Sclose(space2);
H5Tclose(fxdlenstr2);
H5Aclose(attr);
- stride[0]=1;
- count[0]=1;
- block[0]=1;
+ stride[0] = 1;
+ count[0] = 1;
+ block[0] = 1;
- for(i = 0; (hsize_t)i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i);
- H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
}
H5Dclose(dataset);
H5Gclose(group);
- group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset2", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; (hsize_t)i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i);
- H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
}
H5Dclose(dataset);
H5Gclose(group);
-
H5Tclose(fxdlenstr);
fxdlenstr = H5Tcopy(H5T_C_S1);
H5Tset_size(fxdlenstr, LENSTR);
H5Tset_cset(fxdlenstr, H5T_CSET_ASCII);
H5Tset_strpad(fxdlenstr, H5T_STR_NULLPAD);
- group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset3", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0;(hsize_t) i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i);
- H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
}
H5Dclose(dataset);
H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset4", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; (hsize_t)i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i);
- H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
}
@@ -2030,10 +2035,10 @@ static void gent_str2(void)
H5Tset_cset(fxdlenstr, H5T_CSET_ASCII);
H5Tset_strpad(fxdlenstr, H5T_STR_SPACEPAD);
- group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset5", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; (hsize_t)i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i);
H5Tset_size(memtype, HDstrlen(buf) + 1);
@@ -2043,11 +2048,10 @@ static void gent_str2(void)
H5Dclose(dataset);
H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
dataset = H5Dcreate2(group, "dset6", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; (hsize_t)i < sdim; i++) {
+ for (i = 0; (hsize_t)i < sdim; i++) {
start[0] = (hsize_t)i;
HDsprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i);
H5Tset_size(memtype, HDstrlen(buf) + 1);
@@ -2065,30 +2069,29 @@ static void gent_str2(void)
H5Fclose(fid);
}
-static void gent_enum(void)
+static void
+gent_enum(void)
{
/*some code is taken from enum.c in the test dir */
- hid_t file, type, space, dset;
- int val;
- enumtype data[] = {RED, GREEN, BLUE, GREEN, WHITE,
- WHITE, BLACK, GREEN, BLUE, RED,
- RED, BLUE, GREEN, BLACK, WHITE,
- RED, WHITE, GREEN, GREEN, BLUE};
- hsize_t size[1] = {NELMTS(data)};
+ hid_t file, type, space, dset;
+ int val;
+ enumtype data[] = {RED, GREEN, BLUE, GREEN, WHITE, WHITE, BLACK, GREEN, BLUE, RED,
+ RED, BLUE, GREEN, BLACK, WHITE, RED, WHITE, GREEN, GREEN, BLUE};
+ hsize_t size[1] = {NELMTS(data)};
- file = H5Fcreate(FILE15,H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(FILE15, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Try to test names with special characters */
type = H5Tcreate(H5T_ENUM, sizeof(enumtype));
- H5Tenum_insert(type, "RED", (val = 0, &val));
+ H5Tenum_insert(type, "RED", (val = 0, &val));
H5Tenum_insert(type, "GREEN\ngreen", (val = 1, &val));
- H5Tenum_insert(type, "BLUE blue", (val = 2, &val));
+ H5Tenum_insert(type, "BLUE blue", (val = 2, &val));
H5Tenum_insert(type, "WHITE \"white\"", (val = 3, &val));
H5Tenum_insert(type, "BLACK \'black\'", (val = 4, &val));
H5Tcommit2(file, "enum normal", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- space = H5Screate_simple(1,size,NULL);
- dset = H5Dcreate2(file,"table",type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, size, NULL);
+ dset = H5Dcreate2(file, "table", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dset, type, space, space, H5P_DEFAULT, data);
H5Dclose(dset);
@@ -2096,27 +2099,28 @@ static void gent_enum(void)
H5Fclose(file);
}
-static void gent_objref(void)
+static void
+gent_objref(void)
{
/*some code is taken from enum.c in the test dir */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
-
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hobj_ref_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temp. buffer read from disk */
- uint32_t *tu32; /* Temporary pointer to uint32 data */
- int i; /* counting variables */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hobj_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ uint32_t * tu32; /* Temporary pointer to uint32 data */
+ int i; /* counting variables */
const char *write_comment = "Foo!"; /* Comments for group */
/* Allocate write & read buffers */
- wbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
- rbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
- tbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ wbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE16, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2133,7 +2137,7 @@ static void gent_objref(void)
/* Create a dataset (inside Group1) */
dataset = H5Dcreate2(group, "Dataset1", H5T_STD_U32BE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(tu32 = (uint32_t *)((void*)wbuf), i = 0; i < SPACE1_DIM1; i++)
+ for (tu32 = (uint32_t *)((void *)wbuf), i = 0; i < SPACE1_DIM1; i++)
*tu32++ = (uint32_t)(i * 3);
/* Write selection to disk */
@@ -2152,11 +2156,11 @@ static void gent_objref(void)
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
/* Insert fields */
- H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_STD_I32BE);
+ H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_STD_I32BE);
- H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_IEEE_F32BE);
+ H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_IEEE_F32BE);
- H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_IEEE_F32BE);
+ H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_IEEE_F32BE);
/* Save datatype for later */
H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -2200,34 +2204,34 @@ static void gent_objref(void)
HDfree(tbuf);
}
-static void gent_datareg(void)
+static void
+gent_datareg(void)
{
/*some code is taken from enum.c in the test dir */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dset1, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid2; /* Dataspace ID #2 */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- int i; /* counting variables */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dset1, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
+ hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ int i; /* counting variables */
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t*) HDmalloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
- dwbuf = (uint8_t*) HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
- drbuf = (uint8_t*) HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2);
/* Create file */
fid1 = H5Fcreate(FILE17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2238,7 +2242,7 @@ static void gent_datareg(void)
/* Create a dataset */
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
+ for (tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
*tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
@@ -2256,10 +2260,14 @@ static void gent_datareg(void)
/* Create references */
/* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 6;
- block[0] = 1; block[1] = 1;
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 6;
+ block[0] = 1;
+ block[1] = 1;
H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
H5Sget_select_npoints(sid2);
@@ -2268,25 +2276,35 @@ static void gent_datareg(void)
H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
/* Select sequence of ten points for second reference */
- coord1[0][0]=6; coord1[0][1]=9;
- coord1[1][0]=2; coord1[1][1]=2;
- coord1[2][0]=8; coord1[2][1]=4;
- coord1[3][0]=1; coord1[3][1]=6;
- coord1[4][0]=2; coord1[4][1]=8;
- coord1[5][0]=3; coord1[5][1]=2;
- coord1[6][0]=0; coord1[6][1]=4;
- coord1[7][0]=9; coord1[7][1]=0;
- coord1[8][0]=7; coord1[8][1]=1;
- coord1[9][0]=3; coord1[9][1]=3;
- H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(hsize_t *)coord1);
+ coord1[0][0] = 6;
+ coord1[0][1] = 9;
+ coord1[1][0] = 2;
+ coord1[1][1] = 2;
+ coord1[2][0] = 8;
+ coord1[2][1] = 4;
+ coord1[3][0] = 1;
+ coord1[3][1] = 6;
+ coord1[4][0] = 2;
+ coord1[4][1] = 8;
+ coord1[5][0] = 3;
+ coord1[5][1] = 2;
+ coord1[6][0] = 0;
+ coord1[6][1] = 4;
+ coord1[7][0] = 9;
+ coord1[7][1] = 0;
+ coord1[8][0] = 7;
+ coord1[8][1] = 1;
+ coord1[9][0] = 3;
+ coord1[9][1] = 3;
+ H5Sselect_elements(sid2, H5S_SELECT_SET, POINT1_NPOINTS, (hsize_t *)coord1);
H5Sget_select_npoints(sid2);
/* Store second dataset region */
- H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2);
+ H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
/* Write selection to disk */
- H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
/* Close disk dataspace */
H5Sclose(sid1);
@@ -2307,36 +2325,37 @@ static void gent_datareg(void)
HDfree(drbuf);
}
-static void gent_attrreg(void)
+static void
+gent_attrreg(void)
{
/*some code is taken from enum.c in the test dir */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dset1; /* Dataset ID */
- hid_t dset2; /* Dereferenced dataset ID */
- hid_t sid1; /* Dataspace ID #1 */
- hid_t sid2; /* Dataspace ID #2 */
- hid_t sid3; /* Dataspace ID #3 */
- hid_t attr1; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hdset_reg_ref_t *wbuf; /* buffer to write to disk */
- hdset_reg_ref_t *rbuf; /* buffer read from disk */
- uint8_t *dwbuf; /* Buffer for writing numeric data to disk */
- uint8_t *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- int i; /* counting variables */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dset1; /* Dataset ID */
+ hid_t dset2; /* Dereferenced dataset ID */
+ hid_t sid1; /* Dataspace ID #1 */
+ hid_t sid2; /* Dataspace ID #2 */
+ hid_t sid3; /* Dataspace ID #3 */
+ hid_t attr1; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hdset_reg_ref_t *wbuf; /* buffer to write to disk */
+ hdset_reg_ref_t *rbuf; /* buffer read from disk */
+ uint8_t * dwbuf; /* Buffer for writing numeric data to disk */
+ uint8_t * drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t * tu8; /* Temporary pointer to uint8 data */
+ int i; /* counting variables */
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t*) HDmalloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
- dwbuf = (uint8_t*) HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
- drbuf = (uint8_t*) HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2);
/* Create file */
fid1 = H5Fcreate(FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2347,7 +2366,7 @@ static void gent_attrreg(void)
/* Create a dataset */
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
+ for (tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
*tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
@@ -2360,18 +2379,21 @@ static void gent_attrreg(void)
* Create dataset with a null dataspace to serve as the parent for
* the attribute.
*/
- sid1 = H5Screate (H5S_NULL);
- dset1 = H5Dcreate2 (fid1, "Dataset1", H5T_STD_I32LE, sid1, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
- H5Sclose (sid1);
+ sid1 = H5Screate(H5S_NULL);
+ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_I32LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Sclose(sid1);
/* Create references */
/* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 6;
- block[0] = 1; block[1] = 1;
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 6;
+ block[0] = 1;
+ block[1] = 1;
H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
H5Sget_select_npoints(sid2);
@@ -2380,36 +2402,45 @@ static void gent_attrreg(void)
H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
/* Select sequence of ten points for second reference */
- coord1[0][0]=6; coord1[0][1]=9;
- coord1[1][0]=2; coord1[1][1]=2;
- coord1[2][0]=8; coord1[2][1]=4;
- coord1[3][0]=1; coord1[3][1]=6;
- coord1[4][0]=2; coord1[4][1]=8;
- coord1[5][0]=3; coord1[5][1]=2;
- coord1[6][0]=0; coord1[6][1]=4;
- coord1[7][0]=9; coord1[7][1]=0;
- coord1[8][0]=7; coord1[8][1]=1;
- coord1[9][0]=3; coord1[9][1]=3;
- H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(hsize_t *)coord1);
+ coord1[0][0] = 6;
+ coord1[0][1] = 9;
+ coord1[1][0] = 2;
+ coord1[1][1] = 2;
+ coord1[2][0] = 8;
+ coord1[2][1] = 4;
+ coord1[3][0] = 1;
+ coord1[3][1] = 6;
+ coord1[4][0] = 2;
+ coord1[4][1] = 8;
+ coord1[5][0] = 3;
+ coord1[5][1] = 2;
+ coord1[6][0] = 0;
+ coord1[6][1] = 4;
+ coord1[7][0] = 9;
+ coord1[7][1] = 0;
+ coord1[8][0] = 7;
+ coord1[8][1] = 1;
+ coord1[9][0] = 3;
+ coord1[9][1] = 3;
+ H5Sselect_elements(sid2, H5S_SELECT_SET, POINT1_NPOINTS, (hsize_t *)coord1);
H5Sget_select_npoints(sid2);
/* Store second dataset region */
- H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2);
+ H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
/* Create dataspace for the attribute */
sid3 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
/* Create the attribute and write the region references to it. */
- attr1 = H5Acreate2 (dset1, "Attribute1", H5T_STD_REF_DSETREG, sid3, H5P_DEFAULT,
- H5P_DEFAULT);
- H5Awrite (attr1, H5T_STD_REF_DSETREG, wbuf);
+ attr1 = H5Acreate2(dset1, "Attribute1", H5T_STD_REF_DSETREG, sid3, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr1, H5T_STD_REF_DSETREG, wbuf);
/* Close attribute dataspace */
H5Sclose(sid3);
/* Close attribute */
- H5Aclose (attr1);
+ H5Aclose(attr1);
/* Close Dataset */
H5Dclose(dset1);
@@ -2428,48 +2459,48 @@ static void gent_attrreg(void)
}
/*taken from Elena's compound test file*/
-static void gent_nestcomp(void)
+static void
+gent_nestcomp(void)
{
/* Compound memeber of the compound datatype*/
typedef struct cmp_t {
- char a;
- float b[2];
+ char a;
+ float b[2];
} cmp_t;
/* First structure and dataset*/
typedef struct s1_t {
- int a;
- float b;
- double c;
- cmp_t d;
+ int a;
+ float b;
+ double c;
+ cmp_t d;
} s2_t;
- hid_t cmp_tid; /* Handle for the compound datatype */
- hid_t char_id; /* Handle for the string datatype */
- hid_t array_dt;
- hsize_t array_dims[] = {2}; /* Dataspace dimensions */
- unsigned ndims = 1; /* Number of dimensions in the array field */
+ hid_t cmp_tid; /* Handle for the compound datatype */
+ hid_t char_id; /* Handle for the string datatype */
+ hid_t array_dt;
+ hsize_t array_dims[] = {2}; /* Dataspace dimensions */
+ unsigned ndims = 1; /* Number of dimensions in the array field */
- s2_t s1[10];
- hid_t s2_tid; /* File datatype identifier */
+ s2_t s1[10];
+ hid_t s2_tid; /* File datatype identifier */
- int i;
- hid_t file, dataset, space; /* Handles */
- herr_t status;
- hsize_t dim[] = {10}; /* Dataspace dimensions */
+ int i;
+ hid_t file, dataset, space; /* Handles */
+ herr_t status;
+ hsize_t dim[] = {10}; /* Dataspace dimensions */
char datasetname[] = "ArrayOfStructures";
-
/*
* Initialize the data
*/
- for(i = 0; i< 10; i++) {
- s1[i].a = i;
- s1[i].b = (float)(i*i);
- s1[i].c = 1.0F/(float)(i + 1);
- s1[i].d.a = (char)(65 + i);
+ for (i = 0; i < 10; i++) {
+ s1[i].a = i;
+ s1[i].b = (float)(i * i);
+ s1[i].c = 1.0F / (float)(i + 1);
+ s1[i].d.a = (char)(65 + i);
s1[i].d.b[0] = -100.0F;
- s1[i].d.b[1] = 100.0F;
+ s1[i].d.b[1] = 100.0F;
}
/*
@@ -2488,7 +2519,7 @@ static void gent_nestcomp(void)
/*
* Create a datatype for compound field first.
*/
- cmp_tid = H5Tcreate (H5T_COMPOUND, sizeof(cmp_t));
+ cmp_tid = H5Tcreate(H5T_COMPOUND, sizeof(cmp_t));
/* We are using C string of length one to represent "real" character */
char_id = H5Tcopy(H5T_C_S1);
@@ -2499,7 +2530,7 @@ static void gent_nestcomp(void)
H5Tinsert(cmp_tid, "array_name", HOFFSET(cmp_t, b), array_dt);
H5Tclose(array_dt);
- s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t));
+ s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
H5Tinsert(s2_tid, "a_name", HOFFSET(s2_t, a), H5T_NATIVE_INT);
H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE);
H5Tinsert(s2_tid, "b_name", HOFFSET(s2_t, b), H5T_NATIVE_FLOAT);
@@ -2516,7 +2547,7 @@ static void gent_nestcomp(void)
* Wtite data to the dataset;
*/
status = H5Dwrite(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1);
- if(status < 0)
+ if (status < 0)
HDfprintf(stderr, "gent_nestcomp H5Dwrite failed\n");
/*
@@ -2530,14 +2561,15 @@ static void gent_nestcomp(void)
H5Fclose(file);
}
-static void gent_opaque(void)
+static void
+gent_opaque(void)
{
- hid_t file, type, dataset, space;
- char test[100][2];
- int x;
+ hid_t file, type, dataset, space;
+ char test[100][2];
+ int x;
hsize_t dim = 2;
- for(x = 0; x < 100; x++){
+ for (x = 0; x < 100; x++) {
test[x][0] = (char)x;
test[x][1] = (char)(99 - x);
}
@@ -2574,83 +2606,94 @@ static void gent_opaque(void)
H5Fclose(file);
}
-static void gent_bitfields(void)
+static void
+gent_bitfields(void)
{
- hid_t file, grp=H5I_INVALID_HID, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
- size_t i;
- hsize_t nelmts;
+ hid_t file, grp = H5I_INVALID_HID, type = H5I_INVALID_HID, space = H5I_INVALID_HID,
+ dset = H5I_INVALID_HID;
+ size_t i;
+ hsize_t nelmts;
unsigned char buf[32];
file = H5Fcreate(FILE20, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if((grp = H5Gcreate2(file, "typetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if ((grp = H5Gcreate2(file, "typetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
/* bitfield_1 */
nelmts = sizeof(buf);
- if((type = H5Tcopy(H5T_STD_B8LE)) < 0 ||
- (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
- (dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((type = H5Tcopy(H5T_STD_B8LE)) < 0 || (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(i = 0; i < sizeof buf; i++)
+ for (i = 0; i < sizeof buf; i++)
buf[i] = (uint8_t)(0xff ^ i);
- if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Tclose(type) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
/* bitfield_2 */
- nelmts = sizeof(buf)/2;
- if((type = H5Tcopy(H5T_STD_B16LE)) < 0 ||
- (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
- (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ nelmts = sizeof(buf) / 2;
+ if ((type = H5Tcopy(H5T_STD_B16LE)) < 0 || (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(i = 0; i < sizeof buf; i++)
+ for (i = 0; i < sizeof buf; i++)
buf[i] = (uint8_t)(0xff ^ i);
- if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Tclose(type) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Gclose(grp) < 0)
goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Tclose(type) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
- if(H5Gclose(grp) < 0) goto error;
H5Fclose(file);
- error:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Gclose(grp);
H5Tclose(type);
H5Sclose(space);
H5Dclose(dset);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
}
-static void gent_vldatatypes(void)
+static void
+gent_vldatatypes(void)
{
- hvl_t adata, wdata[SPACE1_DIM1];
- hid_t file, dset, space, type;
- hsize_t dims[] = { SPACE1_DIM1 };
- int i;
- herr_t H5_ATTR_NDEBUG_UNUSED ret=0;
+ hvl_t adata, wdata[SPACE1_DIM1];
+ hid_t file, dset, space, type;
+ hsize_t dims[] = {SPACE1_DIM1};
+ int i;
+ herr_t H5_ATTR_NDEBUG_UNUSED ret = 0;
file = H5Fcreate(FILE21, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Allocate and initialize VL dataset to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
int j;
- wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(int));
wdata[i].len = (size_t)(i + 1);
- for(j = 0; j < i + 1; j++)
+ for (j = 0; j < i + 1; j++)
((int *)wdata[i].p)[j] = i * 10 + j;
}
/* write out the integers in little-endian format */
space = H5Screate_simple(SPACE1_RANK, dims, NULL);
- type = H5Tvlen_create(H5T_NATIVE_INT);
- dset = H5Dcreate2(file, "Dataset1.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ type = H5Tvlen_create(H5T_NATIVE_INT);
+ dset = H5Dcreate2(file, "Dataset1.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
HDassert(ret >= 0);
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata);
HDassert(ret >= 0);
@@ -2663,21 +2706,21 @@ static void gent_vldatatypes(void)
HDassert(ret >= 0);
/* Allocate and initialize VL dataset to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
int j;
- wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(float));
+ wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(float));
wdata[i].len = (size_t)(i + 1);
- for(j = 0; j < i + 1; j++)
+ for (j = 0; j < i + 1; j++)
((float *)wdata[i].p)[j] = (float)((float)(i * 10) + ((float)j) / 10.0F);
} /* end for */
/* write out the floats in little-endian format */
space = H5Screate_simple(SPACE1_RANK, dims, NULL);
- type = H5Tvlen_create(H5T_NATIVE_FLOAT);
- dset = H5Dcreate2(file, "Dataset2.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ type = H5Tvlen_create(H5T_NATIVE_FLOAT);
+ dset = H5Dcreate2(file, "Dataset2.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
HDassert(ret >= 0);
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata);
HDassert(ret >= 0);
@@ -2690,17 +2733,17 @@ static void gent_vldatatypes(void)
HDassert(ret >= 0);
/* Allocate and initialize a scalar VL dataset to write */
- adata.p = HDmalloc(37 * sizeof(int));
+ adata.p = HDmalloc(37 * sizeof(int));
adata.len = 37;
- for(i = 0; i < 37; i++)
+ for (i = 0; i < 37; i++)
((int *)adata.p)[i] = i * 2;
/* write out scalar VL dataset in little-endian format */
space = H5Screate_simple(0, NULL, NULL);
- type = H5Tvlen_create(H5T_NATIVE_INT);
- dset = H5Dcreate2(file, "Dataset3.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &adata);
+ type = H5Tvlen_create(H5T_NATIVE_INT);
+ dset = H5Dcreate2(file, "Dataset3.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &adata);
HDassert(ret >= 0);
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &adata);
HDassert(ret >= 0);
@@ -2718,35 +2761,35 @@ static void gent_vldatatypes(void)
static void
gent_vldatatypes2(void)
{
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hvl_t *t1; /* Temporary pointer to VL information */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hsize_t dims1[] = {SPACE1_DIM1};
- unsigned i,j,k; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t * t1; /* Temporary pointer to VL information */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ unsigned i, j, k; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i = 0; i < SPACE1_DIM1; i++) {
+ for (i = 0; i < SPACE1_DIM1; i++) {
wdata[i].p = (hvl_t *)HDmalloc((i + 1) * sizeof(hvl_t));
- if(wdata[i].p == NULL) {
+ if (wdata[i].p == NULL) {
HDprintf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
wdata[i].len = i + 1;
- for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) {
+ for (t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) {
t1->p = (unsigned *)HDmalloc((j + 1) * sizeof(unsigned));
- if(t1->p == NULL) {
- HDprintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ if (t1->p == NULL) {
+ HDprintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
return;
} /* end if */
- t1->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)t1->p)[k]=i*100+j*10+k;
+ t1->len = j + 1;
+ for (k = 0; k < (j + 1); k++)
+ ((unsigned int *)t1->p)[k] = i * 100 + j * 10 + k;
} /* end for */
- } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILE22, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2782,32 +2825,32 @@ gent_vldatatypes2(void)
HDassert(ret >= 0);
ret = H5Fclose(fid1);
HDassert(ret >= 0);
-
}
-static void gent_vldatatypes3(void)
+static void
+gent_vldatatypes3(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
hvl_t v;
} s1;
- s1 wdata[SPACE1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hsize_t dims1[] = {SPACE1_DIM1};
- unsigned i,j; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ s1 wdata[SPACE1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ unsigned i, j; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].i = (int)(i * 10);
- wdata[i].f = (float)((float)(i * 20)/3.0F);
- wdata[i].v.p = HDmalloc((size_t)(i + 1) * sizeof(unsigned int));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)((float)(i * 20) / 3.0F);
+ wdata[i].v.p = HDmalloc((size_t)(i + 1) * sizeof(unsigned int));
wdata[i].v.len = (size_t)(i + 1);
- for(j = 0; j < (i + 1); j++)
+ for (j = 0; j < (i + 1); j++)
((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
} /* end for */
@@ -2855,30 +2898,31 @@ static void gent_vldatatypes3(void)
HDassert(ret >= 0);
}
-static void gent_vldatatypes4(void)
+static void
+gent_vldatatypes4(void)
{
- typedef struct { /* Struct that the VL sequences are composed of */
- int i;
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
float f;
} s1;
- hvl_t wdata[SPACE1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
- hsize_t dims1[] = {SPACE1_DIM1};
- unsigned i,j; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ unsigned i, j; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p = HDmalloc((i + 1) * sizeof(s1));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + 1) * sizeof(s1));
wdata[i].len = i + 1;
- for(j = 0; j < (i + 1); j++) {
+ for (j = 0; j < (i + 1); j++) {
((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j);
((s1 *)wdata[i].p)[j].f = (float)((float)(i * 20 + j) / 3.0F);
} /* end for */
- } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILE24, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2923,46 +2967,47 @@ static void gent_vldatatypes4(void)
}
/* Generate a variable-length dataset with NULL values in it */
-static void gent_vldatatypes5(void)
+static void
+gent_vldatatypes5(void)
{
- hvl_t wdata [SPACE1_DIM1];
- hid_t fid1;
- hid_t dataset;
- hid_t sid1;
- hid_t tid1;
- hsize_t dims1[] = {SPACE1_DIM1};
- int i,j; /* counting variable */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1];
+ hid_t fid1;
+ hid_t dataset;
+ hid_t sid1;
+ hid_t tid1;
+ hsize_t dims1[] = {SPACE1_DIM1};
+ int i, j; /* counting variable */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* initialize data for dataset */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(i%2) {
- wdata[i].len=0;
- wdata[i].p=NULL;
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (i % 2) {
+ wdata[i].len = 0;
+ wdata[i].p = NULL;
} /* end if */
else {
wdata[i].len = (size_t)(i + 5);
- wdata[i].p = HDmalloc(sizeof(unsigned) * (size_t)(i + 5));
- for(j = 0; j < i + 5; j++)
+ wdata[i].p = HDmalloc(sizeof(unsigned) * (size_t)(i + 5));
+ for (j = 0; j < i + 5; j++)
((unsigned *)wdata[i].p)[j] = (unsigned)(j * 2);
} /* end else */
- } /* end for */
+ } /* end for */
/* Create file */
fid1 = H5Fcreate(FILE43, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid1>0);
+ HDassert(fid1 > 0);
/* Create dataspace for datasets */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- HDassert(sid1>0);
+ HDassert(sid1 > 0);
/* Create a datatype to refer to */
tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
- HDassert(tid1>0);
+ HDassert(tid1 > 0);
/* Create a dataset */
dataset = H5Dcreate2(fid1, F43_DSETNAME, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(dataset>0);
+ HDassert(dataset > 0);
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
HDassert(ret >= 0);
@@ -2976,10 +3021,10 @@ static void gent_vldatatypes5(void)
ret = H5Tclose(tid1);
HDassert(ret >= 0);
- ret = H5Sclose (sid1);
+ ret = H5Sclose(sid1);
HDassert(ret >= 0);
- ret = H5Fclose (fid1);
+ ret = H5Fclose(fid1);
HDassert(ret >= 0);
}
@@ -2990,42 +3035,43 @@ static void gent_vldatatypes5(void)
display array indices every 262 x N (N > 0) based on 2000x1000 dims.
*/
#define SPACE_ARRAY1BIG_DIM 2000
-#define ARRAY1BIG_DIM 1000
+#define ARRAY1BIG_DIM 1000
-static void gent_array1_big(void)
+static void
+gent_array1_big(void)
{
- int *wdata; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t sdims1[] = {SPACE_ARRAY1BIG_DIM};
- hsize_t tdims1[] = {ARRAY1BIG_DIM};
- int i,j; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ int * wdata; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE_ARRAY1BIG_DIM};
+ hsize_t tdims1[] = {ARRAY1BIG_DIM};
+ int i, j; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* for region reference dataset */
- hid_t dset2;
- hid_t sid2;
- hsize_t dims2[] = {SPACE1_DIM1};
- hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
- hdset_reg_ref_t *wbuf; /* buffer to write to disk */
-
- start[0] = 0;
+ hid_t dset2;
+ hid_t sid2;
+ hsize_t dims2[] = {SPACE1_DIM1};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ hdset_reg_ref_t *wbuf; /* buffer to write to disk */
+
+ start[0] = 0;
stride[0] = 1;
- count[0] = 999;
- block[0] = 1;
+ count[0] = 999;
+ block[0] = 1;
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
wdata = (int *)HDmalloc(sizeof(int) * (size_t)(SPACE_ARRAY1BIG_DIM * ARRAY1BIG_DIM));
/* Allocate and initialize array data to write */
- for(i = 0; i < SPACE_ARRAY1BIG_DIM; i++)
- for(j = 0; j < ARRAY1BIG_DIM; j++)
+ for (i = 0; i < SPACE_ARRAY1BIG_DIM; i++)
+ for (j = 0; j < ARRAY1BIG_DIM; j++)
*(wdata + (i * ARRAY1BIG_DIM) + j) = i * 1;
/* Create file */
@@ -3065,7 +3111,7 @@ static void gent_array1_big(void)
H5Rcreate(&wbuf[0], fid1, "/Dataset1", H5R_DATASET_REGION, sid1);
/* Write selection to disk */
- H5Dwrite(dset2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+ H5Dwrite(dset2, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -3082,22 +3128,23 @@ static void gent_array1_big(void)
HDfree(wdata);
}
-static void gent_array1(void)
+static void
+gent_array1(void)
{
- int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int i,j; /* counting variables */
- herr_t ret H5_ATTR_NDEBUG_UNUSED; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i, j; /* counting variables */
+ herr_t ret H5_ATTR_NDEBUG_UNUSED; /* Generic return value */
/* Allocate and initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++)
- wdata[i][j]=i*10+j;
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
+ wdata[i][j] = i * 10 + j;
/* Create file */
fid1 = H5Fcreate(FILE25, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3126,24 +3173,25 @@ static void gent_array1(void)
HDassert(ret >= 0);
}
-static void gent_array2(void)
+static void
+gent_array2(void)
{
- int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
+ int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3};
- int i,j,k,l; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ hsize_t tdims2[] = {ARRAY2_DIM1, ARRAY2_DIM2, ARRAY2_DIM3};
+ int i, j, k, l; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Allocate and initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY2_DIM1; j++)
- for(k=0; k<ARRAY2_DIM2; k++)
- for(l=0; l<ARRAY2_DIM3; l++)
- wdata[i][j][k][l]=i*1000+j*100+k*10+l;
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY2_DIM1; j++)
+ for (k = 0; k < ARRAY2_DIM2; k++)
+ for (l = 0; l < ARRAY2_DIM3; l++)
+ wdata[i][j][k][l] = i * 1000 + j * 100 + k * 10 + l;
/* Create file */
fid = H5Fcreate(FILE26, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3172,26 +3220,27 @@ static void gent_array2(void)
HDassert(ret >= 0);
}
-static void gent_array3(void)
+static void
+gent_array3(void)
{
- int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid1; /* 1-D array Datatype ID */
- hid_t tid2; /* 2-D array Datatype ID */
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid1; /* 1-D array Datatype ID */
+ hid_t tid2; /* 2-D array Datatype ID */
hsize_t sdims1[] = {SPACE1_DIM1};
hsize_t tdims1[] = {ARRAY1_DIM1};
- hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2};
- int i,j,k,l; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ hsize_t tdims2[] = {ARRAY3_DIM1, ARRAY3_DIM2};
+ int i, j, k, l; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Allocate and initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++)
- for(k=0; k<ARRAY3_DIM1; k++)
- for(l=0; l<ARRAY3_DIM2; l++)
- wdata[i][j][k][l]=i*1000+j*100+k*10+l;
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++)
+ for (k = 0; k < ARRAY3_DIM1; k++)
+ for (l = 0; l < ARRAY3_DIM2; l++)
+ wdata[i][j][k][l] = i * 1000 + j * 100 + k * 10 + l;
/* Create file */
fid = H5Fcreate(FILE27, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3225,26 +3274,27 @@ static void gent_array3(void)
HDassert(ret >= 0);
}
-static void gent_array4(void)
+static void
+gent_array4(void)
{
- typedef struct { /* Typedef for compound datatype */
- int i;
- float f;
+ typedef struct { /* Typedef for compound datatype */
+ int i;
+ float f;
} s2_t;
- s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int i,j; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i, j; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
wdata[i][j].i = i * 10 + j;
wdata[i][j].f = (float)((float)i * 2.5F + (float)j);
} /* end for */
@@ -3291,29 +3341,30 @@ static void gent_array4(void)
HDassert(ret >= 0);
}
-static void gent_array5(void)
+static void
+gent_array5(void)
{
- typedef struct { /* Typedef for compound datatype */
- int i;
- float f[ARRAY1_DIM1];
+ typedef struct { /* Typedef for compound datatype */
+ int i;
+ float f[ARRAY1_DIM1];
} s2_t;
- s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int i,j,k; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i, j, k; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
wdata[i][j].i = i * 10 + j;
- for(k=0; k<ARRAY1_DIM1; k++)
+ for (k = 0; k < ARRAY1_DIM1; k++)
wdata[i][j].f[k] = (float)((float)i * 10 + (float)j * 2.5F + (float)k);
} /* end for */
@@ -3327,14 +3378,14 @@ static void gent_array5(void)
tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
/* Insert integer field */
- ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid2, "i", HOFFSET(s2_t, i), H5T_NATIVE_INT);
HDassert(ret >= 0);
/* Create an array of floats datatype */
tid3 = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1);
/* Insert float array field */
- ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3);
+ ret = H5Tinsert(tid2, "f", HOFFSET(s2_t, f), tid3);
HDassert(ret >= 0);
/* Close array of floats field datatype */
@@ -3366,25 +3417,26 @@ static void gent_array5(void)
HDassert(ret >= 0);
}
-static void gent_array6(void)
+static void
+gent_array6(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int i,j,k; /* counting variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i, j, k; /* counting variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int));
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int));
wdata[i][j].len = (size_t)(i + j + 1);
- for(k = 0; k < (i + j + 1); k++)
+ for (k = 0; k < (i + j + 1); k++)
((unsigned int *)wdata[i][j].p)[k] = (unsigned)(i * 100 + j * 10 + k);
} /* end for */
@@ -3426,28 +3478,30 @@ static void gent_array6(void)
HDassert(ret >= 0);
}
-static void gent_array7(void)
+static void
+gent_array7(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int i,j,k,l; /* Index variables */
- herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i, j, k, l; /* Index variables */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Initialize array data to write */
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * (sizeof(unsigned int) * ARRAY1_DIM1));
+ for (i = 0; i < SPACE1_DIM1; i++)
+ for (j = 0; j < ARRAY1_DIM1; j++) {
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * (sizeof(unsigned int) * ARRAY1_DIM1));
wdata[i][j].len = (size_t)(i + j + 1);
- for(k = 0; k < (i + j + 1); k++)
- for(l = 0; l<ARRAY1_DIM1; l++)
- ((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] = (unsigned)(i * 1000+j * 100+k * 10 + l);
+ for (k = 0; k < (i + j + 1); k++)
+ for (l = 0; l < ARRAY1_DIM1; l++)
+ ((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] =
+ (unsigned)(i * 1000 + j * 100 + k * 10 + l);
} /* end for */
/* Create file */
@@ -3496,17 +3550,18 @@ static void gent_array7(void)
}
/* Test the boundary of the display output buffer at the reallocation event */
-static void gent_array8(void)
+static void
+gent_array8(void)
{
- hid_t file = H5I_INVALID_HID; /* Handles */
- hid_t filetype = H5I_INVALID_HID; /* Handles */
- hid_t space = H5I_INVALID_HID; /* Handles */
- hid_t dset = H5I_INVALID_HID; /* Handles */
- herr_t H5_ATTR_NDEBUG_UNUSED status = -1;
- hsize_t sdims[] = {F64_DIM0};
- hsize_t tdims[] = {F64_DIM1};
- int *wdata; /* Write buffer */
- unsigned int i;
+ hid_t file = H5I_INVALID_HID; /* Handles */
+ hid_t filetype = H5I_INVALID_HID; /* Handles */
+ hid_t space = H5I_INVALID_HID; /* Handles */
+ hid_t dset = H5I_INVALID_HID; /* Handles */
+ herr_t H5_ATTR_NDEBUG_UNUSED status = -1;
+ hsize_t sdims[] = {F64_DIM0};
+ hsize_t tdims[] = {F64_DIM1};
+ int * wdata; /* Write buffer */
+ unsigned int i;
/* Allocate data buffer */
wdata = (int *)HDmalloc(F64_DIM1 * sizeof(int));
@@ -3522,54 +3577,54 @@ static void gent_array8(void)
/*
* Create a new file using the default properties.
*/
- file = H5Fcreate (F64_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate(F64_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*
* Create array datatypes for file and memory.
*/
- filetype = H5Tarray_create2 (H5T_NATIVE_INT, 1, tdims);
+ filetype = H5Tarray_create2(H5T_NATIVE_INT, 1, tdims);
/*
* Create dataspace. Setting maximum size to NULL sets the maximum
* size to be the current size.
*/
- space = H5Screate_simple (1, sdims, NULL);
+ space = H5Screate_simple(1, sdims, NULL);
/*
* Create the dataset and write the array data to it.
*/
- if(file>=0 && filetype>=0 && space>=0) {
- dset = H5Dcreate2 (file, F64_DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT);
- if(dset>=0)
- status = H5Dwrite (dset, filetype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
- HDassert(status >= 0);
+ if (file >= 0 && filetype >= 0 && space >= 0) {
+ dset = H5Dcreate2(file, F64_DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset >= 0)
+ status = H5Dwrite(dset, filetype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(status >= 0);
}
/*
* Close and release resources.
*/
- status = H5Dclose (dset);
+ status = H5Dclose(dset);
HDassert(status >= 0);
- status = H5Sclose (space);
+ status = H5Sclose(space);
HDassert(status >= 0);
- status = H5Tclose (filetype);
+ status = H5Tclose(filetype);
HDassert(status >= 0);
- status = H5Fclose (file);
+ status = H5Fclose(file);
HDassert(status >= 0);
HDfree(wdata);
}
-static void gent_empty(void)
+static void
+gent_empty(void)
{
typedef struct {
- int a;
- float b;
- char c;
+ int a;
+ float b;
+ char c;
} empty_struct;
- hid_t file, dset, space, type;
- hsize_t dims[] = { SPACE1_DIM1 };
- herr_t H5_ATTR_NDEBUG_UNUSED ret=0;
+ hid_t file, dset, space, type;
+ hsize_t dims[] = {SPACE1_DIM1};
+ herr_t H5_ATTR_NDEBUG_UNUSED ret = 0;
file = H5Fcreate(FILE32, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3606,10 +3661,10 @@ static void gent_empty(void)
HDassert(ret >= 0);
/* write out an empty compound dataset */
- type = H5Tcreate(H5T_COMPOUND,sizeof(empty_struct));
- H5Tinsert(type, "a", HOFFSET(empty_struct, a),H5T_NATIVE_INT);
- H5Tinsert(type, "b", HOFFSET(empty_struct, b),H5T_NATIVE_FLOAT);
- H5Tinsert(type, "c", HOFFSET(empty_struct, c),H5T_NATIVE_CHAR);
+ type = H5Tcreate(H5T_COMPOUND, sizeof(empty_struct));
+ H5Tinsert(type, "a", HOFFSET(empty_struct, a), H5T_NATIVE_INT);
+ H5Tinsert(type, "b", HOFFSET(empty_struct, b), H5T_NATIVE_FLOAT);
+ H5Tinsert(type, "c", HOFFSET(empty_struct, c), H5T_NATIVE_CHAR);
dset = H5Dcreate2(file, "Dataset5.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Don't write any data */
ret = H5Dclose(dset);
@@ -3627,7 +3682,7 @@ static void gent_empty(void)
static void
gent_group_comments(void)
{
- hid_t fid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
hid_t group = H5I_INVALID_HID;
fid = H5Fcreate(FILE33, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3683,23 +3738,26 @@ gent_group_comments(void)
/* /glongcomment */
group = H5Gcreate2(fid, "/glongcomment", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Oset_comment_by_name(group, "/glongcomment", "Comment for group /glongcomment with a really, really, really long, long, long comment", H5P_DEFAULT);
+ H5Oset_comment_by_name(
+ group, "/glongcomment",
+ "Comment for group /glongcomment with a really, really, really long, long, long comment",
+ H5P_DEFAULT);
H5Gclose(group);
H5Fclose(fid);
}
-static
-void gent_split_file(void)
+static void
+gent_split_file(void)
{
- hid_t fapl, fid, root, attr, space, dataset, atype;
- char meta[] = "this is some metadata on this file";
+ hid_t fapl, fid, root, attr, space, dataset, atype;
+ char meta[] = "this is some metadata on this file";
hsize_t dims[2];
- int i, j, dset[10][15];
+ int i, j, dset[10][15];
fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
- fid = H5Fcreate(FILE34, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ fid = H5Fcreate(FILE34, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
atype = H5Tcopy(H5T_C_S1);
@@ -3707,8 +3765,8 @@ void gent_split_file(void)
H5Tset_strpad(atype, H5T_STR_NULLTERM);
dims[0] = 1;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(root, "Metadata", atype, space, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "Metadata", atype, space, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, atype, meta);
H5Tclose(atype);
H5Sclose(space);
@@ -3717,11 +3775,11 @@ void gent_split_file(void)
/* create dataset */
dims[0] = 10;
dims[1] = 15;
- space = H5Screate_simple(2, dims, NULL);
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 15; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
dset[i][j] = i + j;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
@@ -3732,14 +3790,14 @@ void gent_split_file(void)
H5Pclose(fapl);
}
-static
-void gent_family(void)
+static void
+gent_family(void)
{
- hid_t fapl, fid, space, dataset;
+ hid_t fapl, fid, space, dataset;
hsize_t dims[2];
- int i, j, dset[10][15];
+ int i, j, dset[10][15];
-#define FAMILY_SIZE 256
+#define FAMILY_SIZE 256
fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT);
@@ -3749,11 +3807,11 @@ void gent_family(void)
/* create dataset */
dims[0] = 10;
dims[1] = 15;
- space = H5Screate_simple(2, dims, NULL);
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 15; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
dset[i][j] = i + j;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
@@ -3765,23 +3823,23 @@ void gent_family(void)
static const char *multi_letters = "msbrglo";
-static
-void gent_multi(void)
+static void
+gent_multi(void)
{
- hid_t fapl, fid, space, dataset;
+ hid_t fapl, fid, space, dataset;
hsize_t dims[2];
- int i, j, dset[10][15];
+ int i, j, dset[10][15];
/* Multi-file driver, general case of the split driver */
- H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl[H5FD_MEM_NTYPES];
+ H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
const char *memb_name[H5FD_MEM_NTYPES];
- char **sv = NULL;
- char *sv_data = NULL;
- haddr_t memb_addr[H5FD_MEM_NTYPES];
+ char ** sv = NULL;
+ char * sv_data = NULL;
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
sv_data = (char *)HDcalloc(H5FD_MEM_NTYPES * 1024, sizeof(char));
- sv = (char **)HDcalloc(H5FD_MEM_NTYPES, sizeof(sv_data));
+ sv = (char **)HDcalloc(H5FD_MEM_NTYPES, sizeof(sv_data));
for (i = 0; i < H5FD_MEM_NTYPES; i++)
sv[i] = sv_data + (i * 1024);
@@ -3794,9 +3852,9 @@ void gent_multi(void)
HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
memb_fapl[mt] = H5P_DEFAULT;
- memb_map[mt] = mt;
+ memb_map[mt] = mt;
HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
/*HDprintf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/
@@ -3804,19 +3862,18 @@ void gent_multi(void)
}
memb_map[H5FD_MEM_DEFAULT] = H5FD_MEM_SUPER;
- H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name,
- memb_addr, FALSE);
+ H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE);
fid = H5Fcreate(FILE36, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
/* create dataset */
dims[0] = 10;
dims[1] = 15;
- space = H5Screate_simple(2, dims, NULL);
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 15; j++)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 15; j++)
dset[i][j] = i + j;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
@@ -3830,17 +3887,18 @@ void gent_multi(void)
HDfree(sv_data);
}
-static void gent_large_objname(void)
+static void
+gent_large_objname(void)
{
- hid_t fid, group, group2;
- char grp_name[128];
+ hid_t fid, group, group2;
+ char grp_name[128];
register int i;
fid = H5Fcreate(FILE37, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
group = H5Gcreate2(fid, "this_is_a_large_group_name", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 50; ++i) {
+ for (i = 0; i < 50; ++i) {
HDsprintf(grp_name, "this_is_a_large_group_name%d", i);
group2 = H5Gcreate2(group, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(group2);
@@ -3850,20 +3908,19 @@ static void gent_large_objname(void)
H5Fclose(fid);
}
-static void gent_vlstr(void)
+static void
+gent_vlstr(void)
{
- const char *wdata[SPACE1_DIM1]= {
- "Four score and seven years ago our forefathers brought forth on this continent a new nation,",
- "conceived in liberty and dedicated to the proposition that all men are created equal.",
- "",
- NULL
- }; /* Information to write */
- const char *string_att= "This is the string for the attribute";
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, root; /* Dataset ID */
- hid_t sid1, dataspace;/* Dataspace ID */
- hid_t tid1, att; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
+ const char *wdata[SPACE1_DIM1] = {
+ "Four score and seven years ago our forefathers brought forth on this continent a new nation,",
+ "conceived in liberty and dedicated to the proposition that all men are created equal.", "",
+ NULL}; /* Information to write */
+ const char *string_att = "This is the string for the attribute";
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, root; /* Dataset ID */
+ hid_t sid1, dataspace; /* Dataspace ID */
+ hid_t tid1, att; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
/* Create file */
fid1 = H5Fcreate(FILE38, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -3871,8 +3928,8 @@ static void gent_vlstr(void)
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
/* Create a VL string datatype to refer to */
- tid1 = H5Tcopy (H5T_C_S1);
- H5Tset_size (tid1, H5T_VARIABLE);
+ tid1 = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid1, H5T_VARIABLE);
/* Create a dataset and write VL string to it. */
dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -3884,7 +3941,7 @@ static void gent_vlstr(void)
H5Tcommit2(fid1, "vl_string_type", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Create an group attribute of VL string type */
- root = H5Gopen2(fid1, "/", H5P_DEFAULT);
+ root = H5Gopen2(fid1, "/", H5P_DEFAULT);
dataspace = H5Screate(H5S_SCALAR);
att = H5Acreate2(root, "test_scalar", tid1, dataspace, H5P_DEFAULT, H5P_DEFAULT);
@@ -3899,19 +3956,19 @@ static void gent_vlstr(void)
H5Fclose(fid1);
}
-static void gent_char(void)
+static void
+gent_char(void)
{
- const char *wdata =
- "Four score and seven years ago our forefathers brought "
- "forth on this continent a new nation, conceived in "
- "liberty and dedicated to the proposition that all "
- "men are created equal. Now we are engaged in a great "
- "civil war, testing whether that nation or any nation "
- "so conceived and so dedicated can long endure.";
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hsize_t dims1[1];
+ const char *wdata = "Four score and seven years ago our forefathers brought "
+ "forth on this continent a new nation, conceived in "
+ "liberty and dedicated to the proposition that all "
+ "men are created equal. Now we are engaged in a great "
+ "civil war, testing whether that nation or any nation "
+ "so conceived and so dedicated can long endure.";
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hsize_t dims1[1];
dims1[0] = HDstrlen(wdata);
@@ -3931,8 +3988,6 @@ static void gent_char(void)
H5Fclose(fid1);
}
-
-
/*-------------------------------------------------------------------------
* Function: write_attr_in
*
@@ -3947,66 +4002,59 @@ static void gent_char(void)
*-------------------------------------------------------------------------
*/
-static void write_attr_in(hid_t loc_id,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t fid)
+static void
+write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to dataset*/
+ hid_t fid)
{
/* Compound datatype */
- typedef struct s_t
- {
- char a;
- double b;
+ typedef struct s_t {
+ char a;
+ double b;
} s_t;
- typedef enum
- {
- E_RED,
- E_GREEN
- } e_t;
+ typedef enum { E_RED, E_GREEN } e_t;
- hid_t aid;
- hid_t sid;
- hid_t tid;
- herr_t H5_ATTR_NDEBUG_UNUSED status;
- int val, i, j, k, n;
- float f;
+ hid_t aid;
+ hid_t sid;
+ hid_t tid;
+ herr_t H5_ATTR_NDEBUG_UNUSED status;
+ int val, i, j, k, n;
+ float f;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1]={2};
- char buf1[2][3]= {"ab","de"}; /* string */
- char buf2[2]= {1,2}; /* bitfield, opaque */
- s_t buf3[2]= {{1,2},{3,4}}; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1]={3}; /* array dimension */
- int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
- int buf7[2]= {1,2}; /* integer */
- float buf8[2]= {1,2}; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][3] = {"ab", "de"}; /* string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1, 2}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2]={3,2};
- char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
- char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
- s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
- int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
- float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3]={4,3,2};
- char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
- "rs","tu","vw","xz","AB","CD","EF","GH",
- "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
+ "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
/*-------------------------------------------------------------------------
* 1D attributes
@@ -4017,9 +4065,9 @@ static void write_attr_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_attr(loc_id,1,dims,"string",tid,buf1);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_attr(loc_id, 1, dims, "string", tid, buf1);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4027,26 +4075,26 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcopy(H5T_STD_B8LE);
- write_attr(loc_id,1,dims,"bitfield",tid,buf2);
+ write_attr(loc_id, 1, dims, "bitfield", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_attr(loc_id,1,dims,"opaque",tid,buf2);
+ write_attr(loc_id, 1, dims, "opaque", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_COMPOUND
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_attr(loc_id,1,dims,"compound",tid,buf3);
+ write_attr(loc_id, 1, dims, "compound", tid, buf3);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4054,11 +4102,10 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1);
- status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1);
- write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4);
+ if (dset_name) {
+ status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4);
}
/*-------------------------------------------------------------------------
@@ -4066,9 +4113,9 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_attr(loc_id,1,dims,"enum",tid,0);
+ write_attr(loc_id, 1, dims, "enum", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4078,17 +4125,17 @@ static void write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc(1 * sizeof(int));
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
((int *)buf5[0].p)[0] = 1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc(2 * sizeof(int));
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
((int *)buf5[1].p)[0] = 2;
((int *)buf5[1].p)[1] = 3;
- sid = H5Screate_simple(1, dims, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf5);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
@@ -4112,7 +4159,6 @@ static void write_attr_in(hid_t loc_id,
write_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7);
write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8);
-
/*-------------------------------------------------------------------------
* 2D attributes
*-------------------------------------------------------------------------
@@ -4122,9 +4168,9 @@ static void write_attr_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_attr(loc_id,2,dims2,"string2D",tid,buf12);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_attr(loc_id, 2, dims2, "string2D", tid, buf12);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4132,26 +4178,26 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcopy(H5T_STD_B8LE);
- write_attr(loc_id,2,dims2,"bitfield2D",tid,buf22);
+ write_attr(loc_id, 2, dims2, "bitfield2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_attr(loc_id,2,dims2,"opaque2D",tid,buf22);
+ write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_COMPOUND
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_attr(loc_id,2,dims2,"compound2D",tid,buf32);
+ write_attr(loc_id, 2, dims2, "compound2D", tid, buf32);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4159,14 +4205,13 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 2; j++) {
- status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ if (dset_name) {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
+ status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1);
}
}
- write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42);
+ write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42);
}
/*-------------------------------------------------------------------------
@@ -4174,9 +4219,9 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_attr(loc_id,2,dims2,"enum2D",tid,0);
+ write_attr(loc_id, 2, dims2, "enum2D", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4185,21 +4230,21 @@ static void write_attr_in(hid_t loc_id,
*/
/* Allocate and initialize VL dataset to write */
- n=0;
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 2; j++) {
+ n = 0;
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
int l;
- buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
+ for (l = 0; l < i + 1; l++)
((int *)buf52[i][j].p)[l] = n++;
}
}
- sid = H5Screate_simple(2, dims2, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf52);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
@@ -4223,7 +4268,6 @@ static void write_attr_in(hid_t loc_id,
write_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72);
write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82);
-
/*-------------------------------------------------------------------------
* 3D attributes
*-------------------------------------------------------------------------
@@ -4233,9 +4277,9 @@ static void write_attr_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_attr(loc_id,3,dims3,"string3D",tid,buf13);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_attr(loc_id, 3, dims3, "string3D", tid, buf13);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4243,25 +4287,25 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
buf23[i][j][k] = (char)n++;
}
}
}
tid = H5Tcopy(H5T_STD_B8LE);
- write_attr(loc_id,3,dims3,"bitfield3D",tid,buf23);
+ write_attr(loc_id, 3, dims3, "bitfield3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_attr(loc_id,3,dims3,"opaque3D",tid,buf23);
+ write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4269,19 +4313,19 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
buf33[i][j][k].a = (char)n++;
- buf33[i][j][k].b=n++;
+ buf33[i][j][k].b = n++;
}
}
}
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_attr(loc_id,3,dims3,"compound3D",tid,buf33);
+ write_attr(loc_id, 3, dims3, "compound3D", tid, buf33);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4289,15 +4333,14 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++)
- status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ if (dset_name) {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++)
+ status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1);
}
}
- write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43);
+ write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43);
}
/*-------------------------------------------------------------------------
@@ -4305,9 +4348,9 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_attr(loc_id,3,dims3,"enum3D",tid,0);
+ write_attr(loc_id, 3, dims3, "enum3D", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4317,22 +4360,22 @@ static void write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
int l;
- buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
+ for (l = 0; l < i + 1; l++)
((int *)buf53[i][j][k].p)[l] = n++;
}
}
}
- sid = H5Screate_simple(3, dims3, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf53);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
@@ -4346,8 +4389,8 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
n = 1;
- for(i = 0; i < 24; i++)
- for(j = 0; j < (int)dimarray[0]; j++)
+ for (i = 0; i < 24; i++)
+ for (j = 0; j < (int)dimarray[0]; j++)
buf63[i][j] = n++;
tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
@@ -4358,21 +4401,20 @@ static void write_attr_in(hid_t loc_id,
* H5T_INTEGER and H5T_FLOAT
*-------------------------------------------------------------------------
*/
- n=1; f=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- buf73[i][j][k]=n++;
- buf83[i][j][k]=f++;
+ n = 1;
+ f = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ buf73[i][j][k] = n++;
+ buf83[i][j][k] = f++;
}
}
}
- write_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
- write_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
+ write_attr(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73);
+ write_attr(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83);
}
-
-
/*-------------------------------------------------------------------------
* Function: write_dset_in
*
@@ -4387,68 +4429,61 @@ static void write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-static void write_dset_in(hid_t loc_id,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t fid)
+static void
+write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to dataset*/
+ hid_t fid)
{
/* Compound datatype */
- typedef struct s_t
- {
- char a;
- double b;
+ typedef struct s_t {
+ char a;
+ double b;
} s_t;
- typedef enum
- {
- E_RED,
- E_GREEN
- } e_t;
-
- hid_t did;
- hid_t sid;
- hid_t tid;
- hid_t plist_id;
- herr_t H5_ATTR_NDEBUG_UNUSED status;
- int val, i, j, k, n;
- float f;
- int fillvalue=2;
+ typedef enum { E_RED, E_GREEN } e_t;
+
+ hid_t did;
+ hid_t sid;
+ hid_t tid;
+ hid_t plist_id;
+ herr_t H5_ATTR_NDEBUG_UNUSED status;
+ int val, i, j, k, n;
+ float f;
+ int fillvalue = 2;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1]={2};
- char buf1[2][3]= {"ab","de"}; /* string */
- char buf2[2]= {1,2}; /* bitfield, opaque */
- s_t buf3[2]= {{1,2},{3,4}}; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1]={3}; /* array dimension */
- int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
- int buf7[2]= {1,2}; /* integer */
- float buf8[2]= {1,2}; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][3] = {"ab", "de"}; /* string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1, 2}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2]={3,2};
- char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
- char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
- s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
- int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
- float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3]={4,3,2};
- char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
- "rs","tu","vw","xz","AB","CD","EF","GH",
- "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
+ "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
/*-------------------------------------------------------------------------
* 1D
@@ -4459,9 +4494,9 @@ static void write_dset_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_dset(loc_id,1,dims,"string",tid,buf1);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_dset(loc_id, 1, dims, "string", tid, buf1);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4469,26 +4504,26 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcopy(H5T_STD_B8LE);
- write_dset(loc_id,1,dims,"bitfield",tid,buf2);
+ write_dset(loc_id, 1, dims, "bitfield", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_dset(loc_id,1,dims,"opaque",tid,buf2);
+ write_dset(loc_id, 1, dims, "opaque", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_COMPOUND
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_dset(loc_id,1,dims,"compound",tid,buf3);
+ write_dset(loc_id, 1, dims, "compound", tid, buf3);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4496,11 +4531,10 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1);
- status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1);
- write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4);
+ if (dset_name) {
+ status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ write_dset(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4);
}
/*-------------------------------------------------------------------------
@@ -4508,9 +4542,9 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_dset(loc_id,1,dims,"enum",tid,0);
+ write_dset(loc_id, 1, dims, "enum", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4520,17 +4554,17 @@ static void write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc( 1 * sizeof(int));
- ((int *)buf5[0].p)[0]=1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc( 2 * sizeof(int));
- ((int *)buf5[1].p)[0]=2;
- ((int *)buf5[1].p)[1]=3;
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
- sid = H5Screate_simple(1, dims, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
@@ -4551,9 +4585,8 @@ static void write_dset_in(hid_t loc_id,
* H5T_INTEGER and H5T_FLOAT
*-------------------------------------------------------------------------
*/
- write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7);
- write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8);
-
+ write_dset(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7);
+ write_dset(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8);
/*-------------------------------------------------------------------------
* 2D
@@ -4564,9 +4597,9 @@ static void write_dset_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_dset(loc_id,2,dims2,"string2D",tid,buf12);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_dset(loc_id, 2, dims2, "string2D", tid, buf12);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4574,26 +4607,26 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcopy(H5T_STD_B8LE);
- write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22);
+ write_dset(loc_id, 2, dims2, "bitfield2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_dset(loc_id,2,dims2,"opaque2D",tid,buf22);
+ write_dset(loc_id, 2, dims2, "opaque2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_COMPOUND
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_dset(loc_id,2,dims2,"compound2D",tid,buf32);
+ write_dset(loc_id, 2, dims2, "compound2D", tid, buf32);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4601,14 +4634,13 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 2; j++) {
- status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ if (dset_name) {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
+ status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1);
}
}
- write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42);
+ write_dset(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42);
}
/*-------------------------------------------------------------------------
@@ -4616,9 +4648,9 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_dset(loc_id,2,dims2,"enum2D",tid,0);
+ write_dset(loc_id, 2, dims2, "enum2D", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4627,20 +4659,20 @@ static void write_dset_in(hid_t loc_id,
*/
/* Allocate and initialize VL dataset to write */
- n=0;
- for(i = 0; i < 3; i++)
- for(j = 0; j < 2; j++) {
+ n = 0;
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 2; j++) {
int l;
- buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
+ for (l = 0; l < i + 1; l++)
((int *)buf52[i][j].p)[l] = n++;
}
- sid = H5Screate_simple(2, dims2, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
@@ -4662,13 +4694,13 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
plist_id = H5Pcreate(H5P_DATASET_CREATE);
- status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue);
- sid = H5Screate_simple(2, dims2, NULL);
- did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT);
- status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72);
- status = H5Pclose(plist_id);
- status = H5Dclose(did);
- status = H5Sclose(sid);
+ status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue);
+ sid = H5Screate_simple(2, dims2, NULL);
+ did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT);
+ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72);
+ status = H5Pclose(plist_id);
+ status = H5Dclose(did);
+ status = H5Sclose(sid);
/*-------------------------------------------------------------------------
* H5T_FLOAT
@@ -4677,7 +4709,6 @@ static void write_dset_in(hid_t loc_id,
write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82);
-
/*-------------------------------------------------------------------------
* 3D
*-------------------------------------------------------------------------
@@ -4687,9 +4718,9 @@ static void write_dset_in(hid_t loc_id,
* H5T_STRING
*-------------------------------------------------------------------------
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, 2);
- write_dset(loc_id,3,dims3,"string3D",tid,buf13);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_dset(loc_id, 3, dims3, "string3D", tid, buf13);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4697,22 +4728,22 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- n=1;
- for(i = 0; i < 4; i++)
- for(j = 0; j < 3; j++)
- for(k = 0; k < 2; k++)
+ n = 1;
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 3; j++)
+ for (k = 0; k < 2; k++)
buf23[i][j][k] = (char)n++;
tid = H5Tcopy(H5T_STD_B8LE);
- write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23);
+ write_dset(loc_id, 3, dims3, "bitfield3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, 1);
+ tid = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
- write_dset(loc_id,3,dims3,"opaque3D",tid,buf23);
+ write_dset(loc_id, 3, dims3, "opaque3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4720,17 +4751,17 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- n=1;
- for(i = 0; i < 4; i++)
- for(j = 0; j < 3; j++)
- for(k = 0; k < 2; k++) {
+ n = 1;
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 3; j++)
+ for (k = 0; k < 2; k++) {
buf33[i][j][k].a = (char)n++;
buf33[i][j][k].b = n++;
}
- tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
- write_dset(loc_id,3,dims3,"compound3D",tid,buf33);
+ write_dset(loc_id, 3, dims3, "compound3D", tid, buf33);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4738,15 +4769,14 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
/* Create references to dataset */
- if(dset_name)
- {
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++)
- status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ if (dset_name) {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++)
+ status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1);
}
}
- write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43);
+ write_dset(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43);
}
/*-------------------------------------------------------------------------
@@ -4754,9 +4784,9 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
- write_dset(loc_id,3,dims3,"enum3D",tid,0);
+ write_dset(loc_id, 3, dims3, "enum3D", tid, 0);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
@@ -4766,20 +4796,20 @@ static void write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 4; i++)
- for(j = 0; j < 3; j++)
- for(k = 0; k < 2; k++) {
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 3; j++)
+ for (k = 0; k < 2; k++) {
int l;
- buf53[i][j][k].p = HDmalloc(((size_t)i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc(((size_t)i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
+ for (l = 0; l < i + 1; l++)
((int *)buf53[i][j][k].p)[l] = n++;
}
- sid = H5Screate_simple(3, dims3, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
@@ -4792,10 +4822,10 @@ static void write_dset_in(hid_t loc_id,
* H5T_ARRAY
*-------------------------------------------------------------------------
*/
- n=1;
- for(i = 0; i < 24; i++) {
- for(j = 0; j < (int)dimarray[0]; j++) {
- buf63[i][j]=n++;
+ n = 1;
+ for (i = 0; i < 24; i++) {
+ for (j = 0; j < (int)dimarray[0]; j++) {
+ buf63[i][j] = n++;
}
}
@@ -4807,22 +4837,20 @@ static void write_dset_in(hid_t loc_id,
* H5T_INTEGER and H5T_FLOAT
*-------------------------------------------------------------------------
*/
- n=1; f=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- buf73[i][j][k]=n++;
- buf83[i][j][k]=f++;
+ n = 1;
+ f = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ buf73[i][j][k] = n++;
+ buf83[i][j][k] = f++;
}
}
}
- write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
- write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
+ write_dset(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73);
+ write_dset(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83);
}
-
-
-
/*-------------------------------------------------------------------------
* Function: gent_attr_all
*
@@ -4837,23 +4865,24 @@ static void write_dset_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
-static void gent_attr_all(void)
+static void
+gent_attr_all(void)
{
- hid_t fid;
- hid_t did;
- hid_t group_id;
- hid_t group2_id;
- hid_t root_id;
- hid_t sid;
- hsize_t dims[1] = {2};
- herr_t H5_ATTR_NDEBUG_UNUSED status;
+ hid_t fid;
+ hid_t did;
+ hid_t group_id;
+ hid_t group2_id;
+ hid_t root_id;
+ hid_t sid;
+ hsize_t dims[1] = {2};
+ herr_t H5_ATTR_NDEBUG_UNUSED status;
/* Create a file and a dataset */
fid = H5Fcreate(FILE40, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Create a 1D dataset */
- sid = H5Screate_simple(1,dims,NULL);
- did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Sclose(sid);
HDassert(status >= 0);
@@ -4867,16 +4896,16 @@ static void gent_attr_all(void)
*-------------------------------------------------------------------------
*/
- write_attr_in(did,"dset",fid);
- write_attr_in(group_id,NULL,(hid_t)0);
- write_attr_in(root_id,NULL,(hid_t)0);
+ write_attr_in(did, "dset", fid);
+ write_attr_in(group_id, NULL, (hid_t)0);
+ write_attr_in(root_id, NULL, (hid_t)0);
/*-------------------------------------------------------------------------
* write a series of datasets on group 2
*-------------------------------------------------------------------------
*/
- write_dset_in(group2_id,"/dset",fid);
+ write_dset_in(group2_id, "/dset", fid);
/* Close */
status = H5Dclose(did);
@@ -4893,7 +4922,6 @@ static void gent_attr_all(void)
HDassert(status >= 0);
}
-
/*-------------------------------------------------------------------------
* Function: write_attr
*
@@ -4906,13 +4934,12 @@ static void gent_attr_all(void)
*-------------------------------------------------------------------------
*/
-static
-int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
- hid_t tid, void *buf)
+static int
+write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t tid, void *buf)
{
- hid_t aid;
- hid_t sid;
- herr_t status;
+ hid_t aid;
+ hid_t sid;
+ herr_t status;
/* Create a buf space */
sid = H5Screate_simple(rank, dims, NULL);
@@ -4921,7 +4948,7 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
aid = H5Acreate2(loc_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT);
/* Write the buf */
- if(buf)
+ if (buf)
status = H5Awrite(aid, tid, buf);
/* Close */
@@ -4945,13 +4972,12 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
*-------------------------------------------------------------------------
*/
-static
-int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
- hid_t tid, void *buf )
+static int
+write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t tid, void *buf)
{
- hid_t did;
- hid_t sid;
- herr_t status;
+ hid_t did;
+ hid_t sid;
+ herr_t status;
/* Create a buf space */
sid = H5Screate_simple(rank, dims, NULL);
@@ -4960,7 +4986,7 @@ int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write the buf */
- if(buf)
+ if (buf)
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
/* Close */
@@ -4970,67 +4996,64 @@ int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
return status;
}
-
-static void gent_compound_complex(void)
+static void
+gent_compound_complex(void)
{
/* Structure and array for compound types */
typedef struct Array1Struct {
- int a;
- const char *b[F41_DIMb];
- char c[F41_ARRAY_DIMc];
- short d[F41_ARRAY_DIMd1][F41_ARRAY_DIMd2];
- float e;
- double f[F41_ARRAY_DIMf];
- char g;
+ int a;
+ const char *b[F41_DIMb];
+ char c[F41_ARRAY_DIMc];
+ short d[F41_ARRAY_DIMd1][F41_ARRAY_DIMd2];
+ float e;
+ double f[F41_ARRAY_DIMf];
+ char g;
} Array1Struct;
- Array1Struct Array1[F41_LENGTH];
+ Array1Struct Array1[F41_LENGTH];
/* Define the value of the string array */
- const char *quote [F41_DIMb] = {
- "A fight is a contract that takes two people to honor.",
- "A combative stance means that you've accepted the contract.",
- "In which case, you deserve what you get.",
- " -- Professor Cheng Man-ch'ing"
- };
+ const char *quote[F41_DIMb] = {"A fight is a contract that takes two people to honor.",
+ "A combative stance means that you've accepted the contract.",
+ "In which case, you deserve what you get.",
+ " -- Professor Cheng Man-ch'ing"};
/* Define the value of the character array */
- char chararray [F41_ARRAY_DIMc] = {'H', 'e', 'l', 'l', 'o', '!'};
-
-
- hid_t Array1Structid; /* File datatype identifier */
- hid_t array_tid; /* Array datatype handle */
- hid_t array1_tid; /* Array datatype handle */
- hid_t array2_tid; /* Array datatype handle */
- hid_t array4_tid; /* Array datatype handle */
- hid_t datafile, dataset; /* Datafile/dataset handles */
- hid_t dataspace; /* Dataspace handle */
- herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */
- hsize_t dim[] = {F41_LENGTH}; /* Dataspace dimensions */
- hsize_t array_dimb[] = {F41_DIMb}; /* Array dimensions */
- hsize_t array_dimd[]={F41_ARRAY_DIMd1,F41_ARRAY_DIMd2}; /* Array dimensions */
- hsize_t array_dimf[]={F41_ARRAY_DIMf}; /* Array dimensions */
- hid_t str_array_id;
+ char chararray[F41_ARRAY_DIMc] = {'H', 'e', 'l', 'l', 'o', '!'};
+
+ hid_t Array1Structid; /* File datatype identifier */
+ hid_t array_tid; /* Array datatype handle */
+ hid_t array1_tid; /* Array datatype handle */
+ hid_t array2_tid; /* Array datatype handle */
+ hid_t array4_tid; /* Array datatype handle */
+ hid_t datafile, dataset; /* Datafile/dataset handles */
+ hid_t dataspace; /* Dataspace handle */
+ herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */
+ hsize_t dim[] = {F41_LENGTH}; /* Dataspace dimensions */
+ hsize_t array_dimb[] = {F41_DIMb}; /* Array dimensions */
+ hsize_t array_dimd[] = {F41_ARRAY_DIMd1, F41_ARRAY_DIMd2}; /* Array dimensions */
+ hsize_t array_dimf[] = {F41_ARRAY_DIMf}; /* Array dimensions */
+ hid_t str_array_id;
- int m, n, o; /* Array init loop vars */
+ int m, n, o; /* Array init loop vars */
/* Initialize the data in the arrays/datastructure */
- for(m = 0; m< F41_LENGTH; m++) {
+ for (m = 0; m < F41_LENGTH; m++) {
Array1[m].a = m;
- for(n = 0; n < F41_DIMb; n++)
+ for (n = 0; n < F41_DIMb; n++)
Array1[m].b[n] = quote[n];
- for(n = 0; n < F41_ARRAY_DIMc; n++)
+ for (n = 0; n < F41_ARRAY_DIMc; n++)
Array1[m].c[n] = chararray[n];
- for(n = 0; n < F41_ARRAY_DIMd1; n++)
- for(o = 0; o < F41_ARRAY_DIMd2; o++)
+ for (n = 0; n < F41_ARRAY_DIMd1; n++)
+ for (o = 0; o < F41_ARRAY_DIMd2; o++)
Array1[m].d[n][o] = (short)(m + n + o);
- Array1[m].e = (float)((float)m * 0.96F );
+ Array1[m].e = (float)((float)m * 0.96F);
- for(n = 0; n < F41_ARRAY_DIMf; n++)
- Array1[m].f[n] = ((float)m * 1024.9637F );
+ for (n = 0; n < F41_ARRAY_DIMf; n++)
+ Array1[m].f[n] = ((float)m * 1024.9637F);
Array1[m].g = 'm';
}
@@ -5040,16 +5063,15 @@ static void gent_compound_complex(void)
HDassert(dataspace >= 0);
/* Create the file */
- datafile = H5Fcreate(FILE41, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT);
+ datafile = H5Fcreate(FILE41, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
HDassert(datafile >= 0);
/* Copy the array data type for the string array */
- array_tid = H5Tcopy (H5T_C_S1);
+ array_tid = H5Tcopy(H5T_C_S1);
HDassert(array_tid >= 0);
/* Set the string array size to Variable */
- status = H5Tset_size (array_tid,H5T_VARIABLE);
+ status = H5Tset_size(array_tid, H5T_VARIABLE);
HDassert(status >= 0);
/* Create the array data type for the string array */
@@ -5057,11 +5079,11 @@ static void gent_compound_complex(void)
HDassert(str_array_id >= 0);
/* Copy the array data type for the character array */
- array1_tid = H5Tcopy (H5T_C_S1);
+ array1_tid = H5Tcopy(H5T_C_S1);
HDassert(array1_tid >= 0);
/* Set the character array size */
- status = H5Tset_size (array1_tid, F41_ARRAY_DIMc);
+ status = H5Tset_size(array1_tid, F41_ARRAY_DIMc);
HDassert(status >= 0);
/* Create the array data type for the character array */
@@ -5073,45 +5095,37 @@ static void gent_compound_complex(void)
HDassert(array4_tid >= 0);
/* Create the memory data type */
- Array1Structid = H5Tcreate (H5T_COMPOUND, sizeof(Array1Struct));
+ Array1Structid = H5Tcreate(H5T_COMPOUND, sizeof(Array1Struct));
HDassert(Array1Structid >= 0);
/* Insert the arrays and variables into the structure */
- status = H5Tinsert(Array1Structid, "a_name",
- HOFFSET(Array1Struct, a), H5T_NATIVE_INT);
+ status = H5Tinsert(Array1Structid, "a_name", HOFFSET(Array1Struct, a), H5T_NATIVE_INT);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "b_name",
- HOFFSET(Array1Struct, b), str_array_id);
+ status = H5Tinsert(Array1Structid, "b_name", HOFFSET(Array1Struct, b), str_array_id);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "c_name",
- HOFFSET(Array1Struct, c), array1_tid);
+ status = H5Tinsert(Array1Structid, "c_name", HOFFSET(Array1Struct, c), array1_tid);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "d_name",
- HOFFSET(Array1Struct, d), array2_tid);
+ status = H5Tinsert(Array1Structid, "d_name", HOFFSET(Array1Struct, d), array2_tid);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "e_name",
- HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT);
+ status = H5Tinsert(Array1Structid, "e_name", HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "f_name",
- HOFFSET(Array1Struct, f), array4_tid);
+ status = H5Tinsert(Array1Structid, "f_name", HOFFSET(Array1Struct, f), array4_tid);
HDassert(status >= 0);
- status = H5Tinsert(Array1Structid, "g_name",
- HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR);
+ status = H5Tinsert(Array1Structid, "g_name", HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR);
HDassert(status >= 0);
/* Create the dataset */
- dataset = H5Dcreate2(datafile, F41_DATASETNAME, Array1Structid,
- dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(datafile, F41_DATASETNAME, Array1Structid, dataspace, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
/* Write data to the dataset */
- status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, Array1);
+ status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Array1);
HDassert(status >= 0);
/* Release resources */
@@ -5143,21 +5157,21 @@ static void gent_compound_complex(void)
HDassert(status >= 0);
}
-
-static void gent_named_dtype_attr(void)
+static void
+gent_named_dtype_attr(void)
{
- hid_t fid;
- hid_t did;
- hid_t sid;
- hid_t tid;
- hid_t aid;
- hid_t gid;
- int data=8;
+ hid_t fid;
+ hid_t did;
+ hid_t sid;
+ hid_t tid;
+ hid_t aid;
+ hid_t gid;
+ int data = 8;
herr_t H5_ATTR_NDEBUG_UNUSED ret;
/* Create a file */
- fid=H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>0);
+ fid = H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid > 0);
/*-------------------------------------------------------------------------
* datatype
@@ -5165,8 +5179,8 @@ static void gent_named_dtype_attr(void)
*/
/* Create a datatype to commit and use */
- tid=H5Tcopy(H5T_NATIVE_INT);
- HDassert(tid>0);
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ HDassert(tid > 0);
/* Commit datatype to file */
ret = H5Tcommit2(fid, F42_TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -5248,20 +5262,20 @@ static void gent_named_dtype_attr(void)
HDassert(ret >= 0);
}
-
/*-------------------------------------------------------------------------
* Function: gent_null_space
*
* Purpose: generates dataset and attribute of null dataspace
*-------------------------------------------------------------------------
*/
-static void gent_null_space(void)
+static void
+gent_null_space(void)
{
hid_t fid, root, dataset, space, attr;
- int dset_buf = 10;
- int point = 4;
+ int dset_buf = 10;
+ int point = 4;
- fid = H5Fcreate(FILE45, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE45, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* null space */
@@ -5289,22 +5303,23 @@ static void gent_null_space(void)
* Purpose: generates dataset and attribute with dataspace of 0 dimension size
*-------------------------------------------------------------------------
*/
-static void gent_zero_dim_size(void)
+static void
+gent_zero_dim_size(void)
{
- hid_t fid, root, dataset, space, attr;
- hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2};
- int dset_buf = 10;
- int point = 4;
+ hid_t fid, root, dataset, space, attr;
+ hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2};
+ int dset_buf = 10;
+ int point = 4;
- fid = H5Fcreate(FILE67, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE67, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* dataspace of 0 dimension size */
space = H5Screate_simple(SPACE3_RANK, dims1, NULL);
/* dataset */
- dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
/* nothing should be written */
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf);
@@ -5326,39 +5341,34 @@ static void gent_zero_dim_size(void)
*
*-------------------------------------------------------------------------
*/
-static
-int make_dset(hid_t loc_id,
- const char *name,
- hid_t sid,
- hid_t tid,
- hid_t dcpl,
- void *buf)
+static int
+make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t tid, hid_t dcpl, void *buf)
{
- hid_t dsid;
+ hid_t dsid;
/* create the dataset */
- if((dsid = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
return -1;
/* write */
- if(H5Dwrite(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* close */
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
return -1;
return 0;
- out:
- H5E_BEGIN_TRY {
+out:
+ H5E_BEGIN_TRY
+ {
H5Dclose(dsid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
-
/*-------------------------------------------------------------------------
* Function: make_external
*
@@ -5369,19 +5379,19 @@ int make_dset(hid_t loc_id,
static void
make_external(hid_t fid)
{
- hid_t dcpl; /*dataset creation property list */
- hid_t sid; /*dataspace ID */
- hid_t dsid; /*dataset ID */
- hsize_t cur_size[1]; /*data space current size */
- hsize_t max_size[1]; /*data space maximum size */
- hsize_t size; /*bytes reserved for data in the external file*/
- int H5_ATTR_NDEBUG_UNUSED ret;
+ hid_t dcpl; /*dataset creation property list */
+ hid_t sid; /*dataspace ID */
+ hid_t dsid; /*dataset ID */
+ hsize_t cur_size[1]; /*data space current size */
+ hsize_t max_size[1]; /*data space maximum size */
+ hsize_t size; /*bytes reserved for data in the external file*/
+ int H5_ATTR_NDEBUG_UNUSED ret;
cur_size[0] = max_size[0] = 100;
- size = (max_size[0]*sizeof(int)/2);
+ size = (max_size[0] * sizeof(int) / 2);
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- ret = H5Pset_external(dcpl, "ext1.bin", (off_t)0, size);
+ ret = H5Pset_external(dcpl, "ext1.bin", (off_t)0, size);
HDassert(ret >= 0);
ret = H5Pset_external(dcpl, "ext2.bin", (off_t)0, size);
@@ -5410,31 +5420,32 @@ make_external(hid_t fid)
*
*-------------------------------------------------------------------------
*/
-static void gent_filters(void)
+static void
+gent_filters(void)
{
- hid_t fid; /* file id */
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hid_t tid; /* datatype ID */
+ hid_t fid; /* file id */
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hid_t tid; /* datatype ID */
#ifdef H5_HAVE_FILTER_SZIP
- unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block=4;
+ unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block = 4;
#endif /* H5_HAVE_FILTER_SZIP */
- hsize_t dims1[RANK] = {DIM1,DIM2};
- hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
- int buf1[DIM1][DIM2];
- int i, j, n;
+ hsize_t dims1[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int buf1[DIM1][DIM2];
+ int i, j, n;
int H5_ATTR_NDEBUG_UNUSED ret;
- for(i=n=0; i<DIM1; i++){
- for(j=0; j<DIM2; j++){
- buf1[i][j]=n++;
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf1[i][j] = n++;
}
}
/* create a file */
- fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
/* create a space */
sid = H5Screate_simple(SPACE2_RANK, dims1, NULL);
@@ -5450,7 +5461,7 @@ static void gent_filters(void)
ret = H5Pset_layout(dcpl, H5D_COMPACT);
HDassert(ret >= 0);
- ret=make_dset(fid,"compact",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "compact", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
ret = H5Oset_comment_by_name(fid, "compact", "This is a dataset with compact storage", H5P_DEFAULT);
@@ -5459,7 +5470,7 @@ static void gent_filters(void)
ret = H5Pset_layout(dcpl, H5D_CONTIGUOUS);
HDassert(ret >= 0);
- ret=make_dset(fid,"contiguous",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "contiguous", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
ret = H5Oset_comment_by_name(fid, "contiguous", "This is a dataset with contiguous storage", H5P_DEFAULT);
@@ -5471,7 +5482,7 @@ static void gent_filters(void)
ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims);
HDassert(ret >= 0);
- ret=make_dset(fid,"chunked",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "chunked", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
ret = H5Oset_comment_by_name(fid, "chunked", "This is a dataset with chunked storage", H5P_DEFAULT);
@@ -5491,16 +5502,16 @@ static void gent_filters(void)
*-------------------------------------------------------------------------
*/
#ifdef H5_HAVE_FILTER_SZIP
- if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set szip data */
- ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block);
+ ret = H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block);
HDassert(ret >= 0);
- ret=make_dset(fid,"szip",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "szip", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
}
#endif /* H5_HAVE_FILTER_SZIP */
@@ -5509,51 +5520,49 @@ static void gent_filters(void)
* GZIP
*-------------------------------------------------------------------------
*/
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set deflate data */
ret = H5Pset_deflate(dcpl, 9);
HDassert(ret >= 0);
- ret=make_dset(fid,"deflate",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "deflate", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
#endif
-
/*-------------------------------------------------------------------------
* shuffle
*-------------------------------------------------------------------------
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set the shuffle filter */
ret = H5Pset_shuffle(dcpl);
HDassert(ret >= 0);
- ret=make_dset(fid,"shuffle",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "shuffle", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
-
/*-------------------------------------------------------------------------
* checksum
*-------------------------------------------------------------------------
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set the checksum filter */
ret = H5Pset_fletcher32(dcpl);
HDassert(ret >= 0);
- ret=make_dset(fid,"fletcher32",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "fletcher32", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5562,16 +5571,16 @@ static void gent_filters(void)
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set the checksum filter */
ret = H5Pset_nbit(dcpl);
HDassert(ret >= 0);
- tid=H5Tcopy(H5T_NATIVE_INT);
- H5Tset_precision(tid,H5Tget_size(tid)-1);
- ret=make_dset(fid,"nbit",sid,tid,dcpl,buf1);
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ H5Tset_precision(tid, H5Tget_size(tid) - 1);
+ ret = make_dset(fid, "nbit", sid, tid, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5580,14 +5589,14 @@ static void gent_filters(void)
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set the scaleoffset filter */
- ret = H5Pset_scaleoffset(dcpl,H5Z_SO_INT,(int)H5Tget_size(H5T_NATIVE_INT));
+ ret = H5Pset_scaleoffset(dcpl, H5Z_SO_INT, (int)H5Tget_size(H5T_NATIVE_INT));
HDassert(ret >= 0);
- ret=make_dset(fid,"scaleoffset",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "scaleoffset", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5595,7 +5604,7 @@ static void gent_filters(void)
*-------------------------------------------------------------------------
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/* set the shuffle filter */
@@ -5603,15 +5612,15 @@ static void gent_filters(void)
HDassert(ret >= 0);
#ifdef H5_HAVE_FILTER_SZIP
- if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
- szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK;
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ szip_options_mask = H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK;
/* set szip data */
- ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block);
+ ret = H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block);
HDassert(ret >= 0);
}
#endif /* H5_HAVE_FILTER_SZIP */
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
ret = H5Pset_deflate(dcpl, 5);
HDassert(ret >= 0);
@@ -5625,29 +5634,28 @@ static void gent_filters(void)
ret = H5Pset_nbit(dcpl);
HDassert(ret >= 0);
- ret=make_dset(fid,"all",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "all", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
-
/*-------------------------------------------------------------------------
* user defined filter
*-------------------------------------------------------------------------
*/
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
- ret = H5Zregister (H5Z_MYFILTER);
+ ret = H5Zregister(H5Z_MYFILTER);
HDassert(ret >= 0);
- ret = H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL);
+ ret = H5Pset_filter(dcpl, MYFILTER_ID, 0, 0, NULL);
HDassert(ret >= 0);
- ret=make_dset(fid,"myfilter",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "myfilter", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/* remove the filters from the dcpl */
- ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5662,7 +5670,7 @@ static void gent_filters(void)
*/
ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
HDassert(ret >= 0);
- ret=make_dset(fid,"alloc_time_early",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "alloc_time_early", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5671,7 +5679,7 @@ static void gent_filters(void)
*/
ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR);
HDassert(ret >= 0);
- ret=make_dset(fid,"alloc_time_incr",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "alloc_time_incr", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5680,7 +5688,7 @@ static void gent_filters(void)
*/
ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE);
HDassert(ret >= 0);
- ret=make_dset(fid,"alloc_time_late",sid,H5T_NATIVE_INT,dcpl,buf1);
+ ret = make_dset(fid, "alloc_time_late", sid, H5T_NATIVE_INT, dcpl, buf1);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5711,7 +5719,6 @@ static void gent_filters(void)
HDassert(ret >= 0);
}
-
/*-------------------------------------------------------------------------
* Function: myfilter
*
@@ -5721,13 +5728,12 @@ static void gent_filters(void)
*/
static size_t
myfilter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
+ void H5_ATTR_UNUSED **buf)
{
return nbytes;
}
-
/*-------------------------------------------------------------------------
* Function: set_local_myfilter
*
@@ -5739,21 +5745,21 @@ myfilter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
static herr_t
set_local_myfilter(hid_t dcpl_id, hid_t H5_ATTR_UNUSED tid, hid_t H5_ATTR_UNUSED sid)
{
- unsigned flags; /* Filter flags */
- size_t cd_nelmts = 0; /* Number of filter parameters */
- unsigned cd_values[2] = {5, 6}; /* Filter parameters */
+ unsigned flags; /* Filter flags */
+ size_t cd_nelmts = 0; /* Number of filter parameters */
+ unsigned cd_values[2] = {5, 6}; /* Filter parameters */
/* Get the filter's current parameters */
- if(H5Pget_filter_by_id2(dcpl_id, MYFILTER_ID, &flags, &cd_nelmts, cd_values, 0, NULL, NULL) < 0)
- return(FAIL);
+ if (H5Pget_filter_by_id2(dcpl_id, MYFILTER_ID, &flags, &cd_nelmts, cd_values, 0, NULL, NULL) < 0)
+ return (FAIL);
cd_nelmts = 2;
/* Modify the filter's parameters for this dataset */
- if(H5Pmodify_filter(dcpl_id, MYFILTER_ID, flags, cd_nelmts, cd_values) < 0)
- return(FAIL);
+ if (H5Pmodify_filter(dcpl_id, MYFILTER_ID, flags, cd_nelmts, cd_values) < 0)
+ return (FAIL);
- return(SUCCEED);
+ return (SUCCEED);
}
/*-------------------------------------------------------------------------
@@ -5763,62 +5769,54 @@ set_local_myfilter(hid_t dcpl_id, hid_t H5_ATTR_UNUSED tid, hid_t H5_ATTR_UNUSED
*
*-------------------------------------------------------------------------
*/
-static void gent_fcontents(void)
+static void
+gent_fcontents(void)
{
- hid_t fid; /* file id */
- hid_t gid1; /* group ID */
- hid_t tid; /* datatype ID */
- hsize_t dims[1]={4};
- int buf[4]={1,2,3,4};
- int H5_ATTR_NDEBUG_UNUSED ret;
+ hid_t fid; /* file id */
+ hid_t gid1; /* group ID */
+ hid_t tid; /* datatype ID */
+ hsize_t dims[1] = {4};
+ int buf[4] = {1, 2, 3, 4};
+ int H5_ATTR_NDEBUG_UNUSED ret;
/* create a file */
- fid = H5Fcreate(FILE46, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
-
-
- write_dset(fid,1,dims,"dset",H5T_NATIVE_INT,buf);
+ fid = H5Fcreate(FILE46, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
+ write_dset(fid, 1, dims, "dset", H5T_NATIVE_INT, buf);
/*-------------------------------------------------------------------------
* links
*-------------------------------------------------------------------------
*/
-
/* hard link to "dset" */
gid1 = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Lcreate_hard(gid1, "/dset", H5L_SAME_LOC, "dset1", H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(gid1);
-
/* hard link to "dset" */
gid1 = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Lcreate_hard(gid1, "/dset", H5L_SAME_LOC, "dset2", H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(gid1);
-
/* hard link to "g2" */
gid1 = H5Gopen2(fid, "/g1", H5P_DEFAULT);
H5Lcreate_hard(gid1, "/g2", H5L_SAME_LOC, "g1.1", H5P_DEFAULT, H5P_DEFAULT);
H5Gclose(gid1);
-
/* hard link to "dset" */
ret = H5Lcreate_hard(fid, "/dset", H5L_SAME_LOC, "dset3", H5P_DEFAULT, H5P_DEFAULT);
HDassert(ret >= 0);
-
/* hard link to "dset" */
ret = H5Lcreate_hard(fid, "/dset", H5L_SAME_LOC, "dset4", H5P_DEFAULT, H5P_DEFAULT);
HDassert(ret >= 0);
-
/* soft link to itself */
ret = H5Lcreate_soft("mylink", fid, "mylink", H5P_DEFAULT, H5P_DEFAULT);
HDassert(ret >= 0);
-
/* soft link to "dset" */
ret = H5Lcreate_soft("/dset", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT);
HDassert(ret >= 0);
@@ -5841,7 +5839,6 @@ static void gent_fcontents(void)
ret = H5Tclose(tid);
HDassert(ret >= 0);
-
/* no name datatype */
tid = H5Tcopy(H5T_NATIVE_INT);
ret = H5Tcommit2(fid, "mytype2", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -5852,21 +5849,17 @@ static void gent_fcontents(void)
ret = H5Tclose(tid);
HDassert(ret >= 0);
-
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
-
ret = H5Fclose(fid);
HDassert(ret >= 0);
-
/* create a file for the bootblock test */
- fid = H5Fcreate(FILE47, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
-
+ fid = H5Fcreate(FILE47, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
ret = H5Fclose(fid);
HDassert(ret >= 0);
@@ -5879,35 +5872,34 @@ static void gent_fcontents(void)
*
*-------------------------------------------------------------------------
*/
-static void gent_fvalues(void)
+static void
+gent_fvalues(void)
{
/* compound datatype */
- typedef struct c_t
- {
- char a;
- double b;
+ typedef struct c_t {
+ char a;
+ double b;
} c_t;
-
- hid_t fid; /* file id */
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hid_t tid; /* datatype ID */
- hid_t did; /* datasetID */
- hsize_t dims[1]={2};
- int buf[2]={1,2}; /* integer */
- int fillval1=-99; /* integer fill value */
- c_t buf2[2]={{1,2},{3,4}}; /* compound */
- c_t fillval2[1]={{1,2}}; /* compound fill value */
- hvl_t buf3[2]; /* vlen */
- hvl_t fillval3; /* vlen fill value */
- hsize_t dimarray[1]={3}; /* array dimension */
- int buf4[2][3]= {{1,2,3},{4,5,6}}; /* array */
- int H5_ATTR_NDEBUG_UNUSED ret;
+ hid_t fid; /* file id */
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hid_t tid; /* datatype ID */
+ hid_t did; /* datasetID */
+ hsize_t dims[1] = {2};
+ int buf[2] = {1, 2}; /* integer */
+ int fillval1 = -99; /* integer fill value */
+ c_t buf2[2] = {{1, 2}, {3, 4}}; /* compound */
+ c_t fillval2[1] = {{1, 2}}; /* compound fill value */
+ hvl_t buf3[2]; /* vlen */
+ hvl_t fillval3; /* vlen fill value */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf4[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int H5_ATTR_NDEBUG_UNUSED ret;
/* create a file */
- fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
/* create a space */
sid = H5Screate_simple(1, dims, NULL);
@@ -5926,7 +5918,7 @@ static void gent_fvalues(void)
ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1);
HDassert(ret >= 0);
- ret=make_dset(fid,"fill_time_ifset",sid,H5T_NATIVE_INT,dcpl,buf);
+ ret = make_dset(fid, "fill_time_ifset", sid, H5T_NATIVE_INT, dcpl, buf);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5939,7 +5931,7 @@ static void gent_fvalues(void)
ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1);
HDassert(ret >= 0);
- ret=make_dset(fid,"fill_time_never",sid,H5T_NATIVE_INT,dcpl,buf);
+ ret = make_dset(fid, "fill_time_never", sid, H5T_NATIVE_INT, dcpl, buf);
HDassert(ret >= 0);
/*-------------------------------------------------------------------------
@@ -5952,7 +5944,7 @@ static void gent_fvalues(void)
ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1);
HDassert(ret >= 0);
- ret=make_dset(fid,"fill_time_alloc",sid,H5T_NATIVE_INT,dcpl,buf);
+ ret = make_dset(fid, "fill_time_alloc", sid, H5T_NATIVE_INT, dcpl, buf);
HDassert(ret >= 0);
ret = H5Pclose(dcpl);
@@ -5962,19 +5954,19 @@ static void gent_fvalues(void)
* dataset with no fill value
*-------------------------------------------------------------------------
*/
- write_dset(fid,1,dims,"no_fill",H5T_NATIVE_INT,buf);
+ write_dset(fid, 1, dims, "no_fill", H5T_NATIVE_INT, buf);
/*-------------------------------------------------------------------------
* dataset with a H5T_COMPOUND fill value
*-------------------------------------------------------------------------
*/
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- tid = H5Tcreate (H5T_COMPOUND, sizeof(c_t));
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(c_t));
H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(c_t, b), H5T_NATIVE_DOUBLE);
ret = H5Pset_fill_value(dcpl, tid, &fillval2);
HDassert(ret >= 0);
- ret=make_dset(fid,"fill_compound",sid,tid,dcpl,buf2);
+ ret = make_dset(fid, "fill_compound", sid, tid, dcpl, buf2);
HDassert(ret >= 0);
ret = H5Tclose(tid);
HDassert(ret >= 0);
@@ -5985,19 +5977,20 @@ static void gent_fvalues(void)
* dataset with a H5T_VLEN fill value
*-------------------------------------------------------------------------
*/
- buf3[0].len = 1;
- buf3[0].p = HDmalloc( 1 * sizeof(int));
- ((int *)buf3[0].p)[0]=1;
- buf3[1].len = 2;
- buf3[1].p = HDmalloc(2 * sizeof(int));
+ buf3[0].len = 1;
+ buf3[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf3[0].p)[0] = 1;
+ buf3[1].len = 2;
+ buf3[1].p = HDmalloc(2 * sizeof(int));
((int *)buf3[1].p)[0] = 2;
((int *)buf3[1].p)[1] = 3;
- tid = H5Tvlen_create(H5T_NATIVE_INT);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- fillval3.p=NULL; fillval3.len=0;
- ret = H5Pset_fill_value(dcpl, tid, &fillval3);
+ fillval3.p = NULL;
+ fillval3.len = 0;
+ ret = H5Pset_fill_value(dcpl, tid, &fillval3);
HDassert(ret >= 0);
did = H5Dcreate2(fid, "fill_vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -6018,7 +6011,6 @@ static void gent_fvalues(void)
write_dset(fid, 1, dims, "fill_array", tid, buf4);
ret = H5Tclose(tid);
-
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -6029,7 +6021,6 @@ static void gent_fvalues(void)
HDassert(ret >= 0);
}
-
/*-------------------------------------------------------------------------
* Function: gent_string
*
@@ -6037,49 +6028,50 @@ static void gent_fvalues(void)
*
*-------------------------------------------------------------------------
*/
-static void gent_string(void)
+static void
+gent_string(void)
{
/* compound datatype */
- typedef struct c_t
- {
- int a;
- char str[255];
+ typedef struct c_t {
+ int a;
+ char str[255];
} c_t;
- hid_t fid; /* file id */
- hid_t sid; /* dataspace ID */
- hid_t tid; /* datatype ID */
- hid_t str_tid; /* datatype ID */
- hid_t did; /* dataset ID */
- char buf1[]={"quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r"};
- const char *buf2[SPACE1_DIM1]= {
- "Four score and seven\n years ago our forefathers brought forth on this continent a new nation,",
- "conceived in liberty\n and dedicated to the proposition that all men are created equal.",
- "Now we are engaged\n in a great civil war,",
- "testing whether that\n nation or any nation so conceived and so dedicated can long endure."
- };
- c_t buf3 = {24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
- char buf4[] = {"Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
- hsize_t dims1[] = {1};
- hsize_t dims2[] = {SPACE1_DIM1};
- hsize_t dims4[1];
- int H5_ATTR_NDEBUG_UNUSED ret;
+ hid_t fid; /* file id */
+ hid_t sid; /* dataspace ID */
+ hid_t tid; /* datatype ID */
+ hid_t str_tid; /* datatype ID */
+ hid_t did; /* dataset ID */
+ char buf1[] = {"quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r"};
+ const char *buf2[SPACE1_DIM1] = {
+ "Four score and seven\n years ago our forefathers brought forth on this continent a new nation,",
+ "conceived in liberty\n and dedicated to the proposition that all men are created equal.",
+ "Now we are engaged\n in a great civil war,",
+ "testing whether that\n nation or any nation so conceived and so dedicated can long endure."};
+ c_t buf3 = {
+ 24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
+ char buf4[] = {
+ "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
+ hsize_t dims1[] = {1};
+ hsize_t dims2[] = {SPACE1_DIM1};
+ hsize_t dims4[1];
+ int H5_ATTR_NDEBUG_UNUSED ret;
dims4[0] = sizeof(buf4);
/* create a file */
- fid = H5Fcreate(FILE49, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE49, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
/*-------------------------------------------------------------------------
* str1
*-------------------------------------------------------------------------
*/
- tid=H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
ret = H5Tset_size(tid, sizeof(buf1));
HDassert(ret >= 0);
- write_dset(fid,1,dims1,"str1",tid,buf1);
+ write_dset(fid, 1, dims1, "str1", tid, buf1);
HDassert(ret >= 0);
ret = H5Tclose(tid);
HDassert(ret >= 0);
@@ -6106,13 +6098,13 @@ static void gent_string(void)
* str3
*-------------------------------------------------------------------------
*/
- sid = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- tid = H5Tcreate (H5T_COMPOUND, sizeof(c_t));
- str_tid = H5Tcopy( H5T_C_S1 );
- H5Tset_size( str_tid, 255 );
+ sid = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(c_t));
+ str_tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(str_tid, 255);
H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_INT);
- H5Tinsert(tid, "str", HOFFSET(c_t, str), str_tid );
- ret=make_dset(fid,"str3",sid,tid,H5P_DEFAULT,&buf3);
+ H5Tinsert(tid, "str", HOFFSET(c_t, str), str_tid);
+ ret = make_dset(fid, "str3", sid, tid, H5P_DEFAULT, &buf3);
HDassert(ret >= 0);
ret = H5Tclose(tid);
HDassert(ret >= 0);
@@ -6126,7 +6118,7 @@ static void gent_string(void)
*-------------------------------------------------------------------------
*/
sid = H5Screate_simple(SPACE1_RANK, dims4, NULL);
- ret=make_dset(fid,"str4",sid,H5T_NATIVE_CHAR,H5P_DEFAULT,buf4);
+ ret = make_dset(fid, "str4", sid, H5T_NATIVE_CHAR, H5P_DEFAULT, buf4);
ret = H5Sclose(sid);
HDassert(ret >= 0);
@@ -6138,7 +6130,6 @@ static void gent_string(void)
HDassert(ret >= 0);
}
-
/*-------------------------------------------------------------------------
* Function: gent_aindices
*
@@ -6146,49 +6137,50 @@ static void gent_string(void)
*
*-------------------------------------------------------------------------
*/
-static void gent_aindices(void)
+static void
+gent_aindices(void)
{
- hid_t fid; /* file id */
- hid_t gid[6]; /* group ids */
- hsize_t dims1[1] = {100};
- hsize_t dims2[2] = {10,10};
- hsize_t dims3[3] = {2,10,10};
- hsize_t dims4[4] = {2,2,10,10};
- int buf1[100];
- int buf2[10][10];
- int buf3[2][10][10];
- int buf4[2][2][10][10];
- int i, j, k, l, n;
- int H5_ATTR_NDEBUG_UNUSED ret;
-
- for(i = n = 0; i < 100; i++)
+ hid_t fid; /* file id */
+ hid_t gid[6]; /* group ids */
+ hsize_t dims1[1] = {100};
+ hsize_t dims2[2] = {10, 10};
+ hsize_t dims3[3] = {2, 10, 10};
+ hsize_t dims4[4] = {2, 2, 10, 10};
+ int buf1[100];
+ int buf2[10][10];
+ int buf3[2][10][10];
+ int buf4[2][2][10][10];
+ int i, j, k, l, n;
+ int H5_ATTR_NDEBUG_UNUSED ret;
+
+ for (i = n = 0; i < 100; i++)
buf1[i] = n++;
- for(i = n = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ for (i = n = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
buf2[i][j] = n++;
- for(i = n = 0; i < 2; i++)
- for(j = 0; j < 10; j++)
- for(k = 0; k < 10; k++)
+ for (i = n = 0; i < 2; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
buf3[i][j][k] = n++;
- for(i = n = 0; i < 2; i++)
- for(j = 0; j < 2; j++)
- for(k = 0; k < 10; k++)
- for(l = 0; l < 10; l++)
+ for (i = n = 0; i < 2; i++)
+ for (j = 0; j < 2; j++)
+ for (k = 0; k < 10; k++)
+ for (l = 0; l < 10; l++)
buf4[i][j][k][l] = n++;
/* create a file */
- fid = H5Fcreate(FILE50, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE50, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
/*-------------------------------------------------------------------------
* root datasets
*-------------------------------------------------------------------------
*/
- write_dset(fid,1,dims1,"1d",H5T_NATIVE_INT,buf1);
- write_dset(fid,2,dims2,"2d",H5T_NATIVE_INT,buf2);
- write_dset(fid,3,dims3,"3d",H5T_NATIVE_INT,buf3);
- write_dset(fid,4,dims4,"4d",H5T_NATIVE_INT,buf4);
+ write_dset(fid, 1, dims1, "1d", H5T_NATIVE_INT, buf1);
+ write_dset(fid, 2, dims2, "2d", H5T_NATIVE_INT, buf2);
+ write_dset(fid, 3, dims3, "3d", H5T_NATIVE_INT, buf3);
+ write_dset(fid, 4, dims4, "4d", H5T_NATIVE_INT, buf4);
/*-------------------------------------------------------------------------
* test with group indentation
@@ -6200,11 +6192,11 @@ static void gent_aindices(void)
gid[3] = H5Gcreate2(fid, "g1/g2/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
gid[4] = H5Gcreate2(fid, "g1/g2/g3/g4/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
gid[5] = H5Gcreate2(fid, "g1/g2/g3/g4/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- write_dset(gid[5],1,dims1,"1d",H5T_NATIVE_INT,buf1);
- write_dset(gid[5],2,dims2,"2d",H5T_NATIVE_INT,buf2);
- write_dset(gid[5],3,dims3,"3d",H5T_NATIVE_INT,buf3);
- write_dset(gid[5],4,dims4,"4d",H5T_NATIVE_INT,buf4);
- for(i = 0; i < 6; i++)
+ write_dset(gid[5], 1, dims1, "1d", H5T_NATIVE_INT, buf1);
+ write_dset(gid[5], 2, dims2, "2d", H5T_NATIVE_INT, buf2);
+ write_dset(gid[5], 3, dims3, "3d", H5T_NATIVE_INT, buf3);
+ write_dset(gid[5], 4, dims4, "4d", H5T_NATIVE_INT, buf4);
+ for (i = 0; i < 6; i++)
H5Gclose(gid[i]);
/*-------------------------------------------------------------------------
@@ -6213,10 +6205,8 @@ static void gent_aindices(void)
*/
ret = H5Fclose(fid);
HDassert(ret >= 0);
-
}
-
/*-------------------------------------------------------------------------
* Function: gent_longlinks
*
@@ -6224,13 +6214,14 @@ static void gent_aindices(void)
*
*-------------------------------------------------------------------------
*/
-static void gent_longlinks(void)
+static void
+gent_longlinks(void)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t H5_ATTR_NDEBUG_UNUSED gid2 = (-1); /* Datatype ID */
- char *objname = NULL; /* Name of object [Long] */
- size_t u; /* Local index variable */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t H5_ATTR_NDEBUG_UNUSED gid2 = (-1); /* Datatype ID */
+ char * objname = NULL; /* Name of object [Long] */
+ size_t u; /* Local index variable */
/* Create files */
fid = H5Fcreate(FILE51, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -6241,9 +6232,9 @@ static void gent_longlinks(void)
HDassert(gid >= 0);
/* Construct very long file name */
- objname = (char*) HDmalloc((size_t)(F51_MAX_NAME_LEN + 1));
+ objname = (char *)HDmalloc((size_t)(F51_MAX_NAME_LEN + 1));
HDassert(objname);
- for(u = 0; u < F51_MAX_NAME_LEN; u++)
+ for (u = 0; u < F51_MAX_NAME_LEN; u++)
objname[u] = 'a';
objname[F51_MAX_NAME_LEN] = '\0';
@@ -6274,40 +6265,41 @@ static void gent_longlinks(void)
*
*-------------------------------------------------------------------------
*/
-static int gent_ldouble(void)
+static int
+gent_ldouble(void)
{
hid_t fid;
hid_t did;
hid_t tid;
hid_t sid;
hsize_t dims[1] = {3};
- long double buf[3] = {1,2,3};
+ long double buf[3] = {1, 2, 3};
- if((fid = H5Fcreate(FILE52, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE52, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto error;
- if((tid = H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
goto error;
- if(H5Tget_size(tid) == 0)
+ if (H5Tget_size(tid) == 0)
goto error;
- if((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto error;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
return 0;
@@ -6315,9 +6307,58 @@ static int gent_ldouble(void)
error:
HDprintf("error !\n");
return -1;
-
}
+/*-------------------------------------------------------------------------
+ * Function: gent_ldouble_scalar
+ *
+ * Purpose: make file with a long double scalar dataset
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+gent_ldouble_scalar(void)
+{
+ hid_t fid;
+ hid_t did;
+ hid_t tid;
+ hid_t sid;
+ hsize_t dims[1] = {6};
+ long double buf[6] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
+
+ if ((fid = H5Fcreate(FILE88, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ goto error;
+
+ if ((tid = H5Tarray_create2(H5T_NATIVE_LDOUBLE, 1, dims)) < 0)
+ goto error;
+
+ if (H5Tget_size(tid) == 0)
+ goto error;
+
+ if ((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Tclose(tid) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
+
+ return 0;
+
+error:
+ HDprintf("error !\n");
+ return -1;
+}
/*-------------------------------------------------------------------------
* Function: gent_binary
@@ -6333,16 +6374,15 @@ error:
static void
gent_binary(void)
{
- hid_t fid, sid, did, aid;
- hsize_t dims[1] = {6};
- int ibuf[6] = {1,2,3,4,5,6};
- float fbuf[6] = {1,2,3,4,5,6};
- double dbuf[6] = {1,2,3,4,5,6};
+ hid_t fid, sid, did, aid;
+ hsize_t dims[1] = {6};
+ int ibuf[6] = {1, 2, 3, 4, 5, 6};
+ float fbuf[6] = {1, 2, 3, 4, 5, 6};
+ double dbuf[6] = {1, 2, 3, 4, 5, 6};
fid = H5Fcreate(FILE55, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
sid = H5Screate_simple(1, dims, NULL);
-
/*-------------------------------------------------------------------------
* integer
*-------------------------------------------------------------------------
@@ -6371,7 +6411,6 @@ gent_binary(void)
H5Aclose(aid);
H5Dclose(did);
-
/* close */
H5Sclose(sid);
H5Fclose(fid);
@@ -6385,88 +6424,86 @@ gent_binary(void)
*
*-------------------------------------------------------------------------
*/
-#define GB4LL ((unsigned long long) 4*1024*1024*1024)
-#define DIM_4GB (GB4LL + 10)
+#define GB4LL ((unsigned long long)4 * 1024 * 1024 * 1024)
+#define DIM_4GB (GB4LL + 10)
static void
gent_bigdims(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t f_sid = H5I_INVALID_HID;
- hid_t m_sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- hid_t dcpl = H5I_INVALID_HID;
- hsize_t dims[1]={DIM_4GB}; /* dataset dimensions */
- hsize_t chunk_dims[1]={1024}; /* chunk dimensions */
- hsize_t hs_start[1];
- hsize_t hs_size[1]; /* hyperslab dimensions */
- size_t size;
- char fillvalue=0;
- char *buf=NULL;
- hsize_t i;
- char c;
- size_t nelmts;
- int H5_ATTR_NDEBUG_UNUSED ret;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t f_sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hsize_t dims[1] = {DIM_4GB}; /* dataset dimensions */
+ hsize_t chunk_dims[1] = {1024}; /* chunk dimensions */
+ hsize_t hs_start[1];
+ hsize_t hs_size[1]; /* hyperslab dimensions */
+ size_t size;
+ char fillvalue = 0;
+ char * buf = NULL;
+ hsize_t i;
+ char c;
+ size_t nelmts;
+ int H5_ATTR_NDEBUG_UNUSED ret;
/* create a file */
- fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
HDassert(fid >= 0);
/* create dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0)
goto out;
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
goto out;
- if((f_sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((f_sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
- if((did = H5Dcreate2(fid, "dset4gb", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dset4gb", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
- if((size = H5Tget_size(tid)) <= 0)
+ if ((size = H5Tget_size(tid)) <= 0)
goto out;
/* select an hyperslab */
- nelmts = 20;
+ nelmts = 20;
hs_start[0] = GB4LL - 10;
hs_size[0] = nelmts;
- if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ if ((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
goto out;
- buf=(char *) HDmalloc((unsigned)(nelmts*size));
+ buf = (char *)HDmalloc((unsigned)(nelmts * size));
- for(i=0, c=0; i<nelmts; i++, c++)
- {
+ for (i = 0, c = 0; i < nelmts; i++, c++) {
buf[i] = c;
}
- if(H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size,NULL) < 0)
+ if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0)
goto out;
- if(H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_SCHAR, m_sid, f_sid, H5P_DEFAULT, buf) < 0)
goto out;
-
HDfree(buf);
- buf=NULL;
+ buf = NULL;
/* close */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
- if(H5Sclose(f_sid) < 0)
+ if (H5Sclose(f_sid) < 0)
goto out;
f_sid = H5I_INVALID_HID;
- if(H5Sclose(m_sid) < 0)
+ if (H5Sclose(m_sid) < 0)
goto out;
m_sid = H5I_INVALID_HID;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto out;
dcpl = H5I_INVALID_HID;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
did = H5I_INVALID_HID;
@@ -6475,21 +6512,20 @@ gent_bigdims(void)
return;
- out:
+out:
HDprintf("Error.....\n");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(f_sid);
H5Sclose(m_sid);
H5Tclose(tid);
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
- return;
+ }
+ H5E_END_TRY;
}
-
-
/*-------------------------------------------------------------------------
* Function: gent_hyperslab
*
@@ -6500,21 +6536,21 @@ gent_bigdims(void)
static void
gent_hyperslab(void)
{
- hid_t fid; /* file id */
- hsize_t dims[2] = {32,4097}; /* big enough data size to force a second stripmine read */
- double *buf;
- int i;
- int H5_ATTR_NDEBUG_UNUSED ret;
+ hid_t fid; /* file id */
+ hsize_t dims[2] = {32, 4097}; /* big enough data size to force a second stripmine read */
+ double *buf;
+ int i;
+ int H5_ATTR_NDEBUG_UNUSED ret;
- buf = (double*) HDmalloc(32 * 4097 * sizeof(double) );
- for(i = 0; i < 32 * 4097; i++)
+ buf = (double *)HDmalloc(32 * 4097 * sizeof(double));
+ for (i = 0; i < 32 * 4097; i++)
buf[i] = 1;
/* create a file */
- fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
- write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf);
+ write_dset(fid, 2, dims, "stripmine", H5T_NATIVE_DOUBLE, buf);
ret = H5Fclose(fid);
HDassert(ret >= 0);
@@ -6533,23 +6569,22 @@ gent_hyperslab(void)
static void
gent_group_creation_order(void)
{
- hid_t fid = H5I_INVALID_HID; /* file ID */
- hid_t gid = H5I_INVALID_HID; /* group ID */
- hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */
- hid_t fcpl_id = H5I_INVALID_HID; /* file creation property list ID (to set root group order) */
+ hid_t fid = H5I_INVALID_HID; /* file ID */
+ hid_t gid = H5I_INVALID_HID; /* group ID */
+ hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */
+ hid_t fcpl_id = H5I_INVALID_HID; /* file creation property list ID (to set root group order) */
- if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto out;
- if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED ) < 0)
+ if (H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
- if((fid = H5Fcreate(FILE58, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILE58, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0)
goto out;
-
/* create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -6557,128 +6592,123 @@ gent_group_creation_order(void)
*-------------------------------------------------------------------------
*/
-
- if((gid = H5Gcreate2(fid, "2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
-
/*-------------------------------------------------------------------------
* create a group "1" with H5P_CRT_ORDER_TRACKED set
*-------------------------------------------------------------------------
*/
- if(H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ if (H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
-
- if((gid = H5Gcreate2(fid, "1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
- if((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
-
- if(H5Pclose(gcpl_id) < 0)
+ if (H5Pclose(gcpl_id) < 0)
goto out;
gcpl_id = H5I_INVALID_HID;
- if(H5Pclose(fcpl_id) < 0)
+ if (H5Pclose(fcpl_id) < 0)
goto out;
fcpl_id = H5I_INVALID_HID;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
fid = H5I_INVALID_HID;
return;
- out:
+out:
HDprintf("Error.....\n");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Pclose(gcpl_id);
H5Pclose(fcpl_id);
H5Fclose(fid);
-
- } H5E_END_TRY;
- return;
-
+ }
+ H5E_END_TRY;
}
/*-------------------------------------------------------------------------
@@ -6692,47 +6722,47 @@ gent_group_creation_order(void)
static void
gent_attr_creation_order(void)
{
- hid_t fid = H5I_INVALID_HID; /* file id */
- hid_t gid = H5I_INVALID_HID; /* group id */
- hid_t did = H5I_INVALID_HID; /* dataset id */
- hid_t sid = H5I_INVALID_HID; /* space id */
- hid_t aid = H5I_INVALID_HID; /* attribute id */
- hid_t tid = H5I_INVALID_HID; /* datatype id */
- hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */
- hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
- int i;
- const char *attr_name[3] = {"c", "b", "a" };
-
- if((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t gid = H5I_INVALID_HID; /* group id */
+ hid_t did = H5I_INVALID_HID; /* dataset id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t aid = H5I_INVALID_HID; /* attribute id */
+ hid_t tid = H5I_INVALID_HID; /* datatype id */
+ hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */
+ hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
+ int i;
+ const char *attr_name[3] = {"c", "b", "a"};
+
+ if ((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* create group creation property list */
- if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
goto out;
/* create dataset creation property list */
- if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
/* create dataset creation property list */
- if((tcpl_id = H5Pcreate(H5P_DATATYPE_CREATE)) < 0)
+ if ((tcpl_id = H5Pcreate(H5P_DATATYPE_CREATE)) < 0)
goto out;
/* enable attribute creation order tracking on dataset property list */
- if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ if (H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
/* enable attribute creation order tracking on group property list */
- if(H5Pset_attr_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ if (H5Pset_attr_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
/* enable attribute creation order tracking on datatype property list */
- if(H5Pset_attr_creation_order(tcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ if (H5Pset_attr_creation_order(tcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
/* create a dataspace */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
/*-------------------------------------------------------------------------
@@ -6741,74 +6771,68 @@ gent_attr_creation_order(void)
*/
/* create a dataset */
- if((did = H5Dcreate2(fid, "dt", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dt", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
did = H5I_INVALID_HID;
-
/*-------------------------------------------------------------------------
* create a dataset without creation order tracked for attributes and atributes in it
*-------------------------------------------------------------------------
*/
/* create a dataset */
- if((did = H5Dcreate2(fid, "d", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "d", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
did = H5I_INVALID_HID;
-
-
/*-------------------------------------------------------------------------
* create a group with creation order tracked for attributes and atributes in it
*-------------------------------------------------------------------------
*/
- if((gid = H5Gcreate2(fid, "gt", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "gt", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
@@ -6817,22 +6841,21 @@ gent_attr_creation_order(void)
*-------------------------------------------------------------------------
*/
- if((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
@@ -6841,25 +6864,24 @@ gent_attr_creation_order(void)
*-------------------------------------------------------------------------
*/
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
goto out;
- if((H5Tcommit2(fid, "tt", tid, H5P_DEFAULT, tcpl_id, H5P_DEFAULT)) < 0)
+ if ((H5Tcommit2(fid, "tt", tid, H5P_DEFAULT, tcpl_id, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
@@ -6868,25 +6890,24 @@ gent_attr_creation_order(void)
*-------------------------------------------------------------------------
*/
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
goto out;
- if((H5Tcommit2(fid, "t", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((H5Tcommit2(fid, "t", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
@@ -6894,22 +6915,21 @@ gent_attr_creation_order(void)
* add some attributes to the root group
*-------------------------------------------------------------------------
*/
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < 3; i++) {
+ if ((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
aid = H5I_INVALID_HID;
} /* end for */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
gid = H5I_INVALID_HID;
@@ -6917,29 +6937,28 @@ gent_attr_creation_order(void)
* close
*-------------------------------------------------------------------------
*/
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
sid = H5I_INVALID_HID;
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
goto out;
dcpl_id = H5I_INVALID_HID;
- if(H5Pclose(gcpl_id) < 0)
+ if (H5Pclose(gcpl_id) < 0)
goto out;
gcpl_id = H5I_INVALID_HID;
- if(H5Pclose(tcpl_id) < 0)
+ if (H5Pclose(tcpl_id) < 0)
goto out;
tcpl_id = H5I_INVALID_HID;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
fid = H5I_INVALID_HID;
-
-
return;
- out:
+out:
HDprintf("Error.....\n");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Dclose(did);
H5Sclose(sid);
@@ -6947,10 +6966,8 @@ gent_attr_creation_order(void)
H5Pclose(dcpl_id);
H5Pclose(tcpl_id);
H5Fclose(fid);
-
- } H5E_END_TRY;
- return;
-
+ }
+ H5E_END_TRY;
}
/*-------------------------------------------------------------------------
@@ -6966,10 +6983,10 @@ gent_attr_creation_order(void)
static void
gent_fpformat(void)
{
- hid_t fid, sid, did;
- hsize_t dims[1] = {6};
- double dbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
- float fbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
+ hid_t fid, sid, did;
+ hsize_t dims[1] = {6};
+ double dbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
+ float fbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
fid = H5Fcreate(FILE60, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
sid = H5Screate_simple(1, dims, NULL);
@@ -6982,7 +6999,6 @@ gent_fpformat(void)
H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
H5Dclose(did);
-
/*-------------------------------------------------------------------------
* float
*-------------------------------------------------------------------------
@@ -6991,7 +7007,6 @@ gent_fpformat(void)
H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf);
H5Dclose(did);
-
/* close */
H5Sclose(sid);
H5Fclose(fid);
@@ -7009,15 +7024,14 @@ gent_fpformat(void)
static void
gent_extlinks(void)
{
- hid_t source_fid, target_fid, far_fid, sid, did, gid, gid2, tid;
- hsize_t dims[1] = {6};
- int buf[6] = {1, 2, 3, 4, 5, 6};
+ hid_t source_fid, target_fid, far_fid, sid, did, gid, gid2, tid;
+ hsize_t dims[1] = {6};
+ int buf[6] = {1, 2, 3, 4, 5, 6};
/* create two files, a source and a target */
source_fid = H5Fcreate(FILE61, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
target_fid = H5Fcreate(FILE62, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- far_fid = H5Fcreate(FILE63, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
+ far_fid = H5Fcreate(FILE63, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
* create Groups, a Dataset, a committed Datatype, external links, and a
@@ -7041,7 +7055,6 @@ gent_extlinks(void)
H5Gclose(gid2);
H5Gclose(gid);
-
sid = H5Screate_simple(1, dims, NULL);
did = H5Dcreate2(target_fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
@@ -7091,8 +7104,8 @@ gent_extlinks(void)
static void
gent_fs_strategy_threshold(void)
{
- hid_t fid; /* File id */
- hid_t fcpl; /* File creation property */
+ hid_t fid; /* File id */
+ hid_t fcpl; /* File creation property */
/* Create file-creation template */
fcpl = H5Pcreate(H5P_FILE_CREATE);
@@ -7126,11 +7139,11 @@ gent_fs_strategy_threshold(void)
static void
gent_dataset_idx(void)
{
- hid_t fid, space, dcpl, fapl;
- hsize_t dims[2];
- hsize_t maxdims[2];
- int buf[20][10];
- int i, j;
+ hid_t fid, space, dcpl, fapl;
+ hsize_t dims[2];
+ hsize_t maxdims[2];
+ int buf[20][10];
+ int i, j;
int H5_ATTR_NDEBUG_UNUSED ret;
/* Get a copy of the file aaccess property */
@@ -7140,7 +7153,7 @@ gent_dataset_idx(void)
ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
assert(ret >= 0);
- fid = H5Fcreate(FILE68a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ fid = H5Fcreate(FILE68a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
dcpl = H5Pcreate(H5P_DATASET_CREATE);
dims[0] = F68a_CHUNK;
@@ -7153,11 +7166,11 @@ gent_dataset_idx(void)
/* dataset with fixed dimensions */
dims[0] = F68a_DIM20;
dims[1] = F68a_DIM10;
- space = H5Screate_simple(RANK, dims, NULL);
+ space = H5Screate_simple(RANK, dims, NULL);
- for(i = 0; i < F68a_DIM20; i++)
- for(j = 0; j < F68a_DIM10; j++)
- buf[i][j] = j;
+ for (i = 0; i < F68a_DIM20; i++)
+ for (j = 0; j < F68a_DIM10; j++)
+ buf[i][j] = j;
ret = make_dset(fid, F68a_DSET_FIXED, space, H5T_NATIVE_INT, dcpl, buf);
assert(ret >= 0);
@@ -7166,13 +7179,13 @@ gent_dataset_idx(void)
/* dataset with non-fixed dimensions */
maxdims[0] = F68a_DIM200;
maxdims[1] = F68a_DIM100;
- space = H5Screate_simple(RANK, dims, maxdims);
+ space = H5Screate_simple(RANK, dims, maxdims);
ret = make_dset(fid, F68a_DSET_BTREE, space, H5T_NATIVE_INT, dcpl, buf);
assert(ret >= 0);
H5Sclose(space);
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* dataset with fixed dimensions and filters */
/* remove the filters from the dcpl */
@@ -7184,7 +7197,7 @@ gent_dataset_idx(void)
assert(ret >= 0);
space = H5Screate_simple(RANK, dims, NULL);
- ret = make_dset(fid, F68a_DSET_FIXED_FILTER, space, H5T_NATIVE_INT, dcpl, buf);
+ ret = make_dset(fid, F68a_DSET_FIXED_FILTER, space, H5T_NATIVE_INT, dcpl, buf);
assert(ret >= 0);
H5Sclose(space);
@@ -7209,54 +7222,55 @@ gent_dataset_idx(void)
static void
gent_packedbits(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
hsize_t dims[2];
- uint8_t **dsetu8 = NULL;
- uint16_t **dsetu16 = NULL;
- uint32_t **dsetu32 = NULL;
- uint64_t **dsetu64 = NULL;
- int8_t **dset8 = NULL;
- int16_t **dset16 = NULL;
- int32_t **dset32 = NULL;
- int64_t **dset64 = NULL;
- double **dsetdbl = NULL;
-
- uint8_t valu8bits;
- uint16_t valu16bits;
- uint32_t valu32bits;
- uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
+ uint8_t ** dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t ** dset8 = NULL;
+ int16_t ** dset16 = NULL;
+ int32_t ** dset32 = NULL;
+ int64_t ** dset64 = NULL;
+ double ** dsetdbl = NULL;
+
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
unsigned int i, j;
/* Create arrays */
- H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8);
H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F66_XDIM, F66_YDIM16);
H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F66_XDIM, F66_YDIM32);
H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F66_XDIM, F66_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8);
- H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16);
- H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32);
- H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8);
fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++)
+ for (j = 1; j < dims[1]; j++)
dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -7266,15 +7280,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 16 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++)
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++)
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -7283,15 +7298,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 32 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++)
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++)
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
valu32bits <<= 1;
}
@@ -7300,15 +7316,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 64 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++)
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++)
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
valu64bits <<= 1;
}
@@ -7317,15 +7334,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 8 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++)
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++)
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
val8bits = (int8_t)(val8bits << 1);
}
@@ -7334,15 +7352,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 16 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++)
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++)
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
val16bits = (int16_t)(val16bits << 1);
}
@@ -7351,15 +7370,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 32 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++)
- dset32[i][j] = dset32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++)
+ dset32[i][j] = dset32[i][j - 1] << 1;
val32bits <<= 1;
}
@@ -7368,15 +7388,16 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Dataset of 64 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++)
- dset64[i][j] = dset64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++)
+ dset64[i][j] = dset64[i][j - 1] << 1;
val64bits <<= 1;
}
@@ -7385,12 +7406,13 @@ gent_packedbits(void)
H5Dclose(dataset);
/* Double Dummy set for failure tests */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++)
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]);
@@ -7424,57 +7446,58 @@ gent_packedbits(void)
static void
gent_attr_intsize(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t attr = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t root = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t root = H5I_INVALID_HID;
hsize_t dims[2];
- uint8_t **dsetu8 = NULL;
- uint16_t **dsetu16 = NULL;
- uint32_t **dsetu32 = NULL;
- uint64_t **dsetu64 = NULL;
- int8_t **dset8 = NULL;
- int16_t **dset16 = NULL;
- int32_t **dset32 = NULL;
- int64_t **dset64 = NULL;
- double **dsetdbl = NULL;
-
- uint8_t valu8bits;
- uint16_t valu16bits;
- uint32_t valu32bits;
- uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
+ uint8_t ** dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t ** dset8 = NULL;
+ int16_t ** dset16 = NULL;
+ int32_t ** dset32 = NULL;
+ int64_t ** dset64 = NULL;
+ double ** dsetdbl = NULL;
+
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
unsigned int i, j;
/* Create arrays */
- H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8);
H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F66_XDIM, F66_YDIM16);
H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F66_XDIM, F66_YDIM32);
H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F66_XDIM, F66_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8);
- H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16);
- H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32);
- H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8);
- fid = H5Fcreate(FILE69, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE69, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* Attribute of 8 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT);
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -7484,15 +7507,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 16 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -7502,15 +7526,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 32 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
}
valu32bits <<= 1;
}
@@ -7520,15 +7545,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 64 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT);
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
}
valu64bits <<= 1;
}
@@ -7538,15 +7564,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 8 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
@@ -7556,15 +7583,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 16 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
@@ -7574,15 +7602,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 32 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++) {
- dset32[i][j] = dset32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j - 1] << 1;
}
val32bits <<= 1;
}
@@ -7592,15 +7621,16 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Attribute of 64 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT);
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++) {
- dset64[i][j] = dset64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j - 1] << 1;
}
val64bits <<= 1;
}
@@ -7610,12 +7640,13 @@ gent_attr_intsize(void)
H5Aclose(attr);
/* Double Dummy set for failure tests */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(root, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++)
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl[0]);
@@ -7640,77 +7671,85 @@ gent_attr_intsize(void)
static void
gent_nodata(void)
{
- hid_t fid, dataset, space;
+ hid_t fid, dataset, space;
hsize_t dims[2];
fid = H5Fcreate(FILE87, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 16 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 32 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 64 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 8 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 16 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 32 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Dataset of 64 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
/* Double Dummy set for failure tests */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(space);
H5Dclose(dataset);
H5Fclose(fid);
}
-
/*-------------------------------------------------------------------------
* Function: gent_charsets
*
@@ -7724,83 +7763,88 @@ gent_nodata(void)
static void
gent_charsets(void)
{
- hid_t fid, did, sid;
+ hid_t fid, did, sid;
herr_t H5_ATTR_NDEBUG_UNUSED status;
- hsize_t dim[] = {1}; /* Dataspace dimensions */
+ hsize_t dim[] = {1}; /* Dataspace dimensions */
typedef struct CharSetInfo {
- const char *ascii_p_;
- const char *utf8_p_;
+ const char *ascii_p_;
+ const char *utf8_p_;
} CharSetInfo;
- hid_t charset_dtid = H5Tcreate( H5T_COMPOUND, sizeof( CharSetInfo ) );
- hid_t ascii_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE );
- hid_t utf8_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE );
- const char * writeData[] = { "ascii", "utf8", };
+ hid_t charset_dtid = H5Tcreate(H5T_COMPOUND, sizeof(CharSetInfo));
+ hid_t ascii_dtid = H5Tcreate(H5T_STRING, H5T_VARIABLE);
+ hid_t utf8_dtid = H5Tcreate(H5T_STRING, H5T_VARIABLE);
+ const char *writeData[] = {
+ "ascii",
+ "utf8",
+ };
- sid = H5Screate_simple( 1, dim, NULL );
- fid = H5Fcreate( FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
- status = H5Tset_cset( ascii_dtid, H5T_CSET_ASCII );
+ sid = H5Screate_simple(1, dim, NULL);
+ fid = H5Fcreate(FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Tset_cset(ascii_dtid, H5T_CSET_ASCII);
HDassert(status >= 0);
- H5Tinsert( charset_dtid, "ascii", HOFFSET(CharSetInfo, ascii_p_ ), ascii_dtid );
+ H5Tinsert(charset_dtid, "ascii", HOFFSET(CharSetInfo, ascii_p_), ascii_dtid);
- status = H5Tset_cset( utf8_dtid, H5T_CSET_UTF8 );
+ status = H5Tset_cset(utf8_dtid, H5T_CSET_UTF8);
HDassert(status >= 0);
- H5Tinsert( charset_dtid, "utf8", HOFFSET( CharSetInfo, utf8_p_ ), utf8_dtid );
+ H5Tinsert(charset_dtid, "utf8", HOFFSET(CharSetInfo, utf8_p_), utf8_dtid);
- did = H5Dcreate2( fid, "CharSets", charset_dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+ did = H5Dcreate2(fid, "CharSets", charset_dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite( did, charset_dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, writeData );
+ status = H5Dwrite(did, charset_dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, writeData);
HDassert(status >= 0);
- H5Tclose( charset_dtid );
- H5Tclose( ascii_dtid );
- H5Tclose( utf8_dtid );
- H5Sclose( sid );
- H5Dclose( did );
- H5Fclose( fid );
+ H5Tclose(charset_dtid);
+ H5Tclose(ascii_dtid);
+ H5Tclose(utf8_dtid);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid);
}
-static void gent_compound_intsizes(void) {
- hid_t fid, dataset, space;
- hsize_t dims[2];
- hsize_t array_dim8[]={F70_XDIM,F70_YDIM8}; /* Array dimensions */
- hsize_t array_dim16[]={F70_XDIM,F70_YDIM16}; /* Array dimensions */
- hsize_t array_dim32[]={F70_XDIM,F70_YDIM32}; /* Array dimensions */
- hsize_t array_dim64[]={F70_XDIM,F70_YDIM64}; /* Array dimensions */
- hid_t arrayu8_tid; /* Array datatype handle */
- hid_t arrayu16_tid; /* Array datatype handle */
- hid_t arrayu32_tid; /* Array datatype handle */
- hid_t arrayu64_tid; /* Array datatype handle */
- hid_t array8_tid; /* Array datatype handle */
- hid_t array16_tid; /* Array datatype handle */
- hid_t array32_tid; /* Array datatype handle */
- hid_t array64_tid; /* Array datatype handle */
- hid_t arraydbl_tid; /* Array datatype handle */
+static void
+gent_compound_intsizes(void)
+{
+ hid_t fid, dataset, space;
+ hsize_t dims[2];
+ hsize_t array_dim8[] = {F70_XDIM, F70_YDIM8}; /* Array dimensions */
+ hsize_t array_dim16[] = {F70_XDIM, F70_YDIM16}; /* Array dimensions */
+ hsize_t array_dim32[] = {F70_XDIM, F70_YDIM32}; /* Array dimensions */
+ hsize_t array_dim64[] = {F70_XDIM, F70_YDIM64}; /* Array dimensions */
+ hid_t arrayu8_tid; /* Array datatype handle */
+ hid_t arrayu16_tid; /* Array datatype handle */
+ hid_t arrayu32_tid; /* Array datatype handle */
+ hid_t arrayu64_tid; /* Array datatype handle */
+ hid_t array8_tid; /* Array datatype handle */
+ hid_t array16_tid; /* Array datatype handle */
+ hid_t array32_tid; /* Array datatype handle */
+ hid_t array64_tid; /* Array datatype handle */
+ hid_t arraydbl_tid; /* Array datatype handle */
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
/* Structure and array for compound types */
typedef struct Array1Struct {
- uint8_t dsetu8[F70_XDIM][F70_YDIM8];
- uint16_t dsetu16[F70_XDIM][F70_YDIM16];
- uint32_t dsetu32[F70_XDIM][F70_YDIM32];
- uint64_t dsetu64[F70_XDIM][F70_YDIM64];
- int8_t dset8[F70_XDIM][F70_YDIM8];
- int16_t dset16[F70_XDIM][F70_YDIM16];
- int32_t dset32[F70_XDIM][F70_YDIM32];
- int64_t dset64[F70_XDIM][F70_YDIM64];
- double dsetdbl[F70_XDIM][F70_YDIM8];
+ uint8_t dsetu8[F70_XDIM][F70_YDIM8];
+ uint16_t dsetu16[F70_XDIM][F70_YDIM16];
+ uint32_t dsetu32[F70_XDIM][F70_YDIM32];
+ uint64_t dsetu64[F70_XDIM][F70_YDIM64];
+ int8_t dset8[F70_XDIM][F70_YDIM8];
+ int16_t dset16[F70_XDIM][F70_YDIM16];
+ int32_t dset32[F70_XDIM][F70_YDIM32];
+ int64_t dset64[F70_XDIM][F70_YDIM64];
+ double dsetdbl[F70_XDIM][F70_YDIM8];
} Array1Struct;
Array1Struct *Array1;
- hid_t Array1Structid; /* File datatype identifier */
- herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */
- hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */
+ hid_t Array1Structid; /* File datatype identifier */
+ herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */
+ hsize_t dim[] = {F70_LENGTH}; /* Dataspace dimensions */
int m, n, o; /* Array init loop vars */
@@ -7812,98 +7856,107 @@ static void gent_compound_intsizes(void) {
for (m = 0; m < F70_LENGTH; m++) {
/* Array of 8 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu8[n][0] = valu8bits;
- for(o = 1; o < (int)dims[1]; o++)
- Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++)
+ Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o - 1] << 1);
valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM16;
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu16[n][0] = valu16bits;
- for(o = 1; o < (int)dims[1]; o++)
- Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++)
+ Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o - 1] << 1);
valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM32;
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu32[n][0] = valu32bits;
- for(o = 1; o < (int)dims[1]; o++)
- Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++)
+ Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o - 1] << 1;
valu32bits <<= 1;
}
/* Array of 64 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM64;
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu64[n][0] = valu64bits;
- for(o = 1; o < (int)dims[1]; o++)
- Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++)
+ Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o - 1] << 1;
valu64bits <<= 1;
}
/* Array of 8 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset8[n][0] = val8bits;
- for(o = 1; o < (int)dims[1]; o++)
- Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++)
+ Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o - 1] << 1);
val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM16;
- val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset16[n][0] = val16bits;
- for(o = 1; o < (int)dims[1]; o++)
- Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++)
+ Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o - 1] << 1);
val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM32;
- val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset32[n][0] = val32bits;
- for(o = 1; o < (int)dims[1]; o++)
- Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++)
+ Array1[m].dset32[n][o] = Array1[m].dset32[n][o - 1] << 1;
val32bits <<= 1;
}
/* Array of 64 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM64;
- val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset64[n][0] = val64bits;
- for(o = 1; o < (int)dims[1]; o++)
- Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++)
+ Array1[m].dset64[n][o] = Array1[m].dset64[n][o - 1] << 1;
val64bits <<= 1;
}
/* Double Dummy set for failure tests */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- for(n = 0; n < (int)dims[0]; n++)
- for(o = 0; o < (int)dims[1]; o++)
+ for (n = 0; n < (int)dims[0]; n++)
+ for (o = 0; o < (int)dims[1]; o++)
Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n;
}
@@ -8033,47 +8086,49 @@ static void gent_compound_intsizes(void) {
HDfree(Array1);
}
-static void gent_compound_attr_intsizes(void) {
- hid_t fid, attr, space, root;
- hsize_t dims[2];
- hsize_t array_dim8[]={F70_XDIM,F70_YDIM8}; /* Array dimensions */
- hsize_t array_dim16[]={F70_XDIM,F70_YDIM16}; /* Array dimensions */
- hsize_t array_dim32[]={F70_XDIM,F70_YDIM32}; /* Array dimensions */
- hsize_t array_dim64[]={F70_XDIM,F70_YDIM64}; /* Array dimensions */
- hid_t arrayu8_tid; /* Array datatype handle */
- hid_t arrayu16_tid; /* Array datatype handle */
- hid_t arrayu32_tid; /* Array datatype handle */
- hid_t arrayu64_tid; /* Array datatype handle */
- hid_t array8_tid; /* Array datatype handle */
- hid_t array16_tid; /* Array datatype handle */
- hid_t array32_tid; /* Array datatype handle */
- hid_t array64_tid; /* Array datatype handle */
- hid_t arraydbl_tid; /* Array datatype handle */
+static void
+gent_compound_attr_intsizes(void)
+{
+ hid_t fid, attr, space, root;
+ hsize_t dims[2];
+ hsize_t array_dim8[] = {F70_XDIM, F70_YDIM8}; /* Array dimensions */
+ hsize_t array_dim16[] = {F70_XDIM, F70_YDIM16}; /* Array dimensions */
+ hsize_t array_dim32[] = {F70_XDIM, F70_YDIM32}; /* Array dimensions */
+ hsize_t array_dim64[] = {F70_XDIM, F70_YDIM64}; /* Array dimensions */
+ hid_t arrayu8_tid; /* Array datatype handle */
+ hid_t arrayu16_tid; /* Array datatype handle */
+ hid_t arrayu32_tid; /* Array datatype handle */
+ hid_t arrayu64_tid; /* Array datatype handle */
+ hid_t array8_tid; /* Array datatype handle */
+ hid_t array16_tid; /* Array datatype handle */
+ hid_t array32_tid; /* Array datatype handle */
+ hid_t array64_tid; /* Array datatype handle */
+ hid_t arraydbl_tid; /* Array datatype handle */
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
/* Structure and array for compound types */
typedef struct Array1Struct {
- uint8_t dsetu8[F70_XDIM][F70_YDIM8];
- uint16_t dsetu16[F70_XDIM][F70_YDIM16];
- uint32_t dsetu32[F70_XDIM][F70_YDIM32];
- uint64_t dsetu64[F70_XDIM][F70_YDIM64];
- int8_t dset8[F70_XDIM][F70_YDIM8];
- int16_t dset16[F70_XDIM][F70_YDIM16];
- int32_t dset32[F70_XDIM][F70_YDIM32];
- int64_t dset64[F70_XDIM][F70_YDIM64];
- double dsetdbl[F70_XDIM][F70_YDIM8];
+ uint8_t dsetu8[F70_XDIM][F70_YDIM8];
+ uint16_t dsetu16[F70_XDIM][F70_YDIM16];
+ uint32_t dsetu32[F70_XDIM][F70_YDIM32];
+ uint64_t dsetu64[F70_XDIM][F70_YDIM64];
+ int8_t dset8[F70_XDIM][F70_YDIM8];
+ int16_t dset16[F70_XDIM][F70_YDIM16];
+ int32_t dset32[F70_XDIM][F70_YDIM32];
+ int64_t dset64[F70_XDIM][F70_YDIM64];
+ double dsetdbl[F70_XDIM][F70_YDIM8];
} Array1Struct;
Array1Struct *Array1 = NULL;
- hid_t Array1Structid; /* File datatype identifier */
- herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */
- hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */
+ hid_t Array1Structid; /* File datatype identifier */
+ herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */
+ hsize_t dim[] = {F70_LENGTH}; /* Dataspace dimensions */
int m, n, o; /* Array init loop vars */
@@ -8083,106 +8138,115 @@ static void gent_compound_attr_intsizes(void) {
for (m = 0; m < F70_LENGTH; m++) {
/* Array of 8 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu8[n][0] = valu8bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM16;
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu16[n][0] = valu16bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM32;
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu32[n][0] = valu32bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o - 1] << 1;
}
valu32bits <<= 1;
}
/* Array of 64 bits unsigned int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM64;
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dsetu64[n][0] = valu64bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o - 1] << 1;
}
valu64bits <<= 1;
}
/* Array of 8 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset8[n][0] = val8bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM16;
- val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset16[n][0] = val16bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1);
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM32;
- val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset32[n][0] = val32bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset32[n][o] = Array1[m].dset32[n][o - 1] << 1;
}
val32bits <<= 1;
}
/* Array of 64 bits signed int */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM64;
- val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Array1[m].dset64[n][0] = val64bits;
- for(o = 1; o < (int)dims[1]; o++) {
- Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1;
+ for (o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset64[n][o] = Array1[m].dset64[n][o - 1] << 1;
}
val64bits <<= 1;
}
/* Double Dummy set for failure tests */
- dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+ dims[0] = F70_XDIM;
+ dims[1] = F70_YDIM8;
- for(n = 0; n < (int)dims[0]; n++)
- for(o = 0; o < (int)dims[1]; o++)
+ for (n = 0; n < (int)dims[0]; n++)
+ for (o = 0; o < (int)dims[1]; o++)
Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n;
}
@@ -8314,51 +8378,53 @@ static void gent_compound_attr_intsizes(void) {
HDfree(Array1);
}
-static void gent_nested_compound_dt(void) { /* test nested data type */
- hid_t fid, group, dataset, space, type, create_plist, type1, type2;
- hid_t array_dt, enum_dt;
+static void
+gent_nested_compound_dt(void)
+{ /* test nested data type */
+ hid_t fid, group, dataset, space, type, create_plist, type1, type2;
+ hid_t array_dt, enum_dt;
enumtype val;
typedef struct {
- int a;
- float b;
+ int a;
+ float b;
} dset1_t;
dset1_t dset1[10];
typedef struct {
- int a;
- float b;
- enumtype c;
+ int a;
+ float b;
+ enumtype c;
} dset2_t;
dset2_t dset2[10];
typedef struct {
- int a[5];
- float b[5][6];
- dset1_t c;
+ int a[5];
+ float b[5][6];
+ dset1_t c;
} dset3_t;
dset3_t dset3[10];
enumtype dset4[] = {RED, GREEN, BLUE, GREEN, WHITE, BLUE};
- int i, j, k;
+ int i, j, k;
unsigned ndims;
- hsize_t dim[2];
+ hsize_t dim[2];
hsize_t sdim, maxdim;
sdim = 10;
- for(i = 0; i < (int)sdim; i++) {
+ for (i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
- dset1[i].b = (float)(i*i);
+ dset1[i].b = (float)(i * i);
dset2[i].a = i;
dset2[i].b = (float)((float)i + (float)i * 0.1F);
dset2[i].c = GREEN;
- for(j = 0; j < 5; j++) {
+ for (j = 0; j < 5; j++) {
dset3[i].a[j] = i * j;
- for(k = 0; k < 6; k++) {
+ for (k = 0; k < 6; k++) {
dset3[i].b[j][k] = (float)((float)i * (float)j * (float)k * 1.0F);
}
}
@@ -8373,13 +8439,12 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
sdim = 2;
H5Pset_chunk(create_plist, 1, &sdim);
-
- sdim = 6;
+ sdim = 6;
maxdim = H5S_UNLIMITED;
space = H5Screate_simple(1, &sdim, &maxdim);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32LE);
H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32LE);
@@ -8391,20 +8456,20 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
H5Dclose(dataset);
/* Create the shared enumerated datatype. */
- enum_dt = H5Tenum_create (H5T_NATIVE_INT);
- val = (enumtype) RED;
- H5Tenum_insert (enum_dt, "Red", &val);
- val = (enumtype) GREEN;
- H5Tenum_insert (enum_dt, "Green", &val);
- val = (enumtype) BLUE;
- H5Tenum_insert (enum_dt, "Blue", &val);
- val = (enumtype) WHITE;
- H5Tenum_insert (enum_dt, "White", &val);
- val = (enumtype) BLACK;
- H5Tenum_insert (enum_dt, "Black", &val);
- H5Tcommit2(fid, "enumtype", enum_dt, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2[0]));
+ enum_dt = H5Tenum_create(H5T_NATIVE_INT);
+ val = (enumtype)RED;
+ H5Tenum_insert(enum_dt, "Red", &val);
+ val = (enumtype)GREEN;
+ H5Tenum_insert(enum_dt, "Green", &val);
+ val = (enumtype)BLUE;
+ H5Tenum_insert(enum_dt, "Blue", &val);
+ val = (enumtype)WHITE;
+ H5Tenum_insert(enum_dt, "White", &val);
+ val = (enumtype)BLACK;
+ H5Tenum_insert(enum_dt, "Black", &val);
+ H5Tcommit2(fid, "enumtype", enum_dt, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset2[0]));
H5Tinsert(type2, "a_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT);
H5Tinsert(type2, "b_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT);
@@ -8430,19 +8495,22 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset3_t));
- ndims = 1; dim[0] = 5;
+ ndims = 1;
+ dim[0] = 5;
array_dt = H5Tarray_create2(H5T_STD_I32LE, ndims, dim);
H5Tinsert(type2, "int_name", HOFFSET(dset3_t, a), array_dt);
H5Tclose(array_dt);
- ndims = 2; dim[0] = 5; dim[1] = 6;
+ ndims = 2;
+ dim[0] = 5;
+ dim[1] = 6;
array_dt = H5Tarray_create2(H5T_IEEE_F32LE, ndims, dim);
H5Tinsert(type2, "float_name", HOFFSET(dset3_t, b), array_dt);
H5Tclose(array_dt);
- H5Tinsert (type2, "cmpd_name", HOFFSET (dset3_t, c), type1);
+ H5Tinsert(type2, "cmpd_name", HOFFSET(dset3_t, c), type1);
dataset = H5Dcreate2(group, "dset3", type2, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
@@ -8460,7 +8528,6 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
H5Pclose(create_plist);
H5Fclose(fid);
-
}
/*-------------------------------------------------------------------------
@@ -8476,57 +8543,58 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
static void
gent_intscalars(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
hsize_t dims[2];
- uint8_t **dsetu8 = NULL;
- uint16_t **dsetu16 = NULL;
- uint32_t **dsetu32 = NULL;
- uint64_t **dsetu64 = NULL;
- int8_t **dset8 = NULL;
- int16_t **dset16 = NULL;
- int32_t **dset32 = NULL;
- int64_t **dset64 = NULL;
- double **dsetdbl = NULL;
-
- uint8_t valu8bits;
- uint16_t valu16bits;
- uint32_t valu32bits;
- uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
+ uint8_t ** dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t ** dset8 = NULL;
+ int16_t ** dset16 = NULL;
+ int32_t ** dset32 = NULL;
+ int64_t ** dset64 = NULL;
+ double ** dsetdbl = NULL;
+
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
unsigned int i, j;
/* Create arrays */
- H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8);
H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F73_XDIM, F73_YDIM16);
H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F73_XDIM, F73_YDIM32);
H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F73_XDIM, F73_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8);
- H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16);
- H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32);
- H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8);
fid = H5Fcreate(FILE73, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -8536,16 +8604,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 16 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -8555,16 +8624,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 32 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
}
valu32bits <<= 1;
}
@@ -8574,16 +8644,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 64 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
}
valu64bits <<= 1;
}
@@ -8593,16 +8664,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 8 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
@@ -8612,16 +8684,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 16 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
@@ -8631,16 +8704,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 32 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++) {
- dset32[i][j] = dset32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j - 1] << 1;
}
val32bits <<= 1;
}
@@ -8650,16 +8724,17 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Dataset of 64 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++) {
- dset64[i][j] = dset64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j - 1] << 1;
}
val64bits <<= 1;
}
@@ -8669,13 +8744,14 @@ gent_intscalars(void)
H5Dclose(dataset);
/* Double Dummy set for failure tests */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++)
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]);
@@ -8709,60 +8785,60 @@ gent_intscalars(void)
static void
gent_attr_intscalars(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t attr = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t root = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t root = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
hsize_t dims[2];
+ uint8_t ** dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t ** dset8 = NULL;
+ int16_t ** dset16 = NULL;
+ int32_t ** dset32 = NULL;
+ int64_t ** dset64 = NULL;
+ double ** dsetdbl = NULL;
- uint8_t **dsetu8 = NULL;
- uint16_t **dsetu16 = NULL;
- uint32_t **dsetu32 = NULL;
- uint64_t **dsetu64 = NULL;
- int8_t **dset8 = NULL;
- int16_t **dset16 = NULL;
- int32_t **dset32 = NULL;
- int64_t **dset64 = NULL;
- double **dsetdbl = NULL;
-
- uint8_t valu8bits;
- uint16_t valu16bits;
- uint32_t valu32bits;
- uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
unsigned int i, j;
/* Create arrays */
- H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8);
H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F73_XDIM, F73_YDIM16);
H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F73_XDIM, F73_YDIM32);
H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F73_XDIM, F73_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8);
- H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16);
- H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32);
- H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8);
- fid = H5Fcreate(FILE74, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE74, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* Attribute of 8 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -8772,16 +8848,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 16 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -8791,16 +8868,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 32 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
}
valu32bits <<= 1;
}
@@ -8810,16 +8888,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 64 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
}
valu64bits <<= 1;
}
@@ -8829,16 +8908,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 8 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
@@ -8848,16 +8928,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 16 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
@@ -8867,16 +8948,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 32 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++) {
- dset32[i][j] = dset32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j - 1] << 1;
}
val32bits <<= 1;
}
@@ -8886,16 +8968,17 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Attribute of 64 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++) {
- dset64[i][j] = dset64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j - 1] << 1;
}
val64bits <<= 1;
}
@@ -8905,13 +8988,14 @@ gent_attr_intscalars(void)
H5Aclose(attr);
/* Double Dummy set for failure tests */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
- attr = H5Acreate2(root, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT);
-
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++)
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Awrite(attr, tid, dsetdbl[0]);
@@ -8945,28 +9029,29 @@ gent_attr_intscalars(void)
static void
gent_string_scalars(void)
{
- hid_t fid, attr, dataset, space, tid, root;
- hsize_t dims[2];
- char string[F73_XDIM][F73_YDIM8];
+ hid_t fid, attr, dataset, space, tid, root;
+ hsize_t dims[2];
+ char string[F73_XDIM][F73_YDIM8];
unsigned int i, j;
- fid = H5Fcreate(FILE75, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE75, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
/* string scalar */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tcopy(H5T_C_S1);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tcopy(H5T_C_S1);
H5Tset_size(tid, F73_XDIM * F73_YDIM8);
memset(string, ' ', F73_XDIM * F73_YDIM8);
- for(i = 0; i < dims[0]; i++) {
+ for (i = 0; i < dims[0]; i++) {
string[i][0] = (char)('A' + i);
- for(j = 1; j < dims[1]; j++) {
- string[i][j] = (char)(string[i][j-1] + 1);
+ for (j = 1; j < dims[1]; j++) {
+ string[i][j] = (char)(string[i][j - 1] + 1);
}
}
- string[dims[0]-1][dims[1]-1] = 0;
+ string[dims[0] - 1][dims[1] - 1] = 0;
/* Dataset of string scalar */
dataset = H5Dcreate2(fid, "the_str", tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -8985,47 +9070,49 @@ gent_string_scalars(void)
H5Fclose(fid);
}
-static void gent_compound_int_array(void) {
- hid_t fid, dataset, space;
- hsize_t dims[1];
+static void
+gent_compound_int_array(void)
+{
+ hid_t fid, dataset, space;
+ hsize_t dims[1];
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
- hsize_t array_dim8[]={F76_DIM8}; /* Array dimensions */
- hsize_t array_dim16[]={F76_DIM16}; /* Array dimensions */
- hsize_t array_dim32[]={F76_DIM32}; /* Array dimensions */
- hsize_t array_dim64[]={F76_DIM64}; /* Array dimensions */
- hid_t arrayu8_tid; /* Array datatype handle */
- hid_t arrayu16_tid; /* Array datatype handle */
- hid_t arrayu32_tid; /* Array datatype handle */
- hid_t arrayu64_tid; /* Array datatype handle */
- hid_t array8_tid; /* Array datatype handle */
- hid_t array16_tid; /* Array datatype handle */
- hid_t array32_tid; /* Array datatype handle */
- hid_t array64_tid; /* Array datatype handle */
- hid_t arraydbl_tid; /* Array datatype handle */
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+ hsize_t array_dim8[] = {F76_DIM8}; /* Array dimensions */
+ hsize_t array_dim16[] = {F76_DIM16}; /* Array dimensions */
+ hsize_t array_dim32[] = {F76_DIM32}; /* Array dimensions */
+ hsize_t array_dim64[] = {F76_DIM64}; /* Array dimensions */
+ hid_t arrayu8_tid; /* Array datatype handle */
+ hid_t arrayu16_tid; /* Array datatype handle */
+ hid_t arrayu32_tid; /* Array datatype handle */
+ hid_t arrayu64_tid; /* Array datatype handle */
+ hid_t array8_tid; /* Array datatype handle */
+ hid_t array16_tid; /* Array datatype handle */
+ hid_t array32_tid; /* Array datatype handle */
+ hid_t array64_tid; /* Array datatype handle */
+ hid_t arraydbl_tid; /* Array datatype handle */
/* Structure and array for compound types */
typedef struct Cmpd1Struct {
- uint8_t dsetu8[F76_DIM8];
- uint16_t dsetu16[F76_DIM16];
- uint32_t dsetu32[F76_DIM32];
- uint64_t dsetu64[F76_DIM64];
- int8_t dset8[F76_DIM8];
- int16_t dset16[F76_DIM16];
- int32_t dset32[F76_DIM32];
- int64_t dset64[F76_DIM64];
- double dsetdbl[F76_DIM8];
+ uint8_t dsetu8[F76_DIM8];
+ uint16_t dsetu16[F76_DIM16];
+ uint32_t dsetu32[F76_DIM32];
+ uint64_t dsetu64[F76_DIM64];
+ int8_t dset8[F76_DIM8];
+ int16_t dset16[F76_DIM16];
+ int32_t dset32[F76_DIM32];
+ int64_t dset64[F76_DIM64];
+ double dsetdbl[F76_DIM8];
} Cmpd1Struct;
Cmpd1Struct *Cmpd1;
- hid_t Cmpd1Structid; /* File datatype identifier */
- herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */
- hsize_t dim[] = { F76_LENGTH }; /* Dataspace dimensions */
+ hid_t Cmpd1Structid; /* File datatype identifier */
+ herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */
+ hsize_t dim[] = {F76_LENGTH}; /* Dataspace dimensions */
int m, n; /* Array init loop vars */
@@ -9039,26 +9126,26 @@ static void gent_compound_int_array(void) {
/* Array of 8 bits unsigned int */
dims[0] = F76_DIM8;
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dsetu8[n] = valu8bits;
- valu8bits = (uint8_t)(valu8bits << 1);
+ valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
dims[0] = F76_DIM16;
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dsetu16[n] = valu16bits;
- valu16bits = (uint16_t)(valu16bits << 1);
+ valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
dims[0] = F76_DIM32;
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dsetu32[n] = valu32bits;
valu32bits <<= 1;
}
@@ -9066,8 +9153,8 @@ static void gent_compound_int_array(void) {
/* Array of 64 bits unsigned int */
dims[0] = F76_DIM64;
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dsetu64[n] = valu64bits;
valu64bits <<= 1;
}
@@ -9075,26 +9162,26 @@ static void gent_compound_int_array(void) {
/* Array of 8 bits signed int */
dims[0] = F76_DIM8;
- val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dset8[n] = val8bits;
- val8bits = (int8_t)(val8bits << 1);
+ val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
dims[0] = F76_DIM16;
- val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dset16[n] = val16bits;
- val16bits = (int16_t)(val16bits << 1);
+ val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
dims[0] = F76_DIM32;
- val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dset32[n] = val32bits;
val32bits <<= 1;
}
@@ -9102,8 +9189,8 @@ static void gent_compound_int_array(void) {
/* Array of 64 bits signed int */
dims[0] = F76_DIM64;
- val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < (int)dims[0]; n++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (n = 0; n < (int)dims[0]; n++) {
Cmpd1[m].dset64[n] = val64bits;
val64bits <<= 1;
}
@@ -9111,7 +9198,7 @@ static void gent_compound_int_array(void) {
/* Double Dummy set for failure tests */
dims[0] = F76_DIM8;
- for(n = 0; n < (int)dims[0]; n++)
+ for (n = 0; n < (int)dims[0]; n++)
Cmpd1[m].dsetdbl[n] = 0.0001F + (float)n;
}
@@ -9241,47 +9328,49 @@ static void gent_compound_int_array(void) {
HDfree(Cmpd1);
}
-static void gent_compound_ints(void) {
- hid_t fid, dataset, space;
- uint8_t valu8bits = (uint8_t) ~0u; /* all 1s */
- uint16_t valu16bits = (uint16_t) ~0u; /* all 1s */
- uint32_t valu32bits = (uint32_t) ~0u; /* all 1s */
- uint64_t valu64bits = (uint64_t) ~0Lu; /* all 1s */
- int8_t val8bits = (int8_t) ~0; /* all 1s */
- int16_t val16bits = (int16_t) ~0; /* all 1s */
- int32_t val32bits = (int32_t) ~0; /* all 1s */
- int64_t val64bits = (int64_t) ~0L; /* all 1s */
+static void
+gent_compound_ints(void)
+{
+ hid_t fid, dataset, space;
+ uint8_t valu8bits = (uint8_t)~0u; /* all 1s */
+ uint16_t valu16bits = (uint16_t)~0u; /* all 1s */
+ uint32_t valu32bits = (uint32_t)~0u; /* all 1s */
+ uint64_t valu64bits = (uint64_t)~0Lu; /* all 1s */
+ int8_t val8bits = (int8_t)~0; /* all 1s */
+ int16_t val16bits = (int16_t)~0; /* all 1s */
+ int32_t val32bits = (int32_t)~0; /* all 1s */
+ int64_t val64bits = (int64_t)~0L; /* all 1s */
/* Structure and array for compound types */
typedef struct Cmpd1Struct {
- uint8_t dsetu8;
- uint16_t dsetu16;
- uint32_t dsetu32;
- uint64_t dsetu64;
- int8_t dset8;
- int16_t dset16;
- int32_t dset32;
- int64_t dset64;
- double dsetdbl;
+ uint8_t dsetu8;
+ uint16_t dsetu16;
+ uint32_t dsetu32;
+ uint64_t dsetu64;
+ int8_t dset8;
+ int16_t dset16;
+ int32_t dset32;
+ int64_t dset64;
+ double dsetdbl;
} Cmpd1Struct;
Cmpd1Struct *Cmpd1;
typedef struct Cmpd2Struct {
- uint64_t dsetu64;
- uint32_t dsetu32;
- uint16_t dsetu16;
- uint8_t dsetu8;
- int64_t dset64;
- int32_t dset32;
- int16_t dset16;
- int8_t dset8;
- double dsetdbl;
+ uint64_t dsetu64;
+ uint32_t dsetu32;
+ uint16_t dsetu16;
+ uint8_t dsetu8;
+ int64_t dset64;
+ int32_t dset32;
+ int16_t dset16;
+ int8_t dset8;
+ double dsetdbl;
} Cmpd2Struct;
Cmpd2Struct *Cmpd2;
- hid_t Cmpd1Structid; /* File datatype identifier */
- hid_t Cmpd2Structid; /* File datatype identifier */
- herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */
- hsize_t dim[] = { F77_LENGTH }; /* Dataspace dimensions */
+ hid_t Cmpd1Structid; /* File datatype identifier */
+ hid_t Cmpd2Structid; /* File datatype identifier */
+ herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */
+ hsize_t dim[] = {F77_LENGTH}; /* Dataspace dimensions */
int m; /* Array init loop vars */
@@ -9295,57 +9384,57 @@ static void gent_compound_ints(void) {
for (m = 0; m < F77_LENGTH; m++) {
/* Array of 8 bits unsigned int */
- if((m % F76_DIM8) == 0)
- valu8bits = (uint8_t) ~0u; /* all 1s */
+ if ((m % F76_DIM8) == 0)
+ valu8bits = (uint8_t)~0u; /* all 1s */
Cmpd1[m].dsetu8 = valu8bits;
Cmpd2[m].dsetu8 = valu8bits;
- valu8bits = (uint8_t)(valu8bits << 1);
+ valu8bits = (uint8_t)(valu8bits << 1);
/* Array of 16 bits unsigned int */
- if((m % F76_DIM16) == 0)
- valu16bits = (uint16_t) ~0u; /* all 1s */
+ if ((m % F76_DIM16) == 0)
+ valu16bits = (uint16_t)~0u; /* all 1s */
Cmpd1[m].dsetu16 = valu16bits;
Cmpd2[m].dsetu16 = valu16bits;
- valu16bits = (uint16_t)(valu16bits << 1);
+ valu16bits = (uint16_t)(valu16bits << 1);
/* Array of 32 bits unsigned int */
- if((m % F76_DIM32) == 0)
- valu32bits = (uint32_t) ~0u; /* all 1s */
+ if ((m % F76_DIM32) == 0)
+ valu32bits = (uint32_t)~0u; /* all 1s */
Cmpd1[m].dsetu32 = valu32bits;
Cmpd2[m].dsetu32 = valu32bits;
valu32bits <<= 1;
/* Array of 64 bits unsigned int */
- if((m % F76_DIM64) == 0)
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ if ((m % F76_DIM64) == 0)
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
Cmpd1[m].dsetu64 = valu64bits;
Cmpd2[m].dsetu64 = valu64bits;
valu64bits <<= 1;
/* Array of 8 bits signed int */
- if((m % F76_DIM8) == 0)
- val8bits = (int8_t) ~0; /* all 1s */
+ if ((m % F76_DIM8) == 0)
+ val8bits = (int8_t)~0; /* all 1s */
Cmpd1[m].dset8 = val8bits;
Cmpd2[m].dset8 = val8bits;
- val8bits = (int8_t)(val8bits << 1);
+ val8bits = (int8_t)(val8bits << 1);
/* Array of 16 bits signed int */
- if((m % F76_DIM16) == 0)
- val16bits = (int16_t) ~0; /* all 1s */
+ if ((m % F76_DIM16) == 0)
+ val16bits = (int16_t)~0; /* all 1s */
Cmpd1[m].dset16 = val16bits;
Cmpd2[m].dset16 = val16bits;
- val16bits = (int16_t)(val16bits << 1);
+ val16bits = (int16_t)(val16bits << 1);
/* Array of 32 bits signed int */
- if((m % F76_DIM32) == 0)
- val32bits = (int32_t) ~0; /* all 1s */
+ if ((m % F76_DIM32) == 0)
+ val32bits = (int32_t)~0; /* all 1s */
Cmpd1[m].dset32 = val32bits;
Cmpd2[m].dset32 = val32bits;
val32bits <<= 1;
/* Array of 64 bits signed int */
- if((m % F76_DIM64) == 0)
- val64bits = (int64_t) ~0L; /* all 1s */
+ if ((m % F76_DIM64) == 0)
+ val64bits = (int64_t)~0L; /* all 1s */
Cmpd1[m].dset64 = val64bits;
Cmpd2[m].dset64 = val64bits;
val64bits <<= 1;
@@ -9485,58 +9574,59 @@ static void gent_compound_ints(void) {
static void
gent_intattrscalars(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t attr = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
hsize_t dims[2];
- uint8_t **dsetu8 = NULL;
- uint16_t **dsetu16 = NULL;
- uint32_t **dsetu32 = NULL;
- uint64_t **dsetu64 = NULL;
- int8_t **dset8 = NULL;
- int16_t **dset16 = NULL;
- int32_t **dset32 = NULL;
- int64_t **dset64 = NULL;
- double **dsetdbl = NULL;
-
- uint8_t valu8bits;
- uint16_t valu16bits;
- uint32_t valu32bits;
- uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
+ uint8_t ** dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t ** dset8 = NULL;
+ int16_t ** dset16 = NULL;
+ int32_t ** dset32 = NULL;
+ int64_t ** dset64 = NULL;
+ double ** dsetdbl = NULL;
+
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
unsigned int i, j;
/* Create arrays */
- H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8);
H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F73_XDIM, F73_YDIM16);
H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F73_XDIM, F73_YDIM32);
H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F73_XDIM, F73_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8);
- H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16);
- H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32);
- H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8);
fid = H5Fcreate(FILE78, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
}
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -9550,16 +9640,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 16 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
}
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -9573,16 +9664,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 32 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
}
valu32bits <<= 1;
}
@@ -9596,16 +9688,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 64 bits unsigned int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
}
valu64bits <<= 1;
}
@@ -9619,16 +9712,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 8 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
}
val8bits = (int8_t)(val8bits << 1);
}
@@ -9642,16 +9736,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 16 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ for (j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
}
val16bits = (int16_t)(val16bits << 1);
}
@@ -9665,16 +9760,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 32 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++) {
- dset32[i][j] = dset32[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j - 1] << 1;
}
val32bits <<= 1;
}
@@ -9688,16 +9784,17 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Dataset of 64 bits signed int */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++) {
- dset64[i][j] = dset64[i][j-1] << 1;
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j - 1] << 1;
}
val64bits <<= 1;
}
@@ -9711,13 +9808,14 @@ gent_intattrscalars(void)
H5Dclose(dataset);
/* Double Dummy set for failure tests */
- dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
- space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ dims[0] = F73_XDIM;
+ dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++)
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
@@ -9754,80 +9852,80 @@ gent_intattrscalars(void)
static void
gent_intsattrs(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t attr = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t aspace = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t aspace = H5I_INVALID_HID;
hsize_t dims[2], adims[1];
+ uint8_t ** dsetu8 = NULL;
+ uint16_t **dsetu16 = NULL;
+ uint32_t **dsetu32 = NULL;
+ uint64_t **dsetu64 = NULL;
+ int8_t ** dset8 = NULL;
+ int16_t ** dset16 = NULL;
+ int32_t ** dset32 = NULL;
+ int64_t ** dset64 = NULL;
+ double ** dsetdbl = NULL;
+
+ uint8_t * asetu8 = NULL;
+ uint16_t *asetu16 = NULL;
+ uint32_t *asetu32 = NULL;
+ uint64_t *asetu64 = NULL;
+ int8_t * aset8 = NULL;
+ int16_t * aset16 = NULL;
+ int32_t * aset32 = NULL;
+ int64_t * aset64 = NULL;
+ double * asetdbl = NULL;
- uint8_t **dsetu8 = NULL;
- uint16_t **dsetu16 = NULL;
- uint32_t **dsetu32 = NULL;
- uint64_t **dsetu64 = NULL;
- int8_t **dset8 = NULL;
- int16_t **dset16 = NULL;
- int32_t **dset32 = NULL;
- int64_t **dset64 = NULL;
- double **dsetdbl = NULL;
-
- uint8_t *asetu8 = NULL;
- uint16_t *asetu16 = NULL;
- uint32_t *asetu32 = NULL;
- uint64_t *asetu64 = NULL;
- int8_t *aset8 = NULL;
- int16_t *aset16 = NULL;
- int32_t *aset32 = NULL;
- int64_t *aset64 = NULL;
- double *asetdbl = NULL;
-
- uint8_t valu8bits;
- uint16_t valu16bits;
- uint32_t valu32bits;
- uint64_t valu64bits;
- int8_t val8bits;
- int16_t val16bits;
- int32_t val32bits;
- int64_t val64bits;
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
unsigned int i, j;
/* Create arrays */
- H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8);
H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F66_XDIM, F66_YDIM16);
H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F66_XDIM, F66_YDIM32);
H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F66_XDIM, F66_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8);
- H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16);
- H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32);
- H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64);
- H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8);
+ H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16);
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8);
- asetu8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(uint8_t));
+ asetu8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(uint8_t));
asetu16 = HDcalloc(F66_XDIM * F66_YDIM16, sizeof(uint16_t));
asetu32 = HDcalloc(F66_XDIM * F66_YDIM32, sizeof(uint32_t));
asetu64 = HDcalloc(F66_XDIM * F66_YDIM64, sizeof(uint64_t));
- aset8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(int8_t));
+ aset8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(int8_t));
aset16 = HDcalloc(F66_XDIM * F66_YDIM16, sizeof(int16_t));
aset32 = HDcalloc(F66_XDIM * F66_YDIM32, sizeof(int32_t));
aset64 = HDcalloc(F66_XDIM * F66_YDIM64, sizeof(int64_t));
- asetdbl = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(double));
+ asetdbl = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(double));
fid = H5Fcreate(FILE79, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu8bits = (uint8_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dsetu8[i][0] = valu8bits;
- asetu8[i*dims[1]] = dsetu8[i][0];
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
- asetu8[i*dims[1]+j] = dsetu8[i][j];
+ valu8bits = (uint8_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dsetu8[i][0] = valu8bits;
+ asetu8[i * dims[1]] = dsetu8[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
+ asetu8[i * dims[1] + j] = dsetu8[i][j];
}
valu8bits = (uint8_t)(valu8bits << 1);
}
@@ -9835,8 +9933,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8[0]);
/* Attribute of 8 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM8;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETU08, H5T_STD_U8LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU08, H5T_STD_U8LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_UINT8, asetu8);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9844,17 +9942,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 16 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dsetu16[i][0] = valu16bits;
- asetu16[i*dims[1]] = dsetu16[i][0];
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
- asetu16[i*dims[1]+j] = dsetu16[i][j];
+ valu16bits = (uint16_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dsetu16[i][0] = valu16bits;
+ asetu16[i * dims[1]] = dsetu16[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1);
+ asetu16[i * dims[1] + j] = dsetu16[i][j];
}
valu16bits = (uint16_t)(valu16bits << 1);
}
@@ -9862,8 +9961,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16[0]);
/* Attribute of 16 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM16;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETU16, H5T_STD_U16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU16, H5T_STD_U16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_UINT16, asetu16);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9871,17 +9970,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 32 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dsetu32[i][0] = valu32bits;
- asetu32[i*dims[1]] = dsetu32[i][0];
- for(j = 1; j < dims[1]; j++) {
- dsetu32[i][j] = dsetu32[i][j-1] << 1;
- asetu32[i*dims[1]+j] = dsetu32[i][j];
+ valu32bits = (uint32_t)~0u; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dsetu32[i][0] = valu32bits;
+ asetu32[i * dims[1]] = dsetu32[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j - 1] << 1;
+ asetu32[i * dims[1] + j] = dsetu32[i][j];
}
valu32bits <<= 1;
}
@@ -9889,8 +9989,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32[0]);
/* Attribute of 32 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM32;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETU32, H5T_STD_U32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU32, H5T_STD_U32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_UINT32, asetu32);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9898,17 +9998,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 64 bits unsigned int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dsetu64[i][0] = valu64bits;
- asetu64[i*dims[1]] = dsetu64[i][0];
- for(j = 1; j < dims[1]; j++) {
- dsetu64[i][j] = dsetu64[i][j-1] << 1;
- asetu64[i*dims[1]+j] = dsetu64[i][j];
+ valu64bits = (uint64_t)~0Lu; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dsetu64[i][0] = valu64bits;
+ asetu64[i * dims[1]] = dsetu64[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j - 1] << 1;
+ asetu64[i * dims[1] + j] = dsetu64[i][j];
}
valu64bits <<= 1;
}
@@ -9916,8 +10017,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64[0]);
/* Attribute of 64 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM64;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETU64, H5T_STD_U64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU64, H5T_STD_U64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_UINT64, asetu64);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9925,17 +10026,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 8 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dset8[i][0] = val8bits;
- aset8[i*dims[1]] = dset8[i][0];
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
- aset8[i*dims[1]+j] = dset8[i][j];
+ val8bits = (int8_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dset8[i][0] = val8bits;
+ aset8[i * dims[1]] = dset8[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1);
+ aset8[i * dims[1] + j] = dset8[i][j];
}
val8bits = (int8_t)(val8bits << 1);
}
@@ -9943,8 +10045,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8[0]);
/* Attribute of 8 bits signed int */
adims[0] = F66_XDIM * F66_YDIM8;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETS08, H5T_STD_I8LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS08, H5T_STD_I8LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT8, aset8);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9952,17 +10054,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 16 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dset16[i][0] = val16bits;
- aset16[i*dims[1]] = dset16[i][0];
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
- aset16[i*dims[1]+j] = dset16[i][j];
+ val16bits = (int16_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dset16[i][0] = val16bits;
+ aset16[i * dims[1]] = dset16[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1);
+ aset16[i * dims[1] + j] = dset16[i][j];
}
val16bits = (int16_t)(val16bits << 1);
}
@@ -9970,8 +10073,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16[0]);
/* Attribute of 16 bits signed int */
adims[0] = F66_XDIM * F66_YDIM16;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETS16, H5T_STD_I16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS16, H5T_STD_I16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT16, aset16);
H5Aclose(attr);
H5Sclose(aspace);
@@ -9979,17 +10082,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 32 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dset32[i][0] = val32bits;
- aset32[i*dims[1]] = dset32[i][0];
- for(j = 1; j < dims[1]; j++) {
- dset32[i][j] = dset32[i][j-1] << 1;
- aset32[i*dims[1]+j] = dset32[i][j];
+ val32bits = (int32_t)~0; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dset32[i][0] = val32bits;
+ aset32[i * dims[1]] = dset32[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j - 1] << 1;
+ aset32[i * dims[1] + j] = dset32[i][j];
}
val32bits <<= 1;
}
@@ -9997,8 +10101,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]);
/* Attribute of 32 bits signed int */
adims[0] = F66_XDIM * F66_YDIM32;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETS32, H5T_STD_I32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS32, H5T_STD_I32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT32, aset32);
H5Aclose(attr);
H5Sclose(aspace);
@@ -10006,17 +10110,18 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Dataset of 64 bits signed int */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val64bits = (int64_t) ~0L; /* all 1s */
- for(i = 0; i < dims[0]; i++){
- dset64[i][0] = val64bits;
- aset64[i*dims[1]] = dset64[i][0];
- for(j = 1; j < dims[1]; j++) {
- dset64[i][j] = dset64[i][j-1] << 1;
- aset64[i*dims[1]+j] = dset64[i][j];
+ val64bits = (int64_t)~0L; /* all 1s */
+ for (i = 0; i < dims[0]; i++) {
+ dset64[i][0] = val64bits;
+ aset64[i * dims[1]] = dset64[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j - 1] << 1;
+ aset64[i * dims[1] + j] = dset64[i][j];
}
val64bits <<= 1;
}
@@ -10024,8 +10129,8 @@ gent_intsattrs(void)
H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]);
/* Attribute of 64 bits signed int */
adims[0] = F66_XDIM * F66_YDIM64;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DATASETS64, H5T_STD_I64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS64, H5T_STD_I64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT64, aset64);
H5Aclose(attr);
H5Sclose(aspace);
@@ -10033,21 +10138,22 @@ gent_intsattrs(void)
H5Dclose(dataset);
/* Double Dummy set for failure tests */
- dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
- space = H5Screate_simple(2, dims, NULL);
+ dims[0] = F66_XDIM;
+ dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < dims[0]; i++)
- for(j = 0; j < dims[1]; j++) {
- dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
- asetdbl[i*dims[1]+j] = dsetdbl[i][j];
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++) {
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
+ asetdbl[i * dims[1] + j] = dsetdbl[i][j];
}
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]);
/* Attribute of double */
adims[0] = F66_XDIM * F66_YDIM8;
- aspace = H5Screate_simple(1, adims, NULL);
- attr = H5Acreate2(dataset, F66_DUMMYDBL, H5T_IEEE_F64BE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DUMMYDBL, H5T_IEEE_F64BE, aspace, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_DOUBLE, asetdbl);
H5Aclose(attr);
H5Sclose(aspace);
@@ -10076,25 +10182,172 @@ gent_intsattrs(void)
HDfree(asetdbl);
}
-static void gent_bitnopaquefields(void)
+/*-------------------------------------------------------------------------
+ * Function: gent_floatsattrs
+ *
+ * Purpose: Generate a file to be used in the h5dump tests.
+ * Three datasets of 4, 8 and 16 bytes of float types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_floatsattrs(void)
+{
+ hid_t fid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t aspace = H5I_INVALID_HID;
+ hsize_t dims[2], adims[1];
+
+ float ** dset32 = NULL;
+ double ** dset64 = NULL;
+ long double **dset128 = NULL;
+
+ float * aset32 = NULL;
+ double * aset64 = NULL;
+ long double *aset128 = NULL;
+
+ float val32bits;
+ double val64bits;
+ long double val128bits;
+
+ unsigned int i, j;
+
+ /* Create arrays */
+ H5TEST_ALLOCATE_2D_ARRAY(dset32, float, F89_XDIM, F89_YDIM32);
+ H5TEST_ALLOCATE_2D_ARRAY(dset64, double, F89_XDIM, F89_YDIM64);
+ H5TEST_ALLOCATE_2D_ARRAY(dset128, long double, F89_XDIM, F89_YDIM128);
+
+ aset32 = HDcalloc(F89_XDIM * F89_YDIM32, sizeof(float));
+ aset64 = HDcalloc(F89_XDIM * F89_YDIM64, sizeof(double));
+ aset128 = HDcalloc(F89_XDIM * F89_YDIM128, sizeof(long double));
+
+ fid = H5Fcreate(FILE89, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((tid = H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
+ goto error;
+
+ if (H5Tget_size(tid) == 0)
+ goto error;
+
+ /* Dataset of 32 bits float */
+ dims[0] = F89_XDIM;
+ dims[1] = F89_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F89_DATASETF32, H5T_IEEE_F32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (float)F89_YDIM32;
+ for (i = 0; i < dims[0]; i++) {
+ dset32[i][0] = val32bits;
+ aset32[i * dims[1]] = dset32[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset32[i][j] = (float)(j * dims[0] + i) / (float)F89_YDIM32;
+ aset32[i * dims[1] + j] = dset32[i][j];
+ }
+ val32bits -= (float)1;
+ }
+
+ H5Dwrite(dataset, H5T_IEEE_F32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]);
+ /* Attribute of 32 bits float */
+ adims[0] = F89_XDIM * F89_YDIM32;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F89_DATASETF32, H5T_IEEE_F32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_IEEE_F32LE, aset32);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits double */
+ dims[0] = F89_XDIM;
+ dims[1] = F89_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F89_DATASETF64, H5T_IEEE_F64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (double)F89_YDIM64;
+ for (i = 0; i < dims[0]; i++) {
+ dset64[i][0] = val64bits;
+ aset64[i * dims[1]] = dset64[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset64[i][j] = (double)(j * dims[0] + i) / (double)F89_YDIM64;
+ aset64[i * dims[1] + j] = dset64[i][j];
+ }
+ val64bits -= (double)1;
+ }
+
+ H5Dwrite(dataset, H5T_IEEE_F64LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]);
+ /* Attribute of 64 bits double */
+ adims[0] = F89_XDIM * F89_YDIM64;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F89_DATASETF64, H5T_IEEE_F64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_IEEE_F64LE, aset64);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 128 bits long double */
+ dims[0] = F89_XDIM;
+ dims[1] = F89_YDIM128;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F89_DATASETF128, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val128bits = (long double)F89_YDIM128;
+ for (i = 0; i < dims[0]; i++) {
+ dset128[i][0] = val128bits;
+ aset128[i * dims[1]] = dset128[i][0];
+ for (j = 1; j < dims[1]; j++) {
+ dset128[i][j] = (long double)(j * dims[0] + i) / (long double)F89_YDIM128;
+ aset128[i * dims[1] + j] = dset128[i][j];
+ }
+ val128bits -= (long double)1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset128[0]);
+ /* Attribute of 128 bits long double */
+ adims[0] = F89_XDIM * F89_YDIM128;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F89_DATASETF128, tid, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, aset128);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+error:
+ H5Fclose(fid);
+
+ HDfree(dset32);
+ HDfree(dset64);
+ HDfree(dset128);
+
+ HDfree(aset32);
+ HDfree(aset64);
+ HDfree(aset128);
+}
+
+static void
+gent_bitnopaquefields(void)
{
/* Compound datatype */
- typedef struct s_t
- {
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
+ typedef struct s_t {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
} s_t;
- hid_t file_id=H5I_INVALID_HID, grp=H5I_INVALID_HID, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
- size_t i;
+ hid_t file_id = H5I_INVALID_HID, grp = H5I_INVALID_HID, type = H5I_INVALID_HID, space = H5I_INVALID_HID,
+ dset = H5I_INVALID_HID;
+ size_t i;
hsize_t nelmts = F80_DIM32;
- uint8_t buf[F80_DIM32]; /* bitfield, opaque */
- uint16_t buf2[F80_DIM32]; /* bitfield, opaque */
- uint32_t buf3[F80_DIM32]; /* bitfield, opaque */
- uint64_t buf4[F80_DIM32]; /* bitfield, opaque */
- s_t buf5[F80_DIM32]; /* compound */
+ uint8_t buf[F80_DIM32]; /* bitfield, opaque */
+ uint16_t buf2[F80_DIM32]; /* bitfield, opaque */
+ uint32_t buf3[F80_DIM32]; /* bitfield, opaque */
+ uint64_t buf4[F80_DIM32]; /* bitfield, opaque */
+ s_t buf5[F80_DIM32]; /* compound */
file_id = H5Fcreate(FILE80, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -10102,7 +10355,8 @@ static void gent_bitnopaquefields(void)
/* bitfield_1 */
if ((type = H5Tcopy(H5T_STD_B8LE)) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf[i] = (uint8_t)(0xff ^ i);
}
@@ -10117,7 +10371,8 @@ static void gent_bitnopaquefields(void)
/* bitfield_2 */
if ((type = H5Tcopy(H5T_STD_B16LE)) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf2[i] = (uint16_t)(0xffff ^ (i * 16));
}
@@ -10132,7 +10387,8 @@ static void gent_bitnopaquefields(void)
/* bitfield_3 */
if ((type = H5Tcopy(H5T_STD_B32LE)) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "bitfield_3", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_3", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf3[i] = (uint32_t)0xffffffff ^ (uint32_t)(i * 32);
}
@@ -10147,7 +10403,8 @@ static void gent_bitnopaquefields(void)
/* bitfield_4 */
if ((type = H5Tcopy(H5T_STD_B64LE)) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "bitfield_4", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_4", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf4[i] = (uint64_t)0xffffffffffffffff ^ (uint64_t)(i * 64);
}
@@ -10167,8 +10424,9 @@ static void gent_bitnopaquefields(void)
if ((type = H5Tcreate(H5T_OPAQUE, 1)) >= 0) {
if ((H5Tset_tag(type, "1-byte opaque type")) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++)
+ if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++)
H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t);
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
H5Dclose(dset);
@@ -10183,8 +10441,9 @@ static void gent_bitnopaquefields(void)
if ((type = H5Tcreate(H5T_OPAQUE, 2)) >= 0) {
if ((H5Tset_tag(type, "2-byte opaque type")) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++)
+ if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++)
H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t);
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2);
@@ -10206,8 +10465,9 @@ static void gent_bitnopaquefields(void)
H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++) {
+ if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
H5_CHECKED_ASSIGN(buf5[i].a, uint8_t, 0xff ^ i, size_t);
H5_CHECKED_ASSIGN(buf5[i].b, uint16_t, 0xffff ^ (i * 16), size_t);
buf5[i].c = (uint32_t)0xffffffff ^ (uint32_t)(i * 32);
@@ -10237,23 +10497,27 @@ static void gent_bitnopaquefields(void)
static void
gent_intsfourdims(void)
{
- hid_t fid, dataset, space;
- hsize_t dims[F81_RANK];
- uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM];
+ hid_t fid, dataset, space;
+ hsize_t dims[F81_RANK];
+ uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM];
unsigned int i, j, k, l;
fid = H5Fcreate(FILE81, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 32 bits unsigned int */
- dims[0] = F81_ZDIM; dims[1] = F81_YDIM; dims[2] = F81_XDIM; dims[3] = F81_WDIM;
- space = H5Screate_simple(F81_RANK, dims, NULL);
+ dims[0] = F81_ZDIM;
+ dims[1] = F81_YDIM;
+ dims[2] = F81_XDIM;
+ dims[3] = F81_WDIM;
+ space = H5Screate_simple(F81_RANK, dims, NULL);
dataset = H5Dcreate2(fid, F81_DATASETNAME, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < F81_ZDIM; i++)
- for(j = 0; j < F81_YDIM; j++)
- for(k = 0; k < F81_XDIM; k++)
- for(l = 0; l < F81_WDIM; l++)
- dset1[i][j][k][l] = i*F81_YDIM*F81_XDIM*F81_WDIM + j*F81_XDIM*F81_WDIM + k*F81_WDIM + l;
+ for (i = 0; i < F81_ZDIM; i++)
+ for (j = 0; j < F81_YDIM; j++)
+ for (k = 0; k < F81_XDIM; k++)
+ for (l = 0; l < F81_WDIM; l++)
+ dset1[i][j][k][l] =
+ i * F81_YDIM * F81_XDIM * F81_WDIM + j * F81_XDIM * F81_WDIM + k * F81_WDIM + l;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
H5Sclose(space);
@@ -10269,7 +10533,8 @@ gent_intsfourdims(void)
* various sizes, dimensions, member types and nesting.
*-------------------------------------------------------------------------
*/
-static void gent_compound_complex2(void)
+static void
+gent_compound_complex2(void)
{
/* Third-level nested compound */
typedef struct {
@@ -10289,45 +10554,42 @@ static void gent_compound_complex2(void)
} further_nested;
typedef struct {
- char further_nested_string[11];
- char further_nested_string_array[4][13];
+ char further_nested_string[11];
+ char further_nested_string_array[4][13];
third_level_compound deep_nest;
} further_nested2;
/* First First-level nested compound */
- typedef struct
- {
+ typedef struct {
double nested_a;
char nested_string[23];
char nested_string_array[4][12];
} nested_compound;
/* Second First-level nested compound */
- typedef struct
- {
+ typedef struct {
float a;
further_nested b;
further_nested2 c;
} multiple_nested_compound;
/* Compound datatype with different member types */
- typedef struct
- {
+ typedef struct {
/* Arrays nested inside compound */
unsigned int a[4];
int b[6];
float c[2][4];
- nested_compound d; /* Compound inside compound */
- multiple_nested_compound e; /* Compound inside compound with further nested compound */
+ nested_compound d; /* Compound inside compound */
+ multiple_nested_compound e; /* Compound inside compound with further nested compound */
} compound;
- compound *buf; /* compound */
+ compound *buf; /* compound */
- hid_t file, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
- hid_t dset_array_a, dset_array_b, dset_array_c;
- hid_t cmpd_tid1 = H5I_INVALID_HID, cmpd_tid2 = H5I_INVALID_HID, cmpd_tid3 = H5I_INVALID_HID;
- size_t i;
- size_t j, k;
+ hid_t file, type = H5I_INVALID_HID, space = H5I_INVALID_HID, dset = H5I_INVALID_HID;
+ hid_t dset_array_a, dset_array_b, dset_array_c;
+ hid_t cmpd_tid1 = H5I_INVALID_HID, cmpd_tid2 = H5I_INVALID_HID, cmpd_tid3 = H5I_INVALID_HID;
+ size_t i;
+ size_t j, k;
unsigned dset_array_ndims;
hsize_t dset_array_a_dims[1], dset_array_b_dims[1], dset_array_c_dims[2];
hsize_t nelmts = F82_DIM32;
@@ -10341,23 +10603,27 @@ static void gent_compound_complex2(void)
if ((space = H5Screate_simple(F82_RANK, &nelmts, NULL)) >= 0) {
/* CompoundComplex1D */
if ((type = H5Tcreate(H5T_COMPOUND, sizeof(compound))) >= 0) {
- hid_t str_type, array;
+ hid_t str_type, array;
hsize_t dims[1];
- hid_t nest1, nest2;
+ hid_t nest1, nest2;
/* Insert top-level array members */
- dset_array_ndims = 1; dset_array_a_dims[0] = 4;
- dset_array_a = H5Tarray_create2(H5T_STD_U32LE, dset_array_ndims, dset_array_a_dims);
+ dset_array_ndims = 1;
+ dset_array_a_dims[0] = 4;
+ dset_array_a = H5Tarray_create2(H5T_STD_U32LE, dset_array_ndims, dset_array_a_dims);
H5Tinsert(type, "a", HOFFSET(compound, a), dset_array_a);
H5Tclose(dset_array_a);
- dset_array_ndims = 1; dset_array_b_dims[0] = 6;
- dset_array_b = H5Tarray_create2(H5T_STD_I32LE, dset_array_ndims, dset_array_b_dims);
+ dset_array_ndims = 1;
+ dset_array_b_dims[0] = 6;
+ dset_array_b = H5Tarray_create2(H5T_STD_I32LE, dset_array_ndims, dset_array_b_dims);
H5Tinsert(type, "b", HOFFSET(compound, b), dset_array_b);
H5Tclose(dset_array_b);
- dset_array_ndims = 2; dset_array_c_dims[0] = 2; dset_array_c_dims[1] = 4;
- dset_array_c = H5Tarray_create2(H5T_IEEE_F32LE, dset_array_ndims, dset_array_c_dims);
+ dset_array_ndims = 2;
+ dset_array_c_dims[0] = 2;
+ dset_array_c_dims[1] = 4;
+ dset_array_c = H5Tarray_create2(H5T_IEEE_F32LE, dset_array_ndims, dset_array_c_dims);
H5Tinsert(type, "c", HOFFSET(compound, c), dset_array_c);
H5Tclose(dset_array_c);
@@ -10366,16 +10632,16 @@ static void gent_compound_complex2(void)
H5Tinsert(cmpd_tid1, "nested_double", HOFFSET(nested_compound, nested_a), H5T_IEEE_F64LE);
- dims[0] = 1;
+ dims[0] = 1;
str_type = mkstr(23, H5T_STR_NULLTERM);
- array = H5Tarray_create2(str_type, 1, dims);
+ array = H5Tarray_create2(str_type, 1, dims);
H5Tinsert(cmpd_tid1, "nested_string", HOFFSET(nested_compound, nested_string), array);
H5Tclose(array);
H5Tclose(str_type);
- dims[0] = 4;
+ dims[0] = 4;
str_type = mkstr(12, H5T_STR_NULLTERM);
- array = H5Tarray_create2(str_type, 1, dims);
+ array = H5Tarray_create2(str_type, 1, dims);
H5Tinsert(cmpd_tid1, "nested_string_array", HOFFSET(nested_compound, nested_string_array), array);
H5Tclose(array);
H5Tclose(str_type);
@@ -10391,7 +10657,7 @@ static void gent_compound_complex2(void)
nest1 = H5Tcreate(H5T_COMPOUND, sizeof(further_nested));
dims[0] = 5;
- array = H5Tarray_create2(H5T_STD_U32LE, 1, dims);
+ array = H5Tarray_create2(H5T_STD_U32LE, 1, dims);
H5Tinsert(nest1, "nested_unsigned_int", HOFFSET(further_nested, multiple_nested_a), array);
H5Tclose(array);
@@ -10413,17 +10679,18 @@ static void gent_compound_complex2(void)
/* Add second further nested compound */
nest2 = H5Tcreate(H5T_COMPOUND, sizeof(further_nested2));
- dims[0] = 1;
+ dims[0] = 1;
str_type = mkstr(11, H5T_STR_NULLTERM);
- array = H5Tarray_create2(str_type, 1, dims);
+ array = H5Tarray_create2(str_type, 1, dims);
H5Tinsert(nest2, "nested_string", HOFFSET(further_nested2, further_nested_string), array);
H5Tclose(array);
H5Tclose(str_type);
- dims[0] = 4;
+ dims[0] = 4;
str_type = mkstr(13, H5T_STR_NULLTERM);
- array = H5Tarray_create2(str_type, 1, dims);
- H5Tinsert(nest2, "nested_string_array", HOFFSET(further_nested2, further_nested_string_array), array);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(nest2, "nested_string_array", HOFFSET(further_nested2, further_nested_string_array),
+ array);
H5Tclose(array);
H5Tclose(str_type);
@@ -10431,8 +10698,9 @@ static void gent_compound_complex2(void)
cmpd_tid3 = H5Tcreate(H5T_COMPOUND, sizeof(third_level_compound));
dims[0] = 10;
- array = H5Tarray_create2(H5T_STD_I16LE, 1, dims);
- H5Tinsert(cmpd_tid3, "deep_nested_short", HOFFSET(third_level_compound, deep_nested_short), array);
+ array = H5Tarray_create2(H5T_STD_I16LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_short", HOFFSET(third_level_compound, deep_nested_short),
+ array);
H5Tclose(array);
array = H5Tarray_create2(H5T_STD_I32LE, 1, dims);
@@ -10444,11 +10712,13 @@ static void gent_compound_complex2(void)
H5Tclose(array);
array = H5Tarray_create2(H5T_IEEE_F64LE, 1, dims);
- H5Tinsert(cmpd_tid3, "deep_nested_double", HOFFSET(third_level_compound, deep_nested_double), array);
+ H5Tinsert(cmpd_tid3, "deep_nested_double", HOFFSET(third_level_compound, deep_nested_double),
+ array);
H5Tclose(array);
array = H5Tarray_create2(H5T_IEEE_F32LE, 1, dims);
- H5Tinsert(cmpd_tid3, "deep_nested_float", HOFFSET(third_level_compound, deep_nested_float), array);
+ H5Tinsert(cmpd_tid3, "deep_nested_float", HOFFSET(third_level_compound, deep_nested_float),
+ array);
H5Tclose(array);
H5Tinsert(nest2, "deep_nested_compound", HOFFSET(further_nested2, deep_nest), cmpd_tid3);
@@ -10458,19 +10728,19 @@ static void gent_compound_complex2(void)
H5Tinsert(type, "multiple_nested_compound", HOFFSET(compound, e), cmpd_tid2);
-
- if ((dset = H5Dcreate2(file, F82_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++) {
+ if ((dset = H5Dcreate2(file, F82_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
for (j = 0; j < dset_array_a_dims[0]; j++)
- buf[i].a[j] = (unsigned int)(j + i*10);
+ buf[i].a[j] = (unsigned int)(j + i * 10);
for (j = 0; j < dset_array_b_dims[0]; j++)
- buf[i].b[j] = (int)(j - i*10);
+ buf[i].b[j] = (int)(j - i * 10);
for (j = 0; j < dset_array_c_dims[0]; j++)
for (k = 0; k < dset_array_c_dims[1]; k++)
- buf[i].c[j][k] = (float)(j + k + i*10) + (float)(j) * 0.1F;
+ buf[i].c[j][k] = (float)(j + k + i * 10) + (float)(j)*0.1F;
/* Set up first nested compound */
- buf[i].d.nested_a = (double) i;
+ buf[i].d.nested_a = (double)i;
HDstrcpy(buf[i].d.nested_string, "This is a test string.");
@@ -10478,13 +10748,13 @@ static void gent_compound_complex2(void)
HDstrcpy(buf[i].d.nested_string_array[j], "String test");
/* Set up multiple nested compound */
- buf[i].e.a = (float) i;
+ buf[i].e.a = (float)i;
for (j = 0; j < 5; j++) {
- buf[i].e.b.multiple_nested_a[j] = (unsigned int)(j + i*10);
- buf[i].e.b.multiple_nested_b[j] = (int)(j - i*10);
- buf[i].e.b.multiple_nested_c[j] = (unsigned long)(j + i*10);
- buf[i].e.b.multiple_nested_d[j] = (long)(j - i*10);
+ buf[i].e.b.multiple_nested_a[j] = (unsigned int)(j + i * 10);
+ buf[i].e.b.multiple_nested_b[j] = (int)(j - i * 10);
+ buf[i].e.b.multiple_nested_c[j] = (unsigned long)(j + i * 10);
+ buf[i].e.b.multiple_nested_d[j] = (long)(j - i * 10);
}
HDstrcpy(buf[i].e.c.further_nested_string, "1234567890");
@@ -10492,11 +10762,11 @@ static void gent_compound_complex2(void)
HDstrcpy(buf[i].e.c.further_nested_string_array[j], "STRING ARRAY");
for (j = 0; j < 10; j++) {
- buf[i].e.c.deep_nest.deep_nested_short[j] = (short)(j + i*10);
- buf[i].e.c.deep_nest.deep_nested_int[j] = (int)(j - i*10);
- buf[i].e.c.deep_nest.deep_nested_long[j] = (long)(j + i*10);
- buf[i].e.c.deep_nest.deep_nested_double[j] = (double)(j + i*10);
- buf[i].e.c.deep_nest.deep_nested_float[j] = (float)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_short[j] = (short)(j + i * 10);
+ buf[i].e.c.deep_nest.deep_nested_int[j] = (int)(j - i * 10);
+ buf[i].e.c.deep_nest.deep_nested_long[j] = (long)(j + i * 10);
+ buf[i].e.c.deep_nest.deep_nested_double[j] = (double)(j + i * 10);
+ buf[i].e.c.deep_nest.deep_nested_float[j] = (float)(j + i * 10);
}
}
@@ -10514,74 +10784,71 @@ static void gent_compound_complex2(void)
}
/* CompoundComplex2D */
-/* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
- H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
- H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
- H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
- H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
- if ((space = H5Screate_simple(F82_RANK2, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++) {
- buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
- buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
- buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
- buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
- }
+ /* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+ H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+ H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+ H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+ H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+ if ((space = H5Screate_simple(F82_RANK2, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) { buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+ buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+ buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+ buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+ }
- H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
- H5Dclose(dset);
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
}
- H5Sclose(space);
+ H5Tclose(type);
}
- H5Tclose(type);
- }
-*/
+ */
/* CompoundComplex3D */
-/* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
- H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
- H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
- H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
- H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
- if ((space = H5Screate_simple(F82_RANK3, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++) {
- buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
- buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
- buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
- buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
- }
+ /* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+ H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+ H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+ H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+ H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+ if ((space = H5Screate_simple(F82_RANK3, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) { buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+ buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+ buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+ buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+ }
- H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
- H5Dclose(dset);
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
}
- H5Sclose(space);
+ H5Tclose(type);
}
- H5Tclose(type);
- }
-*/
+ */
/* CompoundComplex4D */
-/* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
- H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
- H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
- H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
- H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
- if ((space = H5Screate_simple(F82_RANK4, &nelmts, NULL)) >= 0) {
- if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- for(i = 0; i < nelmts; i++) {
- buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
- buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
- buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
- buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
- }
+ /* if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+ H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+ H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+ H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+ H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+ if ((space = H5Screate_simple(F82_RANK4, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) { buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+ buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+ buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+ buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+ }
- H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
- H5Dclose(dset);
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
}
- H5Sclose(space);
+ H5Tclose(type);
}
- H5Tclose(type);
- }
-*/
+ */
H5Fclose(file);
HDfree(buf);
@@ -10594,32 +10861,30 @@ static void gent_compound_complex2(void)
* length strings.
*-------------------------------------------------------------------------
*/
-static void gent_vlenstr_array(void)
+static void
+gent_vlenstr_array(void)
{
/* Compound datatype with different member types */
- typedef struct compound
- {
+ typedef struct compound {
/* Array of variable-length strings*/
const char *vlen_array[F83_ARRAYDIM];
} compound;
- compound buf[F83_DIM];
+ compound buf[F83_DIM];
const char *test[F83_ARRAYDIM] = {
- "This is a variable-length test string.",
- "This test string is also variable-length.",
- "A final test of variable-length strings. This string is longer than the others."
- };
- const char *buffer[F83_DIM*F83_ARRAYDIM];
+ "This is a variable-length test string.", "This test string is also variable-length.",
+ "A final test of variable-length strings. This string is longer than the others."};
+ const char *buffer[F83_DIM * F83_ARRAYDIM];
- hid_t file, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
+ hid_t file, type = H5I_INVALID_HID, space = H5I_INVALID_HID, dset = H5I_INVALID_HID;
hid_t cmpd_tid1, array_tid;
- int i, j;
+ int i, j;
hsize_t dims[] = {F83_DIM}, arraydim[] = {F83_ARRAYDIM};
/* Initialize scalar data */
for (i = 0; i < F83_DIM; i++)
for (j = 0; j < 3; j++)
- buffer[j + 3*i] = test[j];
+ buffer[j + 3 * i] = test[j];
/* Initialize compound data */
for (i = 0; i < F83_DIM; i++)
@@ -10634,7 +10899,8 @@ static void gent_vlenstr_array(void)
/* ScalarArrayOfVlenStr */
if ((type = H5Tarray_create2(array_tid, F83_RANK, arraydim)) >= 0) {
- if ((dset = H5Dcreate2(file, F83_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(file, F83_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
HDfprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n");
@@ -10655,7 +10921,8 @@ static void gent_vlenstr_array(void)
array_tid = H5Tarray_create2(cmpd_tid1, F83_RANK, arraydim);
H5Tinsert(type, "vlen_str_array", HOFFSET(compound, vlen_array), array_tid);
- if ((dset = H5Dcreate2(file, F83_DATASETNAME2, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((dset = H5Dcreate2(file, F83_DATASETNAME2, type, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) >= 0) {
if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
HDfprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n");
@@ -10676,34 +10943,35 @@ static void gent_vlenstr_array(void)
* Purpose: Generate a file to be used in testing user defined filter plugin3.
*-------------------------------------------------------------------------
*/
-static void gent_udfilter(void)
+static void
+gent_udfilter(void)
{
- hid_t fid; /* file id */
- hid_t dcpl; /* dataset creation property list */
- hid_t dsid; /* dataset ID */
- hid_t sid; /* dataspace ID */
-
- hsize_t dims1[RANK] = {DIM1,DIM2};
- hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
- int buf1[DIM1][DIM2];
- int i, j, n;
- int H5_ATTR_NDEBUG_UNUSED ret;
-
- for(i=n=0; i<DIM1; i++){
- for(j=0; j<DIM2; j++){
- buf1[i][j]=n++;
+ hid_t fid; /* file id */
+ hid_t dcpl; /* dataset creation property list */
+ hid_t dsid; /* dataset ID */
+ hid_t sid; /* dataspace ID */
+
+ hsize_t dims1[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int buf1[DIM1][DIM2];
+ int i, j, n;
+ int H5_ATTR_NDEBUG_UNUSED ret;
+
+ for (i = n = 0; i < DIM1; i++) {
+ for (j = 0; j < DIM2; j++) {
+ buf1[i][j] = n++;
}
}
/* create a file */
- fid = H5Fcreate(FILE84, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(fid>=0);
+ fid = H5Fcreate(FILE84, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
/* create a space */
sid = H5Screate_simple(SPACE2_RANK, dims1, NULL);
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- HDassert(dcpl>=0);
+ HDassert(dcpl >= 0);
ret = H5Pset_layout(dcpl, H5D_CHUNKED);
HDassert(ret >= 0);
@@ -10711,10 +10979,10 @@ static void gent_udfilter(void)
ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims);
HDassert(ret >= 0);
- ret = H5Zregister (H5Z_DYNLIBUD);
+ ret = H5Zregister(H5Z_DYNLIBUD);
HDassert(ret >= 0);
- ret = H5Pset_filter (dcpl, H5Z_FILTER_DYNLIBUD, H5Z_FLAG_MANDATORY, 0, NULL);
+ ret = H5Pset_filter(dcpl, H5Z_FILTER_DYNLIBUD, H5Z_FLAG_MANDATORY, 0, NULL);
HDassert(ret >= 0);
/* create the dataset */
@@ -10761,38 +11029,37 @@ static void gent_udfilter(void)
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- char *int_ptr = (char *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ char * int_ptr = (char *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
- if(cd_nelmts > 0)
- return(0);
+ if (cd_nelmts > 0)
+ return (0);
/* Assignment to eliminate unused parameter warning. */
- cd_values = cd_values;
+ (void)cd_values;
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp - MULTIPLIER);
+ *int_ptr = (int8_t)(temp - MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp + MULTIPLIER);
+ *int_ptr = (int8_t)(temp + MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlibud() */
@@ -10809,13 +11076,14 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
* Purpose: generates dataset and attribute of null dataspace in a group
*-------------------------------------------------------------------------
*/
-static void gent_null_space_group(void)
+static void
+gent_null_space_group(void)
{
hid_t fid, root, group, dataset, space, attr;
- int dset_buf = 10;
- int point = 4;
+ int dset_buf = 10;
+ int point = 4;
- fid = H5Fcreate(FILE85, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE85, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -10840,7 +11108,8 @@ static void gent_null_space_group(void)
H5Fclose(fid);
}
-int main(void)
+int
+main(void)
{
gent_group();
gent_attribute();
@@ -10903,6 +11172,7 @@ int main(void)
gent_aindices();
gent_longlinks();
gent_ldouble();
+ gent_ldouble_scalar();
gent_binary();
gent_bigdims();
gent_hyperslab();
@@ -10926,6 +11196,7 @@ int main(void)
gent_compound_ints();
gent_intattrscalars();
gent_intsattrs();
+ gent_floatsattrs();
gent_bitnopaquefields();
gent_nodata();
@@ -10936,4 +11207,3 @@ int main(void)
return 0;
}
-
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index 1704e1e..82b379c 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -130,6 +130,7 @@ $SRC_H5DUMP_TESTFILES/tfamily00010.h5
$SRC_H5DUMP_TESTFILES/tfcontents1.h5
$SRC_H5DUMP_TESTFILES/tfcontents2.h5
$SRC_H5DUMP_TESTFILES/tfilters.h5
+$SRC_H5DUMP_TESTFILES/tfloatsattrs.h5
$SRC_H5DUMP_TESTFILES/tfpformat.h5
$SRC_H5DUMP_TESTFILES/tfvalues.h5
$SRC_H5DUMP_TESTFILES/tgroup.h5
@@ -140,7 +141,8 @@ $SRC_H5DUMP_TESTFILES/thyperslab.h5
$SRC_H5DUMP_TESTFILES/tintsattrs.h5
$SRC_H5DUMP_TESTFILES/tints4dims.h5
$SRC_H5DUMP_TESTFILES/tlarge_objname.h5
-#$SRC_H5DUMP_TESTFILES/tldouble.h5
+$SRC_H5DUMP_TESTFILES/tldouble.h5
+$SRC_H5DUMP_TESTFILES/tldouble_scalar.h5
$SRC_H5DUMP_TESTFILES/tlonglinks.h5
$SRC_H5DUMP_TESTFILES/tloop.h5
$SRC_H5DUMP_TESTFILES/tmulti-b.h5
@@ -177,6 +179,8 @@ $SRC_H5DUMP_TESTFILES/tvldtypes5.h5
$SRC_H5DUMP_TESTFILES/tvlenstr_array.h5
$SRC_H5DUMP_TESTFILES/tvlstr.h5
$SRC_H5DUMP_TESTFILES/tvms.h5
+$SRC_H5DUMP_TESTFILES/tCVE_2018_11206_fill_old.h5
+$SRC_H5DUMP_TESTFILES/tCVE_2018_11206_fill_new.h5
"
LIST_OTHER_TEST_FILES="
@@ -259,6 +263,7 @@ $SRC_H5DUMP_TESTFILES/textlink.ddl
$SRC_H5DUMP_TESTFILES/tfamily.ddl
$SRC_H5DUMP_TESTFILES/tfill.ddl
$SRC_H5DUMP_TESTFILES/tfletcher32.ddl
+$SRC_H5DUMP_TESTFILES/tfloatsattrs.ddl
$SRC_H5DUMP_TESTFILES/tfpformat.ddl
$SRC_H5DUMP_TESTFILES/tgroup-1.ddl
$SRC_H5DUMP_TESTFILES/tgroup-2.ddl
@@ -284,7 +289,8 @@ $SRC_H5DUMP_TESTFILES/tints4dimsCountEq.ddl
$SRC_H5DUMP_TESTFILES/tints4dimsStride2.ddl
$SRC_H5DUMP_TESTFILES/tintsattrs.ddl
$SRC_H5DUMP_TESTFILES/tlarge_objname.ddl
-#$SRC_H5DUMP_TESTFILES/tldouble.ddl
+$SRC_H5DUMP_TESTFILES/tldouble.ddl
+$SRC_H5DUMP_TESTFILES/tldouble_scalar.ddl
$SRC_H5DUMP_TESTFILES/tlonglinks.ddl
$SRC_H5DUMP_TESTFILES/tloop-1.ddl
$SRC_H5DUMP_TESTFILES/tmulti.ddl
@@ -861,6 +867,35 @@ TOOLTEST5() {
fi
}
+# same as TOOLTEST1 but expects h5dump to fail
+#
+TOOLTEST_FAIL() {
+
+ infile=$1
+ expect="$TESTDIR/`basename $1 exp`.ddl"
+ actual="$TESTDIR/`basename $1 .exp`.out"
+
+ # Run test.
+ TESTING $DUMPER $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@" $infile
+ ) >&$actual
+ RET=$?
+ # Segfault occurred
+ if [ $RET == 139 ] ; then
+ nerrors="`expr $nerrors + 1`"
+ echo "*FAILED - test on $infile failed with segmentation fault"
+ # Should fail but didn't
+ elif [ $RET == 0 ] ; then
+ nerrors="`expr $nerrors + 1`"
+ echo "*FAILED - test on $infile did not fail as expected"
+ else
+ echo " PASSED"
+ fi
+
+}
+
# ADD_HELP_TEST
TOOLTEST_HELP() {
@@ -1344,7 +1379,9 @@ TOOLTEST tgrpnullspace.ddl -p --enable-error-stack tgrpnullspace.h5
TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5
# test for long double (some systems do not have long double)
-#TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5
+TOOLTEST tfloatsattrs.ddl -p --enable-error-stack tfloatsattrs.h5
+TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5
+TOOLTEST tldouble_scalar.ddl -p --enable-error-stack tldouble_scalar.h5
# test for vms
TOOLTEST tvms.ddl --enable-error-stack tvms.h5
@@ -1433,7 +1470,11 @@ TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1
TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5
# test to verify HDFFV-9407: long double full precision
-GREPTEST OUTTXT "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5
+#GREPTEST OUTTXT "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5
+
+# test to verify HDFFV-10480: out of bounds read in H5O_fill_new[old]_decode
+TOOLTEST_FAIL tCVE_2018_11206_fill_old.h5
+TOOLTEST_FAIL tCVE_2018_11206_fill_new.h5
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR
diff --git a/tools/test/h5dump/testh5dumppbits.sh.in b/tools/test/h5dump/testh5dumppbits.sh.in
index ff0659a..6689749 100644
--- a/tools/test/h5dump/testh5dumppbits.sh.in
+++ b/tools/test/h5dump/testh5dumppbits.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5dump/testh5dumpvds.sh.in b/tools/test/h5dump/testh5dumpvds.sh.in
index 29ff238..f2c486e 100644
--- a/tools/test/h5dump/testh5dumpvds.sh.in
+++ b/tools/test/h5dump/testh5dumpvds.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5dump/testh5dumpxml.sh.in b/tools/test/h5dump/testh5dumpxml.sh.in
index 52a13c2..447c819 100644
--- a/tools/test/h5dump/testh5dumpxml.sh.in
+++ b/tools/test/h5dump/testh5dumpxml.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt
index 99420d8..34a3c7b 100644
--- a/tools/test/h5format_convert/CMakeLists.txt
+++ b/tools/test/h5format_convert/CMakeLists.txt
@@ -5,7 +5,7 @@ project (HDF5_TOOLS_TEST_H5FC C)
# Add the h5format_convert test executables
# --------------------------------------------------------------------
add_executable (h5fc_chk_idx ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_chk_idx.c)
-target_include_directories (h5fc_chk_idx PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (h5fc_chk_idx PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5fc_chk_idx STATIC)
target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -15,13 +15,27 @@ else ()
endif ()
set_target_properties (h5fc_chk_idx PROPERTIES FOLDER tools)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5FC_h5fc_chk_idx_FORMAT h5fc_chk_idx)
+endif ()
+
if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5fc_gentest ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_gentest.c)
- target_include_directories (h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5fc_gentest STATIC)
target_link_libraries (h5fc_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools)
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5FC_FORMAT h5fc_gentest)
+ endif ()
+
#add_test (NAME h5fc_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5fc_gentest>)
endif ()
diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake
index 7bc33ce..00a28bb 100644
--- a/tools/test/h5format_convert/CMakeTests.cmake
+++ b/tools/test/h5format_convert/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5format_convert/Makefile.am b/tools/test/h5format_convert/Makefile.am
index eb2d5af..1922399 100644
--- a/tools/test/h5format_convert/Makefile.am
+++ b/tools/test/h5format_convert/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/h5format_convert/Makefile.in b/tools/test/h5format_convert/Makefile.in
index d93cf39..721b42c 100644
--- a/tools/test/h5format_convert/Makefile.in
+++ b/tools/test/h5format_convert/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -114,6 +114,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -421,12 +422,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -464,11 +465,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -500,8 +546,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -515,7 +559,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -525,6 +571,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -718,7 +765,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1244,8 +1291,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/h5format_convert/h5fc_chk_idx.c b/tools/test/h5format_convert/h5fc_chk_idx.c
index 2fbbec4..26a0fb9 100644
--- a/tools/test/h5format_convert/h5fc_chk_idx.c
+++ b/tools/test/h5format_convert/h5fc_chk_idx.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -43,16 +43,16 @@ usage(void)
int
main(int argc, char *argv[])
{
- char *fname = NULL;
- char *dname = NULL;
- hid_t fid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
+ char * fname = NULL;
+ char * dname = NULL;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
H5D_chunk_index_t idx_type;
/* h5fc_chk_idx fname dname */
- if(argc != 3) {
- usage();
- HDexit(EXIT_FAILURE);
+ if (argc != 3) {
+ usage();
+ HDexit(EXIT_FAILURE);
} /* end if */
/* Duplicate the file name & dataset name */
@@ -60,42 +60,41 @@ main(int argc, char *argv[])
dname = HDstrdup(argv[2]);
/* Try opening the file */
- if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) {
- HDfprintf(stderr, "h5fc_chk_idx: unable to open the file\n");
- HDexit(EXIT_FAILURE);
+ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to open the file\n");
+ HDexit(EXIT_FAILURE);
} /* end if */
/* Open the dataset */
- if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) {
- HDfprintf(stderr, "h5fc_chk_idx: unable to open the dataset\n");
- HDexit(EXIT_FAILURE);
+ if ((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to open the dataset\n");
+ HDexit(EXIT_FAILURE);
} /* end if */
/* Get the dataset's chunk indexing type */
- if(H5Dget_chunk_index_type(did, &idx_type) < 0) {
- HDfprintf(stderr, "h5fc_chk_idx: unable to get chunk index type for the dataset\n");
- HDexit(EXIT_FAILURE);
+ if (H5Dget_chunk_index_type(did, &idx_type) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to get chunk index type for the dataset\n");
+ HDexit(EXIT_FAILURE);
} /* end if */
/* Close the dataset */
- if(H5Dclose(did) < 0) {
- HDfprintf(stderr, "h5fc_chk_idx: unable to close the dataset\n");
- HDexit(EXIT_FAILURE);
+ if (H5Dclose(did) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to close the dataset\n");
+ HDexit(EXIT_FAILURE);
} /* end if */
/* Close the file */
- if(H5Fclose(fid) < 0) {
- HDfprintf(stderr, "h5fc_chk_idx_type: cannot close the file\n");
- HDexit(EXIT_FAILURE);
+ if (H5Fclose(fid) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx_type: cannot close the file\n");
+ HDexit(EXIT_FAILURE);
} /* end if */
/* Return success when the chunk indexing type is version 1 B-tree */
- if(idx_type == H5D_CHUNK_IDX_BTREE)
- HDexit(EXIT_SUCCESS);
+ if (idx_type == H5D_CHUNK_IDX_BTREE)
+ HDexit(EXIT_SUCCESS);
else {
- HDfprintf(stderr, "Error: chunk indexing type is %d\n", idx_type);
- HDexit(EXIT_FAILURE);
+ HDfprintf(stderr, "Error: chunk indexing type is %d\n", idx_type);
+ HDexit(EXIT_FAILURE);
} /* end if */
} /* main() */
-
diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c
index 1e9e2cf..09cca45 100644
--- a/tools/test/h5format_convert/h5fc_gentest.c
+++ b/tools/test/h5format_convert/h5fc_gentest.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,45 +24,42 @@
#include "hdf5.h"
#include "H5private.h"
-#define NON_V3_FILE "h5fc_non_v3.h5"
-#define EDGE_V3_FILE "h5fc_edge_v3.h5"
-#define ERR_LEVEL_FILE "h5fc_err_level.h5"
-
-const char *FILENAME[] = {
- "h5fc_ext1_i.h5", /* 0 */
- "h5fc_ext1_s.h5", /* 1 */
- "h5fc_ext1_f.h5", /* 2 */
- "h5fc_ext2_is.h5", /* 3 */
- "h5fc_ext2_if.h5", /* 4 */
- "h5fc_ext2_sf.h5", /* 5 */
- "h5fc_ext3_isf.h5", /* 6 */
- "h5fc_ext_none.h5", /* 7 */
- NULL
-};
-
-#define GROUP "GROUP"
-
-#define DSET_COMPACT "DSET_COMPACT"
-#define DSET_CONTIGUOUS "DSET_CONTIGUOUS"
-
-#define DSET_EA "DSET_EA"
-#define DSET_NDATA_EA "DSET_NDATA_EA"
+#define NON_V3_FILE "h5fc_non_v3.h5"
+#define EDGE_V3_FILE "h5fc_edge_v3.h5"
+#define ERR_LEVEL_FILE "h5fc_err_level.h5"
+
+const char *FILENAME[] = {"h5fc_ext1_i.h5", /* 0 */
+ "h5fc_ext1_s.h5", /* 1 */
+ "h5fc_ext1_f.h5", /* 2 */
+ "h5fc_ext2_is.h5", /* 3 */
+ "h5fc_ext2_if.h5", /* 4 */
+ "h5fc_ext2_sf.h5", /* 5 */
+ "h5fc_ext3_isf.h5", /* 6 */
+ "h5fc_ext_none.h5", /* 7 */
+ NULL};
+
+#define GROUP "GROUP"
+
+#define DSET_COMPACT "DSET_COMPACT"
+#define DSET_CONTIGUOUS "DSET_CONTIGUOUS"
+
+#define DSET_EA "DSET_EA"
+#define DSET_NDATA_EA "DSET_NDATA_EA"
#define DSET_BT2 "DSET_BT2"
-#define DSET_NDATA_BT2 "DSET_NDATA_BT2"
-#define DSET_FA "DSET_FA"
-#define DSET_NDATA_FA "DSET_NDATA_FA"
-#define DSET_NONE "DSET_NONE"
-#define DSET_NDATA_NONE "DSET_NDATA_NONE"
+#define DSET_NDATA_BT2 "DSET_NDATA_BT2"
+#define DSET_FA "DSET_FA"
+#define DSET_NDATA_FA "DSET_NDATA_FA"
+#define DSET_NONE "DSET_NONE"
+#define DSET_NDATA_NONE "DSET_NDATA_NONE"
-#define DSET_EDGE "DSET_EDGE"
-#define DSET_ERR "DSET_ERR"
+#define DSET_EDGE "DSET_EDGE"
+#define DSET_ERR "DSET_ERR"
#define ISTORE_IK 64
#define ISTORE_ERR 1
#define NUM 500
-
/*
* Function: gen_non()
*
@@ -77,42 +74,42 @@ const char *FILENAME[] = {
static void
gen_non(const char *fname)
{
- hid_t fid = H5I_INVALID_HID; /* file id */
- hid_t fcpl = H5I_INVALID_HID; /* file creation property list */
- hid_t gid = H5I_INVALID_HID; /* group id */
- hid_t sid = H5I_INVALID_HID; /* space id */
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
- hid_t did1 = -1, did2 = H5I_INVALID_HID; /* dataset id */
- hsize_t dims1[1] = {10}; /* dataset dimension */
- hsize_t dims2[2] = {4, 6}; /* dataset dimension */
- hsize_t max_dims[2]; /* maximum dataset dimension */
- hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
- int i; /* local index variable */
- int buf[24]; /* data buffer */
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t fcpl = H5I_INVALID_HID; /* file creation property list */
+ hid_t gid = H5I_INVALID_HID; /* group id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
+ hid_t did1 = -1, did2 = H5I_INVALID_HID; /* dataset id */
+ hsize_t dims1[1] = {10}; /* dataset dimension */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t max_dims[2]; /* maximum dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto error;
- if(H5Pset_shared_mesg_nindexes(fcpl, 4) < 0)
+ if (H5Pset_shared_mesg_nindexes(fcpl, 4) < 0)
goto error;
- if(H5Pset_istore_k(fcpl, 64) < 0)
+ if (H5Pset_istore_k(fcpl, 64) < 0)
goto error;
/* Create an empty file with latest-format */
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, fcpl, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, fcpl, H5P_DEFAULT)) < 0)
goto error;
/* Create a group */
- if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create data */
- for(i = 0; i < 24; i++)
+ for (i = 0; i < 24; i++)
buf[i] = i;
/* Set chunk */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, c_dims) < 0)
goto error;
/*
@@ -122,17 +119,17 @@ gen_non(const char *fname)
/* Create dataspace */
max_dims[0] = 10;
max_dims[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
goto error;
/* Create the dataset */
- if((did1 = H5Dcreate2(fid, DSET_NDATA_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, DSET_NDATA_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Closing */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
goto error;
/*
@@ -143,35 +140,35 @@ gen_non(const char *fname)
max_dims[0] = 10;
max_dims[0] = H5S_UNLIMITED;
max_dims[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
goto error;
/* Create the dataset */
- if((did1 = H5Dcreate2(gid, DSET_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(gid, DSET_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write to the dataset */
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/* Closing */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
/* Re-open the file with old format */
- if((fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto error;
/* Open the group */
- if((gid = H5Gopen2(fid, GROUP, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gopen2(fid, GROUP, H5P_DEFAULT)) < 0)
goto error;
/*
@@ -179,23 +176,23 @@ gen_non(const char *fname)
*/
/* Set chunk */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, c_dims) < 0)
goto error;
/* Create dataspace */
max_dims[0] = H5S_UNLIMITED;
max_dims[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
goto error;
/* Create the dataset */
- if((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Close the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
/*
@@ -205,25 +202,25 @@ gen_non(const char *fname)
/* Create dataspace */
max_dims[0] = 10;
max_dims[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
goto error;
/* Create the dataset */
- if((did2 = H5Dcreate2(gid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(gid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write to the dataset */
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/* Closing */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
goto error;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
goto error;
/*
@@ -231,61 +228,64 @@ gen_non(const char *fname)
*/
/* Create dataspace */
- if((sid = H5Screate_simple(1, dims1, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims1, NULL)) < 0)
goto error;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_layout(dcpl, H5D_COMPACT) < 0)
+ if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
goto error;
/* Create the dataset */
- if((did1 = H5Dcreate2(gid, DSET_COMPACT, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(gid, DSET_COMPACT, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
goto error;
/* Closing */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
/*
* Create a contiguous dataset with (2d with data) in the file
*/
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0)
+ if (H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0)
goto error;
- if((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, NULL)) < 0)
goto error;
/* Create the dataset */
- if((did2 = H5Dcreate2(fid, DSET_CONTIGUOUS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, DSET_CONTIGUOUS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto error;
/* Write to the dataset */
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/* Closing */
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Gclose(gid) < 0)
- goto error;
- if(H5Pclose(fcpl) < 0)
- goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Gclose(gid) < 0)
+ goto error;
+ if (H5Pclose(fcpl) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
goto error;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(did1);
@@ -293,7 +293,8 @@ error:
H5Gclose(gid);
H5Fclose(fcpl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
} /* gen_non() */
@@ -307,75 +308,76 @@ error:
static void
gen_edge(const char *fname)
{
- hid_t fid = H5I_INVALID_HID; /* file id */
- hid_t fapl = H5I_INVALID_HID; /* file access property list */
- hid_t sid = H5I_INVALID_HID; /* dataspace id */
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
- hid_t did = H5I_INVALID_HID; /* dataset id */
- hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */
- hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */
- float buf[12][6]; /* Buffer for writing data */
- int i, j; /* local index variable */
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t fapl = H5I_INVALID_HID; /* file access property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
+ hid_t did = H5I_INVALID_HID; /* dataset id */
+ hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */
+ hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */
+ float buf[12][6]; /* Buffer for writing data */
+ int i, j; /* local index variable */
/* Create a new format file */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
/* Set chunk, filter, no-filter-edge-chunk */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, c_dims) < 0)
goto error;
- if(H5Pset_deflate(dcpl, 9) < 0)
+ if (H5Pset_deflate(dcpl, 9) < 0)
goto error;
- if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ if (H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
goto error;
/* Create dataspace */
- if((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, NULL)) < 0)
goto error;
/* Create the dataset */
- if((did = H5Dcreate2(fid, DSET_EDGE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_EDGE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Create data */
- for (i = 0; i< 12; i++)
- for (j = 0; j< 6; j++)
+ for (i = 0; i < 12; i++)
+ for (j = 0; j < 6; j++)
buf[i][j] = 100.0F;
/* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/* Closing */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(did);
H5Fclose(fid);
H5Pclose(fapl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
} /* gen_edge() */
-
/*
* Function: gen_err_level()
*
@@ -395,30 +397,30 @@ error:
static void
gen_err_level(const char *fname)
{
- hid_t fid = H5I_INVALID_HID; /* file ID */
- hid_t fapl = H5I_INVALID_HID; /* file access property list */
- hid_t fcpl = H5I_INVALID_HID; /* file creation property list */
- hid_t sid = H5I_INVALID_HID; /* dataspace id */
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
- hid_t did = H5I_INVALID_HID; /* dataset ID */
- hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
- hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
- unsigned char *buf = NULL; /* buffer for data */
- hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */
- hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */
- hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */
- int n = 0; /* local index variable */
+ hid_t fid = H5I_INVALID_HID; /* file ID */
+ hid_t fapl = H5I_INVALID_HID; /* file access property list */
+ hid_t fcpl = H5I_INVALID_HID; /* file creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
+ hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
+ unsigned char *buf = NULL; /* buffer for data */
+ hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */
+ hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */
+ hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */
+ int n = 0; /* local index variable */
/* Create a new format file */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
/* Set 'K' value to 1 in file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto error;
- if(H5Pset_istore_k(fcpl, ISTORE_ERR) < 0)
+ if (H5Pset_istore_k(fcpl, ISTORE_ERR) < 0)
goto error;
/* Initialize data buffer */
@@ -426,87 +428,88 @@ gen_err_level(const char *fname)
HDmemset(buf, 42, NUM * sizeof(unsigned char));
/* Create the test file */
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
goto error;
/* Create a chunked dataset with extensible array chunk index */
- if((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, max_dims)) < 0)
goto error;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
goto error;
- if((did = H5Dcreate2(fid, DSET_ERR, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET_ERR, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Closing */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
/* Re-open the file */
- if((fid = H5Fopen(fname, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(fname, H5F_ACC_RDWR, fapl)) < 0)
goto error;
/* Open the dataset */
- if((did = H5Dopen2(fid, DSET_ERR, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, DSET_ERR, H5P_DEFAULT)) < 0)
goto error;
/* Loop through appending 1 element at a time */
- for(n = 0; n < NUM; n++) {
- hsize_t start[2] = {0, 0};
- hsize_t count[2] = {1, 1};
- hsize_t extent[2] = {0, 0};
+ for (n = 0; n < NUM; n++) {
+ hsize_t start[2] = {0, 0};
+ hsize_t count[2] = {1, 1};
+ hsize_t extent[2] = {0, 0};
+
+ start[0] = 0;
+ start[1] = (hsize_t)n;
+ extent[0] = 1;
+ extent[1] = (hsize_t)(n + 1);
+
+ /* Set current dimension sizes for the dataset */
+ if (H5Dset_extent(did, extent) < 0)
+ goto error;
- start[0] = 0;
- start[1] = (hsize_t)n;
- extent[0] = 1;
- extent[1] = (hsize_t)(n + 1);
+ /* Set up memory dataspace */
+ if ((msid = H5Screate_simple(2, count, NULL)) < 0)
+ goto error;
- /* Set current dimension sizes for the dataset */
- if(H5Dset_extent(did, extent) < 0)
- goto error;
+ /* Get file dataspace */
+ if ((fsid = H5Dget_space(did)) < 0)
+ goto error;
- /* Set up memory dataspace */
- if((msid = H5Screate_simple(2, count, NULL)) < 0)
- goto error;
+ if ((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
+ goto error;
- /* Get file dataspace */
- if((fsid = H5Dget_space(did)) < 0)
- goto error;
+ /* Write to the dataset */
+ if (H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0)
+ goto error;
- if((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
- goto error;
+ if (H5Sclose(fsid) < 0)
+ goto error;
+ if (H5Sclose(msid) < 0)
+ goto error;
+ }
- /* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0)
+ /* Closing */
+ if (H5Dclose(did) < 0)
goto error;
-
- if(H5Sclose(fsid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
- if(H5Sclose(msid) < 0)
+ if (H5Pclose(fapl) < 0)
goto error;
- }
-
- /* Closing */
- if(H5Dclose(did) < 0)
- goto error;
- if(H5Fclose(fid) < 0)
- goto error;
- if(H5Pclose(fapl) < 0)
- goto error;
error:
- if(buf)
+ if (buf)
free(buf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(did);
@@ -515,7 +518,8 @@ error:
H5Fclose(fid);
H5Pclose(fapl);
H5Pclose(fcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
} /* gen_err_level() */
@@ -534,26 +538,26 @@ error:
static void
gen_ext(const char *fname, unsigned new_format, unsigned what)
{
- hid_t fid = H5I_INVALID_HID; /* file id */
- hid_t fapl = H5I_INVALID_HID; /* file access property list */
- hid_t fcpl = H5I_INVALID_HID; /* file creation property list */
- hid_t gid = H5I_INVALID_HID; /* group id */
- hid_t sid = H5I_INVALID_HID; /* space id */
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
- hid_t did1 = H5I_INVALID_HID, did2 = H5I_INVALID_HID; /* dataset id */
- hsize_t dims1[1] = {10}; /* dataset dimension */
- hsize_t dims2[2] = {4, 6}; /* dataset dimension */
- hsize_t max_dims[2]; /* maximum dataset dimension */
- hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
- int i; /* local index variable */
- int buf[24]; /* data buffer */
-
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto error;
-
- if(new_format) {
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t fapl = H5I_INVALID_HID; /* file access property list */
+ hid_t fcpl = H5I_INVALID_HID; /* file creation property list */
+ hid_t gid = H5I_INVALID_HID; /* group id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
+ hid_t did1 = H5I_INVALID_HID, did2 = H5I_INVALID_HID; /* dataset id */
+ hsize_t dims1[1] = {10}; /* dataset dimension */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t max_dims[2]; /* maximum dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
+
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ if (new_format) {
/* Create a new format file */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
} /* end if */
@@ -561,68 +565,68 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
fcpl = H5Pcreate(H5P_FILE_CREATE);
/* Generate messages that might be placed in superblock extension */
- switch(what) {
- case 0:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- break;
- case 1:
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- break;
- case 2:
- H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
- break;
- case 3:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- break;
- case 4:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1);
- break;
- case 5:
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- H5Pset_file_space_page_size(fcpl, (hsize_t)512);
- break;
- case 6:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
- break;
- default:
- break;
+ switch (what) {
+ case 0:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ break;
+ case 1:
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ break;
+ case 2:
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
+ break;
+ case 3:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ break;
+ case 4:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1);
+ break;
+ case 5:
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ H5Pset_file_space_page_size(fcpl, (hsize_t)512);
+ break;
+ case 6:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
+ break;
+ default:
+ break;
}
/* Create the file */
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
goto error;
/* Create a group */
- if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Set chunk */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, c_dims) < 0)
goto error;
-
/*
* Create a contiguous dataset
*/
/* Create dataspace */
- if((sid = H5Screate_simple(1, dims1, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims1, NULL)) < 0)
goto error;
/* Create the dataset */
- if((did1 = H5Dcreate2(fid, DSET_CONTIGUOUS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, DSET_CONTIGUOUS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto error;
/* Closing */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
goto error;
/*
@@ -633,33 +637,32 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
/* Create dataspace */
max_dims[0] = 10;
max_dims[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
goto error;
/* Create the 2 datasets */
- if((did1 = H5Dcreate2(gid, DSET_NDATA_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(gid, DSET_NDATA_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if((did2 = H5Dcreate2(fid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Create data */
- for(i = 0; i < 24; i++)
+ for (i = 0; i < 24; i++)
buf[i] = i;
/* Write to one dataset */
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/* Closing */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
goto error;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
goto error;
-
/*
* Create 2 chunked datasets with version 2 B-tree chunk indexing type
* (one with data; one without data)
@@ -669,26 +672,26 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
max_dims[0] = 10;
max_dims[0] = H5S_UNLIMITED;
max_dims[1] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
goto error;
/* Create the 2 datasets */
- if((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if((did2 = H5Dcreate2(gid, DSET_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(gid, DSET_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write to one dataset */
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/* Closing */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
goto error;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
goto error;
/*
@@ -699,70 +702,70 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
/* Create dataspace */
max_dims[0] = 20;
max_dims[1] = 10;
- if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
goto error;
/* Create the datasets */
- if((did1 = H5Dcreate2(fid, DSET_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, DSET_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if((did2 = H5Dcreate2(gid, DSET_NDATA_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(gid, DSET_NDATA_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write to the dataset */
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/* Closing */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
goto error;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
goto error;
-
/*
* Create 2 chunked datasets with implicit chunk indexing type
* (one with data; one without data)
*/
/* Create dataspace */
- if((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dims2, NULL)) < 0)
goto error;
/* Set early allocation */
- if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
goto error;
/* Create the 2 datasets */
- if((did1 = H5Dcreate2(fid, DSET_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, DSET_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if((did2 = H5Dcreate2(gid, DSET_NDATA_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(gid, DSET_NDATA_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write to one dataset */
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/* Closing */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
goto error;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(did1);
@@ -771,7 +774,8 @@ error:
H5Fclose(fid);
H5Pclose(fapl);
H5Pclose(fcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
} /* end gen_ext() */
@@ -790,19 +794,18 @@ main(void)
gen_err_level(ERR_LEVEL_FILE);
/* Generate old/new format file with/without messages in the superblock extension */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- for(i = 0; i < 8; i++) {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
+ for (i = 0; i < 8; i++) {
char filename[50];
HDmemset(filename, 0, sizeof(filename));
- if(!new_format)
+ if (!new_format)
HDstrcat(filename, "old_");
HDstrcat(filename, FILENAME[i]);
gen_ext(filename, new_format, i);
} /* end for */
- } /* end for */
+ } /* end for */
return 0;
} /* end main */
-
diff --git a/tools/test/h5format_convert/testh5fc.sh.in b/tools/test/h5format_convert/testh5fc.sh.in
index 2cdd445..762f43d 100644
--- a/tools/test/h5format_convert/testh5fc.sh.in
+++ b/tools/test/h5format_convert/testh5fc.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt
index f3991c5..e8b5bce 100644
--- a/tools/test/h5import/CMakeLists.txt
+++ b/tools/test/h5import/CMakeLists.txt
@@ -5,7 +5,7 @@ project (HDF5_TOOLS_TEST_H5IMPORT C)
# Add the h5import executables
# --------------------------------------------------------------------
add_executable (h5importtest ${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/h5importtest.c)
-target_include_directories (h5importtest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (h5importtest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5importtest STATIC)
target_link_libraries (h5importtest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -15,6 +15,13 @@ else ()
endif ()
set_target_properties (h5importtest PROPERTIES FOLDER tools)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5IMPORT_FORMAT h5importtest)
+endif ()
+
if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
include (CMakeTests.cmake)
endif ()
diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake
index 00d5009..ee1d401 100644
--- a/tools/test/h5import/CMakeTests.cmake
+++ b/tools/test/h5import/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5import/Makefile.am b/tools/test/h5import/Makefile.am
index 7c5371c..61e3548 100644
--- a/tools/test/h5import/Makefile.am
+++ b/tools/test/h5import/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/h5import/Makefile.in b/tools/test/h5import/Makefile.in
index 2b6a0e2..abf6d7d 100644
--- a/tools/test/h5import/Makefile.in
+++ b/tools/test/h5import/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -114,6 +114,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -417,12 +418,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -460,11 +461,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -496,8 +542,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -511,7 +555,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -521,6 +567,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -714,7 +761,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1229,8 +1276,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/h5import/h5importtest.c b/tools/test/h5import/h5importtest.c
index 580530a..e49125b 100644
--- a/tools/test/h5import/h5importtest.c
+++ b/tools/test/h5import/h5importtest.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -32,40 +32,40 @@
int
main(void)
{
- int nrow = 3, ncol = 4, npln = 5;
- int i, j, k;
- FILE *sp;
- char machine_order[3] = {0, 0, 0};
+ int nrow = 3, ncol = 4, npln = 5;
+ int i, j, k;
+ FILE *sp;
+ char machine_order[3] = {0, 0, 0};
- float row4[3], col4[4], pln4[5];
- float rowo4 = 11.0F, colo4 = 21.0F, plno4 = 51.0F;
- float rowi4 = 1.0F, coli4 = 2.0F, plni4 = 5.0F;
+ float row4[3], col4[4], pln4[5];
+ float rowo4 = 11.0F, colo4 = 21.0F, plno4 = 51.0F;
+ float rowi4 = 1.0F, coli4 = 2.0F, plni4 = 5.0F;
- int b32i3[5][3][4];
- int row4i[3], col4i[4], pln4i[5];
- int rowo4i = 11 , colo4i = 21 , plno4i = 51 ;
- int rowi4i = 1 , coli4i = 2 , plni4i = 5 ;
+ int b32i3[5][3][4];
+ int row4i[3], col4i[4], pln4i[5];
+ int rowo4i = 11, colo4i = 21, plno4i = 51;
+ int rowi4i = 1, coli4i = 2, plni4i = 5;
#ifdef H5_SIZEOF_LONG_LONG
long long row4i64[3], col4i64[4], pln4i64[5];
- long long rowo4i64 = (long long)11 , colo4i64 = (long long)21 , plno4i64 = (long long)51 ;
- long long rowi4i64 = (long long)1 , coli4i64 = (long long)2 , plni4i64 = (long long)5 ;
+ long long rowo4i64 = (long long)11, colo4i64 = (long long)21, plno4i64 = (long long)51;
+ long long rowi4i64 = (long long)1, coli4i64 = (long long)2, plni4i64 = (long long)5;
#endif
- short b16i3[5][3][4];
- short row4i16[3], col4i16[4], pln4i16[5];
- short rowo4i16 = (short)11 , colo4i16 = (short)21 , plno4i16 = (short)51 ;
- short rowi4i16 = (short)1 , coli4i16 = (short)2 , plni4i16 = (short)5 ;
+ short b16i3[5][3][4];
+ short row4i16[3], col4i16[4], pln4i16[5];
+ short rowo4i16 = (short)11, colo4i16 = (short)21, plno4i16 = (short)51;
+ short rowi4i16 = (short)1, coli4i16 = (short)2, plni4i16 = (short)5;
- char b8i3[5][3][4];
- char row4i8[3], col4i8[4], pln4i8[5];
- char rowo4i8 = (char)11 , colo4i8 = (char)21 , plno4i8 = (char)51 ;
- char rowi4i8 = (char)1 , coli4i8 = (char)2 , plni4i8 = (char)5 ;
+ char b8i3[5][3][4];
+ char row4i8[3], col4i8[4], pln4i8[5];
+ char rowo4i8 = (char)11, colo4i8 = (char)21, plno4i8 = (char)51;
+ char rowi4i8 = (char)1, coli4i8 = (char)2, plni4i8 = (char)5;
- double b64r3[5][3][4];
- double row8[3], col8[4], pln8[5];
- double rowo8 = 11.0F, colo8 = 21.0F, plno8 = 51.0F;
- double rowi8 = 1.0F, coli8 = 2.0F, plni8 = 5.0F;
+ double b64r3[5][3][4];
+ double row8[3], col8[4], pln8[5];
+ double rowo8 = 11.0, colo8 = 21.0, plno8 = 51.0;
+ double rowi8 = 1.0, coli8 = 2.0, plni8 = 5.0;
/* Initialize machine endian */
volatile uint32_t ibyte = 0x01234567;
@@ -76,19 +76,18 @@ main(void)
HDstrcpy(machine_order, "BE");
/*
- * initialize the row, column, and plane vectors
- *
- * row values start at 11 and increment by 1 => 11, 12, 13
- * column values start at 21 and increment by 2 => 21, 23, 25, 27
- * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71
- */
-
+ * initialize the row, column, and plane vectors
+ *
+ * row values start at 11 and increment by 1 => 11, 12, 13
+ * column values start at 21 and increment by 2 => 21, 23, 25, 27
+ * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71
+ */
/*
- * build array elements - rank 2
- *
- * element value = sum of row value and col values
- */
+ * build array elements - rank 2
+ *
+ * element value = sum of row value and col values
+ */
row4[0] = rowo4;
col4[0] = colo4;
@@ -116,46 +115,43 @@ main(void)
col4i8[0] = colo4i8;
pln4i8[0] = plno4i8;
- for (i = 1; i < nrow; i++)
- {
- row4[i] = row4[i - 1] + rowi4;
- row8[i] = row8[i - 1] + rowi8;
+ for (i = 1; i < nrow; i++) {
+ row4[i] = row4[i - 1] + rowi4;
+ row8[i] = row8[i - 1] + rowi8;
row4i[i] = row4i[i - 1] + rowi4i;
#ifdef H5_SIZEOF_LONG_LONG
row4i64[i] = row4i64[i - 1] + rowi4i64;
#endif
row4i16[i] = (short)(row4i16[i - 1] + rowi4i16);
- row4i8[i] = (char)(row4i8[i - 1] + rowi4i8);
+ row4i8[i] = (char)(row4i8[i - 1] + rowi4i8);
}
- for (j = 1; j < ncol; j++)
- {
- col4[j] = col4[j - 1] + coli4;
- col8[j] = col8[j - 1] + coli8;
+ for (j = 1; j < ncol; j++) {
+ col4[j] = col4[j - 1] + coli4;
+ col8[j] = col8[j - 1] + coli8;
col4i[j] = col4i[j - 1] + coli4i;
#ifdef H5_SIZEOF_LONG_LONG
col4i64[j] = col4i64[j - 1] + coli4i64;
#endif
col4i16[j] = (short)(col4i16[j - 1] + coli4i16);
- col4i8[j] = (char)(col4i8[j - 1] + coli4i8);
+ col4i8[j] = (char)(col4i8[j - 1] + coli4i8);
}
- for (k = 1; k < npln; k++)
- {
- pln4[k] = pln4[k - 1] + plni4;
- pln8[k] = pln8[k - 1] + plni8;
+ for (k = 1; k < npln; k++) {
+ pln4[k] = pln4[k - 1] + plni4;
+ pln8[k] = pln8[k - 1] + plni8;
pln4i[k] = pln4i[k - 1] + plni4i;
#ifdef H5_SIZEOF_LONG_LONG
pln4i64[k] = pln4i64[k - 1] + plni4i64;
#endif
pln4i16[k] = (short)(pln4i16[k - 1] + plni4i16);
- pln4i8[k] = (char)(pln4i8[k - 1] + plni4i8);
+ pln4i8[k] = (char)(pln4i8[k - 1] + plni4i8);
}
/*
- * build array elements - rank 3
- *
- * element value = sum of row value, col, and plane values
- */
+ * build array elements - rank 3
+ *
+ * element value = sum of row value, col, and plane values
+ */
for (i = 0; i < nrow; i++)
for (j = 0; j < ncol; j++)
@@ -163,296 +159,267 @@ main(void)
b64r3[k][i][j] = row8[i] + col8[j] + pln8[k];
b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k];
b16i3[k][i][j] = (short)(row4i16[i] + col4i16[j] + pln4i16[k]);
- b8i3[k][i][j] = (char)(row4i8[i] + col4i8[j] + pln4i8[k]);
+ b8i3[k][i][j] = (char)(row4i8[i] + col4i8[j] + pln4i8[k]);
}
-
-
#ifndef UNICOS
#ifdef REBUILDTEXTFILES
- /*-------------------------------------------------------------------------
- * TOOLTEST txtin8.txt -c $srcdir/testfiles/txtin8.conf -o txtin8.h5
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * TOOLTEST txtin8.txt -c $srcdir/testfiles/txtin8.conf -o txtin8.h5
+ *-------------------------------------------------------------------------
+ */
sp = HDfopen("txtin8.txt", "w");
- for (k = 0; k < npln; k++)
- {
- for (i = 0; i < nrow; i++)
- {
- for (j = 0; j < ncol; j++)
- (void) HDfprintf(sp, "%10u", b8i3[k][i][j]);
- (void) HDfprintf(sp, "\n");
- }
+ for (k = 0; k < npln; k++) {
+ for (i = 0; i < nrow; i++) {
+ for (j = 0; j < ncol; j++)
+ (void)HDfprintf(sp, "%10u", b8i3[k][i][j]);
+ (void)HDfprintf(sp, "\n");
+ }
}
- (void) HDfclose(sp);
+ (void)HDfclose(sp);
- /*-------------------------------------------------------------------------
- * TOOLTEST txtin16.txt -c $srcdir/testfiles/txtin16.conf -o txtin16.h5
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * TOOLTEST txtin16.txt -c $srcdir/testfiles/txtin16.conf -o txtin16.h5
+ *-------------------------------------------------------------------------
+ */
sp = HDfopen("txtin16.txt", "w");
- for (k = 0; k < npln; k++)
- {
- for (i = 0; i < nrow; i++)
- {
- for (j = 0; j < ncol; j++)
- (void) HDfprintf(sp, "%10u", b16i3[k][i][j]);
- (void) HDfprintf(sp, "\n");
- }
+ for (k = 0; k < npln; k++) {
+ for (i = 0; i < nrow; i++) {
+ for (j = 0; j < ncol; j++)
+ (void)HDfprintf(sp, "%10u", b16i3[k][i][j]);
+ (void)HDfprintf(sp, "\n");
+ }
}
- (void) HDfclose(sp);
+ (void)HDfclose(sp);
- /*-------------------------------------------------------------------------
- * TOOLTEST txtin32.txt -c $srcdir/testfiles/textin32.conf -o textin32.h5
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * TOOLTEST txtin32.txt -c $srcdir/testfiles/textin32.conf -o textin32.h5
+ *-------------------------------------------------------------------------
+ */
sp = HDfopen("txtin32.txt", "w");
- for (k = 0; k < npln; k++)
- {
- for (i = 0; i < nrow; i++)
- {
+ for (k = 0; k < npln; k++) {
+ for (i = 0; i < nrow; i++) {
for (j = 0; j < ncol; j++)
- (void) HDfprintf(sp, "%10d", b32i3[k][i][j]);
- (void) HDfprintf(sp, "\n");
+ (void)HDfprintf(sp, "%10d", b32i3[k][i][j]);
+ (void)HDfprintf(sp, "\n");
}
}
- (void) HDfclose(sp);
+ (void)HDfclose(sp);
#endif
- /*-------------------------------------------------------------------------
- * TOOLTEST binin32.bin -c binin32.conf -o binin32.h5
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binin32.bin -c binin32.conf -o binin32.h5
+ *-------------------------------------------------------------------------
+ */
sp = HDfopen("binin32.bin", OPEN_FLAGS);
- for (k = 0; k < npln; k++)
- {
- for (i = 0; i < nrow; i++)
- {
- for (j = 0; j < ncol; j++)
- {
- (void) HDfwrite((char *) &b32i3[k][i][j], sizeof(int), 1, sp);
+ for (k = 0; k < npln; k++) {
+ for (i = 0; i < nrow; i++) {
+ for (j = 0; j < ncol; j++) {
+ (void)HDfwrite((char *)&b32i3[k][i][j], sizeof(int), 1, sp);
}
}
}
- (void) HDfclose(sp);
+ (void)HDfclose(sp);
sp = HDfopen("binin32.conf", "w");
- (void) HDfprintf(sp, "PATH /int/bin/32-bit\n");
- (void) HDfprintf(sp, "INPUT-CLASS IN\n");
- (void) HDfprintf(sp, "INPUT-SIZE 32\n");
- (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
- (void) HDfprintf(sp, "RANK 3\n");
- (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
- (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER BE\n");
- (void) HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n");
- (void) HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 1 2 1\n");
- (void) HDfprintf(sp, "\n");
- (void) HDfclose(sp);
-
- /*-------------------------------------------------------------------------
- * TOOLTEST binuin32.bin -c binuin32.conf -o binuin32.h5
- *-------------------------------------------------------------------------
- */
+ (void)HDfprintf(sp, "PATH /int/bin/32-bit\n");
+ (void)HDfprintf(sp, "INPUT-CLASS IN\n");
+ (void)HDfprintf(sp, "INPUT-SIZE 32\n");
+ (void)HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
+ (void)HDfprintf(sp, "RANK 3\n");
+ (void)HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
+ (void)HDfprintf(sp, "OUTPUT-BYTE-ORDER BE\n");
+ (void)HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n");
+ (void)HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 1 2 1\n");
+ (void)HDfprintf(sp, "\n");
+ (void)HDfclose(sp);
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binuin32.bin -c binuin32.conf -o binuin32.h5
+ *-------------------------------------------------------------------------
+ */
sp = HDfopen("binuin32.bin", OPEN_FLAGS);
- for (k = 0; k < npln; k++)
- {
- for (i = 0; i < nrow; i++)
- {
- for (j = 0; j < ncol; j++)
- {
- (void) HDfwrite((char *) &b32i3[k][i][j], sizeof(unsigned int), 1, sp);
+ for (k = 0; k < npln; k++) {
+ for (i = 0; i < nrow; i++) {
+ for (j = 0; j < ncol; j++) {
+ (void)HDfwrite((char *)&b32i3[k][i][j], sizeof(unsigned int), 1, sp);
}
}
}
- (void) HDfclose(sp);
+ (void)HDfclose(sp);
sp = HDfopen("binuin32.conf", "w");
- (void) HDfprintf(sp, "PATH /int/buin/32-bit\n");
- (void) HDfprintf(sp, "INPUT-CLASS UIN\n");
- (void) HDfprintf(sp, "INPUT-SIZE 32\n");
- (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
- (void) HDfprintf(sp, "RANK 3\n");
- (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
- (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n");
- (void) HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n");
- (void) HDfprintf(sp, "\n");
- (void) HDfclose(sp);
-
- /*-------------------------------------------------------------------------
- * TOOLTEST binin16.bin -c binin16.conf -o binin16.h5
- *-------------------------------------------------------------------------
- */
+ (void)HDfprintf(sp, "PATH /int/buin/32-bit\n");
+ (void)HDfprintf(sp, "INPUT-CLASS UIN\n");
+ (void)HDfprintf(sp, "INPUT-SIZE 32\n");
+ (void)HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
+ (void)HDfprintf(sp, "RANK 3\n");
+ (void)HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
+ (void)HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n");
+ (void)HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n");
+ (void)HDfprintf(sp, "\n");
+ (void)HDfclose(sp);
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binin16.bin -c binin16.conf -o binin16.h5
+ *-------------------------------------------------------------------------
+ */
sp = HDfopen("binin16.bin", OPEN_FLAGS);
- for (k = 0; k < npln; k++)
- {
- for (i = 0; i < nrow; i++)
- {
- for (j = 0; j < ncol; j++)
- {
- (void) HDfwrite((char *) &b16i3[k][i][j], sizeof(short), 1, sp);
+ for (k = 0; k < npln; k++) {
+ for (i = 0; i < nrow; i++) {
+ for (j = 0; j < ncol; j++) {
+ (void)HDfwrite((char *)&b16i3[k][i][j], sizeof(short), 1, sp);
}
}
}
- (void) HDfclose(sp);
+ (void)HDfclose(sp);
sp = HDfopen("binin16.conf", "w");
- (void) HDfprintf(sp, "PATH /int/bin/16-bit\n");
- (void) HDfprintf(sp, "INPUT-CLASS IN\n");
- (void) HDfprintf(sp, "INPUT-SIZE 16\n");
- (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
- (void) HDfprintf(sp, "RANK 3\n");
- (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
- (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n");
- (void) HDfprintf(sp, "DIMENSION-SIZES 2 3 4\n");
- (void) HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n");
- (void) HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 8\n");
- (void) HDfprintf(sp, "\n");
- (void) HDfclose(sp);
-
- /*-------------------------------------------------------------------------
- * TOOLTEST binuin16.bin -c binuin16.conf -o binuin16.h5
- *-------------------------------------------------------------------------
- */
+ (void)HDfprintf(sp, "PATH /int/bin/16-bit\n");
+ (void)HDfprintf(sp, "INPUT-CLASS IN\n");
+ (void)HDfprintf(sp, "INPUT-SIZE 16\n");
+ (void)HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
+ (void)HDfprintf(sp, "RANK 3\n");
+ (void)HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
+ (void)HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n");
+ (void)HDfprintf(sp, "DIMENSION-SIZES 2 3 4\n");
+ (void)HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n");
+ (void)HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 8\n");
+ (void)HDfprintf(sp, "\n");
+ (void)HDfclose(sp);
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binuin16.bin -c binuin16.conf -o binuin16.h5
+ *-------------------------------------------------------------------------
+ */
sp = HDfopen("binuin16.bin", OPEN_FLAGS);
- for (k = 0; k < npln; k++)
- {
- for (i = 0; i < nrow; i++)
- {
- for (j = 0; j < ncol; j++)
- {
- (void) HDfwrite((char *) &b16i3[k][i][j], sizeof(unsigned short), 1, sp);
+ for (k = 0; k < npln; k++) {
+ for (i = 0; i < nrow; i++) {
+ for (j = 0; j < ncol; j++) {
+ (void)HDfwrite((char *)&b16i3[k][i][j], sizeof(unsigned short), 1, sp);
}
}
}
- (void) HDfclose(sp);
+ (void)HDfclose(sp);
sp = HDfopen("binuin16.conf", "w");
- (void) HDfprintf(sp, "PATH /int/buin/16-bit\n");
- (void) HDfprintf(sp, "INPUT-CLASS UIN\n");
- (void) HDfprintf(sp, "INPUT-SIZE 16\n");
- (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
- (void) HDfprintf(sp, "RANK 3\n");
- (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
- (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER BE\n");
- (void) HDfprintf(sp, "DIMENSION-SIZES 2 3 4\n");
- (void) HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n");
- (void) HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 8\n");
- (void) HDfprintf(sp, "\n");
- (void) HDfclose(sp);
-
- /*-------------------------------------------------------------------------
- * TOOLTEST binin8.bin -c binin8.conf -o binin8.h5
- *-------------------------------------------------------------------------
- */
+ (void)HDfprintf(sp, "PATH /int/buin/16-bit\n");
+ (void)HDfprintf(sp, "INPUT-CLASS UIN\n");
+ (void)HDfprintf(sp, "INPUT-SIZE 16\n");
+ (void)HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
+ (void)HDfprintf(sp, "RANK 3\n");
+ (void)HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
+ (void)HDfprintf(sp, "OUTPUT-BYTE-ORDER BE\n");
+ (void)HDfprintf(sp, "DIMENSION-SIZES 2 3 4\n");
+ (void)HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n");
+ (void)HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 8\n");
+ (void)HDfprintf(sp, "\n");
+ (void)HDfclose(sp);
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binin8.bin -c binin8.conf -o binin8.h5
+ *-------------------------------------------------------------------------
+ */
sp = HDfopen("binin8.bin", OPEN_FLAGS);
- for (k = 0; k < npln; k++)
- {
- for (i = 0; i < nrow; i++)
- {
- for (j = 0; j < ncol; j++)
- {
- (void) HDfwrite((char *) &b8i3[k][i][j], sizeof(char), 1, sp);
+ for (k = 0; k < npln; k++) {
+ for (i = 0; i < nrow; i++) {
+ for (j = 0; j < ncol; j++) {
+ (void)HDfwrite((char *)&b8i3[k][i][j], sizeof(char), 1, sp);
}
}
}
- (void) HDfclose(sp);
+ (void)HDfclose(sp);
sp = HDfopen("binin8.conf", "w");
- (void) HDfprintf(sp, "PATH /int/bin/8-bit\n");
- (void) HDfprintf(sp, "INPUT-CLASS IN\n");
- (void) HDfprintf(sp, "INPUT-SIZE 8\n");
- (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
- (void) HDfprintf(sp, "RANK 3\n");
- (void) HDfprintf(sp, "OUTPUT-CLASS IN\n");
- (void) HDfprintf(sp, "OUTPUT-SIZE 16\n");
- (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
- (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n");
- (void) HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n");
- (void) HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n");
- (void) HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 -1\n");
- (void) HDfprintf(sp, "COMPRESSION-PARAM 3\n");
- (void) HDfprintf(sp, "\n");
- (void) HDfclose(sp);
+ (void)HDfprintf(sp, "PATH /int/bin/8-bit\n");
+ (void)HDfprintf(sp, "INPUT-CLASS IN\n");
+ (void)HDfprintf(sp, "INPUT-SIZE 8\n");
+ (void)HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
+ (void)HDfprintf(sp, "RANK 3\n");
+ (void)HDfprintf(sp, "OUTPUT-CLASS IN\n");
+ (void)HDfprintf(sp, "OUTPUT-SIZE 16\n");
+ (void)HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
+ (void)HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n");
+ (void)HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n");
+ (void)HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n");
+ (void)HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 -1\n");
+ (void)HDfprintf(sp, "COMPRESSION-PARAM 3\n");
+ (void)HDfprintf(sp, "\n");
+ (void)HDfclose(sp);
#endif /* UNICOS */
- /*-------------------------------------------------------------------------
- * TOOLTEST binfp64.bin -c binfp64.conf -o binfp64.h5
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binfp64.bin -c binfp64.conf -o binfp64.h5
+ *-------------------------------------------------------------------------
+ */
- /*
- * binary 64-bit file - rank 2 & 3
- */
+ /*
+ * binary 64-bit file - rank 2 & 3
+ */
sp = HDfopen("binfp64.bin", OPEN_FLAGS);
- for (k = 0; k < npln; k++)
- {
- for (i = 0; i < nrow; i++)
- {
- for (j = 0; j < ncol; j++)
- {
- (void) HDfwrite((char *) &b64r3[k][i][j], sizeof(double), 1, sp);
+ for (k = 0; k < npln; k++) {
+ for (i = 0; i < nrow; i++) {
+ for (j = 0; j < ncol; j++) {
+ (void)HDfwrite((char *)&b64r3[k][i][j], sizeof(double), 1, sp);
}
}
}
- (void) HDfclose(sp);
+ (void)HDfclose(sp);
sp = HDfopen("binfp64.conf", "w");
- (void) HDfprintf(sp, "PATH /fp/bin/64-bit\n");
- (void) HDfprintf(sp, "INPUT-CLASS FP\n");
- (void) HDfprintf(sp, "INPUT-SIZE 64\n");
- (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
- (void) HDfprintf(sp, "RANK 3\n");
- (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE IEEE\n");
- (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n");
- (void) HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n");
- (void) HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n");
- (void) HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 6 7\n");
- (void) HDfprintf(sp, "COMPRESSION-PARAM 8\n");
- (void) HDfprintf(sp, "\n");
- (void) HDfclose(sp);
-
- /*-------------------------------------------------------------------------
- * TOOLTEST binin8w.bin -c binin8w.conf -o binin8w.h5
- *-------------------------------------------------------------------------
- */
+ (void)HDfprintf(sp, "PATH /fp/bin/64-bit\n");
+ (void)HDfprintf(sp, "INPUT-CLASS FP\n");
+ (void)HDfprintf(sp, "INPUT-SIZE 64\n");
+ (void)HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
+ (void)HDfprintf(sp, "RANK 3\n");
+ (void)HDfprintf(sp, "OUTPUT-ARCHITECTURE IEEE\n");
+ (void)HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n");
+ (void)HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n");
+ (void)HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n");
+ (void)HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 6 7\n");
+ (void)HDfprintf(sp, "COMPRESSION-PARAM 8\n");
+ (void)HDfprintf(sp, "\n");
+ (void)HDfclose(sp);
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binin8w.bin -c binin8w.conf -o binin8w.h5
+ *-------------------------------------------------------------------------
+ */
{
/* test CR+LF (13,10) and EOF (26) in windows */
- char bin8w[4] = {13,10,26,0};
+ char bin8w[4] = {13, 10, 26, 0};
sp = HDfopen("binin8w.bin", OPEN_FLAGS);
- for (i = 0; i < 4; i++)
- {
+ for (i = 0; i < 4; i++) {
char c = bin8w[i];
- if ( HDfwrite( &c, sizeof(char), 1, sp) != 1 )
+ if (HDfwrite(&c, sizeof(char), 1, sp) != 1)
HDprintf("error writing file\n");
}
HDfclose(sp);
sp = HDfopen("binin8w.conf", "w");
- (void) HDfprintf(sp, "INPUT-CLASS IN\n");
- (void) HDfprintf(sp, "INPUT-SIZE 8\n");
- (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
- (void) HDfprintf(sp, "RANK 1\n");
- (void) HDfprintf(sp, "OUTPUT-CLASS IN\n");
- (void) HDfprintf(sp, "OUTPUT-SIZE 8\n");
- (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
- (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n");
- (void) HDfprintf(sp, "DIMENSION-SIZES 4\n");
- (void) HDfprintf(sp, "\n");
- (void) HDfclose(sp);
-
+ (void)HDfprintf(sp, "INPUT-CLASS IN\n");
+ (void)HDfprintf(sp, "INPUT-SIZE 8\n");
+ (void)HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order);
+ (void)HDfprintf(sp, "RANK 1\n");
+ (void)HDfprintf(sp, "OUTPUT-CLASS IN\n");
+ (void)HDfprintf(sp, "OUTPUT-SIZE 8\n");
+ (void)HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n");
+ (void)HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n");
+ (void)HDfprintf(sp, "DIMENSION-SIZES 4\n");
+ (void)HDfprintf(sp, "\n");
+ (void)HDfclose(sp);
}
return (EXIT_SUCCESS);
}
-
diff --git a/tools/test/h5import/h5importtestutil.sh.in b/tools/test/h5import/h5importtestutil.sh.in
index 7dff689..0cbc8f1 100644
--- a/tools/test/h5import/h5importtestutil.sh.in
+++ b/tools/test/h5import/h5importtestutil.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt
index 78160d3..9da7080 100644
--- a/tools/test/h5jam/CMakeLists.txt
+++ b/tools/test/h5jam/CMakeLists.txt
@@ -6,16 +6,23 @@ project (HDF5_TOOLS_TEST_H5JAM C)
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5jamgentest ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/h5jamgentest.c)
- target_include_directories (h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5jamgentest STATIC)
target_link_libraries (h5jamgentest PRIVATE ${HDF5_LIB_TARGET})
set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools)
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5JAM_FORMAT h5jamgentest)
+ endif ()
+
#add_test (NAME h5jamgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5jamgentest>)
endif ()
add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c)
-target_include_directories (getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (getub STATIC)
target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -26,7 +33,7 @@ endif ()
set_target_properties (getub PROPERTIES FOLDER tools)
add_executable (tellub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/tellub.c)
-target_include_directories (tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (tellub STATIC)
target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -36,6 +43,14 @@ else ()
endif ()
set_target_properties (tellub PROPERTIES FOLDER tools)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5JAM_getub_FORMAT getub)
+ clang_format (HDF5_TOOLS_TEST_H5JAM_tellub_FORMAT tellub)
+endif ()
+
if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
include (CMakeTests.cmake)
endif ()
diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake
index aaa9a5c..82d99b7 100644
--- a/tools/test/h5jam/CMakeTests.cmake
+++ b/tools/test/h5jam/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5jam/Makefile.am b/tools/test/h5jam/Makefile.am
index c07aeb2..bbbdf7d 100644
--- a/tools/test/h5jam/Makefile.am
+++ b/tools/test/h5jam/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/h5jam/Makefile.in b/tools/test/h5jam/Makefile.in
index cb4b59e..77ee64b 100644
--- a/tools/test/h5jam/Makefile.in
+++ b/tools/test/h5jam/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -114,6 +114,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -422,12 +423,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -465,11 +466,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -501,8 +547,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -516,7 +560,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -526,6 +572,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -719,7 +766,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1238,8 +1285,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c
index f496a7a..fd21d6c 100644
--- a/tools/test/h5jam/getub.c
+++ b/tools/test/h5jam/getub.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,11 +21,9 @@ void parse_command_line(int argc, const char *argv[]);
#define PROGRAM_NAME "getub"
char *nbytes = NULL;
-static const char *s_opts = "c:"; /* add more later ? */
-static struct long_options l_opts[] = {
- {"c", require_arg, 'c'}, /* input file */
- {NULL, 0, '\0'}
-};
+static const char * s_opts = "c:"; /* add more later ? */
+static struct h5_long_options l_opts[] = {{"c", require_arg, 'c'}, /* input file */
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -36,7 +34,7 @@ static struct long_options l_opts[] = {
*-------------------------------------------------------------------------
*/
static void
-usage (const char *prog)
+usage(const char *prog)
{
HDfflush(stdout);
HDfprintf(stdout, "usage: %s -c nb file] \n", prog);
@@ -59,33 +57,33 @@ parse_command_line(int argc, const char *argv[])
int opt;
/* parse command line options */
- while((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) {
- switch((char) opt) {
- case 'c':
- nbytes = HDstrdup(opt_arg);
- break;
- case '?':
- default:
- usage(h5tools_getprogname());
- HDexit(EXIT_FAILURE);
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
+ case 'c':
+ nbytes = HDstrdup(H5_optarg);
+ break;
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ HDexit(EXIT_FAILURE);
} /* end switch */
- } /* end while */
+ } /* end while */
- if(argc <= opt_ind) {
- error_msg("missing file name\n");
- usage(h5tools_getprogname());
- HDexit(EXIT_FAILURE);
+ if (argc <= H5_optind) {
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ HDexit(EXIT_FAILURE);
} /* end if */
} /* end parse_command_line() */
int
main(int argc, const char *argv[])
{
- int fd = H5I_INVALID_HID;
+ int fd = H5I_INVALID_HID;
unsigned size;
- char *filename = NULL;
- long res;
- char *buf = NULL;
+ char * filename = NULL;
+ long res;
+ char * buf = NULL;
h5tools_setprogname(PROGRAM_NAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -95,61 +93,61 @@ main(int argc, const char *argv[])
parse_command_line(argc, argv);
- if(NULL == nbytes) {
+ if (NULL == nbytes) {
/* missing arg */
error_msg("missing size\n");
usage(h5tools_getprogname());
goto error;
} /* end if */
- if(argc <= (opt_ind)) {
+ if (argc <= (H5_optind)) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
goto error;
} /* end if */
- filename = HDstrdup(argv[opt_ind]);
+ filename = HDstrdup(argv[H5_optind]);
size = 0;
- if(EOF == (res = sscanf(nbytes, "%u", &size))) {
- /* fail */
- error_msg("missing file name\n");
- usage(h5tools_getprogname());
- goto error;
+ if (EOF == (res = HDsscanf(nbytes, "%u", &size))) {
+ /* fail */
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ goto error;
} /* end if */
- if((fd = HDopen(filename, O_RDONLY, 0)) < 0) {
+ if ((fd = HDopen(filename, O_RDONLY, 0)) < 0) {
error_msg("can't open file %s\n", filename);
goto error;
} /* end if */
- if(NULL == (buf = (char *)HDmalloc((unsigned)(size + 1)))) {
+ if (NULL == (buf = (char *)HDmalloc((unsigned)(size + 1)))) {
error_msg("can't allocate buffer \n");
goto error;
} /* end if */
res = HDread(fd, buf, (unsigned)size);
- if(res < (long)size) {
+ if (res < (long)size) {
error_msg("Bad read \n");
goto error;
} /* end if */
- if(HDwrite(1, buf, (unsigned)size) < 0) {
+ if (HDwrite(1, buf, (unsigned)size) < 0) {
error_msg("Bad write \n");
goto error;
} /* end if */
/* close things and exit */
+ HDfree(filename);
HDfree(buf);
HDclose(fd);
return EXIT_SUCCESS;
error:
- if(buf)
- HDfree(buf);
- if(fd >= 0)
+ HDfree(filename);
+ HDfree(buf);
+ if (fd >= 0)
HDclose(fd);
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c
index 56b4ead..5632cc0 100644
--- a/tools/test/h5jam/h5jamgentest.c
+++ b/tools/test/h5jam/h5jamgentest.c
@@ -1,4 +1,4 @@
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -31,24 +31,7 @@
#define UBTXT3 "u511.txt"
#define UBTXT4 "u512.txt"
#define UBTXT5 "u513.txt"
-/* not used yet
-#define UBTXT6 "u1023.txt"
-#define UBTXT7 "u1024.txt"
-#define UBTXT8 "u1025.txt"
-#define UBTXT9 "u2047.txt"
-#define UBTXT10 "u2048.txt"
-#define UBTXT11 "u2049.txt"
-#define UBBIN1 "u0.dat"
-#define UBBIN2 "u10.dat"
-#define UBBIN3 "u511.dat"
-#define UBBIN4 "u512.dat"
-#define UBBIN5 "u513.dat"
-*/
-/* not used yet
-#define FILE1 "tnull.h5"
-#define FILE2 "tnullwithub.h5"
-*/
/* tall is same as dumper test */
#define FILE7 "tall.h5"
#define FILE8 "twithub.h5"
@@ -64,33 +47,15 @@ char pattern[11] = "abcdefghij";
*-------------------------------------------------------------------------
*/
-
#define BUF_SIZE 1024
-/* Element selection information */
-
-typedef enum{
- RED,
- GREEN,
- BLUE,
- WHITE,
- BLACK
-} enumtype;
-
-/* Compound datatype */
-typedef struct s1_t {
- unsigned int a;
- unsigned int b;
- float c;
-} s1_t;
-
-
/* A UD link traversal function. Shouldn't actually be called. */
-static hid_t UD_traverse(const char H5_ATTR_UNUSED * link_name, hid_t H5_ATTR_UNUSED cur_group,
- const void H5_ATTR_UNUSED * udata, size_t H5_ATTR_UNUSED udata_size, hid_t H5_ATTR_UNUSED lapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id)
+static hid_t
+UD_traverse(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED cur_group,
+ const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size, hid_t H5_ATTR_UNUSED lapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id)
{
- return -1;
+ return H5I_INVALID_HID;
}
#define MY_LINKCLASS 187
@@ -106,8 +71,6 @@ const H5L_class_t UD_link_class[1] = {{
NULL /* Query callback */
}};
-
-
/* gent_ub
with no ub, identical to gent_all from h5dumpgentest.c
@@ -124,257 +87,340 @@ g1.2.1 : slink
g2 : dset2.1 dset2.2 udlink
*/
-
-static void
-gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
+static herr_t
+gent_ub(const char *filename, size_t ub_size, size_t ub_fill)
{
- hid_t fid, group, attr, dataset, space;
- hid_t create_plist;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t group = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t create_plist = H5I_INVALID_HID;
hsize_t dims[2];
- int data[2][2], dset1[10][10], dset2[20];
- char buf[BUF_SIZE];
- int i, j;
- size_t u;
- float dset2_1[10], dset2_2[3][5];
- int fd;
- char *bp;
-
- if(ub_size > 0)
- {
- create_plist = H5Pcreate(H5P_FILE_CREATE);
- H5Pset_userblock(create_plist, (hsize_t)ub_size);
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT);
- }
- else
- {
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- }
-
- /* create groups */
- group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- group = H5Gcreate2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- /* root attributes */
- group = H5Gopen2(fid, "/", H5P_DEFAULT);
-
- dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
- HDsprintf(buf, "abcdefghi");
- H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
- H5Sclose(space);
- H5Aclose(attr);
-
- dims[0] = 2; dims[1] = 2;
- space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
- data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
- H5Awrite(attr, H5T_NATIVE_INT, data);
- H5Sclose(space);
- H5Aclose(attr);
-
- H5Gclose(group);
-
- group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT);
-
- /* dset1.1.1 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
- dataset = H5Dcreate2(group, "dset1.1.1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- dset1[i][j] = j*i;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
- H5Sclose(space);
-
- /* attributes of dset1.1.1 */
- dims[0] = 27;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
- HDsprintf(buf, "1st attribute of dset1.1.1");
- H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
- H5Sclose(space);
- H5Aclose(attr);
-
- dims[0] = 27;
- space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
- HDsprintf(buf, "2nd attribute of dset1.1.1");
- H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
- H5Sclose(space);
- H5Aclose(attr);
-
- H5Dclose(dataset);
-
- /* dset1.1.2 */
- dims[0] = 20;
- space = H5Screate_simple(1, dims, NULL);
- dataset = H5Dcreate2(group, "dset1.1.2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for (i = 0; i < 20; i++)
- dset2[i] = i;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
- H5Sclose(space);
- H5Dclose(dataset);
-
- H5Gclose(group);
-
- /* external link */
- H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT);
-
- /* soft link */
- group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT);
- H5Lcreate_soft("somevalue", group, "slink", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
-
- group = H5Gopen2(fid, "/g2", H5P_DEFAULT);
-
- /* dset2.1 */
- dims[0] = 10;
- space = H5Screate_simple(1, dims, NULL);
- dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for (i = 0; i < 10; i++)
- dset2_1[i] = (float)((float)i * 0.1F + 1.0F);
- H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
- H5Sclose(space);
- H5Dclose(dataset);
-
- /* dset2.2 */
- dims[0] = 3; dims[1] = 5;
- space = H5Screate_simple(2, dims, NULL);
- dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for (i = 0; i < 3; i++)
- for (j = 0; j < 5; j++)
+ int data[2][2], dset1[10][10], dset2[20];
+ char buf[BUF_SIZE];
+ int i, j;
+ size_t u;
+ float dset2_1[10], dset2_2[3][5];
+ int fd = -1;
+
+ if (ub_size > 0) {
+ if ((create_plist = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
+ if (H5Pset_userblock(create_plist, (hsize_t)ub_size) < 0)
+ goto error;
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT)) < 0)
+ goto error;
+ }
+ else {
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ }
+
+ /* Create groups */
+ if ((group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Gclose(group) < 0)
+ goto error;
+
+ if ((group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Gclose(group) < 0)
+ goto error;
+
+ if ((group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Gclose(group) < 0)
+ goto error;
+
+ if ((group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Gclose(group) < 0)
+ goto error;
+
+ if ((group = H5Gcreate2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Gclose(group) < 0)
+ goto error;
+
+ /* Root attributes */
+ if ((group = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ goto error;
+
+ dims[0] = 10;
+ if ((space = H5Screate_simple(1, dims, NULL)) < 0)
+ goto error;
+ if ((attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (HDsprintf(buf, "abcdefghi") < 0)
+ goto error;
+ if (H5Awrite(attr, H5T_NATIVE_SCHAR, buf) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Aclose(attr) < 0)
+ goto error;
+
+ dims[0] = 2;
+ dims[1] = 2;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
+ if ((attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ data[0][0] = 0;
+ data[0][1] = 1;
+ data[1][0] = 2;
+ data[1][1] = 3;
+ if (H5Awrite(attr, H5T_NATIVE_INT, data) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Aclose(attr) < 0)
+ goto error;
+
+ if (H5Gclose(group) < 0)
+ goto error;
+
+ if ((group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Dataset 1.1.1 */
+ dims[0] = 10;
+ dims[1] = 10;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
+ if ((dataset =
+ H5Dcreate2(group, "dset1.1.1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ dset1[i][j] = j * i;
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+
+ /* Attributes of dset1.1.1 */
+ dims[0] = 27;
+ if ((space = H5Screate_simple(1, dims, NULL)) < 0)
+ goto error;
+ if ((attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (HDsprintf(buf, "1st attribute of dset1.1.1") < 0)
+ goto error;
+ if (H5Awrite(attr, H5T_NATIVE_SCHAR, buf) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Aclose(attr) < 0)
+ goto error;
+
+ dims[0] = 27;
+ if ((space = H5Screate_simple(1, dims, NULL)) < 0)
+ goto error;
+ if ((attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (HDsprintf(buf, "2nd attribute of dset1.1.1") < 0)
+ goto error;
+ if (H5Awrite(attr, H5T_NATIVE_SCHAR, buf) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Aclose(attr) < 0)
+ goto error;
+
+ if (H5Dclose(dataset) < 0)
+ goto error;
+
+ /* Dataset 1.1.2 */
+ dims[0] = 20;
+ if ((space = H5Screate_simple(1, dims, NULL)) < 0)
+ goto error;
+ if ((dataset =
+ H5Dcreate2(group, "dset1.1.2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < 20; i++)
+ dset2[i] = i;
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
+
+ if (H5Gclose(group) < 0)
+ goto error;
+
+ /* External link */
+ if (H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto error;
+
+ /* Soft link */
+ if ((group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Lcreate_soft("somevalue", group, "slink", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto error;
+ if (H5Gclose(group) < 0)
+ goto error;
+
+ if ((group = H5Gopen2(fid, "/g2", H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Dataset 2.1 */
+ dims[0] = 10;
+ if ((space = H5Screate_simple(1, dims, NULL)) < 0)
+ goto error;
+ if ((dataset =
+ H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < 10; i++)
+ dset2_1[i] = (float)((float)i * 0.1F + 1.0F);
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
+
+ /* Dataset 2.2 */
+ dims[0] = 3;
+ dims[1] = 5;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
+ if ((dataset =
+ H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 5; j++)
dset2_2[i][j] = (float)(((float)i + 1.0F) * (float)j * 0.1F);
- H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2);
- H5Sclose(space);
- H5Dclose(dataset);
-
- H5Gclose(group);
-
- /* user-defined link */
- H5Lregister(UD_link_class);
- H5Lcreate_ud(fid, "/g2/udlink", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT);
-
- H5Fclose(fid);
-
- /* If a user block is being used, write to it here */
- if(ub_size > 0) {
- HDassert(ub_size <= BUF_SIZE);
-
- fd = HDopen(filename, O_RDWR);
- HDassert(fd >= 0);
-
- /* fill buf with pattern */
- HDmemset(buf, '\0', ub_size);
- bp = buf;
- for (u = 0; u < ub_fill; u++)
- *bp++ = pattern[u % 10];
-
- HDwrite(fd, buf, ub_size);
-
- HDclose(fd);
- }
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Dclose(dataset) < 0)
+ goto error;
+
+ if (H5Gclose(group) < 0)
+ goto error;
+
+ /* User-defined link */
+ if (H5Lregister(UD_link_class) < 0)
+ goto error;
+ if (H5Lcreate_ud(fid, "/g2/udlink", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) <
+ 0)
+ goto error;
+
+ /* MUST close the file ID before the user block code or you risk tripping
+ * over file locking issues.
+ */
+ if (H5Fclose(fid) < 0)
+ goto error;
+
+ /* If a user block is being used, write to it here */
+ if (ub_size > 0) {
+ char *bp;
+
+ if (ub_size > BUF_SIZE)
+ goto error;
+
+ if ((fd = HDopen(filename, O_RDWR)) < 0)
+ goto error;
+
+ /* Fill buf with pattern */
+ HDmemset(buf, '\0', ub_size);
+ bp = buf;
+ for (u = 0; u < ub_fill; u++)
+ *bp++ = pattern[u % 10];
+
+ if (HDwrite(fd, buf, ub_size) < 0)
+ goto error;
+
+ if (HDclose(fd) < 0)
+ goto error;
+ }
+
+ return SUCCEED;
+
+error:
+ if (fd >= 0)
+ HDclose(fd);
+
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(fid);
+ H5Gclose(group);
+ H5Aclose(attr);
+ H5Dclose(dataset);
+ H5Sclose(space);
+ H5Pclose(create_plist);
+ }
+ H5E_END_TRY;
+
+ return FAIL;
}
-static void
+/* Creates a simple (i.e., not HDF5) text file and fills it with a pattern */
+static herr_t
create_textfile(const char *name, size_t size)
{
- char *buf;
- int fd;
+ char * buf = NULL;
+ int fd = -1;
size_t i;
- char *bp;
+ char * bp = NULL;
- fd = HDcreat(name,0777);
- HDassert(fd >= 0);
- buf = (char *)HDcalloc(size, (size_t)1);
- HDassert(buf);
+ if ((fd = HDcreat(name, 0777)) < 0)
+ goto error;
+ if (NULL == (buf = (char *)HDcalloc(size, 1)))
+ goto error;
- /* fill buf with pattern */
+ /* Fill buf with pattern */
bp = buf;
- for(i = 0; i < size; i++)
+ for (i = 0; i < size; i++)
*bp++ = pattern[i % 10];
- HDwrite(fd, buf, size);
+ if (HDwrite(fd, buf, size) < 0)
+ goto error;
HDfree(buf);
-
HDclose(fd);
-}
-
-#ifdef notdef
-/* not used yet */
-void
-create_binfile(char *name, off_t size)
-{
- char *buf;
- int fd;
- int i;
- char *bp;
- fd = creat(name,0777);
- HDassert(fd >= 0);
+ return SUCCEED;
- buf = HDcalloc(size,1);
- HDassert(buf);
-
- /* fill buf with pattern */
- bp = buf;
- for (i = 0; i < size; i++)
- *bp++ = (char) i & 0xff;
-
- HDwrite(fd,buf,size);
+error:
+ HDfree(buf);
+ if (fd >= 0)
+ HDclose(fd);
- HDclose(fd);
+ return FAIL;
}
-#endif
/*-------------------------------------------------------------------------
* Function: main
*
*-------------------------------------------------------------------------
*/
-
-
-int main(void)
+int
+main(void)
{
-
-/*
-create_textfile(UBTXT1, (size_t)0);
-*/
-create_textfile(UBTXT2, (size_t)10);
-create_textfile(UBTXT3, (size_t)511);
-create_textfile(UBTXT4, (size_t)512);
-create_textfile(UBTXT5, (size_t)513);
-/*
-create_textfile(UBTXT6, (size_t)1023);
-create_textfile(UBTXT7, (size_t)1024);
-create_textfile(UBTXT8, (size_t)1025);
-create_textfile(UBTXT9, (size_t)2047);
-create_textfile(UBTXT10, (size_t)2048);
-create_textfile(UBTXT11, (size_t)2049);
-
-create_binfile(UBBIN1, (off_t)0);
-create_binfile(UBBIN2, (off_t)10);
-create_binfile(UBBIN3, (off_t)511);
-create_binfile(UBBIN4, (off_t)512);
-create_binfile(UBBIN5, (off_t)513);
-
-*/
- gent_ub(FILE7, (size_t)0, (size_t)0);
- gent_ub(FILE8, (size_t)512, HDstrlen(pattern));
- gent_ub(FILE9, (size_t)1024, (size_t)513);
-
- return 0;
+ if (create_textfile(UBTXT2, 10) < 0)
+ goto error;
+ if (create_textfile(UBTXT3, 511) < 0)
+ goto error;
+ if (create_textfile(UBTXT4, 512) < 0)
+ goto error;
+ if (create_textfile(UBTXT5, 513) < 0)
+ goto error;
+
+ if (gent_ub(FILE7, 0, 0) < 0)
+ goto error;
+ if (gent_ub(FILE8, 512, HDstrlen(pattern)) < 0)
+ goto error;
+ if (gent_ub(FILE9, 1024, 513) < 0)
+ goto error;
+
+ return EXIT_SUCCESS;
+
+error:
+ HDfprintf(stderr, "h5jam test generator FAILED\n");
+ return EXIT_FAILURE;
}
diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c
index dbd2e69..46e5ae3 100644
--- a/tools/test/h5jam/tellub.c
+++ b/tools/test/h5jam/tellub.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,12 +24,8 @@
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
-static const char *s_opts = "h";
-static struct long_options l_opts[] = {
- {"help", no_arg, 'h'},
- {"hel", no_arg, 'h'},
- {NULL, 0, '\0'}
-};
+static const char * s_opts = "h";
+static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -40,12 +36,11 @@ static struct long_options l_opts[] = {
*-------------------------------------------------------------------------
*/
static void
-usage (const char *prog)
+usage(const char *prog)
{
HDfflush(stdout);
HDfprintf(stdout, "usage: %s h5_file\n", prog);
- HDfprintf(stdout,
- " Check that h5_fil is HDF5 file and print size of user block \n");
+ HDfprintf(stdout, " Check that h5_fil is HDF5 file and print size of user block \n");
HDfprintf(stdout, " %s -h\n", prog);
HDfprintf(stdout, " Print a usage message and exit\n");
} /* end usage() */
@@ -61,28 +56,28 @@ usage (const char *prog)
*/
static void
-parse_command_line (int argc, const char *argv[])
+parse_command_line(int argc, const char *argv[])
{
int opt;
/* parse command line options */
- while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) {
- switch ((char) opt) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
case 'h':
- usage (h5tools_getprogname());
+ usage(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
break;
case '?':
default:
- usage (h5tools_getprogname());
+ usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
}
}
/* check for file name to be processed */
- if (argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing file name\n");
- usage (h5tools_getprogname());
+ usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
}
} /* end parse_command_line() */
@@ -90,8 +85,8 @@ parse_command_line (int argc, const char *argv[])
static void
leave(int ret)
{
- h5tools_close();
- HDexit(ret);
+ h5tools_close();
+ HDexit(ret);
}
/*-------------------------------------------------------------------------
@@ -103,14 +98,14 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- char *ifname;
- hid_t ifile = H5I_INVALID_HID;
+ char * ifname;
+ hid_t ifile = H5I_INVALID_HID;
hsize_t usize;
- htri_t testval;
- herr_t status;
- hid_t plist = H5I_INVALID_HID;
+ htri_t testval;
+ herr_t status;
+ hid_t plist = H5I_INVALID_HID;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -123,18 +118,18 @@ main (int argc, const char *argv[])
/* enable error reporting if command line option */
h5tools_error_report();
- if(argc <= (opt_ind)) {
+ if (argc <= (H5_optind)) {
error_msg("missing file name\n");
- usage (h5tools_getprogname());
+ usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- ifname = HDstrdup(argv[opt_ind]);
+ ifname = HDstrdup(argv[H5_optind]);
- testval = H5Fis_hdf5 (ifname);
+ testval = H5Fis_hdf5(ifname);
- if(testval <= 0) {
+ if (testval <= 0) {
error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -142,33 +137,32 @@ main (int argc, const char *argv[])
ifile = H5Fopen(ifname, H5F_ACC_RDONLY, H5P_DEFAULT);
- if(ifile < 0) {
+ if (ifile < 0) {
error_msg("Can't open input HDF5 file \"%s\"\n", ifname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
plist = H5Fget_create_plist(ifile);
- if(plist < 0) {
+ if (plist < 0) {
error_msg("Can't get file creation plist for file \"%s\"\n", ifname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
status = H5Pget_userblock(plist, &usize);
- if(status < 0) {
+ if (status < 0) {
error_msg("Can't get user block for file \"%s\"\n", ifname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- HDprintf("%ld\n", (long) usize);
+ HDprintf("%ld\n", (long)usize);
done:
- H5Pclose (plist);
- if(ifile >= 0)
- H5Fclose (ifile);
+ H5Pclose(plist);
+ if (ifile >= 0)
+ H5Fclose(ifile);
leave(h5tools_getstatus());
} /* end main() */
-
diff --git a/tools/test/h5jam/testh5jam.sh.in b/tools/test/h5jam/testh5jam.sh.in
index bf705b4..caa3416 100644
--- a/tools/test/h5jam/testh5jam.sh.in
+++ b/tools/test/h5jam/testh5jam.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt
index 3993277..ba6e468 100644
--- a/tools/test/h5ls/CMakeLists.txt
+++ b/tools/test/h5ls/CMakeLists.txt
@@ -10,13 +10,21 @@ if (BUILD_SHARED_LIBS)
set (H5LS_TOOL_PLUGIN_LIB_TARGET ${H5LS_TOOL_PLUGIN_LIB_CORENAME})
add_library (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c)
- target_include_directories (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED)
- target_link_libraries (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ target_link_libraries (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${H5LS_TOOL_PLUGIN_LIB_TARGET} ${H5LS_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5LS_PLUGIN_FORMAT ${H5LS_TOOL_PLUGIN_LIB_TARGET})
+ endif ()
+
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
+
#-----------------------------------------------------------------------------
# Copy plugin library to a plugins folder
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake
index 2b7aa96..cd2f764 100644
--- a/tools/test/h5ls/CMakeTests.cmake
+++ b/tools/test/h5ls/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -139,7 +139,7 @@
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5ls${tgt_file_ext}> ${ARGN})
set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (${resultcode} EQUAL 1)
+ if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
else ()
@@ -164,7 +164,7 @@
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5ls${tgt_file_ext}> ${ARGN})
set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (${resultcode} EQUAL 1)
+ if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
else ()
diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake
index 3fc8aab..e93e7e7 100644
--- a/tools/test/h5ls/CMakeTestsVDS.cmake
+++ b/tools/test/h5ls/CMakeTestsVDS.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -85,7 +85,7 @@
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5ls${tgt_file_ext}> ${ARGN})
set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
- if (${resultcode} EQUAL 1)
+ if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
else ()
@@ -112,7 +112,7 @@
ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}"
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
)
- if (${resultcode} EQUAL 1)
+ if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
else ()
diff --git a/tools/test/h5ls/Makefile.am b/tools/test/h5ls/Makefile.am
index f5ec0f7..7e7b8b8 100644
--- a/tools/test/h5ls/Makefile.am
+++ b/tools/test/h5ls/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/h5ls/Makefile.in b/tools/test/h5ls/Makefile.in
index 85082e8..d4b4488 100644
--- a/tools/test/h5ls/Makefile.in
+++ b/tools/test/h5ls/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -423,12 +424,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -466,11 +467,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -502,8 +548,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -517,7 +561,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -527,6 +573,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -720,7 +767,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1236,8 +1283,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c
index 661a6dc..433522d 100644
--- a/tools/test/h5ls/dynlib_ls.c
+++ b/tools/test/h5ls/dynlib_ls.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,25 +17,33 @@
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIBUD 300
-#define MULTIPLIER 3
+#define H5Z_FILTER_DYNLIBUD 300
+#define MULTIPLIER 3
-static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIBUD, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlibud", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIBUD, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlibud", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ H5Z_filter_dynlibud, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return H5Z_DYNLIBUD;
+}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlibud
@@ -51,39 +59,37 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- char *int_ptr = (char *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ char * int_ptr = (char *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
- if(cd_nelmts > 0)
- return(0);
+ if (cd_nelmts > 0)
+ return (0);
/* Assignment to eliminate unused parameter warning. */
- cd_values = cd_values;
+ (void)cd_values;
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp - MULTIPLIER);
+ *int_ptr = (int8_t)(temp - MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp + MULTIPLIER);
+ *int_ptr = (int8_t)(temp + MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlibud() */
-
diff --git a/tools/test/h5ls/h5ls_plugin.sh.in b/tools/test/h5ls/h5ls_plugin.sh.in
index 28370e6..29e982d 100644
--- a/tools/test/h5ls/h5ls_plugin.sh.in
+++ b/tools/test/h5ls/h5ls_plugin.sh.in
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5ls/testh5ls.sh.in b/tools/test/h5ls/testh5ls.sh.in
index 353f1bb..ee0dad7 100644
--- a/tools/test/h5ls/testh5ls.sh.in
+++ b/tools/test/h5ls/testh5ls.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5ls/testh5lsvds.sh.in b/tools/test/h5ls/testh5lsvds.sh.in
index eb44367..4814f85 100644
--- a/tools/test/h5ls/testh5lsvds.sh.in
+++ b/tools/test/h5ls/testh5lsvds.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt
index 54cff64..0b90750 100644
--- a/tools/test/h5repack/CMakeLists.txt
+++ b/tools/test/h5repack/CMakeLists.txt
@@ -6,7 +6,7 @@ project (HDF5_TOOLS_TEST_H5REPACK C)
# --------------------------------------------------------------------
add_executable (testh5repack_detect_szip ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c)
target_include_directories (testh5repack_detect_szip
- PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC)
@@ -17,6 +17,7 @@ else ()
endif ()
set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools)
+# These are the same files used by the h5repack tool
set (REPACK_COMMON_SOURCES
${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_copy.c
${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_filters.c
@@ -28,7 +29,7 @@ set (REPACK_COMMON_SOURCES
)
add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c)
target_include_directories (h5repacktest
- PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5repacktest STATIC)
@@ -51,17 +52,25 @@ if (BUILD_SHARED_LIBS)
set (H5REPACK_TOOL_PLUGIN_LIB_VTARGET ${H5REPACK_TOOL_PLUGIN_LIB_VCORENAME})
add_library (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c)
- target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED)
- target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} ${H5REPACK_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
add_library (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c)
- target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED)
- target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} ${H5REPACK_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB")
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5REPACK_PLUGIN_FORMAT ${H5REPACK_TOOL_PLUGIN_LIB_TARGET})
+ clang_format (HDF5_TOOLS_TEST_H5REPACK_VPLUGIN_FORMAT ${H5REPACK_TOOL_PLUGIN_LIB_VTARGET})
+ endif ()
+
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
#-----------------------------------------------------------------------------
@@ -90,11 +99,18 @@ endif ()
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5repackgentest ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repackgentest.c)
- target_include_directories (h5repackgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5repackgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5repackgentest STATIC)
target_link_libraries (h5repackgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5repackgentest PROPERTIES FOLDER generator/tools)
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5REPACK_FORMAT h5repackgentest)
+ endif ()
+
#add_test (NAME h5repackgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repackgentest>)
endif ()
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index 33c12d1..1d0a9e9 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -51,6 +51,8 @@
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_named_dtypes.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nested_8bit_enum.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nested_8bit_enum_deflated.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_CVE-2018-17432.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_CVE-2018-14460.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nbit.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_objs.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_refs.h5
@@ -1536,13 +1538,23 @@
# the references in attribute of compund or vlen datatype
ADD_H5_TEST (HDFFV-5932 "TEST" ${FILE_ATTR_REF})
-# Add test for memory leak in attirbute. This test is verified by CTEST.
+# Add test for memory leak in attribute. This test is verified by CTEST.
# 1. leak from vlen string
# 2. leak from compound type without reference member
# (HDFFV-7840, )
# Note: this test is experimental for sharing test file among tools
ADD_H5_TEST (HDFFV-7840 "TEST" h5diff_attr1.h5)
+# test CVE-2018-17432 fix
+ set (arg h5repack_CVE-2018-17432.h5 --low=1 --high=2 -f GZIP=8 -l dset1:CHUNK=5x6)
+ set (TESTTYPE "TEST")
+ ADD_H5_FILTER_TEST (HDFFV-10590 "" ${TESTTYPE} 1 ${arg})
+
+# test CVE-2018-14460 fix
+ set (arg h5repack_CVE-2018-14460.h5)
+ set (TESTTYPE "TEST")
+ ADD_H5_FILTER_TEST (HDFFV-11223 "" ${TESTTYPE} 1 ${arg})
+
# tests for metadata block size option ('-M')
ADD_H5_TEST_META (meta_short h5repack_layout.h5 -M 8192)
ADD_H5_TEST_META (meta_long h5repack_layout.h5 --metadata_block_size=8192)
diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake
index 6399ee0..7eea4cc 100644
--- a/tools/test/h5repack/CMakeVFDTests.cmake
+++ b/tools/test/h5repack/CMakeVFDTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -25,7 +25,7 @@ set (VFD_LIST
family
)
-if (DIRECT_VFD)
+if (H5_HAVE_DIRECT)
set (VFD_LIST ${VFD_LIST} direct)
endif ()
diff --git a/tools/test/h5repack/Makefile.am b/tools/test/h5repack/Makefile.am
index 29906a1..dbd8478 100644
--- a/tools/test/h5repack/Makefile.am
+++ b/tools/test/h5repack/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/h5repack/Makefile.in b/tools/test/h5repack/Makefile.in
index 108271e..deb1456 100644
--- a/tools/test/h5repack/Makefile.in
+++ b/tools/test/h5repack/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -119,6 +119,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -466,13 +467,13 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src, test, and tools/lib directories
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/test -I$(top_srcdir)/tools/lib \
-I$(top_srcdir)/tools/src/h5repack
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -510,11 +511,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -546,8 +592,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -561,7 +605,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -571,6 +617,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -764,7 +811,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1334,8 +1381,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/h5repack/dynlib_rpk.c b/tools/test/h5repack/dynlib_rpk.c
index 29c3eae..b228344 100644
--- a/tools/test/h5repack/dynlib_rpk.c
+++ b/tools/test/h5repack/dynlib_rpk.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -20,24 +20,32 @@
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIB1 257
+#define H5Z_FILTER_DYNLIB1 257
-static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIB1[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIB1, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlib1", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIB1, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlib1", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ H5Z_filter_dynlib1, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return H5Z_DYNLIB1;
+}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlib1
@@ -57,39 +65,37 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;}
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- int *int_ptr = (int *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
- int add_on = 0;
+ int * int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int add_on = 0;
/* Check for the correct number of parameters */
- if(cd_nelmts == 0)
+ if (cd_nelmts == 0)
return 0;
/* Check that permanent parameters are set correctly */
- if(cd_values[0] > 9)
+ if (cd_values[0] > 9)
return 0;
add_on = (int)cd_values[0];
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Substract the "add on" value to all the data values */
- while(buf_left > 0) {
+ while (buf_left > 0) {
*int_ptr++ -= add_on;
buf_left -= sizeof(int);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the "add on" value to all the data values */
- while(buf_left > 0) {
+ while (buf_left > 0) {
*int_ptr++ += add_on;
buf_left -= sizeof(int);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlib1() */
-
diff --git a/tools/test/h5repack/dynlib_vrpk.c b/tools/test/h5repack/dynlib_vrpk.c
index 06d90ff..5eac4f2 100644
--- a/tools/test/h5repack/dynlib_vrpk.c
+++ b/tools/test/h5repack/dynlib_vrpk.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,26 +17,35 @@
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIB4 260
+#define H5Z_FILTER_DYNLIB4 260
-#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
+#define PUSH_ERR(func, minor, str) \
+ H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
-static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIB4[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIB4, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlib4", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIB4, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlib4", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ H5Z_filter_dynlib4, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return H5Z_DYNLIB4;
+}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlib4
@@ -53,50 +62,48 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;}
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- int *int_ptr = (int *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
- int add_on = 0;
+ int * int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int add_on = 0;
unsigned ver_info[3];
/* Check for the library version */
- if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) {
+ if (H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) {
PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion");
- return(0);
+ return (0);
}
/* Check for the correct number of parameters */
- if(cd_nelmts == 0)
- return(0);
+ if (cd_nelmts == 0)
+ return (0);
/* Check that permanent parameters are set correctly */
- if(cd_values[0] > 9)
- return(0);
+ if (cd_values[0] > 9)
+ return (0);
- if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) {
+ if (ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) {
PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match");
- return(0);
+ return (0);
}
add_on = (int)cd_values[0];
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Substract the "add on" value to all the data values */
- while(buf_left > 0) {
+ while (buf_left > 0) {
*int_ptr++ -= add_on;
buf_left -= sizeof(int);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the "add on" value to all the data values */
- while(buf_left > 0) {
+ while (buf_left > 0) {
*int_ptr++ += add_on;
buf_left -= sizeof(int);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlib4() */
-
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index 0b0c489..18be371 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -124,6 +124,9 @@ $SRC_H5REPACK_TESTFILES/h5repack_paged_nopersist.h5
$SRC_H5REPACK_TESTFILES/h5repack_paged_persist.h5
########h5diff/testfile########
$SRC_H5DIFF_TESTFILES/h5diff_attr1.h5
+########test#HDFFV-10590########
+$SRC_H5REPACK_TESTFILES/h5repack_CVE-2018-17432.h5
+$SRC_H5REPACK_TESTFILES/h5repack_CVE-2018-14460.h5
########tools/testfiles#for#external#links########
$SRC_TOOLS_TESTFILES/tsoftlinks.h5
$SRC_TOOLS_TESTFILES/textlinkfar.h5
@@ -672,6 +675,26 @@ VERIFY_INVALIDBOUNDS()
} # end of VERIFY_INVALIDBOUNDS
# -----------------------------------------------------------------------------
+# Expect h5diff to fail
+# Use only by VERIFY_EXTERNAL_CONSOLIDATION
+# -----------------------------------------------------------------------------
+DIFFFAIL()
+{
+ VERIFY h5diff unequal $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
+ )
+ RET=$?
+ if [ $RET -eq 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+}
+
+# -----------------------------------------------------------------------------
# Catchall test for repacking with external files
# Loops over all (internally-listed) cases and applies the given arguments
# to h5repack.
@@ -839,6 +862,45 @@ TOOLTESTV()
rm -f $outfile
}
+# Same as TOOLTEST, but expects h5repack fails
+#
+TOOLTEST_FAIL()
+{
+ infile=$1
+ outfile=$2
+ expect="$TESTDIR/$2-$1.ddl"
+ actual="$TESTDIR/$2-$1.out"
+ actual_err="$TESTDIR/$2-$1.err"
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >&$actual
+ RET=$?
+
+ # Normally h5repack of files tested with this function are expected
+ # to return not 0, but if the command results in "Segmentation fault"
+ # or "core dumped" it is a failure regardless of the return value.
+ failure=`grep -e 'Segmentation fault' -e 'core dumped' $actual`
+ if [ "$failure" != "" ]; then
+ nerrors="`expr $nerrors + 1`"
+ echo " FAILED"
+ echo " $failure"
+ else
+ if [ $RET == 0 ] ; then
+ nerrors="`expr $nerrors + 1`"
+ echo " FAILED"
+ else
+ echo " PASSED"
+ fi
+ fi
+ rm -f $outfile
+}
+
# This is same as TOOLTESTV() with comparing display output
# with actual filename swapped
#
@@ -1655,6 +1717,14 @@ TOOLTEST HDFFV-5932 h5repack_attr_refs.h5
# Note: this test is experimental for sharing test file among tools
TOOLTEST HDFFV-7840 h5diff_attr1.h5
+# test HDFFV-10590
+arg="h5repack_CVE-2018-17432.h5 h5repack_CVE-2018-17432_out.h5 --low=1 --high=2 -f GZIP=8 -l dset1:CHUNK=5x6"
+TOOLTEST_FAIL $arg
+
+# test HDFFV-11223
+arg="h5repack_CVE-2018-14460.h5 h5repack_CVE-2018-14460_out.h5"
+TOOLTEST_FAIL $arg
+
# tests for metadata block size option
TOOLTEST_META meta_short h5repack_layout.h5 -M 8192
TOOLTEST_META meta_long h5repack_layout.h5 --metadata_block_size=8192
diff --git a/tools/test/h5repack/h5repack_plugin.sh.in b/tools/test/h5repack/h5repack_plugin.sh.in
index 5efd9e8..0331d85 100644
--- a/tools/test/h5repack/h5repack_plugin.sh.in
+++ b/tools/test/h5repack/h5repack_plugin.sh.in
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c
index 7604964..576b1c7 100644
--- a/tools/test/h5repack/h5repackgentest.c
+++ b/tools/test/h5repack/h5repackgentest.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -35,28 +35,34 @@
#include "hdf5.h"
#include "H5private.h"
-#define MAX_NAME_SIZE 256
+#define MAX_NAME_SIZE 256
#define FILE_INT32LE_1 "h5repack_int32le_1d"
#define FILE_INT32LE_2 "h5repack_int32le_2d"
#define FILE_INT32LE_3 "h5repack_int32le_3d"
-#define FILE_UINT8BE "h5repack_uint8be"
-#define FILE_F32LE "h5repack_f32le"
-
-#define H5REPACKGENTEST_OOPS { \
- ret_value = -1; \
- goto done; \
-}
-
-#define H5REPACKGENTEST_COMMON_CLEANUP(dcpl, file, space) { \
- if ((dcpl) != H5P_DEFAULT && (dcpl) != H5I_INVALID_HID) { \
- (void)H5Pclose((dcpl)); \
- } \
- if ((file) != H5I_INVALID_HID) { (void)H5Fclose((file)); } \
- if ((space) != H5I_INVALID_HID) { (void)H5Sclose((space)); } \
-}
+#define FILE_UINT8BE "h5repack_uint8be"
+#define FILE_F32LE "h5repack_f32le"
+
+#define H5REPACKGENTEST_OOPS \
+ { \
+ ret_value = -1; \
+ goto done; \
+ }
+
+#define H5REPACKGENTEST_COMMON_CLEANUP(dcpl, file, space) \
+ { \
+ if ((dcpl) != H5P_DEFAULT && (dcpl) != H5I_INVALID_HID) { \
+ (void)H5Pclose((dcpl)); \
+ } \
+ if ((file) != H5I_INVALID_HID) { \
+ (void)H5Fclose((file)); \
+ } \
+ if ((space) != H5I_INVALID_HID) { \
+ (void)H5Sclose((space)); \
+ } \
+ }
struct external_def {
- hsize_t type_size;
+ hsize_t type_size;
unsigned n_elts_per_file;
unsigned n_elts_total;
};
@@ -66,14 +72,13 @@ struct external_def {
* Returns 0 on success, -1 on failure.
*/
static int
-__make_dataset(hid_t file_id, const char *dset_name,
- hid_t mem_type_id, hid_t space_id, hid_t dcpl_id, void *wdata) {
- hid_t dset_id = H5I_INVALID_HID;
+make_dataset(hid_t file_id, const char *dset_name, hid_t mem_type_id, hid_t space_id, hid_t dcpl_id,
+ void *wdata)
+{
+ hid_t dset_id = H5I_INVALID_HID;
int ret_value = 0;
- dset_id = H5Dcreate2(file_id, dset_name, mem_type_id, space_id,
- H5P_DEFAULT, dcpl_id,
- H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, dset_name, mem_type_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
if (dset_id == H5I_INVALID_HID)
H5REPACKGENTEST_OOPS;
@@ -82,10 +87,10 @@ __make_dataset(hid_t file_id, const char *dset_name,
done:
if (dset_id != H5I_INVALID_HID)
- (void) H5Dclose(dset_id);
+ (void)H5Dclose(dset_id);
return ret_value;
-} /* end __make_dataset() */
+} /* end make_dataset() */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Helper function to populate the DCPL external storage list.
@@ -96,11 +101,12 @@ done:
* Returns 0 on success, -1 on failure.
*/
static int
-__set_dcpl_external_list(hid_t dcpl, const char *filename,
- unsigned n_elts_per_file, unsigned n_elts_total, hsize_t elt_size) {
+set_dcpl_external_list(hid_t dcpl, const char *filename, unsigned n_elts_per_file, unsigned n_elts_total,
+ hsize_t elt_size)
+{
char name[MAX_NAME_SIZE];
unsigned n_external_files = 0;
- unsigned i = 0;
+ unsigned i = 0;
if (NULL == filename || '\0' == *filename)
return -1;
@@ -109,7 +115,6 @@ __set_dcpl_external_list(hid_t dcpl, const char *filename,
if (n_elts_total != (n_external_files * n_elts_per_file))
return -1;
-
for (i = 0; i < n_external_files; i++) {
if (HDsnprintf(name, MAX_NAME_SIZE, "%s_ex-%u.dat", filename, i) >= MAX_NAME_SIZE)
return -1;
@@ -118,7 +123,7 @@ __set_dcpl_external_list(hid_t dcpl, const char *filename,
return -1;
}
return 0;
-} /* end __set_dcpl_external_list() */
+} /* end set_dcpl_external_list() */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Generalized utility function to write a file with the specified data and
@@ -127,12 +132,13 @@ __set_dcpl_external_list(hid_t dcpl, const char *filename,
* Returns 0 on success, -1 on failure.
*/
static int
-__make_file(const char *basename, struct external_def *ext,
- hid_t type_id, hsize_t rank, hsize_t *dims, void *wdata) {
+make_file(const char *basename, struct external_def *ext, hid_t type_id, hsize_t rank, hsize_t *dims,
+ void *wdata)
+{
char filename[MAX_NAME_SIZE];
- hid_t file_id = H5I_INVALID_HID;
- hid_t dcpl_id = H5P_DEFAULT;
- hid_t space_id = H5I_INVALID_HID;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t dcpl_id = H5P_DEFAULT;
+ hid_t space_id = H5I_INVALID_HID;
int ret_value = 0;
if (HDsnprintf(filename, MAX_NAME_SIZE, "%s%s.h5", basename, (NULL != ext) ? "_ex" : "") >= MAX_NAME_SIZE)
@@ -143,7 +149,8 @@ __make_file(const char *basename, struct external_def *ext,
if (dcpl_id == H5I_INVALID_HID)
H5REPACKGENTEST_OOPS;
- if (__set_dcpl_external_list(dcpl_id, basename, ext->n_elts_per_file, ext->n_elts_total, ext->type_size) < 0)
+ if (set_dcpl_external_list(dcpl_id, basename, ext->n_elts_per_file, ext->n_elts_total,
+ ext->type_size) < 0)
H5REPACKGENTEST_OOPS;
}
@@ -155,35 +162,35 @@ __make_file(const char *basename, struct external_def *ext,
if (file_id == H5I_INVALID_HID)
H5REPACKGENTEST_OOPS;
-
- if (__make_dataset(file_id, "dset", type_id, space_id, dcpl_id, wdata) < 0)
+ if (make_dataset(file_id, "dset", type_id, space_id, dcpl_id, wdata) < 0)
H5REPACKGENTEST_OOPS;
done:
H5REPACKGENTEST_COMMON_CLEANUP(dcpl_id, file_id, space_id);
-return ret_value;
-} /* end __make_file() */
+ return ret_value;
+} /* end make_file() */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Returns 0 on success, -1 on failure.
*/
static int
-generate_int32le_1d(hbool_t external) {
- int32_t wdata[12];
- hsize_t dims[] = { 12 };
- struct external_def *def_ptr = NULL;
- struct external_def def = { (hsize_t) sizeof(int32_t), 6, 12 };
- int32_t n = 0;
- int ret_value = 0;
+generate_int32le_1d(hbool_t external)
+{
+ int32_t wdata[12];
+ hsize_t dims[] = {12};
+ struct external_def *def_ptr = NULL;
+ struct external_def def = {(hsize_t)sizeof(int32_t), 6, 12};
+ int32_t n = 0;
+ int ret_value = 0;
/* Generate values
- */
+ */
for (n = 0; n < 12; n++) {
wdata[n] = n - 6;
}
def_ptr = (TRUE == external) ? (&def) : NULL;
- if (__make_file(FILE_INT32LE_1, def_ptr, H5T_STD_I32LE, 1, dims, wdata) < 0)
+ if (make_file(FILE_INT32LE_1, def_ptr, H5T_STD_I32LE, 1, dims, wdata) < 0)
ret_value = -1;
return ret_value;
@@ -193,22 +200,23 @@ generate_int32le_1d(hbool_t external) {
* Returns 0 on success, -1 on failure.
*/
static int
-generate_int32le_2d(hbool_t external) {
- int32_t wdata[64];
- hsize_t dims[] = { 8, 8 };
- struct external_def *def_ptr = NULL;
- struct external_def def = { (hsize_t) sizeof(int32_t), 64, 64 };
- int32_t n = 0;
- int ret_value = 0;
+generate_int32le_2d(hbool_t external)
+{
+ int32_t wdata[64];
+ hsize_t dims[] = {8, 8};
+ struct external_def *def_ptr = NULL;
+ struct external_def def = {(hsize_t)sizeof(int32_t), 64, 64};
+ int32_t n = 0;
+ int ret_value = 0;
/* Generate values
- */
+ */
for (n = 0; n < 64; n++) {
wdata[n] = n - 32;
}
def_ptr = (TRUE == external) ? (&def) : NULL;
- if (__make_file(FILE_INT32LE_2, def_ptr, H5T_STD_I32LE, 2, dims, wdata) < 0)
+ if (make_file(FILE_INT32LE_2, def_ptr, H5T_STD_I32LE, 2, dims, wdata) < 0)
ret_value = -1;
return ret_value;
@@ -218,19 +226,20 @@ generate_int32le_2d(hbool_t external) {
* Returns 0 on success, -1 on failure.
*/
static int
-generate_int32le_3d(hbool_t external) {
- hsize_t dims[] = { 8, 8, 8 };
- int32_t wdata[512]; /* 8^3, from dims */
- struct external_def *def_ptr = NULL;
- struct external_def def = { (hsize_t) sizeof(int32_t), 512, 512 };
- int32_t n = 0;
- int i = 0;
- int j = 0;
- int k = 0;
- int ret_value = 0;
+generate_int32le_3d(hbool_t external)
+{
+ hsize_t dims[] = {8, 8, 8};
+ int32_t wdata[512]; /* 8^3, from dims */
+ struct external_def *def_ptr = NULL;
+ struct external_def def = {(hsize_t)sizeof(int32_t), 512, 512};
+ int32_t n = 0;
+ int i = 0;
+ int j = 0;
+ int k = 0;
+ int ret_value = 0;
/* generate values, alternating positive and negative
- */
+ */
for (i = 0, n = 0; (hsize_t)i < dims[0]; i++) {
for (j = 0; (hsize_t)j < dims[1]; j++) {
for (k = 0; (hsize_t)k < dims[2]; k++, n++) {
@@ -240,7 +249,7 @@ generate_int32le_3d(hbool_t external) {
}
def_ptr = (TRUE == external) ? (&def) : NULL;
- if (__make_file(FILE_INT32LE_3, def_ptr, H5T_STD_I32LE, 3, dims, wdata) < 0)
+ if (make_file(FILE_INT32LE_3, def_ptr, H5T_STD_I32LE, 3, dims, wdata) < 0)
ret_value = -1;
return ret_value;
@@ -250,19 +259,20 @@ generate_int32le_3d(hbool_t external) {
* Returns 0 on success, -1 on failure.
*/
static int
-generate_uint8be(hbool_t external) {
- hsize_t dims[] = { 4, 8, 8 };
- uint8_t wdata[256]; /* 4*8*8, from dims */
- struct external_def *def_ptr = NULL;
- struct external_def def = { (hsize_t) sizeof(uint8_t), 64, 256 };
- uint8_t n = 0;
- int i = 0;
- int j = 0;
- int k = 0;
- int ret_value = 0;
+generate_uint8be(hbool_t external)
+{
+ hsize_t dims[] = {4, 8, 8};
+ uint8_t wdata[256]; /* 4*8*8, from dims */
+ struct external_def *def_ptr = NULL;
+ struct external_def def = {(hsize_t)sizeof(uint8_t), 64, 256};
+ uint8_t n = 0;
+ int i = 0;
+ int j = 0;
+ int k = 0;
+ int ret_value = 0;
/* Generate values, ping-pong from ends of range
- */
+ */
for (i = 0, n = 0; (hsize_t)i < dims[0]; i++) {
for (j = 0; (hsize_t)j < dims[1]; j++) {
for (k = 0; (hsize_t)k < dims[2]; k++, n++) {
@@ -272,7 +282,7 @@ generate_uint8be(hbool_t external) {
}
def_ptr = (TRUE == external) ? (&def) : NULL;
- if (__make_file(FILE_UINT8BE, def_ptr, H5T_STD_U8BE, 3, dims, wdata) < 0)
+ if (make_file(FILE_UINT8BE, def_ptr, H5T_STD_U8BE, 3, dims, wdata) < 0)
ret_value = -1;
return ret_value;
@@ -282,16 +292,17 @@ generate_uint8be(hbool_t external) {
* Returns 0 on success, -1 on failure.
*/
static int
-generate_f32le(hbool_t external) {
- hsize_t dims[] = { 12, 6 };
- float wdata[72]; /* 12*6, from dims */
- struct external_def *def_ptr = NULL;
- struct external_def def = { (hsize_t) sizeof(float), 72, 72 };
- float n = 0;
- int i = 0;
- int j = 0;
- int k = 0;
- int ret_value = 0;
+generate_f32le(hbool_t external)
+{
+ hsize_t dims[] = {12, 6};
+ float wdata[72]; /* 12*6, from dims */
+ struct external_def *def_ptr = NULL;
+ struct external_def def = {(hsize_t)sizeof(float), 72, 72};
+ float n = 0;
+ int i = 0;
+ int j = 0;
+ int k = 0;
+ int ret_value = 0;
/* Generate values */
for (i = 0, k = 0, n = 0; (hsize_t)i < dims[0]; i++) {
@@ -301,7 +312,7 @@ generate_f32le(hbool_t external) {
}
def_ptr = (TRUE == external) ? (&def) : NULL;
- if (__make_file(FILE_F32LE, def_ptr, H5T_IEEE_F32LE, 2, dims, wdata) < 0)
+ if (make_file(FILE_F32LE, def_ptr, H5T_IEEE_F32LE, 2, dims, wdata) < 0)
ret_value = -1;
return ret_value;
@@ -312,7 +323,8 @@ generate_f32le(hbool_t external) {
* Return 0 on success, nonzero on failure.
*/
int
-main(void) {
+main(void)
+{
int i = 0;
for (i = 0; i < 2; i++) {
@@ -336,4 +348,3 @@ main(void) {
return EXIT_SUCCESS;
} /* end main() */
-
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index 5cd76ef..34d0b53 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,39 +17,42 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-#define GOERROR {H5_FAILED(); goto error;}
-
+#define GOERROR \
+ { \
+ H5_FAILED(); \
+ goto error; \
+ }
/* fill value test */
-#define FNAME0 "h5repack_fill.h5"
-#define FNAME0OUT "h5repack_fill_out.h5"
+#define FNAME0 "h5repack_fill.h5"
+#define FNAME0OUT "h5repack_fill_out.h5"
/* HDF5 objects and all dataset datatypes */
-#define FNAME1 "h5repack_objs.h5"
-#define FNAME1OUT "h5repack_objs_out.h5"
+#define FNAME1 "h5repack_objs.h5"
+#define FNAME1OUT "h5repack_objs_out.h5"
/* attributes, all datatypes */
-#define FNAME2 "h5repack_attr.h5"
-#define FNAME2OUT "h5repack_attr_out.h5"
+#define FNAME2 "h5repack_attr.h5"
+#define FNAME2OUT "h5repack_attr_out.h5"
/* hard links */
-#define FNAME3 "h5repack_hlink.h5"
-#define FNAME3OUT "h5repack_hlink_out.h5"
+#define FNAME3 "h5repack_hlink.h5"
+#define FNAME3OUT "h5repack_hlink_out.h5"
/* layout */
-#define FNAME4 "h5repack_layout.h5"
-#define FNAME4OUT "h5repack_layout_out.h5"
+#define FNAME4 "h5repack_layout.h5"
+#define FNAME4OUT "h5repack_layout_out.h5"
/* H5D_ALLOC_TIME_EARLY */
-#define FNAME5 "h5repack_early.h5"
-#define FNAME5OUT "h5repack_early_out.h5"
-#define FNAME6 "h5repack_early2.h5"
+#define FNAME5 "h5repack_early.h5"
+#define FNAME5OUT "h5repack_early_out.h5"
+#define FNAME6 "h5repack_early2.h5"
#ifdef H5_HAVE_FILTER_SZIP
/* SZIP filter */
-#define FNAME7 "h5repack_szip.h5"
-#define FNAME7OUT "h5repack_szip_out.h5"
+#define FNAME7 "h5repack_szip.h5"
+#define FNAME7OUT "h5repack_szip_out.h5"
#endif
/* GZIP filter */
-#define FNAME8 "h5repack_deflate.h5"
-#define FNAME8OUT "h5repack_deflate_out.h5"
+#define FNAME8 "h5repack_deflate.h5"
+#define FNAME8OUT "h5repack_deflate_out.h5"
/* GZIP filter */
-#define FNAME9 "h5repack_shuffle.h5"
-#define FNAME9OUT "h5repack_shuffle_out.h5"
+#define FNAME9 "h5repack_shuffle.h5"
+#define FNAME9OUT "h5repack_shuffle_out.h5"
/* Fletcher filter */
#define FNAME10 "h5repack_fletcher.h5"
#define FNAME10OUT "h5repack_fletcher_out.h5"
@@ -72,58 +75,55 @@
#define FNAME16 "h5repack_ub.h5"
#define FNAME16OUT "h5repack_ub_out.h5"
/* Named datatypes */
-#define FNAME17 "h5repack_named_dtypes.h5"
-#define FNAME17OUT "h5repack_named_dtypes_out.h5"
+#define FNAME17 "h5repack_named_dtypes.h5"
+#define FNAME17OUT "h5repack_named_dtypes_out.h5"
-#define FNAME18 "h5repack_layout2.h5"
+#define FNAME18 "h5repack_layout2.h5"
/* Files for testing file space paging */
-#define FSPACE_OUT "h5repack_fspace_OUT.h5" /* The output file */
-#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
+#define FSPACE_OUT "h5repack_fspace_OUT.h5" /* The output file */
+#define NELMTS(X) (sizeof(X) / sizeof(X[0])) /* # of elements */
const char *H5REPACK_FSPACE_FNAMES[] = {
- "h5repack_latest.h5", /* 0 */
- "h5repack_default.h5", /* 1 */
- "h5repack_page_persist.h5", /* 2 */
- "h5repack_fsm_aggr_persist.h5", /* 3 */
- "h5repack_page_threshold.h5", /* 4 */
- "h5repack_fsm_aggr_threshold.h5", /* 5 */
- "h5repack_aggr.h5", /* 6 */
- "h5repack_none.h5" /* 7 */
+ "h5repack_latest.h5", /* 0 */
+ "h5repack_default.h5", /* 1 */
+ "h5repack_page_persist.h5", /* 2 */
+ "h5repack_fsm_aggr_persist.h5", /* 3 */
+ "h5repack_page_threshold.h5", /* 4 */
+ "h5repack_fsm_aggr_threshold.h5", /* 5 */
+ "h5repack_aggr.h5", /* 6 */
+ "h5repack_none.h5" /* 7 */
};
-#define FNAME_UB "ublock.bin"
+#define FNAME_UB "ublock.bin"
/* obj and region references */
-#define FNAME_REF "h5repack_refs.h5"
+#define FNAME_REF "h5repack_refs.h5"
/* obj and region references in attr of compound and vlen type */
-#define FNAME_ATTR_REF "h5repack_attr_refs.h5"
+#define FNAME_ATTR_REF "h5repack_attr_refs.h5"
-const char *H5REPACK_FILENAMES[] = {
- "h5repack_big_out",
- NULL
-};
+const char *H5REPACK_FILENAMES[] = {"h5repack_big_out", NULL};
#define H5REPACK_EXTFILE "h5repack_ext.bin"
/* Name of tool */
#define PROGRAMNAME "h5repacktst"
-#define DIM1 40
-#define DIM2 20
-#define CDIM1 DIM1/2
-#define CDIM2 DIM2/2
-#define RANK 2
+#define DIM1 40
+#define DIM2 20
+#define CDIM1 (DIM1 / 2)
+#define CDIM2 (DIM2 / 2)
+#define RANK 2
/* Size of userblock (for userblock test) */
-#define USERBLOCK_SIZE 2048
+#define USERBLOCK_SIZE 2048
/* obj and region references */
-#define NAME_OBJ_DS1 "Dset1"
-#define NAME_OBJ_GRP "Group"
+#define NAME_OBJ_DS1 "Dset1"
+#define NAME_OBJ_GRP "Group"
#define NAME_OBJ_NDTYPE "NamedDatatype"
-#define NAME_OBJ_DS2 "Dset2"
-#define REG_REF_DS1 "Dset_REGREF"
+#define NAME_OBJ_DS2 "Dset2"
+#define REG_REF_DS1 "Dset_REGREF"
/*-------------------------------------------------------------------------
* prototypes
@@ -148,21 +148,20 @@ static int make_all_filters(hid_t loc_id);
static int make_fill(hid_t loc_id);
static int make_big(hid_t loc_id);
static int make_testfiles(void);
-static int write_dset_in(hid_t loc_id,const char* dset_name,hid_t file_id,int make_diffs );
-static int write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs );
-static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *dset_name,hid_t tid,void *buf );
-static int make_dset(hid_t loc_id,const char *name,hid_t sid,hid_t dcpl,void *buf);
-static int make_attr(hid_t loc_id,int rank,hsize_t *dims,const char *attr_name,hid_t tid,void *buf);
+static int write_dset_in(hid_t loc_id, const char *dset_name, hid_t file_id, int make_diffs);
+static int write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs);
+static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t tid, void *buf);
+static int make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t dcpl, void *buf);
+static int make_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t tid, void *buf);
static int make_dset_reg_ref(hid_t loc_id);
static int make_external(hid_t loc_id);
static int make_userblock(void);
-static int verify_userblock( const char* filename);
+static int verify_userblock(const char *filename);
static int make_userblock_file(void);
static int make_named_dtype(hid_t loc_id);
static int make_references(hid_t loc_id);
static int make_complex_attr_references(hid_t loc_id);
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -173,18 +172,19 @@ static int make_complex_attr_references(hid_t loc_id);
*-------------------------------------------------------------------------
*/
-int main (void)
+int
+main(void)
{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
+ pack_opt_t pack_options;
+ diff_opt_t diff_options;
- unsigned j; /* Local index variable for testing file space */
- const char *fname; /* File name for testing file space */
+ unsigned j; /* Local index variable for testing file space */
+ const char *fname; /* File name for testing file space */
- h5_stat_t file_stat;
- h5_stat_size_t fsize1, fsize2; /* file sizes */
-#if defined (H5_HAVE_FILTER_SZIP)
- int szip_can_encode = 0;
+ h5_stat_t file_stat;
+ h5_stat_size_t fsize1, fsize2; /* file sizes */
+#if defined(H5_HAVE_FILTER_SZIP)
+ int szip_can_encode = 0;
#endif
h5tools_setprogname(PROGRAMNAME);
@@ -194,8 +194,8 @@ int main (void)
h5tools_init();
/* initialize */
- HDmemset(&diff_options, 0, sizeof (diff_opt_t));
- HDmemset(&pack_options, 0, sizeof (pack_opt_t));
+ HDmemset(&diff_options, 0, sizeof(diff_opt_t));
+ HDmemset(&pack_options, 0, sizeof(pack_opt_t));
/* run tests */
puts("Testing h5repack:");
@@ -218,153 +218,150 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" files with file space info setting--no options (-S, -P, -T, -G) are set");
- j = 0; /* #0 */
+ j = 0; /* #0 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
-
TESTING(" files with file space info setting--all options -S, -P, -T, -G are set");
- ++j; /* #1 */
+ ++j; /* #1 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
- pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
+ pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
pack_options.fs_threshold = 1;
- pack_options.fs_pagesize = 8192;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ pack_options.fs_pagesize = 8192;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
-
TESTING(" files with file space info setting--options -S and -T are set");
- ++j; /* #2 */
+ ++j; /* #2 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- pack_options.fs_strategy = (H5F_fspace_strategy_t)-1; /* "FSM_AGGR" specified via -S FSM_AGGR */
- pack_options.fs_threshold = -1; /* "0" specified via -T 0 */
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ pack_options.fs_strategy = (H5F_fspace_strategy_t)-1; /* "FSM_AGGR" specified via -S FSM_AGGR */
+ pack_options.fs_threshold = -1; /* "0" specified via -T 0 */
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
-
TESTING(" files with file space info setting-- options -S and -P are set & -L");
- ++j; /* #3 */
+ ++j; /* #3 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, TRUE) < 0)
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
GOERROR;
pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE; /* "PAGE" specified via -S */
- pack_options.fs_persist = TRUE;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ pack_options.fs_persist = TRUE;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" files with file space info setting-- options -P and -T are set & -L");
- ++j; /* #4 */
+ ++j; /* #4 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, TRUE) < 0)
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
GOERROR;
- pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
+ pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
pack_options.fs_threshold = 2;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" files with file space info setting-- options -S and -G are set & -L");
- ++j; /* #5 */
+ ++j; /* #5 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, TRUE) < 0)
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
GOERROR;
pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE;
pack_options.fs_pagesize = 8192;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" files with file space info setting-- options -S, -P, -T, -G are set");
- ++j; /* #6 */
+ ++j; /* #6 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
- pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
+ pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
pack_options.fs_threshold = 1;
- pack_options.fs_pagesize = 8192;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ pack_options.fs_pagesize = 8192;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
TESTING(" files with file space info setting-- options -S, -T, -G are set & -L");
- ++j; /* #7 */
+ ++j; /* #7 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, TRUE) < 0)
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
pack_options.fs_threshold = 1;
- pack_options.fs_pagesize = 4096;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ pack_options.fs_pagesize = 4096;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -388,7 +385,6 @@ int main (void)
GOERROR;
PASSED();
-
/*-------------------------------------------------------------------------
* file with all kinds of dataset datatypes
*-------------------------------------------------------------------------
@@ -408,7 +404,6 @@ int main (void)
GOERROR;
PASSED();
-
/*-------------------------------------------------------------------------
* file with attributes
*-------------------------------------------------------------------------
@@ -565,7 +560,7 @@ int main (void)
TESTING(" adding szip filter");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_SZIP)
if (h5tools_can_encode(H5Z_FILTER_SZIP) > 0)
szip_can_encode = 1;
@@ -575,7 +570,7 @@ int main (void)
*/
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
if (h5repack_addfilter("dset2:SZIP=8,EC", &pack_options) < 0)
GOERROR;
@@ -587,7 +582,7 @@ int main (void)
GOERROR;
if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -599,14 +594,13 @@ int main (void)
SKIPPED();
#endif
-
/*-------------------------------------------------------------------------
* test all objects option
*-------------------------------------------------------------------------
*/
TESTING(" adding szip filter to all");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -630,7 +624,6 @@ int main (void)
SKIPPED();
#endif
-
TESTING(" addding shuffle filter");
/*-------------------------------------------------------------------------
@@ -679,7 +672,6 @@ int main (void)
PASSED();
-
TESTING(" adding checksum filter");
/*-------------------------------------------------------------------------
@@ -726,7 +718,6 @@ int main (void)
PASSED();
-
TESTING(" filter queue fletcher, shuffle, deflate, szip");
/*-------------------------------------------------------------------------
@@ -743,7 +734,7 @@ int main (void)
if (h5repack_addfilter("dset1:SHUF", &pack_options) < 0)
GOERROR;
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_addfilter("dset1:SZIP=8,NN", &pack_options) < 0)
GOERROR;
@@ -766,7 +757,6 @@ int main (void)
PASSED();
-
TESTING(" adding layout chunked (old format)");
/*-------------------------------------------------------------------------
@@ -782,7 +772,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options ) <= 0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -804,7 +794,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options ) <= 0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -933,7 +923,6 @@ int main (void)
PASSED();
-
TESTING(" layout compact to contiguous conversion");
/*-------------------------------------------------------------------------
@@ -986,9 +975,9 @@ int main (void)
GOERROR;
if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options)<= 0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -1110,7 +1099,6 @@ int main (void)
GOERROR;
PASSED();
-
/*-------------------------------------------------------------------------
* the following tests assume the input files have filters
* FNAME7
@@ -1122,7 +1110,7 @@ int main (void)
*/
TESTING(" copy of szip filter");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -1148,7 +1136,7 @@ int main (void)
TESTING(" removing szip filter");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -1172,7 +1160,6 @@ int main (void)
SKIPPED();
#endif
-
TESTING(" copy of deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -1192,7 +1179,6 @@ int main (void)
SKIPPED();
#endif
-
TESTING(" removing deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -1214,8 +1200,6 @@ int main (void)
SKIPPED();
#endif
-
-
TESTING(" copy of shuffle filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1231,7 +1215,6 @@ int main (void)
PASSED();
-
TESTING(" removing shuffle filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1249,7 +1232,6 @@ int main (void)
PASSED();
-
TESTING(" copy of fletcher filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1265,7 +1247,6 @@ int main (void)
PASSED();
-
TESTING(" removing fletcher filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1283,7 +1264,6 @@ int main (void)
PASSED();
-
TESTING(" copy of nbit filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1299,7 +1279,6 @@ int main (void)
PASSED();
-
TESTING(" removing nbit filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1317,7 +1296,6 @@ int main (void)
PASSED();
-
TESTING(" adding nbit filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1328,14 +1306,13 @@ int main (void)
GOERROR;
if (h5diff(FNAME12, FNAME12OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME12, FNAME12OUT, &pack_options)<= 0)
+ if (h5repack_verify(FNAME12, FNAME12OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
-
TESTING(" copy of scaleoffset filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1351,7 +1328,6 @@ int main (void)
PASSED();
-
TESTING(" removing scaleoffset filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1369,7 +1345,6 @@ int main (void)
PASSED();
-
TESTING(" adding scaleoffset filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1387,7 +1362,6 @@ int main (void)
PASSED();
-
/*-------------------------------------------------------------------------
* file with all filters
* dset_all
@@ -1399,7 +1373,7 @@ int main (void)
*/
TESTING(" filter conversion from deflate to szip");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_SZIP) && defined(H5_HAVE_FILTER_DEFLATE)
if (szip_can_encode) {
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1426,7 +1400,7 @@ int main (void)
TESTING(" filter conversion from szip to deflate");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_SZIP) && defined(H5_HAVE_FILTER_DEFLATE)
if (szip_can_encode) {
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1451,7 +1425,6 @@ int main (void)
SKIPPED();
#endif
-
/*-------------------------------------------------------------------------
* test the NONE global option
*-------------------------------------------------------------------------
@@ -1459,7 +1432,7 @@ int main (void)
TESTING(" removing all filters");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_SZIP) && defined(H5_HAVE_FILTER_DEFLATE)
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -1519,17 +1492,17 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" file with userblock");
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if(h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
+ if (h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0)
+ if (h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0)
GOERROR;
- if(verify_userblock(FNAME16OUT) < 0)
+ if (verify_userblock(FNAME16OUT) < 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -1540,7 +1513,7 @@ int main (void)
TESTING(" latest file format options");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- pack_options.latest = 1;
+ pack_options.latest = 1;
pack_options.grp_compact = 10;
pack_options.grp_indexed = 5;
pack_options.msg_size[0] = 10;
@@ -1552,13 +1525,12 @@ int main (void)
GOERROR;
if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options)<=0)
+ if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
-
/*-------------------------------------------------------------------------
* test several global filters
*-------------------------------------------------------------------------
@@ -1566,7 +1538,7 @@ int main (void)
TESTING(" several global filters");
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -1588,7 +1560,6 @@ int main (void)
SKIPPED();
#endif
-
/*-------------------------------------------------------------------------
* test file with userblock
*-------------------------------------------------------------------------
@@ -1597,31 +1568,29 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
/* add the options for a user block size and user block filename */
- pack_options.ublock_size = USERBLOCK_SIZE;
+ pack_options.ublock_size = USERBLOCK_SIZE;
pack_options.ublock_filename = FNAME_UB;
- if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
+ if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
+ if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
GOERROR;
- if(verify_userblock(FNAME8OUT) < 0)
+ if (verify_userblock(FNAME8OUT) < 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
-
PASSED();
#else
SKIPPED();
#endif
-
/*-------------------------------------------------------------------------
* test file with aligment
*-------------------------------------------------------------------------
@@ -1630,18 +1599,18 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
/* add the options for aligment */
pack_options.alignment = 1;
pack_options.threshold = 1;
- if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
+ if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
+ if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
GOERROR;
/* verify aligment */
@@ -1655,7 +1624,7 @@ int main (void)
GOERROR;
if ((fapl = H5Fget_access_plist(fid)) < 0)
GOERROR;
- if (H5Pget_alignment(fapl, &threshold, &alignment) < 0)
+ if (H5Pget_alignment(fapl, &threshold, &alignment) < 0)
GOERROR;
if (threshold != 1)
GOERROR;
@@ -1665,14 +1634,11 @@ int main (void)
GOERROR;
if (H5Fclose(fid) < 0)
GOERROR;
-
}
-
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
-
PASSED();
#else
SKIPPED();
@@ -1684,19 +1650,18 @@ int main (void)
*/
TESTING(" file with committed datatypes");
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if(h5repack(FNAME17, FNAME17OUT, &pack_options) < 0)
+ if (h5repack(FNAME17, FNAME17OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(FNAME17, FNAME17OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(FNAME17, FNAME17OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME17, FNAME17OUT, &pack_options) <= 0)
+ if (h5repack_verify(FNAME17, FNAME17OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
-
PASSED();
/*-------------------------------------------------------------------------
@@ -1711,48 +1676,46 @@ int main (void)
/* First run without metadata option. No need to verify the correctness */
/* since this has been verified by earlier tests. Just record the file */
/* size of the output file. */
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if(HDstat(FNAME4OUT, &file_stat) < 0)
+ if (HDstat(FNAME4OUT, &file_stat) < 0)
GOERROR;
fsize1 = file_stat.st_size;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
/* run it again with metadata option */
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
pack_options.meta_block_size = 8192;
- if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
/* record the file size of the output file */
- if(HDstat(FNAME4OUT, &file_stat) < 0)
+ if (HDstat(FNAME4OUT, &file_stat) < 0)
GOERROR;
fsize2 = file_stat.st_size;
/* verify second file size is larger than the first one */
- if(fsize2 <= fsize1)
+ if (fsize2 <= fsize1)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
-
/*-------------------------------------------------------------------------
* clean temporary test files
*-------------------------------------------------------------------------
*/
{
- hid_t fapl;
+ hid_t fapl;
fapl = h5_fileaccess();
h5_clean_files(H5REPACK_FILENAMES, fapl);
-
}
puts("All h5repack tests passed.");
@@ -1764,105 +1727,103 @@ int main (void)
error:
puts("***** H5REPACK TESTS FAILED *****");
return 1;
-
}
-
/*-------------------------------------------------------------------------
-* Function: make_testfiles
-*
-* Purpose: make a test file with all types of HDF5 objects,
-* datatypes and filters
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_testfiles(void)
+ * Function: make_testfiles
+ *
+ * Purpose: make a test file with all types of HDF5 objects,
+ * datatypes and filters
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_testfiles(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
- hid_t fapl = H5I_INVALID_HID; /* File access property list */
- unsigned j; /* Local index variable */
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ unsigned j; /* Local index variable */
/*-------------------------------------------------------------------------
* create a file for general copy test
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME0, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME0, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_fill(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create another file for general copy test (all datatypes)
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_all_objects(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file for attributes copy test
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_attributes(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file for hard links test
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_hlinks(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file for layouts test
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_layout(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file for layout conversion test
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- if(make_layout2(fid) < 0)
+ if (make_layout2(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* for test layout conversions form chunk with unlimited max dims
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate("h5repack_layout3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate("h5repack_layout3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- if(make_layout3(fid) < 0)
+ if (make_layout3(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
@@ -1872,131 +1833,130 @@ int make_testfiles(void)
if (make_early() < 0)
goto out;
- /*-------------------------------------------------------------------------
- * create a file with the SZIP filter
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * create a file with the SZIP filter
+ *-------------------------------------------------------------------------
+ */
#ifdef H5_HAVE_FILTER_SZIP
- if((fid = H5Fcreate(FNAME7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_szip(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
#endif /* H5_HAVE_FILTER_SZIP */
-
/*-------------------------------------------------------------------------
* create a file with the deflate filter
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_deflate(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with the shuffle filter
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_shuffle(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with the fletcher32 filter
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME10, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME10, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_fletcher32(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with all the filters
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME11, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME11, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_all_filters(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with the nbit filter
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_nbit(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with the scaleoffset filter
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_scaleoffset(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a big dataset
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_big(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with external dataset
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME15, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME15, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_external(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with userblock
*-------------------------------------------------------------------------
*/
- if(make_userblock() < 0)
+ if (make_userblock() < 0)
goto out;
/*-------------------------------------------------------------------------
* create a userblock file
*-------------------------------------------------------------------------
*/
- if(make_userblock_file() < 0)
+ if (make_userblock_file() < 0)
goto out;
/*-------------------------------------------------------------------------
* create a file with named datatypes
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_named_dtype(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
@@ -2005,23 +1965,23 @@ int make_testfiles(void)
* add attribute with obj and region reference type (bug1726)
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
/* create reference type datasets */
if (make_references(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with obj and region references in attribute of compound and
* vlen datatype
*-------------------------------------------------------------------------*/
- if((fid = H5Fcreate(FNAME_ATTR_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME_ATTR_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_complex_attr_references(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
@@ -2029,11 +1989,11 @@ int make_testfiles(void)
*------------------------------------------------------------------------- */
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
/*
@@ -2042,9 +2002,9 @@ int make_testfiles(void)
* default: inpage=4096
*/
j = 0;
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[j], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[j], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*
@@ -2053,9 +2013,9 @@ int make_testfiles(void)
* default: inpage=4096
*/
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*
@@ -2066,21 +2026,20 @@ int make_testfiles(void)
* latest format
*/
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
- if(H5Pset_file_space_page_size(fcpl, (hsize_t)512) < 0)
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)512) < 0)
return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
return -1;
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
return -1;
-
/*
* #3 -- h5repack_fsm_aggr_persist.h5
* Setting:
@@ -2088,19 +2047,18 @@ int make_testfiles(void)
* default: inpage=4096
*/
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
return -1;
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
return -1;
-
/*
* #4 -- h5repack_page_threshold.h5
* Setting:
@@ -2110,18 +2068,18 @@ int make_testfiles(void)
*/
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)3) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)3) < 0)
return -1;
- if(H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0)
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0)
return -1;
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
return -1;
/*
@@ -2132,18 +2090,18 @@ int make_testfiles(void)
*/
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)3) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)3) < 0)
return -1;
- if(H5Pset_file_space_page_size(fcpl, (hsize_t)FS_PAGESIZE_DEF) < 0)
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)FS_PAGESIZE_DEF) < 0)
return -1;
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
return -1;
/*
@@ -2154,16 +2112,16 @@ int make_testfiles(void)
*/
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
return -1;
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
return -1;
/*
@@ -2174,21 +2132,21 @@ int make_testfiles(void)
*/
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1) < 0)
return -1;
- if(H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0)
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0)
return -1;
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
return -1;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
return -1;
return 0;
@@ -2198,47 +2156,44 @@ out:
return -1;
}
-
-
/*-------------------------------------------------------------------------
-* Function: make_all_objects
-*
-* Purpose: make a test file with all types of HDF5 objects
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_all_objects(hid_t loc_id)
+ * Function: make_all_objects
+ *
+ * Purpose: make a test file with all types of HDF5 objects
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_all_objects(hid_t loc_id)
{
- hid_t did = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- hid_t rid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t gcplid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t rid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t gcplid = H5I_INVALID_HID;
hsize_t dims[1] = {2};
/* compound datatype */
- typedef struct s_t
- {
- int a;
- float b;
+ typedef struct s_t {
+ int a;
+ float b;
} s_t;
/*-------------------------------------------------------------------------
- * H5G_DATASET
- *-------------------------------------------------------------------------
- */
+ * H5G_DATASET
+ *-------------------------------------------------------------------------
+ */
if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
- if ((did = H5Dcreate2(loc_id, "dset_referenced", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "dset_referenced", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * H5G_GROUP
- *-------------------------------------------------------------------------
- */
- if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ * H5G_GROUP
+ *-------------------------------------------------------------------------
+ */
+ if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if (H5Gclose(gid) < 0)
goto out;
@@ -2254,9 +2209,9 @@ int make_all_objects(hid_t loc_id)
goto out;
/*-------------------------------------------------------------------------
- * H5G_TYPE
- *-------------------------------------------------------------------------
- */
+ * H5G_TYPE
+ *-------------------------------------------------------------------------
+ */
/* create a compound datatype */
if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
@@ -2269,27 +2224,27 @@ int make_all_objects(hid_t loc_id)
goto out;
/*-------------------------------------------------------------------------
- * H5G_LINK
- *-------------------------------------------------------------------------
- */
+ * H5G_LINK
+ *-------------------------------------------------------------------------
+ */
if (H5Lcreate_soft("dset", loc_id, "link", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5G_UDLINK
- *-------------------------------------------------------------------------
- */
+ * H5G_UDLINK
+ *-------------------------------------------------------------------------
+ */
/* Create an external link. Other UD links are not supported by h5repack */
if (H5Lcreate_external("file", "path", loc_id, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
/*-------------------------------------------------------------------------
- * write a series of datasetes at root
- *-------------------------------------------------------------------------
- */
+ * write a series of datasetes at root
+ *-------------------------------------------------------------------------
+ */
- if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
+ if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
goto out;
if (write_dset_in(rid, "dset_referenced", loc_id, 0) < 0)
goto out;
@@ -2317,58 +2272,58 @@ out:
H5Sclose(sid);
H5Tclose(tid);
H5Pclose(gcplid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_attributes
-*
-* Purpose: make a test file with all types of attributes
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_attributes(hid_t loc_id)
+ * Function: make_attributes
+ *
+ * Purpose: make a test file with all types of attributes
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_attributes(hid_t loc_id)
{
- hid_t did = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t rid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t rid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hsize_t dims[1] = {2};
/*-------------------------------------------------------------------------
- * H5G_DATASET
- *-------------------------------------------------------------------------
- */
+ * H5G_DATASET
+ *-------------------------------------------------------------------------
+ */
if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
- if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5G_GROUP
- *-------------------------------------------------------------------------
- */
- if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ * H5G_GROUP
+ *-------------------------------------------------------------------------
+ */
+ if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
+ if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * write a series of attributes on the dataset, group, and root group
- *-------------------------------------------------------------------------
- */
+ * write a series of attributes on the dataset, group, and root group
+ *-------------------------------------------------------------------------
+ */
- if ( write_attr_in(did, "dset", loc_id, 0) < 0)
+ if (write_attr_in(did, "dset", loc_id, 0) < 0)
goto out;
if (write_attr_in(gid, "dset", loc_id, 0) < 0)
goto out;
if (write_attr_in(rid, "dset", loc_id, 0) < 0)
goto out;
- /* close */
+ /* close */
if (H5Dclose(did) < 0)
goto out;
if (H5Gclose(gid) < 0)
@@ -2387,59 +2342,58 @@ out:
H5Gclose(gid);
H5Gclose(rid);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
/*-------------------------------------------------------------------------
-* Function: make_hlinks
-*
-* Purpose: make a test file with hard links
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_hlinks(hid_t loc_id)
+ * Function: make_hlinks
+ *
+ * Purpose: make a test file with hard links
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_hlinks(hid_t loc_id)
{
- hid_t g1id =- 1;
- hid_t g2id = H5I_INVALID_HID;
- hid_t g3id = H5I_INVALID_HID;
- hsize_t dims[2] = {3,2};
- int buf[3][2] = {{1,1}, {1,2}, {2,2}};
+ hid_t g1id = -1;
+ hid_t g2id = H5I_INVALID_HID;
+ hid_t g3id = H5I_INVALID_HID;
+ hsize_t dims[2] = {3, 2};
+ int buf[3][2] = {{1, 1}, {1, 2}, {2, 2}};
/*-------------------------------------------------------------------------
- * create a dataset and some hard links to it
- *-------------------------------------------------------------------------
- */
+ * create a dataset and some hard links to it
+ *-------------------------------------------------------------------------
+ */
- if(write_dset(loc_id, 2, dims, "dset", H5T_NATIVE_INT, buf) < 0)
+ if (write_dset(loc_id, 2, dims, "dset", H5T_NATIVE_INT, buf) < 0)
return -1;
- if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link1 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link1 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
return -1;
- if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link2 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link2 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
return -1;
- if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link3 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link3 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
return -1;
/*-------------------------------------------------------------------------
- * create a group and some hard links to it
- *-------------------------------------------------------------------------
- */
+ * create a group and some hard links to it
+ *-------------------------------------------------------------------------
+ */
- if((g1id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((g1id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if((g2id = H5Gcreate2(g1id, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((g2id = H5Gcreate2(g1id, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if((g3id = H5Gcreate2(g2id, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((g3id = H5Gcreate2(g2id, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Lcreate_hard(loc_id, "g1", g2id, "link1 to g1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(loc_id, "g1", g2id, "link1 to g1", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
- if(H5Lcreate_hard(g1id, "g2", g3id, "link1 to g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(g1id, "g2", g3id, "link1 to g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
-
/* close */
if (H5Gclose(g1id) < 0)
goto out;
@@ -2456,31 +2410,30 @@ out:
H5Gclose(g1id);
H5Gclose(g2id);
H5Gclose(g3id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
-
/*-------------------------------------------------------------------------
-* Function: make_szip
-*
-* Purpose: make a dataset with the SZIP filter
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: make_szip
+ *
+ * Purpose: make a dataset with the SZIP filter
+ *
+ *-------------------------------------------------------------------------
+ */
#ifdef H5_HAVE_FILTER_SZIP
-static
-int make_szip(hid_t loc_id)
+static int
+make_szip(hid_t loc_id)
{
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
- hid_t sid = H5I_INVALID_HID; /* dataspace ID */
- unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block = 8;
- hsize_t dims[RANK] = {DIM1, DIM2};
- hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int **buf = NULL;
- int szip_can_encode = 0;
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int ** buf = NULL;
+ int szip_can_encode = 0;
/* Create and fill array */
H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
@@ -2489,26 +2442,26 @@ int make_szip(hid_t loc_id)
H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* create a dcpl */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
/*-------------------------------------------------------------------------
- * SZIP
- *-------------------------------------------------------------------------
- */
+ * SZIP
+ *-------------------------------------------------------------------------
+ */
/* Make sure encoding is enabled */
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
szip_can_encode = 1;
if (szip_can_encode) {
/* set szip data */
- if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0)
+ if (H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block) < 0)
goto error;
if (make_dset(loc_id, "dset_szip", sid, dcpl, buf[0]) < 0)
goto error;
@@ -2516,9 +2469,9 @@ int make_szip(hid_t loc_id)
else
/* WARNING? SZIP is decoder only, can't generate test files */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
HDfree(buf);
@@ -2526,10 +2479,12 @@ int make_szip(hid_t loc_id)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
@@ -2537,23 +2492,21 @@ error:
}
#endif /* H5_HAVE_FILTER_SZIP */
-
-
/*-------------------------------------------------------------------------
-* Function: make_deflate
-*
-* Purpose: make a dataset with the deflate filter
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_deflate(hid_t loc_id)
+ * Function: make_deflate
+ *
+ * Purpose: make a dataset with the deflate filter
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_deflate(hid_t loc_id)
{
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
- hid_t sid = H5I_INVALID_HID; /* dataspace ID */
- hsize_t dims[RANK] = {DIM1,DIM2};
- hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
- int **buf = NULL;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int ** buf = NULL;
hobj_ref_t bufref[1]; /* reference */
hsize_t dims1r[1] = {1};
@@ -2564,22 +2517,22 @@ int make_deflate(hid_t loc_id)
H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* create a dcpl */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
- /*-------------------------------------------------------------------------
- * GZIP
- *-------------------------------------------------------------------------
- */
-#if defined (H5_HAVE_FILTER_DEFLATE)
+ /*-------------------------------------------------------------------------
+ * GZIP
+ *-------------------------------------------------------------------------
+ */
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
- if(H5Pset_deflate(dcpl, 9) < 0)
+ if (H5Pset_deflate(dcpl, 9) < 0)
goto error;
if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf[0]) < 0)
goto error;
@@ -2592,14 +2545,13 @@ int make_deflate(hid_t loc_id)
goto error;
#endif
-
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
HDfree(buf);
@@ -2607,32 +2559,33 @@ int make_deflate(hid_t loc_id)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_shuffle
-*
-* Purpose: make a dataset with the shuffle filter
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_shuffle(hid_t loc_id)
+ * Function: make_shuffle
+ *
+ * Purpose: make a dataset with the shuffle filter
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_shuffle(hid_t loc_id)
{
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
- hid_t sid = H5I_INVALID_HID; /* dataspace ID */
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int **buf = NULL;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int ** buf = NULL;
/* Create and fill array */
H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
@@ -2641,19 +2594,19 @@ int make_shuffle(hid_t loc_id)
H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* create a dcpl */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
/*-------------------------------------------------------------------------
- * shuffle
- *-------------------------------------------------------------------------
- */
+ * shuffle
+ *-------------------------------------------------------------------------
+ */
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
@@ -2661,14 +2614,13 @@ int make_shuffle(hid_t loc_id)
if (make_dset(loc_id, "dset_shuffle", sid, dcpl, buf[0]) < 0)
goto error;
-
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
HDfree(buf);
@@ -2676,10 +2628,12 @@ int make_shuffle(hid_t loc_id)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
@@ -2687,20 +2641,20 @@ error:
}
/*-------------------------------------------------------------------------
-* Function: make_fletcher32
-*
-* Purpose: make a dataset with the fletcher32 filter
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_fletcher32(hid_t loc_id)
+ * Function: make_fletcher32
+ *
+ * Purpose: make a dataset with the fletcher32 filter
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_fletcher32(hid_t loc_id)
{
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
- hid_t sid = H5I_INVALID_HID; /* dataspace ID */
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int **buf = NULL;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int ** buf = NULL;
/* Create and fill array */
H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
@@ -2709,23 +2663,22 @@ int make_fletcher32(hid_t loc_id)
H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
-
/*-------------------------------------------------------------------------
- * fletcher32
- *-------------------------------------------------------------------------
- */
+ * fletcher32
+ *-------------------------------------------------------------------------
+ */
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto error;
/* set the checksum filter */
if (H5Pset_fletcher32(dcpl) < 0)
@@ -2734,12 +2687,12 @@ int make_fletcher32(hid_t loc_id)
goto error;
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
HDfree(buf);
@@ -2747,34 +2700,35 @@ int make_fletcher32(hid_t loc_id)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_nbit
-*
-* Purpose: make a dataset with the nbit filter
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_nbit(hid_t loc_id)
+ * Function: make_nbit
+ *
+ * Purpose: make a dataset with the nbit filter
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_nbit(hid_t loc_id)
{
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
- hid_t sid = H5I_INVALID_HID; /* dataspace ID */
- hid_t dtid = H5I_INVALID_HID;
- hid_t dsid = H5I_INVALID_HID;
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int **buf = NULL;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t dtid = H5I_INVALID_HID;
+ hid_t dsid = H5I_INVALID_HID;
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int ** buf = NULL;
/* Create and fill array */
H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
@@ -2783,45 +2737,45 @@ int make_nbit(hid_t loc_id)
H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
dtid = H5Tcopy(H5T_NATIVE_INT);
- if (H5Tset_precision(dtid,(H5Tget_precision(dtid) - 1)) < 0)
+ if (H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)) < 0)
goto error;
/* remove the filters from the dcpl */
- if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto error;
- if(H5Pset_nbit(dcpl) < 0)
+ if (H5Pset_nbit(dcpl) < 0)
goto error;
- if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
goto error;
H5Dclose(dsid);
- if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto error;
- if((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
goto error;
H5Dclose(dsid);
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
if (H5Tclose(dtid) < 0)
goto error;
@@ -2831,36 +2785,37 @@ int make_nbit(hid_t loc_id)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(dtid);
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(dsid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_scaleoffset
-*
-* Purpose: make a dataset with the scaleoffset filter
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_scaleoffset(hid_t loc_id)
+ * Function: make_scaleoffset
+ *
+ * Purpose: make a dataset with the scaleoffset filter
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_scaleoffset(hid_t loc_id)
{
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
- hid_t sid = H5I_INVALID_HID; /* dataspace ID */
- hid_t dtid = H5I_INVALID_HID;
- hid_t dsid = H5I_INVALID_HID;
- hsize_t dims[RANK] = {DIM1,DIM2};
- hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
- int **buf = NULL;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t dtid = H5I_INVALID_HID;
+ hid_t dsid = H5I_INVALID_HID;
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int ** buf = NULL;
/* Create and fill array */
H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
@@ -2869,41 +2824,41 @@ int make_scaleoffset(hid_t loc_id)
H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
dtid = H5Tcopy(H5T_NATIVE_INT);
/* remove the filters from the dcpl */
- if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto error;
- if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0)
+ if (H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0)
goto error;
- if((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
goto error;
H5Dclose(dsid);
- if((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
goto error;
H5Tclose(dtid);
H5Dclose(dsid);
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
HDfree(buf);
@@ -2911,41 +2866,42 @@ int make_scaleoffset(hid_t loc_id)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dsid);
H5Tclose(dtid);
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_all_filters
-*
-* Purpose: make a file with all filters
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_all_filters(hid_t loc_id)
+ * Function: make_all_filters
+ *
+ * Purpose: make a file with all filters
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_all_filters(hid_t loc_id)
{
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
- hid_t sid = H5I_INVALID_HID; /* dataspace ID */
- hid_t dtid = H5I_INVALID_HID;
- hid_t dsid = H5I_INVALID_HID;
-#if defined (H5_HAVE_FILTER_SZIP)
- unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t dtid = H5I_INVALID_HID;
+ hid_t dsid = H5I_INVALID_HID;
+#if defined(H5_HAVE_FILTER_SZIP)
+ unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block = 8;
#endif /* H5_HAVE_FILTER_SZIP */
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int **buf = NULL;
-#if defined (H5_HAVE_FILTER_SZIP)
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int ** buf = NULL;
+#if defined(H5_HAVE_FILTER_SZIP)
int szip_can_encode = 0;
#endif
@@ -2956,7 +2912,7 @@ int make_all_filters(hid_t loc_id)
H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
@@ -2973,24 +2929,23 @@ int make_all_filters(hid_t loc_id)
if (H5Pset_fletcher32(dcpl) < 0)
goto error;
-#if defined (H5_HAVE_FILTER_SZIP)
- if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
- {
+#if defined(H5_HAVE_FILTER_SZIP)
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
szip_can_encode = 1;
}
- if (szip_can_encode)
- {
+ if (szip_can_encode) {
/* set szip data */
- if(H5Pset_szip (dcpl,szip_options_mask, szip_pixels_per_block) < 0)
+ if (H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block) < 0)
goto error;
- } else {
+ }
+ else {
/* WARNING? SZIP is decoder only, can't generate test data using szip */
}
#endif
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
- if(H5Pset_deflate(dcpl, 9) < 0)
+ if (H5Pset_deflate(dcpl, 9) < 0)
goto error;
#endif
@@ -2998,7 +2953,7 @@ int make_all_filters(hid_t loc_id)
goto error;
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto error;
/* set the checksum filter */
if (H5Pset_fletcher32(dcpl) < 0)
@@ -3006,28 +2961,25 @@ int make_all_filters(hid_t loc_id)
if (make_dset(loc_id, "dset_fletcher32", sid, dcpl, buf[0]) < 0)
goto error;
-
- /* Make sure encoding is enabled */
-#if defined (H5_HAVE_FILTER_SZIP)
- if (szip_can_encode)
- {
+ /* Make sure encoding is enabled */
+#if defined(H5_HAVE_FILTER_SZIP)
+ if (szip_can_encode) {
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto error;
/* set szip data */
- if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
+ if (H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block) < 0)
goto error;
if (make_dset(loc_id, "dset_szip", sid, dcpl, buf[0]) < 0)
goto error;
- } else
- {
+ }
+ else {
/* WARNING? SZIP is decoder only, can't generate test dataset */
}
#endif
-
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto error;
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
@@ -3035,20 +2987,17 @@ int make_all_filters(hid_t loc_id)
if (make_dset(loc_id, "dset_shuffle", sid, dcpl, buf[0]) < 0)
goto error;
-
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto error;
/* set deflate data */
- if(H5Pset_deflate(dcpl, 1) < 0)
+ if (H5Pset_deflate(dcpl, 1) < 0)
goto error;
if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf[0]) < 0)
goto error;
#endif
-
-
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
goto error;
@@ -3059,20 +3008,20 @@ int make_all_filters(hid_t loc_id)
goto error;
if (H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)) < 0)
goto error;
- if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
goto error;
/* close */
- if(H5Tclose(dtid) < 0)
+ if (H5Tclose(dtid) < 0)
goto error;
- if(H5Dclose(dsid) < 0)
+ if (H5Dclose(dsid) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
HDfree(buf);
@@ -3086,35 +3035,34 @@ error:
H5Dclose(dsid);
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
return -1;
}
-
-
/*-------------------------------------------------------------------------
-* Function: make_early
-*
-* Purpose: create a file for the H5D_ALLOC_TIME_EARLY test
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_early(void)
+ * Function: make_early
+ *
+ * Purpose: create a file for the H5D_ALLOC_TIME_EARLY test
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_early(void)
{
- hsize_t dims[1] ={3000};
- hsize_t cdims[1]={30};
- hid_t fid=H5I_INVALID_HID;
- hid_t did=H5I_INVALID_HID;
- hid_t sid=H5I_INVALID_HID;
- hid_t tid=H5I_INVALID_HID;
- hid_t dcpl=H5I_INVALID_HID;
+ hsize_t dims[1] = {3000};
+ hsize_t cdims[1] = {30};
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
int i;
char name[16];
- int iter=100;
+ int iter = 100;
if ((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
@@ -3130,8 +3078,7 @@ int make_early(void)
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
goto out;
- for(i = 0; i < iter; i++)
- {
+ for (i = 0; i < iter; i++) {
if ((fid = H5Fopen(FNAME5, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
if ((did = H5Dcreate2(fid, "early", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
@@ -3152,15 +3099,14 @@ int make_early(void)
}
/*-------------------------------------------------------------------------
- * do the same without close/opening the file and creating the dataset
- *-------------------------------------------------------------------------
- */
+ * do the same without close/opening the file and creating the dataset
+ *-------------------------------------------------------------------------
+ */
if ((fid = H5Fcreate(FNAME6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- for(i = 0; i < iter; i++)
- {
+ for (i = 0; i < iter; i++) {
if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
goto out;
HDsprintf(name, "%d", i);
@@ -3187,28 +3133,28 @@ out:
H5Sclose(sid);
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_layout
-*
-* Purpose: make several datasets with several layouts in location LOC_ID
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_layout(hid_t loc_id)
+ * Function: make_layout
+ *
+ * Purpose: make several datasets with several layouts in location LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_layout(hid_t loc_id)
{
- hid_t dcpl=H5I_INVALID_HID; /* dataset creation property list */
- hid_t sid=H5I_INVALID_HID; /* dataspace ID */
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int **buf = NULL;
- int i;
- char name[16];
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int ** buf = NULL;
+ int i;
+ char name[16];
/* Create and fill array */
H5TEST_ALLOCATE_2D_ARRAY(buf, int, DIM1, DIM2);
@@ -3216,63 +3162,61 @@ int make_layout(hid_t loc_id)
goto error;
H5TEST_FILL_2D_ARRAY(buf, int, DIM1, DIM2);
-
/*-------------------------------------------------------------------------
- * make several dataset with no filters
- *-------------------------------------------------------------------------
- */
- for (i=0; i<4; i++) {
- HDsprintf(name,"dset%d",i+1);
+ * make several dataset with no filters
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0; i < 4; i++) {
+ HDsprintf(name, "dset%d", i + 1);
if (write_dset(loc_id, RANK, dims, name, H5T_NATIVE_INT, buf[0]) < 0)
goto error;
}
-
/*-------------------------------------------------------------------------
- * make several dataset with several layout options
- *-------------------------------------------------------------------------
- */
+ * make several dataset with several layout options
+ *-------------------------------------------------------------------------
+ */
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
/*-------------------------------------------------------------------------
- * H5D_COMPACT
- *-------------------------------------------------------------------------
- */
- if(H5Pset_layout (dcpl,H5D_COMPACT) < 0)
+ * H5D_COMPACT
+ *-------------------------------------------------------------------------
+ */
+ if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
goto error;
if (make_dset(loc_id, "dset_compact", sid, dcpl, buf[0]) < 0)
goto error;
/*-------------------------------------------------------------------------
- * H5D_CONTIGUOUS
- *-------------------------------------------------------------------------
- */
- if(H5Pset_layout (dcpl,H5D_CONTIGUOUS) < 0)
+ * H5D_CONTIGUOUS
+ *-------------------------------------------------------------------------
+ */
+ if (H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0)
goto error;
if (make_dset(loc_id, "dset_contiguous", sid, dcpl, buf[0]) < 0)
goto error;
/*-------------------------------------------------------------------------
- * H5D_CHUNKED
- *-------------------------------------------------------------------------
- */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ * H5D_CHUNKED
+ *-------------------------------------------------------------------------
+ */
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
if (make_dset(loc_id, "dset_chunk", sid, dcpl, buf[0]) < 0)
goto error;
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
HDfree(buf);
@@ -3284,7 +3228,8 @@ error:
{
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
@@ -3301,25 +3246,25 @@ error:
*
*-------------------------------------------------------------------------
*/
-#define S_DIM1 4
-#define S_DIM2 10
-#define CONTIG_S "contig_small"
-#define CHUNKED_S_FIX "chunked_small_fixed"
+#define S_DIM1 4
+#define S_DIM2 10
+#define CONTIG_S "contig_small"
+#define CHUNKED_S_FIX "chunked_small_fixed"
-static
-int make_layout2(hid_t loc_id)
+static int
+make_layout2(hid_t loc_id)
{
- hid_t contig_dcpl = H5I_INVALID_HID; /* dataset creation property list */
- hid_t chunked_dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t contig_dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t chunked_dcpl = H5I_INVALID_HID; /* dataset creation property list */
- int ret_value = -1; /* Return value */
- hid_t s_sid = H5I_INVALID_HID; /* dataspace ID */
+ int ret_value = -1; /* Return value */
+ hid_t s_sid = H5I_INVALID_HID; /* dataspace ID */
- hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */
- hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */
+ hsize_t s_dims[RANK] = {S_DIM1, S_DIM2}; /* Dataspace (< 1 k) */
+ hsize_t chunk_dims[RANK] = {S_DIM1 / 2, S_DIM2 / 2}; /* Dimension sizes for chunks */
- int **s_buf = NULL; /* Temporary buffer */
+ int **s_buf = NULL; /* Temporary buffer */
/* Create and fill array */
H5TEST_ALLOCATE_2D_ARRAY(s_buf, int, S_DIM1, S_DIM2);
@@ -3328,79 +3273,78 @@ int make_layout2(hid_t loc_id)
H5TEST_FILL_2D_ARRAY(s_buf, int, S_DIM1, S_DIM2);
/* Create dataspaces */
- if((s_sid = H5Screate_simple(RANK, s_dims, NULL)) < 0)
+ if ((s_sid = H5Screate_simple(RANK, s_dims, NULL)) < 0)
goto error;
/* Create contiguous datasets */
- if((contig_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((contig_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_layout(contig_dcpl, H5D_CONTIGUOUS) < 0)
+ if (H5Pset_layout(contig_dcpl, H5D_CONTIGUOUS) < 0)
goto error;
- if(make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf[0]) < 0)
+ if (make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf[0]) < 0)
goto error;
/* Create chunked datasets */
- if((chunked_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((chunked_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(chunked_dcpl, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(chunked_dcpl, RANK, chunk_dims) < 0)
goto error;
- if(make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf[0]) < 0)
+ if (make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf[0]) < 0)
goto error;
- HDfree(s_buf);
-
ret_value = 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(contig_dcpl);
H5Pclose(chunked_dcpl);
H5Sclose(s_sid);
-
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(s_buf);
- return(ret_value);
+ return (ret_value);
} /* make_layout2() */
/*-------------------------------------------------------------------------
-* Function: make_layout3
-*
-* Purpose: make chunked datasets with unlimited max dim and chunk dim is
-* bigger than current dim. (HDFFV-7933)
-* Test for converting chunk to chunk , chunk to conti and chunk
-* to compact.
-* - The chunk to chunk changes layout bigger than any current dim
-* again.
-* - The chunk to compact test dataset bigger than 64K, should
-* remain original layout.*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: make_layout3
+ *
+ * Purpose: make chunked datasets with unlimited max dim and chunk dim is
+ * bigger than current dim. (HDFFV-7933)
+ * Test for converting chunk to chunk , chunk to conti and chunk
+ * to compact.
+ * - The chunk to chunk changes layout bigger than any current dim
+ * again.
+ * - The chunk to compact test dataset bigger than 64K, should
+ * remain original layout.*
+ *
+ *-------------------------------------------------------------------------
+ */
#define DIM1_L3 300
#define DIM2_L3 200
/* small size */
#define SDIM1_L3 4
#define SDIM2_L3 50
-static
-int make_layout3(hid_t loc_id)
+static int
+make_layout3(hid_t loc_id)
{
- hid_t dcpl1=H5I_INVALID_HID; /* dataset creation property list */
- hid_t dcpl2=H5I_INVALID_HID; /* dataset creation property list */
- hid_t dcpl3=H5I_INVALID_HID; /* dataset creation property list */
- hid_t sid1=H5I_INVALID_HID; /* dataspace ID */
- hid_t sid2=H5I_INVALID_HID; /* dataspace ID */
- hsize_t dims1[RANK]={DIM1_L3,DIM2_L3};
- hsize_t dims2[RANK]={SDIM1_L3,SDIM2_L3};
- hsize_t maxdims[RANK]={H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims1[RANK]={DIM1_L3*2,5};
- hsize_t chunk_dims2[RANK]={SDIM1_L3 + 2, SDIM2_L3/2};
- hsize_t chunk_dims3[RANK]={SDIM1_L3 - 2, SDIM2_L3/2};
- int **buf1 = NULL;
- int **buf2 = NULL;
+ hid_t dcpl1 = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t dcpl2 = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t dcpl3 = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid1 = H5I_INVALID_HID; /* dataspace ID */
+ hid_t sid2 = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims1[RANK] = {DIM1_L3, DIM2_L3};
+ hsize_t dims2[RANK] = {SDIM1_L3, SDIM2_L3};
+ hsize_t maxdims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims1[RANK] = {DIM1_L3 * 2, 5};
+ hsize_t chunk_dims2[RANK] = {SDIM1_L3 + 2, SDIM2_L3 / 2};
+ hsize_t chunk_dims3[RANK] = {SDIM1_L3 - 2, SDIM2_L3 / 2};
+ int ** buf1 = NULL;
+ int ** buf2 = NULL;
/* Create and fill arrays */
H5TEST_ALLOCATE_2D_ARRAY(buf1, int, DIM1_L3, DIM2_L3);
@@ -3413,77 +3357,76 @@ int make_layout3(hid_t loc_id)
goto error;
H5TEST_FILL_2D_ARRAY(buf2, int, SDIM1_L3, SDIM2_L3);
-
/*-------------------------------------------------------------------------
- * make chunked dataset with
- * - dset maxdims are UNLIMIT
- * - a chunk dim is bigger than dset dim
- * - dset size bigger than compact max (64K)
- *-------------------------------------------------------------------------
- */
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dim is bigger than dset dim
+ * - dset size bigger than compact max (64K)
+ *-------------------------------------------------------------------------
+ */
/* create a space */
- if((sid1 = H5Screate_simple(RANK, dims1, maxdims)) < 0)
+ if ((sid1 = H5Screate_simple(RANK, dims1, maxdims)) < 0)
goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl1, RANK, chunk_dims1) < 0)
+ if (H5Pset_chunk(dcpl1, RANK, chunk_dims1) < 0)
goto error;
if (make_dset(loc_id, "chunk_unlimit1", sid1, dcpl1, buf1[0]) < 0)
goto error;
/*-------------------------------------------------------------------------
- * make chunked dataset with
- * - dset maxdims are UNLIMIT
- * - a chunk dim is bigger than dset dim
- * - dset size smaller than compact (64K)
- *-------------------------------------------------------------------------
- */
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dim is bigger than dset dim
+ * - dset size smaller than compact (64K)
+ *-------------------------------------------------------------------------
+ */
/* create a space */
- if((sid2 = H5Screate_simple(RANK, dims2, maxdims)) < 0)
+ if ((sid2 = H5Screate_simple(RANK, dims2, maxdims)) < 0)
goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl2, RANK, chunk_dims2) < 0)
+ if (H5Pset_chunk(dcpl2, RANK, chunk_dims2) < 0)
goto error;
if (make_dset(loc_id, "chunk_unlimit2", sid2, dcpl2, buf2[0]) < 0)
goto error;
/*-------------------------------------------------------------------------
- * make chunked dataset with
- * - dset maxdims are UNLIMIT
- * - a chunk dims are smaller than dset dims
- * - dset size smaller than compact (64K)
- *-------------------------------------------------------------------------
- */
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dims are smaller than dset dims
+ * - dset size smaller than compact (64K)
+ *-------------------------------------------------------------------------
+ */
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl3 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl3, RANK, chunk_dims3) < 0)
+ if (H5Pset_chunk(dcpl3, RANK, chunk_dims3) < 0)
goto error;
if (make_dset(loc_id, "chunk_unlimit3", sid2, dcpl3, buf2[0]) < 0)
goto error;
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid1) < 0)
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid1) < 0)
goto error;
- if(H5Sclose(sid2) < 0)
+ if (H5Sclose(sid2) < 0)
goto error;
- if(H5Pclose(dcpl1) < 0)
+ if (H5Pclose(dcpl1) < 0)
goto error;
- if(H5Pclose(dcpl2) < 0)
+ if (H5Pclose(dcpl2) < 0)
goto error;
- if(H5Pclose(dcpl3) < 0)
+ if (H5Pclose(dcpl3) < 0)
goto error;
HDfree(buf1);
@@ -3499,7 +3442,8 @@ error:
H5Pclose(dcpl1);
H5Pclose(dcpl2);
H5Pclose(dcpl3);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf1);
HDfree(buf2);
@@ -3508,178 +3452,179 @@ error:
}
/*-------------------------------------------------------------------------
-* Function: make a file with an integer dataset with a fill value
-*
-* Purpose: test copy of fill values
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_fill(hid_t loc_id)
+ * Function: make a file with an integer dataset with a fill value
+ *
+ * Purpose: test copy of fill values
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_fill(hid_t loc_id)
{
- hid_t did=H5I_INVALID_HID;
- hid_t sid=H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hid_t dcpl;
- hsize_t dims[2]={3,2};
- int buf[3][2]= {{1,1},{1,2},{2,2}};
+ hsize_t dims[2] = {3, 2};
+ int buf[3][2] = {{1, 1}, {1, 2}, {2, 2}};
int fillvalue = 2;
/*-------------------------------------------------------------------------
- * H5T_INTEGER, write a fill value
- *-------------------------------------------------------------------------
- */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
goto out;
- if((sid = H5Screate_simple(2,dims,NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
goto out;
- if((did = H5Dcreate2(loc_id, "dset_fill", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "dset_fill", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
/*-------------------------------------------------------------------------
-* Function: make_big
-*
-* Purpose: used in test read by hyperslabs. Creates a 128MB dataset.
-* Only 1 1024Kb hyperslab is written.
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_big(hid_t loc_id)
+ * Function: make_big
+ *
+ * Purpose: used in test read by hyperslabs. Creates a 128MB dataset.
+ * Only 1 1024Kb hyperslab is written.
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_big(hid_t loc_id)
{
- hid_t did=H5I_INVALID_HID;
- hid_t f_sid=H5I_INVALID_HID;
- hid_t m_sid=H5I_INVALID_HID;
- hid_t tid;
- hid_t dcpl;
- hsize_t dims[1]={ H5TOOLS_MALLOCSIZE + 1}; /* dataset dimensions */
- hsize_t hs_size[1]; /* hyperslab dimensions */
- hsize_t hs_start[1]; /* hyperslab start */
- hsize_t chunk_dims[1]={1024}; /* chunk dimensions */
- size_t size;
- size_t nelmts=(size_t)1024;
- signed char fillvalue=-1;
- signed char *buf=NULL;
+ hid_t did = H5I_INVALID_HID;
+ hid_t f_sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t tid;
+ hid_t dcpl;
+ hsize_t dims[1] = {H5TOOLS_MALLOCSIZE + 1}; /* dataset dimensions */
+ hsize_t hs_size[1]; /* hyperslab dimensions */
+ hsize_t hs_start[1]; /* hyperslab start */
+ hsize_t chunk_dims[1] = {1024}; /* chunk dimensions */
+ size_t size;
+ size_t nelmts = (size_t)1024;
+ signed char fillvalue = -1;
+ signed char *buf = NULL;
/* write one 1024 byte hyperslab */
hs_start[0] = 0;
hs_size[0] = 1024;
/* create */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0)
goto out;
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
goto out;
- if((f_sid = H5Screate_simple(1,dims,NULL)) < 0)
+ if ((f_sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
- if((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ if ((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
goto out;
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
- if((size = H5Tget_size(tid))<=0)
+ if ((size = H5Tget_size(tid)) <= 0)
goto out;
/* initialize buffer to 0 */
- buf=(signed char *) HDcalloc( nelmts, size);
+ buf = (signed char *)HDcalloc(nelmts, size);
- if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
+ if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0)
goto out;
- if (H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_SCHAR, m_sid, f_sid, H5P_DEFAULT, buf) < 0)
goto out;
HDfree(buf);
- buf=NULL;
+ buf = NULL;
/* close */
- if(H5Sclose(f_sid) < 0)
+ if (H5Sclose(f_sid) < 0)
goto out;
- if(H5Sclose(m_sid) < 0)
+ if (H5Sclose(m_sid) < 0)
goto out;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(f_sid);
H5Sclose(m_sid);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
-
/*-------------------------------------------------------------------------
-* Function: make_external
-*
-* Purpose: create a external dataset
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_external(hid_t loc_id)
+ * Function: make_external
+ *
+ * Purpose: create a external dataset
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_external(hid_t loc_id)
{
- hid_t did=H5I_INVALID_HID;
- hid_t sid=H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hid_t dcpl;
- int buf[2]={1,2};
- hsize_t cur_size[1]; /* data space current size */
- hsize_t max_size[1]; /* data space maximum size */
+ int buf[2] = {1, 2};
+ hsize_t cur_size[1]; /* data space current size */
+ hsize_t max_size[1]; /* data space maximum size */
hsize_t size;
cur_size[0] = max_size[0] = 2;
- size = max_size[0] * sizeof(int);
+ size = max_size[0] * sizeof(int);
/* create */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_external(dcpl, H5REPACK_EXTFILE, (off_t)0, size) < 0)
+ if (H5Pset_external(dcpl, H5REPACK_EXTFILE, (off_t)0, size) < 0)
goto out;
- if((sid = H5Screate_simple(1,cur_size, max_size)) < 0)
+ if ((sid = H5Screate_simple(1, cur_size, max_size)) < 0)
goto out;
- if((did = H5Dcreate2(loc_id, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
return 0;
@@ -3690,51 +3635,50 @@ out:
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
/*-------------------------------------------------------------------------
-* Function: make_userblock
-*
-* Purpose: create a file for the userblock copying test
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: make_userblock
+ *
+ * Purpose: create a file for the userblock copying test
+ *
+ *-------------------------------------------------------------------------
+ */
static int
make_userblock(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t fcpl = H5I_INVALID_HID;
- int fd = -1; /* File descriptor for writing userblock */
- char ub[USERBLOCK_SIZE]; /* User block data */
- ssize_t H5_ATTR_NDEBUG_UNUSED nwritten; /* # of bytes written */
- size_t u; /* Local index variable */
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fcpl = H5I_INVALID_HID;
+ int fd = -1; /* File descriptor for writing userblock */
+ char ub[USERBLOCK_SIZE]; /* User block data */
+ ssize_t H5_ATTR_NDEBUG_UNUSED nwritten; /* # of bytes written */
+ size_t u; /* Local index variable */
/* Create file creation property list with userblock set */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto out;
- if(H5Pset_userblock(fcpl, (hsize_t)USERBLOCK_SIZE) < 0)
+ if (H5Pset_userblock(fcpl, (hsize_t)USERBLOCK_SIZE) < 0)
goto out;
/* Create file with userblock */
- if((fid = H5Fcreate(FNAME16, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME16, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
/* Close file creation property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
goto out;
-
/* Initialize userblock data */
- for(u = 0; u < USERBLOCK_SIZE; u++)
+ for (u = 0; u < USERBLOCK_SIZE; u++)
ub[u] = (char)('a' + (char)(u % 26));
/* Re-open HDF5 file, as "plain" file */
- if((fd = HDopen(FNAME16, O_WRONLY)) < 0)
+ if ((fd = HDopen(FNAME16, O_WRONLY)) < 0)
goto out;
/* Write userblock data */
@@ -3747,58 +3691,59 @@ make_userblock(void)
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl);
H5Fclose(fid);
- } H5E_END_TRY;
- if(fd >= 0)
+ }
+ H5E_END_TRY;
+ if (fd >= 0)
HDclose(fd);
return -1;
} /* end make_userblock() */
/*-------------------------------------------------------------------------
-* Function: verify_userblock
-*
-* Purpose: Verify that the userblock was copied correctly
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: verify_userblock
+ *
+ * Purpose: Verify that the userblock was copied correctly
+ *
+ *-------------------------------------------------------------------------
+ */
static int
-verify_userblock( const char* filename)
+verify_userblock(const char *filename)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t fcpl = H5I_INVALID_HID;
- int fd = -1; /* File descriptor for writing userblock */
- char ub[USERBLOCK_SIZE]; /* User block data */
- hsize_t ub_size = 0; /* User block size */
- ssize_t H5_ATTR_NDEBUG_UNUSED nread; /* # of bytes read */
- size_t u; /* Local index variable */
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fcpl = H5I_INVALID_HID;
+ int fd = -1; /* File descriptor for writing userblock */
+ char ub[USERBLOCK_SIZE]; /* User block data */
+ hsize_t ub_size = 0; /* User block size */
+ ssize_t H5_ATTR_NDEBUG_UNUSED nread; /* # of bytes read */
+ size_t u; /* Local index variable */
/* Open file with userblock */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
goto out;
/* Retrieve file creation property list & userblock size */
- if((fcpl = H5Fget_create_plist(fid)) < 0)
+ if ((fcpl = H5Fget_create_plist(fid)) < 0)
goto out;
- if(H5Pget_userblock(fcpl, &ub_size) < 0)
+ if (H5Pget_userblock(fcpl, &ub_size) < 0)
goto out;
/* Verify userblock size is correct */
- if(ub_size != USERBLOCK_SIZE)
+ if (ub_size != USERBLOCK_SIZE)
goto out;
/* Close file creation property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
-
/* Re-open HDF5 file, as "plain" file */
- if((fd = HDopen(filename, O_RDONLY)) < 0)
+ if ((fd = HDopen(filename, O_RDONLY)) < 0)
goto out;
/* Read userblock data */
@@ -3806,8 +3751,8 @@ verify_userblock( const char* filename)
HDassert(nread == USERBLOCK_SIZE);
/* Verify userblock data */
- for(u = 0; u < USERBLOCK_SIZE; u++)
- if(ub[u] != (char)('a' + (u % 26)))
+ for (u = 0; u < USERBLOCK_SIZE; u++)
+ if (ub[u] != (char)('a' + (u % 26)))
goto out;
/* Close file */
@@ -3816,38 +3761,39 @@ verify_userblock( const char* filename)
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl);
H5Fclose(fid);
- } H5E_END_TRY;
- if(fd >= 0)
+ }
+ H5E_END_TRY;
+ if (fd >= 0)
HDclose(fd);
return -1;
} /* end verify_userblock() */
-
/*-------------------------------------------------------------------------
-* Function: make_userblock_file
-*
-* Purpose: create a file for the userblock add test
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: make_userblock_file
+ *
+ * Purpose: create a file for the userblock add test
+ *
+ *-------------------------------------------------------------------------
+ */
static int
make_userblock_file(void)
{
- int fd = -1; /* File descriptor for writing userblock */
- char ub[USERBLOCK_SIZE]; /* User block data */
- ssize_t H5_ATTR_NDEBUG_UNUSED nwritten; /* # of bytes written */
- size_t u; /* Local index variable */
+ int fd = -1; /* File descriptor for writing userblock */
+ char ub[USERBLOCK_SIZE]; /* User block data */
+ ssize_t H5_ATTR_NDEBUG_UNUSED nwritten; /* # of bytes written */
+ size_t u; /* Local index variable */
/* initialize userblock data */
- for(u = 0; u < USERBLOCK_SIZE; u++)
+ for (u = 0; u < USERBLOCK_SIZE; u++)
ub[u] = (char)('a' + (char)(u % 26));
/* open file */
- if((fd = HDopen(FNAME_UB, O_WRONLY|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ if ((fd = HDopen(FNAME_UB, O_WRONLY | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto out;
/* write userblock data */
@@ -3861,147 +3807,135 @@ make_userblock_file(void)
out:
- if(fd >= 0)
+ if (fd >= 0)
HDclose(fd);
return -1;
}
/*-------------------------------------------------------------------------
-* Function: write_dset_in
-*
-* Purpose: write datasets in LOC_ID
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 12, 2003
-*
-*-------------------------------------------------------------------------
-*/
-static
-int write_dset_in(hid_t loc_id,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t file_id,
- int make_diffs /* flag to modify data buffers */)
+ * Function: write_dset_in
+ *
+ * Purpose: write datasets in LOC_ID
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to dataset*/
+ hid_t file_id, int make_diffs /* flag to modify data buffers */)
{
/* compound datatype */
- typedef struct s_t
- {
+ typedef struct s_t {
char a;
double b;
} s_t;
- typedef enum
- {
- RED,
- GREEN
- } e_t;
-
- hid_t did=H5I_INVALID_HID;
- hid_t sid=H5I_INVALID_HID;
- hid_t tid=H5I_INVALID_HID;
- hid_t pid=H5I_INVALID_HID;
+ typedef enum { RED, GREEN } e_t;
+
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t pid = H5I_INVALID_HID;
unsigned i, j;
- int val, k, n;
- float f;
+ int val, k, n;
+ float f;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1]={2};
- hsize_t dims1r[1]={2};
- char buf1[2][3]= {"ab","de"}; /* string */
- char buf2[2]= {1,2}; /* bitfield, opaque */
- s_t buf3[2]= {{1,2},{3,4}}; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- e_t buf45[2]= {RED,GREEN}; /* enum */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1]={3}; /* array dimension */
- int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
- int buf7[2]= {1,2}; /* integer */
- float buf8[2]= {1,2}; /* float */
+ hsize_t dims[1] = {2};
+ hsize_t dims1r[1] = {2};
+ char buf1[2][3] = {"ab", "de"}; /* string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2] = {RED, GREEN}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1, 2}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2]={3,2};
- hsize_t dims2r[2]={1,1};
- char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
- char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
- s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
- hobj_ref_t buf42[1][1]; /* reference */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
- int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
- float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+ hsize_t dims2[2] = {3, 2};
+ hsize_t dims2r[2] = {1, 1};
+ char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
+ hobj_ref_t buf42[1][1]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3]={4,3,2};
- hsize_t dims3r[3]={1,1,1};
- char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
- "rs","tu","vw","xz","AB","CD","EF","GH",
- "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[1][1][1]; /* reference */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
-
- /*-------------------------------------------------------------------------
- * 1D
- *-------------------------------------------------------------------------
- */
+ hsize_t dims3[3] = {4, 3, 2};
+ hsize_t dims3r[3] = {1, 1, 1};
+ char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
+ "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[1][1][1]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+ /*-------------------------------------------------------------------------
+ * 1D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
-
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++)
- for(j = 0; j < 2; j++)
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++)
buf1[i][j] = 'z';
}
-
if ((tid = H5Tcopy(H5T_C_S1)) < 0)
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (write_dset(loc_id,1,dims,"string",tid,buf1) < 0)
+ if (write_dset(loc_id, 1, dims, "string", tid, buf1) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
-
/* create hard link */
if (H5Lcreate_hard(loc_id, "string", H5L_SAME_LOC, "string_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++)
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
buf2[i] = buf2[1] = 0;
}
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (write_dset(loc_id,1,dims,"bitfield",tid,buf2) < 0)
+ if (write_dset(loc_id, 1, dims, "bitfield", tid, buf2) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++) {
+ if (make_diffs) {
+ for (i = 0; i < 2; i++) {
buf3[i].a = 0;
buf3[i].b = 0;
}
@@ -4011,45 +3945,43 @@ int write_dset_in(hid_t loc_id,
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (write_dset(loc_id,1,dims,"opaque",tid,buf2) < 0)
+ if (write_dset(loc_id, 1, dims, "opaque", tid, buf2) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
-
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++)
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
buf45[i] = GREEN;
}
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (write_dset(loc_id,1,dims,"compound",tid,buf3) < 0)
+ if (write_dset(loc_id, 1, dims, "compound", tid, buf3) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* object references ( H5R_OBJECT ) */
- buf4[0]=0;
- buf4[1]=0;
- if (dset_name)
- {
- if (H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ buf4[0] = 0;
+ buf4[1] = 0;
+ if (dset_name) {
+ if (H5Rcreate(&buf4[0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
- if (write_dset(loc_id,1,dims1r,"refobj",H5T_STD_REF_OBJ,buf4) < 0)
+ if (write_dset(loc_id, 1, dims1r, "refobj", H5T_STD_REF_OBJ, buf4) < 0)
goto out;
}
@@ -4057,38 +3989,37 @@ int write_dset_in(hid_t loc_id,
if (make_dset_reg_ref(loc_id) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (write_dset(loc_id,1,dims,"enum",tid,buf45) < 0)
+ if (write_dset(loc_id, 1, dims, "enum", tid, buf45) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc( 1 * sizeof(int));
- ((int *)buf5[0].p)[0]=1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc( 2 * sizeof(int));
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
((int *)buf5[1].p)[0] = 2;
((int *)buf5[1].p)[1] = 3;
- if(make_diffs) {
+ if (make_diffs) {
((int *)buf5[0].p)[0] = 0;
((int *)buf5[1].p)[0] = 0;
((int *)buf5[1].p)[1] = 0;
@@ -4112,13 +4043,13 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++)
- for(j = 0; j < 3; j++)
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 3; j++)
buf6[i][j] = 0;
}
@@ -4131,27 +4062,26 @@ int write_dset_in(hid_t loc_id,
{
- hsize_t TEST_BUFSIZE = (128 * 1024 * 1024); /* 128MB */
- double *dbuf; /* information to write */
+ hsize_t TEST_BUFSIZE = (128 * 1024 * 1024); /* 128MB */
+ double * dbuf; /* information to write */
size_t size;
hsize_t sdims[] = {1};
hsize_t tdims[] = {TEST_BUFSIZE / sizeof(double) + 1};
unsigned u;
/* allocate and initialize array data to write */
- size = ( TEST_BUFSIZE / sizeof(double) + 1 ) * sizeof(double);
- dbuf = (double*)HDmalloc( size );
- if (NULL == dbuf)
- {
- HDprintf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 );
+ size = (TEST_BUFSIZE / sizeof(double) + 1) * sizeof(double);
+ dbuf = (double *)HDmalloc(size);
+ if (NULL == dbuf) {
+ HDprintf("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n",
+ (int)size / 1000000);
goto out;
}
- for( u = 0; u < TEST_BUFSIZE / sizeof(double) + 1; u++)
+ for (u = 0; u < TEST_BUFSIZE / sizeof(double) + 1; u++)
dbuf[u] = u;
- if (make_diffs)
- {
+ if (make_diffs) {
dbuf[5] = 0;
dbuf[6] = 0;
}
@@ -4182,107 +4112,100 @@ int write_dset_in(hid_t loc_id,
}
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++) {
+ if (make_diffs) {
+ for (i = 0; i < 2; i++) {
buf7[i] = 0;
buf8[i] = 0;
}
}
- if (write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7) < 0)
+ if (write_dset(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7) < 0)
goto out;
- if (write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8) < 0)
+ if (write_dset(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * 2D
- *-------------------------------------------------------------------------
- */
+ * 2D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
+ if (make_diffs) {
HDmemset(buf12, 'z', sizeof buf12);
}
-
if ((tid = H5Tcopy(H5T_C_S1)) < 0)
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (write_dset(loc_id,2,dims2,"string2D",tid,buf12) < 0)
+ if (write_dset(loc_id, 2, dims2, "string2D", tid, buf12) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
-
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf22,0,sizeof buf22);
+ if (make_diffs) {
+ HDmemset(buf22, 0, sizeof buf22);
}
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0)
+ if (write_dset(loc_id, 2, dims2, "bitfield2D", tid, buf22) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (write_dset(loc_id,2,dims2,"opaque2D",tid,buf22) < 0)
+ if (write_dset(loc_id, 2, dims2, "opaque2D", tid, buf22) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf32,0,sizeof buf32);
+ if (make_diffs) {
+ HDmemset(buf32, 0, sizeof buf32);
}
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (write_dset(loc_id,2,dims2,"compound2D",tid,buf32) < 0)
+ if (write_dset(loc_id, 2, dims2, "compound2D", tid, buf32) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
- if (dset_name)
- {
+ if (dset_name) {
if (H5Rcreate(&buf42[0][0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
if (write_dset(loc_id, 2, dims2r, "refobj2D", H5T_STD_REF_OBJ, buf42) < 0)
@@ -4290,36 +4213,36 @@ int write_dset_in(hid_t loc_id,
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (write_dset(loc_id,2,dims2,"enum2D",tid,0) < 0)
+ if (write_dset(loc_id, 2, dims2, "enum2D", tid, 0) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 2; j++) {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
unsigned l;
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++) {
- if(make_diffs)
+ for (l = 0; l < i + 1; l++) {
+ if (make_diffs)
((int *)buf52[i][j].p)[l] = 0;
else
((int *)buf52[i][j].p)[l] = n++;
@@ -4345,16 +4268,14 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf62,0,sizeof buf62);
+ if (make_diffs) {
+ HDmemset(buf62, 0, sizeof buf62);
}
-
if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0)
goto out;
if (write_dset(loc_id, 2, dims2, "array2D", tid, buf62) < 0)
@@ -4363,17 +4284,15 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_INTEGER, write a fill value
- *-------------------------------------------------------------------------
- */
-
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
+ if (make_diffs) {
HDmemset(buf72, 0, sizeof buf72);
HDmemset(buf82, 0, sizeof buf82);
}
-
if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
if ((sid = H5Screate_simple(2, dims2, NULL)) < 0)
@@ -4390,49 +4309,46 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
- if (write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82) < 0)
+ if (write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * 3D
- *-------------------------------------------------------------------------
- */
+ * 3D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf13,'z',sizeof buf13);
+ if (make_diffs) {
+ HDmemset(buf13, 'z', sizeof buf13);
}
if ((tid = H5Tcopy(H5T_C_S1)) < 0)
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"string3D",tid,buf13) < 0)
+ if (write_dset(loc_id, 3, dims3, "string3D", tid, buf13) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
-
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- if(make_diffs)
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs)
buf23[i][j][k] = 0;
else
buf23[i][j][k] = (char)(n++);
@@ -4440,37 +4356,36 @@ int write_dset_in(hid_t loc_id,
}
}
-
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23) < 0)
+ if (write_dset(loc_id, 3, dims3, "bitfield3D", tid, buf23) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"opaque3D",tid,buf23) < 0)
+ if (write_dset(loc_id, 3, dims3, "opaque3D", tid, buf23) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- if(make_diffs) {
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
buf33[i][j][k].a = 0;
buf33[i][j][k].b = 0;
}
@@ -4482,25 +4397,23 @@ int write_dset_in(hid_t loc_id,
}
}
-
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"compound3D",tid,buf33) < 0)
+ if (write_dset(loc_id, 3, dims3, "compound3D", tid, buf33) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
- if (dset_name)
- {
+ if (dset_name) {
if (H5Rcreate(&buf43[0][0][0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
if (write_dset(loc_id, 3, dims3r, "refobj3D", H5T_STD_REF_OBJ, buf43) < 0)
@@ -4508,37 +4421,37 @@ int write_dset_in(hid_t loc_id,
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"enum3D",tid,0) < 0)
+ if (write_dset(loc_id, 3, dims3, "enum3D", tid, 0) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
unsigned l;
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++) {
- if(make_diffs)
+ for (l = 0; l < i + 1; l++) {
+ if (make_diffs)
((int *)buf53[i][j][k].p)[l] = 0;
else
((int *)buf53[i][j][k].p)[l] = n++;
@@ -4567,15 +4480,14 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
-
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
n = 1;
- for(i = 0; i < 24; i++) {
- for(j = 0; j < dimarray[0]; j++) {
- if(make_diffs)
+ for (i = 0; i < 24; i++) {
+ for (j = 0; j < dimarray[0]; j++) {
+ if (make_diffs)
buf63[i][j] = 0;
else
buf63[i][j] = n++;
@@ -4590,76 +4502,77 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
- n=1; f=1;
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ n = 1;
+ f = 1;
for (i = 0; i < 4; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++) {
if (make_diffs) {
- buf73[i][j][k]=0;
- buf83[i][j][k]=0;
+ buf73[i][j][k] = 0;
+ buf83[i][j][k] = 0;
}
else {
- buf73[i][j][k]=n++;
- buf83[i][j][k]=f++;
+ buf73[i][j][k] = n++;
+ buf83[i][j][k] = f++;
}
}
}
}
- if (write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73) < 0)
+ if (write_dset(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73) < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0)
+ if (write_dset(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83) < 0)
goto out;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(pid);
H5Sclose(sid);
H5Dclose(did);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
-
/*-------------------------------------------------------------------------
-* Function: make_dset_reg_ref
-*
-* Purpose: write dataset region references
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: make_dset_reg_ref
+ *
+ * Purpose: write dataset region references
+ *
+ *-------------------------------------------------------------------------
+ */
#define SPACE1_RANK 1
#define SPACE1_DIM1 1
#define SPACE2_RANK 2
#define SPACE2_DIM1 10
#define SPACE2_DIM2 10
-static
-int make_dset_reg_ref(hid_t loc_id)
+static int
+make_dset_reg_ref(hid_t loc_id)
{
- hid_t did1=H5I_INVALID_HID; /* Dataset ID */
- hid_t did2=H5I_INVALID_HID; /* Dereferenced dataset ID */
- hid_t sid1=H5I_INVALID_HID; /* Dataspace ID #1 */
- hid_t sid2=H5I_INVALID_HID; /* Dataspace ID #2 */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hdset_reg_ref_t *wbuf=NULL; /* buffer to write to disk */
- int *dwbuf=NULL; /* Buffer for writing numeric data to disk */
- int i; /* counting variables */
- int retval = -1; /* return value */
+ hid_t did1 = H5I_INVALID_HID; /* Dataset ID */
+ hid_t did2 = H5I_INVALID_HID; /* Dereferenced dataset ID */
+ hid_t sid1 = H5I_INVALID_HID; /* Dataspace ID #1 */
+ hid_t sid2 = H5I_INVALID_HID; /* Dataspace ID #2 */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hdset_reg_ref_t *wbuf = NULL; /* buffer to write to disk */
+ int * dwbuf = NULL; /* Buffer for writing numeric data to disk */
+ int i; /* counting variables */
+ int retval = -1; /* return value */
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
dwbuf = (int *)HDmalloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2);
/* Create dataspace for datasets */
@@ -4667,7 +4580,8 @@ int make_dset_reg_ref(hid_t loc_id)
goto out;
/* Create a dataset */
- if ((did2 = H5Dcreate2(loc_id, "dsetreg", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(loc_id, "dsetreg", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto out;
for (i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
@@ -4682,24 +4596,28 @@ int make_dset_reg_ref(hid_t loc_id)
goto out;
/* Create a dataset */
- if ((did1 = H5Dcreate2(loc_id, "refreg", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(loc_id, "refreg", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto out;
/* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 6;
- block[0] = 1; block[1] = 1;
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 6;
+ block[0] = 1;
+ block[1] = 1;
if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block) < 0)
goto out;
-
/* Store dataset region */
if (H5Rcreate(&wbuf[0], loc_id, "dsetreg", H5R_DATASET_REGION, sid2) < 0)
goto out;
/* Write selection to disk */
- if (H5Dwrite(did1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf) < 0)
+ if (H5Dwrite(did1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
goto out;
/* Close all objects */
@@ -4715,9 +4633,9 @@ int make_dset_reg_ref(hid_t loc_id)
retval = 0;
out:
- if(wbuf)
+ if (wbuf)
HDfree(wbuf);
- if(dwbuf)
+ if (dwbuf)
HDfree(dwbuf);
H5E_BEGIN_TRY
@@ -4726,105 +4644,96 @@ out:
H5Sclose(sid2);
H5Dclose(did1);
H5Dclose(did2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return retval;
}
/*-------------------------------------------------------------------------
-* Function: write_attr_in
-*
-* Purpose: write attributes in LOC_ID (dataset, group, named datatype)
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 12, 2003
-*
-*-------------------------------------------------------------------------
-*/
-
-static
-int write_attr_in(hid_t loc_id,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t fid, /* for reference create */
- int make_diffs /* flag to modify data buffers */)
+ * Function: write_attr_in
+ *
+ * Purpose: write attributes in LOC_ID (dataset, group, named datatype)
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static int
+write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to dataset*/
+ hid_t fid, /* for reference create */
+ int make_diffs /* flag to modify data buffers */)
{
/* Compound datatype */
- typedef struct s_t
- {
+ typedef struct s_t {
char a;
double b;
} s_t;
- typedef enum
- {
- RED,
- GREEN
- } e_t;
+ typedef enum { RED, GREEN } e_t;
- hid_t aid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- int val, j, k, n;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ int val, j, k, n;
unsigned i;
- float f;
+ float f;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1]={2};
- char buf1[2][3]= {"ab","de"}; /* string */
- char buf2[2]= {1,2}; /* bitfield, opaque */
- s_t buf3[2]= {{1,2},{3,4}}; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- e_t buf45[2]= {RED,RED}; /* enum */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1]={3}; /* array dimension */
- int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
- int buf7[2]= {1,2}; /* integer */
- float buf8[2]= {1,2}; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][3] = {"ab", "de"}; /* string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2] = {RED, RED}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1, 2}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2]={3,2};
- char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
- char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
- s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- e_t buf452[3][2]; /* enum */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
- int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
- float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ e_t buf452[3][2]; /* enum */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3]={4,3,2};
- char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
- "rs","tu","vw","xz","AB","CD","EF","GH",
- "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- e_t buf453[4][3][2]; /* enum */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
-
- /*-------------------------------------------------------------------------
- * 1D attributes
- *-------------------------------------------------------------------------
- */
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
+ "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ e_t buf453[4][3][2]; /* enum */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+ /*-------------------------------------------------------------------------
+ * 1D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- for (j=0; j<2; j++)
- {
- buf1[i][j]='z';
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++) {
+ buf1[i][j] = 'z';
}
}
/*
@@ -4843,21 +4752,20 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"string",tid,buf1) < 0)
+ if (make_attr(loc_id, 1, dims, "string", tid, buf1) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- buf2[i]=buf2[1]=0;
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
+ buf2[i] = buf2[1] = 0;
}
/*
buf2[2]= {1,2};
@@ -4873,16 +4781,16 @@ int write_attr_in(hid_t loc_id,
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"bitfield",tid,buf2) < 0)
+ if (make_attr(loc_id, 1, dims, "bitfield", tid, buf2) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
/*
buf2[2]= {1,2};
@@ -4900,22 +4808,21 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (make_attr(loc_id,1,dims,"opaque",tid,buf2) < 0)
+ if (make_attr(loc_id, 1, dims, "opaque", tid, buf2) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- {
- buf3[i].a=0; buf3[i].b=0;
+ if (make_diffs) {
+ for (i = 0; i < 2; i++) {
+ buf3[i].a = 0;
+ buf3[i].b = 0;
}
}
@@ -4932,43 +4839,39 @@ int write_attr_in(hid_t loc_id,
[ 1 ] 4 5 1
*/
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"compound",tid,buf3) < 0)
+ if (make_attr(loc_id, 1, dims, "compound", tid, buf3) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* object references ( H5R_OBJECT */
- if (dset_name)
- {
- if (H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ if (dset_name) {
+ if (H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
- if (H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ if (H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4) < 0)
+ if (make_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4) < 0)
goto out;
}
-
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- {
- buf45[i]=GREEN;
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs) {
+ for (i = 0; i < 2; i++) {
+ buf45[i] = GREEN;
}
}
/*
@@ -4983,33 +4886,32 @@ int write_attr_in(hid_t loc_id,
*/
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"enum",tid,buf45) < 0)
+ if (make_attr(loc_id, 1, dims, "enum", tid, buf45) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc( 1 * sizeof(int));
- ((int *)buf5[0].p)[0]=1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc(2 * sizeof(int));
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
((int *)buf5[1].p)[0] = 2;
((int *)buf5[1].p)[1] = 3;
- if(make_diffs)
- {
+ if (make_diffs) {
((int *)buf5[0].p)[0] = 0;
((int *)buf5[1].p)[0] = 0;
((int *)buf5[1].p)[1] = 0;
@@ -5045,16 +4947,14 @@ int write_attr_in(hid_t loc_id,
sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- for (j=0; j<3; j++)
- {
- buf6[i][j]=0;
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 3; j++) {
+ buf6[i][j] = 0;
}
}
/*
@@ -5080,16 +4980,14 @@ int write_attr_in(hid_t loc_id,
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs)
- {
- for(i = 0; i < 2; i++)
- {
- buf7[i]=0;
- buf8[i]=0;
+ if (make_diffs) {
+ for (i = 0; i < 2; i++) {
+ buf7[i] = 0;
+ buf8[i] = 0;
}
}
@@ -5107,23 +5005,21 @@ int write_attr_in(hid_t loc_id,
[ 0 ] 1 0 1
[ 1 ] 2 0 2
*/
- if (make_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7) < 0)
+ if (make_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8) < 0)
+ if (make_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * 2D attributes
- *-------------------------------------------------------------------------
- */
+ * 2D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
- if (make_diffs)
- {
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs) {
HDmemset(buf12, 'z', sizeof buf12);
}
@@ -5151,20 +5047,19 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"string2D",tid,buf12) < 0)
+ if (make_attr(loc_id, 2, dims2, "string2D", tid, buf12) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf22,0,sizeof buf22);
+ if (make_diffs) {
+ HDmemset(buf22, 0, sizeof buf22);
}
/*
@@ -5181,19 +5076,18 @@ int write_attr_in(hid_t loc_id,
[ 2 1 ] 6 0 6
*/
-
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0)
+ if (make_attr(loc_id, 2, dims2, "bitfield2D", tid, buf22) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
/*
buf22[3][2]= {{1,2},{3,4},{5,6}};
@@ -5212,19 +5106,18 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"opaque2D",tid,buf22) < 0)
+ if (make_attr(loc_id, 2, dims2, "opaque2D", tid, buf22) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
- if (make_diffs)
- {
- HDmemset(buf32,0,sizeof buf32);
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs) {
+ HDmemset(buf32, 0, sizeof buf32);
}
/*
@@ -5241,47 +5134,44 @@ int write_attr_in(hid_t loc_id,
[ 2 1 ] 6 0 6
*/
-
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"compound2D",tid,buf32) < 0)
+ if (make_attr(loc_id, 2, dims2, "compound2D", tid, buf32) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
- if (dset_name)
- {
- for (i = 0; i < 3; i++)
- {
- for (j = 0; j < 2; j++)
- {
- if (H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ if (dset_name) {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
+ if (H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
}
}
- if (make_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42) < 0)
+ if (make_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42) < 0)
goto out;
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
- for (i=0; i<3; i++)
- {
- for (j=0; j<2; j++)
- {
- if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED;
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
+ if (make_diffs)
+ buf452[i][j] = GREEN;
+ else
+ buf452[i][j] = RED;
}
}
@@ -5299,31 +5189,31 @@ int write_attr_in(hid_t loc_id,
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"enum2D",tid,buf452) < 0)
+ if (make_attr(loc_id, 2, dims2, "enum2D", tid, buf452) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- n=0;
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 2; j++) {
+ n = 0;
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
unsigned l;
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
- if(make_diffs)
+ for (l = 0; l < i + 1; l++)
+ if (make_diffs)
((int *)buf52[i][j].p)[l] = 0;
else
((int *)buf52[i][j].p)[l] = n++;
@@ -5367,13 +5257,12 @@ int write_attr_in(hid_t loc_id,
sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf62,0,sizeof buf62);
+ if (make_diffs) {
+ HDmemset(buf62, 0, sizeof buf62);
}
/*
buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}};
@@ -5410,12 +5299,11 @@ int write_attr_in(hid_t loc_id,
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs)
- {
+ if (make_diffs) {
HDmemset(buf72, 0, sizeof buf72);
HDmemset(buf82, 0, sizeof buf82);
}
@@ -5441,25 +5329,23 @@ int write_attr_in(hid_t loc_id,
[ 2 1 ] 6 0 6
*/
- if (make_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72) < 0)
+ if (make_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72) < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82) < 0)
+ if (make_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * 3D attributes
- *-------------------------------------------------------------------------
- */
+ * 3D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf13,'z',sizeof buf13);
+ if (make_diffs) {
+ HDmemset(buf13, 'z', sizeof buf13);
}
/*
@@ -5523,22 +5409,22 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"string3D",tid,buf13) < 0)
+ if (make_attr(loc_id, 3, dims3, "string3D", tid, buf13) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- if(make_diffs)
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs)
buf23[i][j][k] = 0;
else
buf23[i][j][k] = (char)(n++);
@@ -5577,36 +5463,36 @@ int write_attr_in(hid_t loc_id,
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"bitfield3D",tid,buf23) < 0)
+ if (make_attr(loc_id, 3, dims3, "bitfield3D", tid, buf23) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"opaque3D",tid,buf23) < 0)
+ if (make_attr(loc_id, 3, dims3, "opaque3D", tid, buf23) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- if(make_diffs) {
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
buf33[i][j][k].a = 0;
buf33[i][j][k].b = 0;
}
@@ -5669,58 +5555,48 @@ int write_attr_in(hid_t loc_id,
[ 3 2 1 ] 48 0 48
*/
-
-
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"compound3D",tid,buf33) < 0)
+ if (make_attr(loc_id, 3, dims3, "compound3D", tid, buf33) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
- if (dset_name)
- {
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
+ if (dset_name) {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++)
- if (H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ if (H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
}
}
- if (make_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43) < 0)
+ if (make_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43) < 0)
goto out;
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < 2; k++)
- {
- if (make_diffs)
- {
- buf453[i][j][k]=RED;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
+ buf453[i][j][k] = RED;
}
- else
- {
- buf453[i][j][k]=GREEN;
+ else {
+ buf453[i][j][k] = GREEN;
}
}
}
@@ -5755,35 +5631,31 @@ int write_attr_in(hid_t loc_id,
[ 3 2 1 ] GREEN RED
*/
-
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"enum3D",tid,buf453) < 0)
+ if (make_attr(loc_id, 3, dims3, "enum3D", tid, buf453) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- n=0;
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < 2; k++)
- {
+ n = 0;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
unsigned l;
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)i + 1;
for (l = 0; l < i + 1; l++)
if (make_diffs)
@@ -5829,16 +5701,16 @@ int write_attr_in(hid_t loc_id,
sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
- n=1;
- for (i = 0; i < 24; i++)
- {
- for (j = 0; j < (int)dimarray[0]; j++)
- {
- if (make_diffs) buf63[i][j]=0;
- else buf63[i][j]=n++;
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ n = 1;
+ for (i = 0; i < 24; i++) {
+ for (j = 0; j < (int)dimarray[0]; j++) {
+ if (make_diffs)
+ buf63[i][j] = 0;
+ else
+ buf63[i][j] = n++;
}
}
/*
@@ -5863,23 +5735,19 @@ int write_attr_in(hid_t loc_id,
tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
- n = 1; f = 1;
- for(i = 0; i < 4; i++)
- {
- for(j = 0; j < 3; j++)
- {
- for(k = 0; k < 2; k++)
- {
- if(make_diffs)
- {
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ n = 1;
+ f = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
buf73[i][j][k] = 0;
buf83[i][j][k] = 0;
}
- else
- {
+ else {
buf73[i][j][k] = n++;
buf83[i][j][k] = f++;
}
@@ -5902,45 +5770,39 @@ int write_attr_in(hid_t loc_id,
[ 1 1 1 ] 10 0 10
etc
*/
- if (make_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73) < 0)
+ if (make_attr(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73) < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0)
+ if (make_attr(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83) < 0)
goto out;
-
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid);
H5Sclose(sid);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
-
-
/*-------------------------------------------------------------------------
-* Function: make_dset
-*
-* Purpose: utility function to create and write a dataset in LOC_ID
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 12, 2003
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_dset(hid_t loc_id,
- const char *name,
- hid_t sid,
- hid_t dcpl,
- void *buf)
+ * Function: make_dset
+ *
+ * Purpose: utility function to create and write a dataset in LOC_ID
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t dcpl, void *buf)
{
- hid_t did=H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
if ((did = H5Dcreate2(loc_id, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
return -1;
@@ -5951,42 +5813,37 @@ int make_dset(hid_t loc_id,
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: write_dset
-*
-* Purpose: utility function to create and write a dataset in LOC_ID
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 12, 2003
-*
-*-------------------------------------------------------------------------
-*/
-static
-int write_dset( hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *dset_name,
- hid_t tid,
- void *buf )
+ * Function: write_dset
+ *
+ * Purpose: utility function to create and write a dataset in LOC_ID
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t tid, void *buf)
{
- hid_t did=H5I_INVALID_HID;
- hid_t sid=H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
return -1;
if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if (buf)
- {
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (buf) {
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
}
if (H5Dclose(did) < 0)
@@ -5997,44 +5854,38 @@ int write_dset( hid_t loc_id,
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
-
/*-------------------------------------------------------------------------
-* Function: make_attr
-*
-* Purpose: utility function to write an attribute in LOC_ID
-*
-* Programmer: Pedro Vicente
-*
-* Date: November 12, 2003
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_attr(hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *attr_name,
- hid_t tid,
- void *buf)
+ * Function: make_attr
+ *
+ * Purpose: utility function to write an attribute in LOC_ID
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t tid, void *buf)
{
- hid_t aid;
- hid_t sid;
+ hid_t aid;
+ hid_t sid;
if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
return -1;
if ((aid = H5Acreate2(loc_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(buf)
- {
- if(H5Awrite(aid, tid, buf) < 0)
+ if (buf) {
+ if (H5Awrite(aid, tid, buf) < 0)
goto out;
}
if (H5Aclose(aid) < 0)
@@ -6044,119 +5895,120 @@ int make_attr(hid_t loc_id,
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_named_dtype
-*
-* Purpose: create a file with named datatypes in various configurations
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_named_dtype(hid_t loc_id)
+ * Function: make_named_dtype
+ *
+ * Purpose: create a file with named datatypes in various configurations
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_named_dtype(hid_t loc_id)
{
- hsize_t dims[1] ={3};
- hid_t did=H5I_INVALID_HID;
- hid_t aid=H5I_INVALID_HID;
- hid_t sid=H5I_INVALID_HID;
- hid_t tid=H5I_INVALID_HID;
- hid_t gid=H5I_INVALID_HID;
+ hsize_t dims[1] = {3};
+ hid_t did = H5I_INVALID_HID;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
/* Create a dataset with an anonymous committed datatype as the first thing
* h5repack sees */
- if((tid = H5Tcopy(H5T_STD_I16LE)) < 0)
+ if ((tid = H5Tcopy(H5T_STD_I16LE)) < 0)
goto out;
- if(H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
if ((did = H5Dcreate2(loc_id, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
/* Create an attribute on that dataset that uses a committed datatype in
* a remote group */
- if((gid = H5Gcreate2(loc_id, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(loc_id, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
- if((gid = H5Gcreate2(loc_id, "M/M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(loc_id, "M/M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
- if((tid = H5Tcopy(H5T_STD_I16BE)) < 0)
+ if ((tid = H5Tcopy(H5T_STD_I16BE)) < 0)
goto out;
- if(H5Tcommit2(loc_id, "/M/M/A", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(loc_id, "/M/M/A", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
- if((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/* Create a dataset in the remote group that uses a committed datatype in
* the root group */
- if((tid = H5Tcopy(H5T_STD_I32LE)) < 0)
+ if ((tid = H5Tcopy(H5T_STD_I32LE)) < 0)
goto out;
- if(H5Tcommit2(loc_id, "N", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(loc_id, "N", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
- if((did = H5Dcreate2(loc_id, "M/M/B", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "M/M/B", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
/* Create an attribute on the remote dataset that uses an anonymous
* committed datatype */
- if((tid = H5Tcopy(H5T_STD_I32BE)) < 0)
+ if ((tid = H5Tcopy(H5T_STD_I32BE)) < 0)
goto out;
- if(H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
- if((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
/* Create another attribute that uses the same anonymous datatype */
- if((aid = H5Acreate2(did, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/* Create a dataset in the root group that uses the committed datatype in
* the root group */
- if((tid = H5Topen2(loc_id, "N", H5P_DEFAULT)) < 0)
+ if ((tid = H5Topen2(loc_id, "N", H5P_DEFAULT)) < 0)
goto out;
- if((did = H5Dcreate2(loc_id, "O", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "O", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/* Create 2 attributes on the committed datatype that use that datatype */
- if((aid = H5Acreate2(tid, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- if((aid = H5Acreate2(tid, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
/* Close */
@@ -6173,7 +6025,8 @@ out:
H5Sclose(sid);
H5Dclose(did);
H5Gclose(gid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end make_named_dtype() */
@@ -6190,48 +6043,45 @@ out:
*
* Programmer: Jonathan Kim (March 23, 2010)
*------------------------------------------------------------------------*/
-static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id)
+static herr_t
+add_attr_with_objref(hid_t file_id, hid_t obj_id)
{
int ret = SUCCEED;
int status;
/* attr obj ref */
- hsize_t dim_attr_objref[1]={3};
+ hsize_t dim_attr_objref[1] = {3};
hobj_ref_t data_attr_objref[3];
/* --------------------------------
* add attribute with obj ref type
*/
/* ref to dset */
- status = H5Rcreate(&data_attr_objref[0],file_id,NAME_OBJ_DS1,H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
+ status = H5Rcreate(&data_attr_objref[0], file_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* ref to group */
- status = H5Rcreate(&data_attr_objref[1],file_id,NAME_OBJ_GRP,H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
+ status = H5Rcreate(&data_attr_objref[1], file_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* ref to datatype */
- status = H5Rcreate(&data_attr_objref[2],file_id,NAME_OBJ_NDTYPE,H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
+ status = H5Rcreate(&data_attr_objref[2], file_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create attr with obj ref type */
- status = make_attr(obj_id,1,dim_attr_objref,"Attr_OBJREF",H5T_STD_REF_OBJ,data_attr_objref);
- if (status < 0)
- {
+ status = make_attr(obj_id, 1, dim_attr_objref, "Attr_OBJREF", H5T_STD_REF_OBJ, data_attr_objref);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6240,7 +6090,6 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id)
out:
return ret;
-
}
/*-------------------------------------------------------------------------
@@ -6255,52 +6104,48 @@ out:
*
* Programmer: Jonathan Kim (March 23, 2010)
*------------------------------------------------------------------------*/
-static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id)
+static herr_t
+add_attr_with_regref(hid_t file_id, hid_t obj_id)
{
int ret = SUCCEED;
int status;
/* attr region ref */
- hid_t sid_regrefed_dset=0;
- hsize_t dim_regrefed_dset[2]={3,6};
- hsize_t coords_regrefed_dset[3][2] = {{0,1},{1,2},{2,3}};
- hsize_t dim_attr_regref[1]= {1}; /* dim of */
+ hid_t sid_regrefed_dset = 0;
+ hsize_t dim_regrefed_dset[2] = {3, 6};
+ hsize_t coords_regrefed_dset[3][2] = {{0, 1}, {1, 2}, {2, 3}};
+ hsize_t dim_attr_regref[1] = {1}; /* dim of */
hdset_reg_ref_t data_attr_regref[1];
-
/* -----------------------------------
* add attribute with region ref type
*/
- sid_regrefed_dset = H5Screate_simple (2, dim_regrefed_dset, NULL);
- if (sid_regrefed_dset < 0)
- {
+ sid_regrefed_dset = H5Screate_simple(2, dim_regrefed_dset, NULL);
+ if (sid_regrefed_dset < 0) {
HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* select elements space for reference */
- status = H5Sselect_elements (sid_regrefed_dset, H5S_SELECT_SET, (size_t)3, coords_regrefed_dset[0]);
- if (status < 0)
- {
+ status = H5Sselect_elements(sid_regrefed_dset, H5S_SELECT_SET, (size_t)3, coords_regrefed_dset[0]);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference from elements space */
- status = H5Rcreate (&data_attr_regref[0], file_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_regrefed_dset);
- if (status < 0)
- {
+ status = H5Rcreate(&data_attr_regref[0], file_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_regrefed_dset);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create attr with region ref type */
- status = make_attr(obj_id,1,dim_attr_regref,"Attr_REGREF",H5T_STD_REF_DSETREG,data_attr_regref);
- if (status < 0)
- {
+ status = make_attr(obj_id, 1, dim_attr_regref, "Attr_REGREF", H5T_STD_REF_DSETREG, data_attr_regref);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6308,10 +6153,9 @@ static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id)
out:
if (sid_regrefed_dset > 0)
- H5Sclose (sid_regrefed_dset);
+ H5Sclose(sid_regrefed_dset);
return ret;
-
}
/*-------------------------------------------------------------------------
@@ -6325,44 +6169,42 @@ out:
*
* Programmer: Jonathan Kim (March 23, 2010)
*------------------------------------------------------------------------*/
-static herr_t gen_refered_objs(hid_t loc_id)
+static herr_t
+gen_refered_objs(hid_t loc_id)
{
- int status;
+ int status;
herr_t ret = SUCCEED;
/* objects (dset, group, datatype) */
- hid_t sid=0, did1=0, gid=0, tid=0;
- hsize_t dims1[1]={3};
- int data[3] = {10,20,30};
+ hid_t sid = 0, did1 = 0, gid = 0, tid = 0;
+ hsize_t dims1[1] = {3};
+ int data[3] = {10, 20, 30};
/* Dset2 */
- hid_t sid2=0, did2=0;
- hsize_t dims2[2] = {3,16};
- char data2[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
+ hid_t sid2 = 0, did2 = 0;
+ hsize_t dims2[2] = {3, 16};
+ char data2[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
/*-----------------------
* add short dataset
* (define NAME_OBJ_DS1)
*/
sid = H5Screate_simple(1, dims1, NULL);
- if (sid < 0)
- {
+ if (sid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- did1 = H5Dcreate2 (loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (did1 < 0)
- {
+ did1 = H5Dcreate2(loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (did1 < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6372,9 +6214,8 @@ static herr_t gen_refered_objs(hid_t loc_id)
* add group
* (define NAME_OBJ_GRP)
*/
- gid = H5Gcreate2 (loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (gid < 0)
- {
+ gid = H5Gcreate2(loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6384,62 +6225,56 @@ static herr_t gen_refered_objs(hid_t loc_id)
* add named datatype
* (define NAME_OBJ_NDTYPE)
*/
- tid = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
- }
-
+ }
- /*--------------------------
- * create long dataset
- * (define NAME_OBJ_DS2)
- */
- sid2 = H5Screate_simple (2, dims2, NULL);
- if (sid2 < 0)
- {
+ /*--------------------------
+ * create long dataset
+ * (define NAME_OBJ_DS2)
+ */
+ sid2 = H5Screate_simple(2, dims2, NULL);
+ if (sid2 < 0) {
HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create normal dataset which is refered */
- did2 = H5Dcreate2 (loc_id, NAME_OBJ_DS2, H5T_STD_I8LE, sid2, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
- if (did2 < 0)
- {
+ did2 = H5Dcreate2(loc_id, NAME_OBJ_DS2, H5T_STD_I8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (did2 < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* write values to dataset */
- status = H5Dwrite (did2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
- if (status < 0)
- {
+ status = H5Dwrite(did2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
out:
- if(did1 > 0)
+ if (did1 > 0)
H5Dclose(did1);
- if(gid > 0)
+ if (gid > 0)
H5Gclose(gid);
- if(tid > 0)
+ if (tid > 0)
H5Tclose(tid);
- if(sid > 0)
+ if (sid > 0)
H5Sclose(sid);
- if(did2 > 0)
+ if (did2 > 0)
H5Dclose(did2);
- if(sid2 > 0)
+ if (sid2 > 0)
H5Sclose(sid2);
return ret;
-
}
/*-------------------------------------------------------------------------
@@ -6453,17 +6288,18 @@ out:
*
* Programmer: Jonathan Kim (March 18, 2010)
*------------------------------------------------------------------------*/
-static herr_t gen_obj_ref(hid_t loc_id)
+static herr_t
+gen_obj_ref(hid_t loc_id)
{
- int status;
+ int status;
herr_t ret = SUCCEED;
- hid_t sid=0, oid=0;
- hsize_t dims_dset_objref[1]={3};
+ hid_t sid = 0, oid = 0;
+ hsize_t dims_dset_objref[1] = {3};
/* attr with int type */
- hsize_t dim_attr_int[1]={2};
- int data_attr_int[2] = {10,20};
+ hsize_t dim_attr_int[1] = {2};
+ int data_attr_int[2] = {10, 20};
/* write buffer for obj reference */
hobj_ref_t objref_buf[3];
@@ -6473,27 +6309,24 @@ static herr_t gen_obj_ref(hid_t loc_id)
* Passing -1 as reference is an object.*/
/* obj ref to dataset */
- status = H5Rcreate (&objref_buf[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
+ status = H5Rcreate(&objref_buf[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* obj ref to group */
- status = H5Rcreate (&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
+ status = H5Rcreate(&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* obj ref to named-datatype */
- status = H5Rcreate (&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
+ status = H5Rcreate(&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6502,38 +6335,34 @@ static herr_t gen_obj_ref(hid_t loc_id)
/*---------------------------------------------------------
* create dataset contain references
*/
- sid = H5Screate_simple (1, dims_dset_objref, NULL);
- if (sid < 0)
- {
+ sid = H5Screate_simple(1, dims_dset_objref, NULL);
+ if (sid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
- if (oid < 0)
- {
+ oid = H5Dcreate2(loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, objref_buf);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* add attribute with int type */
- if (make_attr(oid,1,dim_attr_int,"integer",H5T_NATIVE_INT,data_attr_int) < 0)
+ if (make_attr(oid, 1, dim_attr_int, "integer", H5T_NATIVE_INT, data_attr_int) < 0)
goto out;
/* add attribute with obj ref */
status = add_attr_with_objref(loc_id, oid);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6541,23 +6370,21 @@ static herr_t gen_obj_ref(hid_t loc_id)
/* add attribute with region ref */
status = add_attr_with_regref(loc_id, oid);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
out:
- if(oid > 0)
+ if (oid > 0)
H5Dclose(oid);
- if(sid > 0)
+ if (sid > 0)
H5Sclose(sid);
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: gen_region_ref
*
@@ -6568,110 +6395,103 @@ out:
*
* Programmer: Jonathan Kim (March 18, 2010)
*------------------------------------------------------------------------*/
-static herr_t gen_region_ref(hid_t loc_id)
+static herr_t
+gen_region_ref(hid_t loc_id)
{
- int status;
+ int status;
herr_t ret = SUCCEED;
/* target dataset */
- hid_t sid_trg=0;
- hsize_t dims_trg[2] = {3,16};
+ hid_t sid_trg = 0;
+ hsize_t dims_trg[2] = {3, 16};
/* dset with region ref type */
- hid_t sid_ref=0, oid_ref=0;
+ hid_t sid_ref = 0, oid_ref = 0;
/* region ref to target dataset */
- hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} };
- hdset_reg_ref_t rr_data[2];
- hsize_t start[2] = {0,0};
- hsize_t stride[2] = {2,11};
- hsize_t count[2] = {2,2};
- hsize_t block[2] = {1,3};
- hsize_t dims1[1] = {2};
+ hsize_t coords[4][2] = {{0, 1}, {2, 11}, {1, 0}, {2, 4}};
+ hdset_reg_ref_t rr_data[2];
+ hsize_t start[2] = {0, 0};
+ hsize_t stride[2] = {2, 11};
+ hsize_t count[2] = {2, 2};
+ hsize_t block[2] = {1, 3};
+ hsize_t dims1[1] = {2};
/* attr with int type */
- hsize_t dim_attr_int[1]={2};
- int data_attr_int[2] = {10,20};
+ hsize_t dim_attr_int[1] = {2};
+ int data_attr_int[2] = {10, 20};
- sid_trg = H5Screate_simple (2, dims_trg, NULL);
- if (sid_trg < 0)
- {
+ sid_trg = H5Screate_simple(2, dims_trg, NULL);
+ if (sid_trg < 0) {
HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* select elements space for reference */
- status = H5Sselect_elements (sid_trg, H5S_SELECT_SET, (size_t)4, coords[0]);
- if (status < 0)
- {
+ status = H5Sselect_elements(sid_trg, H5S_SELECT_SET, (size_t)4, coords[0]);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference from elements space */
- status = H5Rcreate (&rr_data[0], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg);
- if (status < 0)
- {
+ status = H5Rcreate(&rr_data[0], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* select hyperslab space for reference */
- status = H5Sselect_hyperslab (sid_trg, H5S_SELECT_SET, start, stride, count, block);
- if (status < 0)
- {
+ status = H5Sselect_hyperslab(sid_trg, H5S_SELECT_SET, start, stride, count, block);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference from hyperslab space */
- status = H5Rcreate (&rr_data[1], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg);
- if (status < 0)
- {
+ status = H5Rcreate(&rr_data[1], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* Create dataspace. */
- sid_ref = H5Screate_simple (1, dims1, NULL);
- if (sid_ref < 0)
- {
+ sid_ref = H5Screate_simple(1, dims1, NULL);
+ if (sid_ref < 0) {
HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference dataset */
- oid_ref = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid_ref, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
- if (oid_ref < 0)
- {
+ oid_ref =
+ H5Dcreate2(loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid_ref, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid_ref < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* write data as region references */
- status = H5Dwrite (oid_ref, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
- if (status < 0)
- {
+ status = H5Dwrite(oid_ref, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* add attribute with int type */
- if (make_attr(oid_ref,1,dim_attr_int,"integer",H5T_NATIVE_INT,data_attr_int) < 0)
+ if (make_attr(oid_ref, 1, dim_attr_int, "integer", H5T_NATIVE_INT, data_attr_int) < 0)
goto out;
/* add attribute with obj ref */
status = add_attr_with_objref(loc_id, oid_ref);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6679,8 +6499,7 @@ static herr_t gen_region_ref(hid_t loc_id)
/* add attribute with region ref */
status = add_attr_with_regref(loc_id, oid_ref);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6688,48 +6507,46 @@ static herr_t gen_region_ref(hid_t loc_id)
out:
if (oid_ref > 0)
- H5Dclose (oid_ref);
+ H5Dclose(oid_ref);
if (sid_ref > 0)
- H5Sclose (sid_ref);
+ H5Sclose(sid_ref);
if (sid_trg > 0)
- H5Sclose (sid_trg);
+ H5Sclose(sid_trg);
return ret;
}
/*-------------------------------------------------------------------------
-* Function: make_references
-*
-* Purpose: create a file with obj and region references
-*
-* Programmer: Jonathan Kim (March 18, 2010)
-*-------------------------------------------------------------------------
-*/
-static herr_t make_references(hid_t loc_id)
+ * Function: make_references
+ *
+ * Purpose: create a file with obj and region references
+ *
+ * Programmer: Jonathan Kim (March 18, 2010)
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+make_references(hid_t loc_id)
{
herr_t ret = SUCCEED;
herr_t status;
/* add target objects */
status = gen_refered_objs(loc_id);
- if (status == FAIL)
- {
+ if (status == FAIL) {
HDfprintf(stderr, "Failed to generate referenced object.\n");
ret = FAIL;
}
/* add object reference */
status = gen_obj_ref(loc_id);
- if (status == FAIL)
- {
+ if (status == FAIL) {
HDfprintf(stderr, "Failed to generate object reference.\n");
ret = FAIL;
}
/* add region reference */
status = gen_region_ref(loc_id);
- if (status == FAIL)
- {
+ if (status == FAIL) {
HDfprintf(stderr, "Failed to generate region reference.\n");
ret = FAIL;
}
@@ -6738,110 +6555,107 @@ static herr_t make_references(hid_t loc_id)
}
/*-------------------------------------------------------------------------
-* Function: make_complex_attr_references
-*
-* Purpose:
-* create a file with :
-* 1. obj ref in attribute of compound type
-* 2. region ref in attribute of compound type
-* 3. obj ref in attribute of vlen type
-* 4. region ref in attribute of vlen type
-*
-* Programmer: Jonathan (March 25, 2010)
-*-------------------------------------------------------------------------
-*/
+ * Function: make_complex_attr_references
+ *
+ * Purpose:
+ * create a file with :
+ * 1. obj ref in attribute of compound type
+ * 2. region ref in attribute of compound type
+ * 3. obj ref in attribute of vlen type
+ * 4. region ref in attribute of vlen type
+ *
+ * Programmer: Jonathan (March 25, 2010)
+ *-------------------------------------------------------------------------
+ */
/* obj dset */
#define RANK_OBJ 2
#define DIM0_OBJ 6
#define DIM1_OBJ 10
/* container dset */
#define RANK_DSET 1
-#define DIM_DSET 4
+#define DIM_DSET 4
/* 1. obj references in compound attr */
#define RANK_COMP_OBJREF 1
-#define DIM_COMP_OBJREF 3 /* for dataset, group, datatype */
+#define DIM_COMP_OBJREF 3 /* for dataset, group, datatype */
/* 2. region references in compound attr */
#define RANK_COMP_REGREF 1
-#define DIM_COMP_REGREF 1 /* for element region */
+#define DIM_COMP_REGREF 1 /* for element region */
/* 3. obj references in vlen attr */
#define RANK_VLEN_OBJREF 1
-#define DIM_VLEN_OBJREF 3 /* for dataset, group, datatype */
-#define LEN0_VLEN_OBJREF 1 /* dataset */
-#define LEN1_VLEN_OBJREF 1 /* group */
-#define LEN2_VLEN_OBJREF 1 /* datatype */
+#define DIM_VLEN_OBJREF 3 /* for dataset, group, datatype */
+#define LEN0_VLEN_OBJREF 1 /* dataset */
+#define LEN1_VLEN_OBJREF 1 /* group */
+#define LEN2_VLEN_OBJREF 1 /* datatype */
/* 4. region references in vlen attr */
#define RANK_VLEN_REGREF 1
-#define DIM_VLEN_REGREF 1 /* for element region */
-#define LEN0_VLEN_REGREF 1 /* element region */
+#define DIM_VLEN_REGREF 1 /* for element region */
+#define LEN0_VLEN_REGREF 1 /* element region */
-static herr_t make_complex_attr_references(hid_t loc_id)
+static herr_t
+make_complex_attr_references(hid_t loc_id)
{
herr_t ret = SUCCEED;
herr_t status;
/*
* for objects
*/
- hid_t objgid=0, objdid=0, objtid=0, objsid=0;
- hsize_t obj_dims[RANK_OBJ] = {DIM0_OBJ, DIM1_OBJ};
- int obj_data[DIM0_OBJ][DIM1_OBJ]=
- {{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
- {10,11,12,13,14,15,16,17,18,19},
- {20,21,22,23,24,25,26,27,28,29},
- {30,31,32,33,34,35,36,37,38,39},
- {40,41,42,43,44,45,46,47,48,49},
- {50,51,52,53,54,55,56,57,58,59}};
+ hid_t objgid = 0, objdid = 0, objtid = 0, objsid = 0;
+ hsize_t obj_dims[RANK_OBJ] = {DIM0_OBJ, DIM1_OBJ};
+ int obj_data[DIM0_OBJ][DIM1_OBJ] = {
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {10, 11, 12, 13, 14, 15, 16, 17, 18, 19},
+ {20, 21, 22, 23, 24, 25, 26, 27, 28, 29}, {30, 31, 32, 33, 34, 35, 36, 37, 38, 39},
+ {40, 41, 42, 43, 44, 45, 46, 47, 48, 49}, {50, 51, 52, 53, 54, 55, 56, 57, 58, 59}};
/*
* group main
*/
- hid_t main_gid=0;
+ hid_t main_gid = 0;
/*
* dataset which the attribute will be attached to
*/
hsize_t main_dset_dims[RANK_DSET] = {DIM_DSET};
- hid_t main_sid=0, main_did=0;
+ hid_t main_sid = 0, main_did = 0;
/*
* 1. obj references in compound attr
*/
- hid_t comp_objref_tid=0, comp_objref_aid=0;
+ hid_t comp_objref_tid = 0, comp_objref_aid = 0;
typedef struct comp_objref_t {
hobj_ref_t val_objref;
- int val_int;
+ int val_int;
} comp_objref_t;
comp_objref_t comp_objref_data[DIM_COMP_OBJREF];
- hid_t comp_objref_attr_sid=0;
- hsize_t comp_objref_dim[RANK_COMP_OBJREF] = {DIM_COMP_OBJREF};
+ hid_t comp_objref_attr_sid = 0;
+ hsize_t comp_objref_dim[RANK_COMP_OBJREF] = {DIM_COMP_OBJREF};
/*
* 2. region references in compound attr
*/
- hid_t comp_regref_tid=0, comp_regref_aid=0;
+ hid_t comp_regref_tid = 0, comp_regref_aid = 0;
typedef struct comp_regref_t {
hdset_reg_ref_t val_regref;
- int val_int;
+ int val_int;
} comp_regref_t;
comp_regref_t comp_regref_data[DIM_COMP_REGREF];
- hid_t comp_regref_attr_sid=0;
- hsize_t comp_regref_dim[RANK_COMP_REGREF] = {DIM_COMP_REGREF};
- hsize_t coords[4][2] = { {0,1}, {2,3}, {3,4}, {4,5} };
+ hid_t comp_regref_attr_sid = 0;
+ hsize_t comp_regref_dim[RANK_COMP_REGREF] = {DIM_COMP_REGREF};
+ hsize_t coords[4][2] = {{0, 1}, {2, 3}, {3, 4}, {4, 5}};
/*
* 3. obj references in vlen attr
*/
- hid_t vlen_objref_attr_tid=0, vlen_objref_attr_sid=0;
- hid_t vlen_objref_attr_id=0;
- hvl_t vlen_objref_data[DIM_VLEN_OBJREF];
+ hid_t vlen_objref_attr_tid = 0, vlen_objref_attr_sid = 0;
+ hid_t vlen_objref_attr_id = 0;
+ hvl_t vlen_objref_data[DIM_VLEN_OBJREF];
hsize_t vlen_objref_dims[RANK_VLEN_OBJREF] = {DIM_VLEN_OBJREF};
/*
* 4. region references in vlen attr
*/
- hid_t vlen_regref_attr_tid=0, vlen_regref_attr_sid=0;
- hid_t vlen_regref_attr_id=0;
- hvl_t vlen_regref_data[DIM_VLEN_REGREF];
+ hid_t vlen_regref_attr_tid = 0, vlen_regref_attr_sid = 0;
+ hid_t vlen_regref_attr_id = 0;
+ hvl_t vlen_regref_data[DIM_VLEN_REGREF];
hsize_t vlen_regref_dim[RANK_VLEN_REGREF] = {DIM_VLEN_REGREF};
-
/* ---------------------------------------
* create objects which to be referenced
*/
@@ -6852,8 +6666,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
objsid = H5Screate_simple(RANK_OBJ, obj_dims, NULL);
objdid = H5Dcreate2(loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, objsid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(objdid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6862,21 +6675,18 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/* object3 named datatype */
objtid = H5Tcopy(H5T_NATIVE_INT);
status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, objtid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
-
/* ---------------------------------------------
* Put testing objs in this group
* create group contain dataset with attribute and the attribute has
* compound type which contain obj and region reference */
main_gid = H5Gcreate2(loc_id, "group_main", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (main_gid < 0)
- {
+ if (main_gid < 0) {
HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6887,11 +6697,11 @@ static herr_t make_complex_attr_references(hid_t loc_id)
*/
main_sid = H5Screate_simple(RANK_DSET, main_dset_dims, NULL);
- main_did = H5Dcreate2(main_gid, "dset_main", H5T_NATIVE_INT, main_sid, H5P_DEFAULT,H5P_DEFAULT, H5P_DEFAULT);
+ main_did =
+ H5Dcreate2(main_gid, "dset_main", H5T_NATIVE_INT, main_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(main_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6904,7 +6714,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create compound type for attribute
*/
- comp_objref_tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_objref_t));
+ comp_objref_tid = H5Tcreate(H5T_COMPOUND, sizeof(comp_objref_t));
H5Tinsert(comp_objref_tid, "value_objref", HOFFSET(comp_objref_t, val_objref), H5T_STD_REF_OBJ);
H5Tinsert(comp_objref_tid, "value_int", HOFFSET(comp_objref_t, val_int), H5T_NATIVE_INT);
@@ -6912,30 +6722,27 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* Create the object references into compound type
*/
- /* references to dataset */
- status = H5Rcreate (&(comp_objref_data[0].val_objref), loc_id, NAME_OBJ_DS1, H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
+ /* references to dataset */
+ status = H5Rcreate(&(comp_objref_data[0].val_objref), loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
comp_objref_data[0].val_int = 0;
- /* references to group */
- status = H5Rcreate (&(comp_objref_data[1].val_objref), loc_id, NAME_OBJ_GRP, H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
+ /* references to group */
+ status = H5Rcreate(&(comp_objref_data[1].val_objref), loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
comp_objref_data[1].val_int = 10;
- /* references to datatype */
- status = H5Rcreate (&(comp_objref_data[2].val_objref), loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
+ /* references to datatype */
+ status = H5Rcreate(&(comp_objref_data[2].val_objref), loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6945,11 +6752,11 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create attribute and write the object ref
*/
- comp_objref_attr_sid = H5Screate_simple (RANK_COMP_OBJREF, comp_objref_dim, NULL);
- comp_objref_aid = H5Acreate2 (main_did, "Comp_OBJREF", comp_objref_tid, comp_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Awrite (comp_objref_aid, comp_objref_tid, comp_objref_data);
- if (status < 0)
- {
+ comp_objref_attr_sid = H5Screate_simple(RANK_COMP_OBJREF, comp_objref_dim, NULL);
+ comp_objref_aid =
+ H5Acreate2(main_did, "Comp_OBJREF", comp_objref_tid, comp_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(comp_objref_aid, comp_objref_tid, comp_objref_data);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6961,7 +6768,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create compound type for attribute
*/
- comp_regref_tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_regref_t));
+ comp_regref_tid = H5Tcreate(H5T_COMPOUND, sizeof(comp_regref_t));
H5Tinsert(comp_regref_tid, "value_regref", HOFFSET(comp_regref_t, val_regref), H5T_STD_REF_DSETREG);
H5Tinsert(comp_regref_tid, "value_int", HOFFSET(comp_regref_t, val_int), H5T_NATIVE_INT);
@@ -6969,16 +6776,14 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create the region reference
*/
- status = H5Sselect_elements (objsid, H5S_SELECT_SET, (size_t)4, coords[0]);
- if (status < 0)
- {
+ status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- status = H5Rcreate (&(comp_regref_data[0].val_regref), loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid);
- if (status < 0)
- {
+ status = H5Rcreate(&(comp_regref_data[0].val_regref), loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -6988,80 +6793,78 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create attribute and write the region ref
*/
- comp_regref_attr_sid = H5Screate_simple (RANK_COMP_REGREF, comp_regref_dim, NULL);
- comp_regref_aid = H5Acreate2 (main_did, "Comp_REGREF", comp_regref_tid, comp_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Awrite (comp_regref_aid, comp_regref_tid, comp_regref_data);
- if (status < 0)
- {
+ comp_regref_attr_sid = H5Screate_simple(RANK_COMP_REGREF, comp_regref_dim, NULL);
+ comp_regref_aid =
+ H5Acreate2(main_did, "Comp_REGREF", comp_regref_tid, comp_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(comp_regref_aid, comp_regref_tid, comp_regref_data);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
-
/*-------------------------------------------------------------------
* 3. create obj references in attribute of vlen type
*/
/*
* prepare vlen data
*/
- vlen_objref_data[0].len = LEN0_VLEN_OBJREF;
- vlen_objref_data[0].p = HDmalloc (vlen_objref_data[0].len * sizeof(hobj_ref_t));
- vlen_objref_data[1].len = LEN1_VLEN_OBJREF;
- vlen_objref_data[1].p = HDmalloc (vlen_objref_data[1].len * sizeof(hobj_ref_t));
- vlen_objref_data[2].len = LEN2_VLEN_OBJREF;
- vlen_objref_data[2].p = HDmalloc (vlen_objref_data[2].len * sizeof(hobj_ref_t));
-
- /*
- * create obj references
- */
- /* reference to dataset */
- status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
+ vlen_objref_data[0].len = LEN0_VLEN_OBJREF;
+ vlen_objref_data[0].p = HDmalloc(vlen_objref_data[0].len * sizeof(hobj_ref_t));
+ vlen_objref_data[1].len = LEN1_VLEN_OBJREF;
+ vlen_objref_data[1].p = HDmalloc(vlen_objref_data[1].len * sizeof(hobj_ref_t));
+ vlen_objref_data[2].len = LEN2_VLEN_OBJREF;
+ vlen_objref_data[2].p = HDmalloc(vlen_objref_data[2].len * sizeof(hobj_ref_t));
+
+ /*
+ * create obj references
+ */
+ /* reference to dataset */
+ status =
+ H5Rcreate(&((hobj_ref_t *)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- /* reference to group */
- status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
+ /* reference to group */
+ status =
+ H5Rcreate(&((hobj_ref_t *)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- /* reference to datatype */
- status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[2].p)[0], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
+ /* reference to datatype */
+ status =
+ H5Rcreate(&((hobj_ref_t *)vlen_objref_data[2].p)[0], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- /*
- * create vlen type with obj reference
- */
- vlen_objref_attr_tid = H5Tvlen_create (H5T_STD_REF_OBJ);
- vlen_objref_attr_sid = H5Screate_simple (RANK_VLEN_OBJREF, vlen_objref_dims, NULL);
+ /*
+ * create vlen type with obj reference
+ */
+ vlen_objref_attr_tid = H5Tvlen_create(H5T_STD_REF_OBJ);
+ vlen_objref_attr_sid = H5Screate_simple(RANK_VLEN_OBJREF, vlen_objref_dims, NULL);
- /*
+ /*
* create attribute and write the object reference
*/
- vlen_objref_attr_id = H5Acreate2(main_did, "Vlen_OBJREF", vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Awrite (vlen_objref_attr_id, vlen_objref_attr_tid, vlen_objref_data);
- if (status < 0)
- {
+ vlen_objref_attr_id = H5Acreate2(main_did, "Vlen_OBJREF", vlen_objref_attr_tid, vlen_objref_attr_sid,
+ H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(vlen_objref_attr_id, vlen_objref_attr_tid, vlen_objref_data);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* close resource for vlen data */
- status = H5Dvlen_reclaim (vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, vlen_objref_data);
- if (status < 0)
- {
+ status = H5Dvlen_reclaim(vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, vlen_objref_data);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -7075,21 +6878,20 @@ static herr_t make_complex_attr_references(hid_t loc_id)
* prepare vlen data
*/
vlen_regref_data[0].len = LEN0_VLEN_REGREF;
- vlen_regref_data[0].p = HDmalloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t));
+ vlen_regref_data[0].p = HDmalloc(vlen_regref_data[0].len * sizeof(hdset_reg_ref_t));
/*
* create region reference
*/
status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]);
- if (status < 0)
- {
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
- status = H5Rcreate (&((hdset_reg_ref_t*)vlen_regref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid);
- if (status < 0)
- {
+ status = H5Rcreate(&((hdset_reg_ref_t *)vlen_regref_data[0].p)[0], loc_id, NAME_OBJ_DS1,
+ H5R_DATASET_REGION, objsid);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
@@ -7104,19 +6906,18 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create attribute and write the region reference
*/
- vlen_regref_attr_id = H5Acreate2(main_did, "Vlen_REGREF", vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Awrite(vlen_regref_attr_id, vlen_regref_attr_tid, vlen_regref_data);
- if (status < 0)
- {
+ vlen_regref_attr_id = H5Acreate2(main_did, "Vlen_REGREF", vlen_regref_attr_tid, vlen_regref_attr_sid,
+ H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(vlen_regref_attr_id, vlen_regref_attr_tid, vlen_regref_data);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
/* close resource for vlen data */
- status = H5Dvlen_reclaim (vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, vlen_regref_data);
- if (status < 0)
- {
+ status = H5Dvlen_reclaim(vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, vlen_regref_data);
+ if (status < 0) {
HDfprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt
index a184ae8..ddd8c42 100644
--- a/tools/test/h5repack/testfiles/h5repack-help.txt
+++ b/tools/test/h5repack/testfiles/h5repack-help.txt
@@ -122,6 +122,7 @@ usage: h5repack [OPTIONS] file1 file2
UD=<filter_number,filter_flag,cd_value_count,value1[,value2,...,valueN]>
Required values: filter_number, filter_flag, cd_value_count, value1
Optional values: value2 to valueN
+ filter_flag: 1 is OPTIONAL or 0 is MANDATORY
NONE (no parameter)
LAYT - is a string with the format:
diff --git a/tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5 b/tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5
new file mode 100644
index 0000000..f4093b5
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5 b/tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5
new file mode 100644
index 0000000..7a815ba
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
index eec64d8..80fafbd 100644
--- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
@@ -11,7 +11,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 7 }
+ PARAMS { 9 1 10 8 }
}
}
FILLVALUE {
@@ -33,7 +33,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 7 }
+ PARAMS { 9 1 10 8 }
}
}
FILLVALUE {
@@ -55,7 +55,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 7 }
+ PARAMS { 9 1 10 8 }
}
}
FILLVALUE {
@@ -77,7 +77,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 7 }
+ PARAMS { 9 1 10 8 }
}
}
FILLVALUE {
@@ -99,7 +99,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 7 }
+ PARAMS { 9 1 10 8 }
}
}
FILLVALUE {
@@ -121,7 +121,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 7 }
+ PARAMS { 9 1 10 8 }
}
}
FILLVALUE {
@@ -143,7 +143,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 7 }
+ PARAMS { 9 1 10 8 }
}
}
FILLVALUE {
diff --git a/tools/test/h5repack/testh5repack_detect_szip.c b/tools/test/h5repack/testh5repack_detect_szip.c
index 6b86dd5..29414b4 100644
--- a/tools/test/h5repack/testh5repack_detect_szip.c
+++ b/tools/test/h5repack/testh5repack_detect_szip.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -16,7 +16,6 @@
#include "h5tools_utils.h"
#include "h5test.h"
-
/* Name of tool */
#define PROGRAMNAME "h5repack_detect_szip"
@@ -39,8 +38,8 @@
*-------------------------------------------------------------------------
*/
-
-int main(void)
+int
+main(void)
{
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -51,9 +50,9 @@ int main(void)
#ifdef H5_HAVE_FILTER_SZIP
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
HDprintf("yes\n");
- return(1);
+ return (1);
}
#endif /* H5_HAVE_FILTER_SZIP */
HDprintf("no\n");
- return(0);
+ return (0);
}
diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt
index f50a747..a40d196 100644
--- a/tools/test/h5stat/CMakeLists.txt
+++ b/tools/test/h5stat/CMakeLists.txt
@@ -6,11 +6,18 @@ project (HDF5_TOOLS_TEST_H5STAT C)
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5stat_gentest ${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/h5stat_gentest.c)
- target_include_directories (h5stat_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5stat_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5stat_gentest STATIC)
target_link_libraries (h5stat_gentest PRIVATE ${HDF5_LIB_TARGET})
set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools)
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5STAT_FORMAT h5stat_gentest)
+ endif ()
+
#add_test (NAME h5stat_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5stat_gentest>)
endif ()
diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake
index 0c07418..d4238b5 100644
--- a/tools/test/h5stat/CMakeTests.cmake
+++ b/tools/test/h5stat/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -207,7 +207,7 @@
# -d --di=15
ADD_H5_ERR_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5)
ADD_H5_TEST (h5stat_dims1 0 -gd -m 5 h5stat_threshold.h5)
- ADD_H5_TEST (h5stat_dims2 0 -d --di=15 h5stat_threshold.h5)
+ ADD_H5_TEST (h5stat_dims2 0 -d --dims=15 h5stat_threshold.h5)
#
# Tests for -a option on h5stat_threshold.h5
# -a -2 (incorrect threshold value)
diff --git a/tools/test/h5stat/Makefile.am b/tools/test/h5stat/Makefile.am
index dd251f8..ca1108f 100644
--- a/tools/test/h5stat/Makefile.am
+++ b/tools/test/h5stat/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/h5stat/Makefile.in b/tools/test/h5stat/Makefile.in
index a3bd057..817996d 100644
--- a/tools/test/h5stat/Makefile.in
+++ b/tools/test/h5stat/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -114,6 +114,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -417,12 +418,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -460,11 +461,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -496,8 +542,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -511,7 +555,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -521,6 +567,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -714,7 +761,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1240,8 +1287,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c
index 0bf1001..c775d6a 100644
--- a/tools/test/h5stat/h5stat_gentest.c
+++ b/tools/test/h5stat/h5stat_gentest.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,101 +24,117 @@
#include "H5private.h"
/* For gen_newgrat_file() */
-#define NEWGRAT_FILE "h5stat_newgrat.h5"
-#define DATASET_NAME "DATASET_NAME"
-#define GROUP_NAME "GROUP"
+#define NEWGRAT_FILE "h5stat_newgrat.h5"
+#define DATASET_NAME "DATASET_NAME"
+#define GROUP_NAME "GROUP"
#define ATTR_NAME "ATTR"
#define NUM_GRPS 35000
#define NUM_ATTRS 100
/* Declarations for gen_idx_file() */
-#define IDX_FILE "h5stat_idx.h5"
+#define IDX_FILE "h5stat_idx.h5"
#define DSET "dset"
-#define DSET_FILTER "dset_filter"
+#define DSET_FILTER "dset_filter"
/* For gen_threshold_file() */
-#define THRESHOLD_FILE "h5stat_threshold.h5"
-#define THRES_ATTR_NAME "attr"
-#define THRES_ATTR_GRP_NAME "grp_attr"
+#define THRESHOLD_FILE "h5stat_threshold.h5"
+#define THRES_ATTR_NAME "attr"
+#define THRES_ATTR_GRP_NAME "grp_attr"
#define THRES_DSET_NAME "dset"
-#define THRES_NUM 10
+#define THRES_NUM 10
#define THRES_NUM_25 25
/* For gen_err_refcount() */
-#define ERR_REFCOUNT_FILE "h5stat_err_refcount.h5"
+#define ERR_REFCOUNT_FILE "h5stat_err_refcount.h5"
/*
* Generate HDF5 file with latest format with
* NUM_GRPS groups and NUM_ATTRS attributes for the dataset
*/
-static void
+static herr_t
gen_newgrat_file(const char *fname)
{
- hid_t fcpl = H5I_INVALID_HID; /* File creation property */
- hid_t fapl = H5I_INVALID_HID; /* File access property */
- hid_t fid = H5I_INVALID_HID; /* File id */
- hid_t gid = H5I_INVALID_HID; /* Group id */
- hid_t tid = H5I_INVALID_HID; /* Datatype id */
- hid_t sid = H5I_INVALID_HID; /* Dataspace id */
- hid_t attr_id = H5I_INVALID_HID; /* Attribute id */
- hid_t did = H5I_INVALID_HID; /* Dataset id */
- char name[30]; /* Group name */
- char attrname[30]; /* Attribute name */
- int i; /* Local index variable */
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property */
+ hid_t fapl = H5I_INVALID_HID; /* File access property */
+ hid_t fid = H5I_INVALID_HID; /* File id */
+ hid_t gid = H5I_INVALID_HID; /* Group id */
+ hid_t tid = H5I_INVALID_HID; /* Datatype id */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace id */
+ hid_t attr_id = H5I_INVALID_HID; /* Attribute id */
+ hid_t did = H5I_INVALID_HID; /* Dataset id */
+ char name[30]; /* Group name */
+ char attrname[30]; /* Attribute name */
+ int i; /* Local index variable */
/* Get a copy file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
/* Get a copy of file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto error;
/* Set file space handling strategy */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1) < 0)
goto error;
- /* Create file */
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ /* Create file */
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
goto error;
/* Create NUM_GRPS groups in the root group */
- for(i = 1; i <= NUM_GRPS; i++) {
- HDsprintf(name, "%s%d", GROUP_NAME,i);
- if((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 1; i <= NUM_GRPS; i++) {
+ HDsprintf(name, "%s%d", GROUP_NAME, i);
+ if ((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto error;
} /* end for */
/* Create a datatype to commit and use */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
goto error;
/* Create dataspace for dataset */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
goto error;
/* Create dataset */
- if((did = H5Dcreate2(fid, DATASET_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DATASET_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create NUM_ATTRS for the dataset */
- for(i = 1; i <= NUM_ATTRS; i++) {
- HDsprintf(attrname, "%s%d", ATTR_NAME,i);
- if((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 1; i <= NUM_ATTRS; i++) {
+ HDsprintf(attrname, "%s%d", ATTR_NAME, i);
+ if ((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto error;
} /* end for */
/* Close dataset, dataspace, datatype, file */
+ if (H5Pclose(fapl) < 0)
+ goto error;
+ if (H5Pclose(fcpl) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
+ if (H5Tclose(tid) < 0)
+ goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
+
+ return SUCCEED;
+
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(fcpl);
H5Aclose(attr_id);
@@ -127,178 +143,202 @@ error:
H5Sclose(sid);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ return FAIL;
} /* gen_newgrat_file() */
/*
* Generate an HDF5 file with groups, datasets, attributes for testing the options:
* -l N (--links=N): Set the threshold for # of links when printing information for small groups.
- * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets.
- * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes.
+ * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small
+ * datasets. -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for
+ * small # of attributes.
*/
-static void
+static herr_t
gen_threshold_file(const char *fname)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t sid0 = H5I_INVALID_HID; /* Dataspace IDs */
- hid_t sid1 = H5I_INVALID_HID; /* Dataspace IDs */
- hid_t sid2 = H5I_INVALID_HID; /* Dataspace IDs */
- hid_t sid3 = H5I_INVALID_HID; /* Dataspace IDs */
- hid_t sid4 = H5I_INVALID_HID; /* Dataspace IDs */
- hid_t did = H5I_INVALID_HID; /* Dataset ID */
- hid_t attr_id = H5I_INVALID_HID; /* Attribute ID */
- hid_t gid = H5I_INVALID_HID; /* Group ID */
- hsize_t two_dims[] = {2, 5}; /* Dimension array */
- hsize_t one_dims[] = {6}; /* Dimension array */
- hsize_t zero_dims[] = {0}; /* Dimension array */
- char name[30]; /* Name */
- unsigned i; /* Local index variable */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t sid0 = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t sid1 = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t sid2 = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t sid3 = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t sid4 = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t attr_id = H5I_INVALID_HID; /* Attribute ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hsize_t two_dims[] = {2, 5}; /* Dimension array */
+ hsize_t one_dims[] = {6}; /* Dimension array */
+ hsize_t zero_dims[] = {0}; /* Dimension array */
+ char name[30]; /* Name */
+ unsigned i; /* Local index variable */
/* Create file */
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create 1-D dataspace with zero dimension size */
- if((sid0 = H5Screate_simple(1, zero_dims, NULL)) < 0)
+ if ((sid0 = H5Screate_simple(1, zero_dims, NULL)) < 0)
goto error;
/* Create 1-D dataspace with non-zero dimension size*/
- if((sid1 = H5Screate_simple(1, one_dims, NULL)) < 0)
+ if ((sid1 = H5Screate_simple(1, one_dims, NULL)) < 0)
goto error;
/* Create 2-D dataspace */
- if((sid2 = H5Screate_simple(2, two_dims, NULL)) < 0)
+ if ((sid2 = H5Screate_simple(2, two_dims, NULL)) < 0)
goto error;
/* Create scalar dataspace */
- if((sid3 = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid3 = H5Screate(H5S_SCALAR)) < 0)
goto error;
/* Create null dataspace */
- if((sid4 = H5Screate(H5S_NULL)) < 0)
+ if ((sid4 = H5Screate(H5S_NULL)) < 0)
goto error;
/* Create an attribute for the root group */
- if((attr_id = H5Acreate2(fid, "attr", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2(fid, "attr", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto error;
/* Create 1-D dataset with zero dimension size for the root group */
- if((did = H5Dcreate2(fid, "zero_dset", H5T_NATIVE_UCHAR, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "zero_dset", H5T_NATIVE_UCHAR, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
goto error;
/* Create 11 attributes for the dataset */
- for(i = 1; i <= (THRES_NUM+1); i++) {
- HDsprintf(name, "%s%d", THRES_ATTR_NAME,i);
- if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 1; i <= (THRES_NUM + 1); i++) {
+ HDsprintf(name, "%s%d", THRES_ATTR_NAME, i);
+ if ((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto error;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
/* Create dataset with scalar dataspace for the root group */
- if((did = H5Dcreate2(fid, "scalar_dset", H5T_NATIVE_UCHAR, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "scalar_dset", H5T_NATIVE_UCHAR, sid3, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto error;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
/* Create dataset with null dataspace for the root group */
- if((did = H5Dcreate2(fid, "null_dset", H5T_NATIVE_UCHAR, sid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "null_dset", H5T_NATIVE_UCHAR, sid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
+ 0)
goto error;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
/* Create 2-D dataset for the root group */
- if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dset", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create 10 attributes for the 2-D dataset */
- for(i = 1; i <= THRES_NUM; i++) {
- HDsprintf(name, "%s%d", THRES_ATTR_NAME,i);
- if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 1; i <= THRES_NUM; i++) {
+ HDsprintf(name, "%s%d", THRES_ATTR_NAME, i);
+ if ((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto error;
}
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
/* Create first group */
- if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create an attribute for the group */
- if((attr_id = H5Acreate2(gid, "ATTR", H5T_NATIVE_INT, sid3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2(gid, "ATTR", H5T_NATIVE_INT, sid3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Close attribute */
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto error;
/* Create 10 1-D datasets with non-zero dimension size for the group */
- for(i = 1; i <= THRES_NUM; i++) {
+ for (i = 1; i <= THRES_NUM; i++) {
/* set up dataset name */
- HDsprintf(name, "%s%d", THRES_DSET_NAME,i);
+ HDsprintf(name, "%s%d", THRES_DSET_NAME, i);
/* Create the dataset */
- if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
}
/* Close the group */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto error;
-
/* Create second group */
- if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create 25 attributes for the group */
- for(i = 1; i <= THRES_NUM_25; i++) {
- /* Set up attribute name */
- HDsprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i);
+ for (i = 1; i <= THRES_NUM_25; i++) {
+ /* Set up attribute name */
+ HDsprintf(name, "%s%d", THRES_ATTR_GRP_NAME, i);
/* Create the attribute */
- if((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Close the attribute */
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
goto error;
}
/* Close the group */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto error;
/* Create third group */
- if((gid = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create 9 1-D datasets with non-zero dimension size for the group */
- for(i = 1; i < THRES_NUM; i++) {
+ for (i = 1; i < THRES_NUM; i++) {
/* set up dataset name */
- HDsprintf(name, "%s%d", THRES_DSET_NAME,i);
+ HDsprintf(name, "%s%d", THRES_DSET_NAME, i);
/* Create the dataset */
- if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
}
+ if (H5Gclose(gid) < 0)
+ goto error;
+ if (H5Sclose(sid0) < 0)
+ goto error;
+ if (H5Sclose(sid1) < 0)
+ goto error;
+ if (H5Sclose(sid2) < 0)
+ goto error;
+ if (H5Sclose(sid3) < 0)
+ goto error;
+ if (H5Sclose(sid4) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
+
+ return SUCCEED;
+
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Aclose(attr_id);
H5Dclose(did);
@@ -308,7 +348,10 @@ error:
H5Sclose(sid3);
H5Sclose(sid4);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ return FAIL;
} /* gen_threshold_file() */
@@ -320,80 +363,100 @@ error:
* one dataset: fixed dimension, chunked layout, w/ filters
*
*/
-static void
+static herr_t
gen_idx_file(const char *fname)
{
- hid_t fapl = H5I_INVALID_HID; /* file access property id */
- hid_t fid = H5I_INVALID_HID; /* file id */
- hid_t sid = H5I_INVALID_HID; /* space id */
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
- hid_t did = -1, did2 = H5I_INVALID_HID; /* dataset id */
- hsize_t dims[1] = {10}; /* dataset dimension */
- hsize_t c_dims[1] = {2}; /* chunk dimension */
- int i; /* local index variable */
- int buf[10]; /* data buffer */
+ hid_t fapl = H5I_INVALID_HID; /* file access property id */
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
+ hid_t did = H5I_INVALID_HID; /* dataset id */
+#if defined(H5_HAVE_FILTER_DEFLATE)
+ hid_t did2 = H5I_INVALID_HID; /* dataset id (compressed) */
+#endif
+ hsize_t dims[1] = {10}; /* dataset dimension */
+ hsize_t c_dims[1] = {2}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[10]; /* data buffer */
/* Get a copy of the file access property */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
/* Set the "use the latest format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
/* Create file */
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
/* Create data */
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
buf[i] = i;
/* Set chunk */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl, 1, c_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, c_dims) < 0)
goto error;
/* Create a 1D dataset */
- if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto error;
- if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
- if(H5Pset_deflate(dcpl, 9) < 0)
+ if (H5Pset_deflate(dcpl, 9) < 0)
goto error;
/* Create and write the dataset */
- if((did2 = H5Dcreate2(fid, DSET_FILTER, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, DSET_FILTER, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/* Close the dataset */
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
goto error;
#endif
/* closing: dataspace, dataset, file */
+ if (H5Pclose(fapl) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
+
+ return SUCCEED;
+
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(did);
H5Fclose(fid);
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
H5Dclose(did2);
#endif
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ return FAIL;
} /* gen_idx_file() */
@@ -410,73 +473,78 @@ error:
* H5O_refcount_decode in the jira issue.
*
*/
-static void
+static herr_t
gen_err_refcount(const char *fname)
{
- hid_t fid = H5I_INVALID_HID; /* File identifier */
- hid_t sid = H5I_INVALID_HID; /* Dataspace message */
- hid_t did = H5I_INVALID_HID; /* Dataset identifier */
- hid_t gid = H5I_INVALID_HID; /* Group identifier */
- hid_t aid1 = -1, aid2 = H5I_INVALID_HID; /* Attribute identifier */
- hid_t tid = H5I_INVALID_HID; /* Datatype identifier */
- int i, n; /* Local index variables */
- int buf[10]; /* Data buffer */
- hsize_t dims[1]; /* Dimension size */
- int fd = -1; /* File descriptor */
- unsigned short val = 22; /* The refcount message ID */
+ hid_t fid = H5I_INVALID_HID; /* File identifier */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace message */
+ hid_t did = H5I_INVALID_HID; /* Dataset identifier */
+ hid_t gid = H5I_INVALID_HID; /* Group identifier */
+ hid_t aid1 = H5I_INVALID_HID; /* Attribute identifier */
+ hid_t aid2 = H5I_INVALID_HID; /* Attribute identifier */
+ hid_t tid = H5I_INVALID_HID; /* Datatype identifier */
+ int i, n; /* Local index variables */
+ int buf[10]; /* Data buffer */
+ hsize_t dims[1]; /* Dimension size */
+ int fd = -1; /* File descriptor */
+ unsigned short val = 22; /* The refcount message ID */
/* Initialize data buffer */
n = 0;
- for(i = 0; i < 10; i++)
+ for (i = 0; i < 10; i++)
buf[i] = n++;
/* Create the file */
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create a group */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create a committed datatype in the group */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
goto error;
- if(H5Tcommit2(gid, "dtype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(gid, "dtype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto error;
/* Create the dataspace */
dims[0] = 10;
- if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto error;
/* Create a dataset with the committed datatype in the file */
- if((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
/* Attach an attribute with the committed datatype to the group */
- if((aid1 = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid1 = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Attach an attribute with the committed datatype to the dataset */
- if((aid2 = H5Acreate2(did, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid2 = H5Acreate2(did, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Closing */
- if(H5Aclose(aid1) < 0)
+ if (H5Aclose(aid1) < 0)
goto error;
- if(H5Aclose(aid2) < 0)
+ if (H5Aclose(aid2) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto error;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+
+ /* Be sure to close this before opening the file again via open(), below,
+ * or you'll possibly trip over the file locking.
+ */
+ if (H5Fclose(fid) < 0)
goto error;
/* This section of code will write a refcount message ID to a message in the
@@ -486,14 +554,20 @@ gen_err_refcount(const char *fname)
with the committed datatype */
/* 24: the offset in the object header containing the version of the
attribute message */
- if((fd = HDopen(fname, O_RDWR, 0633)) >= 0) {
- HDlseek(fd, 4520+24, SEEK_SET);
- HDwrite(fd, &val, 2);
- HDclose(fd);
- }
+ if ((fd = HDopen(fname, O_RDWR, 0633)) < 0)
+ goto error;
+ if (HDlseek(fd, 4520 + 24, SEEK_SET) < 0)
+ goto error;
+ if (HDwrite(fd, &val, 2) < 0)
+ goto error;
+ if (HDclose(fd) < 0)
+ goto error;
+
+ return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid);
H5Dclose(did);
H5Tclose(tid);
@@ -501,7 +575,13 @@ error:
H5Aclose(aid1);
H5Aclose(aid2);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ if (fd >= 0)
+ HDclose(fd);
+
+ return FAIL;
} /* gen_err_refcount() */
/*
@@ -528,17 +608,25 @@ error:
* jira issue.
*/
-int main(void)
+int
+main(void)
{
- gen_newgrat_file(NEWGRAT_FILE);
- gen_threshold_file(THRESHOLD_FILE);
+ if (gen_newgrat_file(NEWGRAT_FILE) < 0)
+ goto error;
+ if (gen_threshold_file(THRESHOLD_FILE) < 0)
+ goto error;
/* Generate an HDF file to test for datasets with Fixed Array indexing */
- gen_idx_file(IDX_FILE);
+ if (gen_idx_file(IDX_FILE) < 0)
+ goto error;
/* Generate a file with a refcount message ID */
- gen_err_refcount(ERR_REFCOUNT_FILE);
+ if (gen_err_refcount(ERR_REFCOUNT_FILE) < 0)
+ goto error;
- return 0;
-}
+ return EXIT_SUCCESS;
+error:
+ HDfprintf(stderr, "h5stat test generator FAILED\n");
+ return EXIT_FAILURE;
+}
diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in
index 69b856e..647f06a 100644
--- a/tools/test/h5stat/testh5stat.sh.in
+++ b/tools/test/h5stat/testh5stat.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -304,7 +304,7 @@ TOOLTEST h5stat_links5.ddl -g -l 40000 h5stat_newgrat.h5
# -d --di=15
TOOLTEST h5stat_err1_dims.ddl -d --dims=-1 h5stat_threshold.h5
TOOLTEST h5stat_dims1.ddl -gd -m 5 h5stat_threshold.h5
-TOOLTEST h5stat_dims2.ddl -d --di=15 h5stat_threshold.h5
+TOOLTEST h5stat_dims2.ddl -d --dims=15 h5stat_threshold.h5
#
# Tests for -a option on h5stat_threshold.h5
# -a -2 (incorrect threshold value)
diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt
index 8f13d84..f67f36b 100644
--- a/tools/test/misc/CMakeLists.txt
+++ b/tools/test/misc/CMakeLists.txt
@@ -6,7 +6,7 @@ project (HDF5_TOOLS_TEST_MISC C)
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c)
- target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5repart_gentest STATIC)
target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
@@ -17,8 +17,15 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools)
#add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repart_gentest>)
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_MISC_h5repart_gentest_FORMAT h5repart_gentest)
+ endif ()
+
add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c)
- target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5clear_gentest STATIC)
target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
@@ -29,12 +36,19 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
set_target_properties (h5clear_gentest PROPERTIES FOLDER tools)
#add_test (NAME H5CLEAR-h5clear_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5clear_gentest>)
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_MISC_h5clear_gentest_FORMAT h5clear_gentest)
+ endif ()
+
add_subdirectory (vds)
endif ()
add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c)
-target_include_directories (h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5repart_test STATIC)
target_link_libraries (h5repart_test PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -44,8 +58,15 @@ else ()
endif ()
set_target_properties (h5repart_test PROPERTIES FOLDER tools)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_MISC_h5repart_test_FORMAT h5repart_test)
+endif ()
+
add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c)
-target_include_directories (clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (clear_open_chk STATIC)
target_link_libraries (clear_open_chk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -55,6 +76,13 @@ else ()
endif ()
set_target_properties (clear_open_chk PROPERTIES FOLDER tools)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_MISC_clear_open_chk_FORMAT clear_open_chk)
+endif ()
+
if (HDF5_TEST_SERIAL)
include (CMakeTestsRepart.cmake)
include (CMakeTestsClear.cmake)
diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake
index cb285e4..198a363 100644
--- a/tools/test/misc/CMakeTestsClear.cmake
+++ b/tools/test/misc/CMakeTestsClear.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -397,7 +397,7 @@
#
# The following are tests to verify the expected exit code from h5clear:
# "h5clear -m h5clear_mdc_image.h5" (valid option, existing file, succeed exit code)
-# "h5clear --vers" (valid option, version #, succeed exit code)
+# "h5clear --version" (valid option, version #, succeed exit code)
# "h5clear -k" (invalid 1 option, no file, fail exit code)
# "h5clear -k junk.h5" (invalid 1 option, nonexisting file, fail exit code)
# "h5clear -l h5clear_sec2_v2.h5" (invalid 1 option, existing file, fail exit code)
@@ -408,7 +408,7 @@
# "h5clear -m -l h5clear_sec2_v0.h5" (valid/invalid 2 options, existing file, fail exit code)
# "h5clear -l -m h5clear_sec2_v0.h5" (invalid/valid 2 options, existing file, fail exit code)
ADD_H5_RETTEST (h5clr_mdc_image "false" "-m" h5clear_mdc_image.h5)
- ADD_H5_RETTEST (h5clr_vers "false" "--vers")
+ ADD_H5_RETTEST (h5clr_vers "false" "--version")
ADD_H5_RETTEST (h5clr_k "true" "-k")
ADD_H5_RETTEST (h5clr_k_junk "true" "-k" junk.h5)
ADD_H5_RETTEST (h5clr_l_sec2 "true" "-l" h5clear_sec2_v2.h5)
diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake
index fb9e5ba..11c9fdf 100644
--- a/tools/test/misc/CMakeTestsMkgrp.cmake
+++ b/tools/test/misc/CMakeTestsMkgrp.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake
index 14b349c..20ae263 100644
--- a/tools/test/misc/CMakeTestsRepart.cmake
+++ b/tools/test/misc/CMakeTestsRepart.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/misc/Makefile.am b/tools/test/misc/Makefile.am
index c58ba38..2dcbe7c 100644
--- a/tools/test/misc/Makefile.am
+++ b/tools/test/misc/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/misc/Makefile.in b/tools/test/misc/Makefile.in
index f2ba3db..58ee1b1 100644
--- a/tools/test/misc/Makefile.in
+++ b/tools/test/misc/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -479,12 +480,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -522,11 +523,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -558,8 +604,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -573,7 +617,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -583,6 +629,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -776,7 +823,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1412,8 +1459,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/misc/clear_open_chk.c b/tools/test/misc/clear_open_chk.c
index 7d22ca6..dd217b0 100644
--- a/tools/test/misc/clear_open_chk.c
+++ b/tools/test/misc/clear_open_chk.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -40,11 +40,11 @@ usage(void)
int
main(int argc, char *argv[])
{
- char *fname; /* The HDF5 file name */
- hid_t fid; /* File ID */
+ char *fname; /* The HDF5 file name */
+ hid_t fid; /* File ID */
/* Check the # of arguments */
- if(argc != 2) {
+ if (argc != 2) {
usage();
HDexit(EXIT_FAILURE);
}
@@ -53,7 +53,7 @@ main(int argc, char *argv[])
fname = HDstrdup(argv[1]);
/* Try opening the file */
- if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) {
+ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) {
HDfprintf(stderr, "clear_open_chk: unable to open the file\n");
HDfree(fname);
HDexit(EXIT_FAILURE);
@@ -61,7 +61,7 @@ main(int argc, char *argv[])
HDfree(fname);
/* Close the file */
- if(H5Fclose(fid) < 0) {
+ if (H5Fclose(fid) < 0) {
HDfprintf(stderr, "clear_open_chk: cannot close the file\n");
HDexit(EXIT_FAILURE);
}
diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c
index 8d6883c..53fbc42 100644
--- a/tools/test/misc/h5clear_gentest.c
+++ b/tools/test/misc/h5clear_gentest.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,31 +15,31 @@
/* The HDF5 test files */
const char *FILENAME[] = {
- "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */
- "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */
- "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */
- "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */
+ "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */
+ "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */
+ "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */
+ "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */
};
const char *FILENAME_ENHANCE[] = {
- "h5clear_fsm_persist_equal.h5", /* 0: persisting free-space, stored EOA = actual EOF */
- "h5clear_fsm_persist_greater.h5", /* 1: persisting free-space, stored EOA > actual EOF */
- "h5clear_fsm_persist_less.h5", /* 2: persisting free-space, stored EOA < actual EOF */
- "h5clear_fsm_persist_user_equal.h5", /* 3: user block, persisting free-space, stored EOA = actual EOF */
- "h5clear_fsm_persist_user_greater.h5", /* 4: user block, persisting free-space, stored EOA > actual EOF */
- "h5clear_fsm_persist_user_less.h5", /* 5: user block, persisting free-space, stored EOA < actual EOF */
- "h5clear_status_noclose.h5", /* 6 -- v3 superblock, nonzero status_flags, no flush, exit,
- stored EOA < actual EOF */
- "h5clear_fsm_persist_noclose.h5" /* 7 -- persisting free-space, no flush, exit, stored EOA < actual EOF */
+ "h5clear_fsm_persist_equal.h5", /* 0: persisting free-space, stored EOA = actual EOF */
+ "h5clear_fsm_persist_greater.h5", /* 1: persisting free-space, stored EOA > actual EOF */
+ "h5clear_fsm_persist_less.h5", /* 2: persisting free-space, stored EOA < actual EOF */
+ "h5clear_fsm_persist_user_equal.h5", /* 3: user block, persisting free-space, stored EOA = actual EOF */
+ "h5clear_fsm_persist_user_greater.h5", /* 4: user block, persisting free-space, stored EOA > actual EOF */
+ "h5clear_fsm_persist_user_less.h5", /* 5: user block, persisting free-space, stored EOA < actual EOF */
+ "h5clear_status_noclose.h5", /* 6 -- v3 superblock, nonzero status_flags, no flush, exit,
+ stored EOA < actual EOF */
+ "h5clear_fsm_persist_noclose.h5" /* 7 -- persisting free-space, no flush, exit, stored EOA < actual EOF */
};
-#define KB 1024U
+#define KB 1024U
-#define CACHE_IMAGE_FILE "h5clear_mdc_image.h5"
-#define DSET "DSET"
-#define DATASET "dset"
-#define NUM_ELMTS 100
-#define USERBLOCK 512
+#define CACHE_IMAGE_FILE "h5clear_mdc_image.h5"
+#define DSET "DSET"
+#define DATASET "dset"
+#define NUM_ELMTS 100
+#define USERBLOCK 512
/*-------------------------------------------------------------------------
* Function: gen_cache_image_file
@@ -56,73 +56,71 @@ const char *FILENAME_ENHANCE[] = {
static int
gen_cache_image_file(const char *fname)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t did = -1, sid = H5I_INVALID_HID; /* Dataset ID, dataspace ID */
- hid_t fapl = H5I_INVALID_HID; /* File access property list */
- hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
- hsize_t dims[2]; /* Dimension sizes */
- hsize_t chunks[2]; /* Chunked dimension sizes */
- int i, j; /* Local index variables */
- int **buf = NULL; /* Buffer for data to write */
- H5AC_cache_image_config_t cache_image_config = /* Cache image input configuration */
- { H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
- TRUE, FALSE,
- H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE};
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t did = -1, sid = H5I_INVALID_HID; /* Dataset ID, dataspace ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+ hsize_t dims[2]; /* Dimension sizes */
+ hsize_t chunks[2]; /* Chunked dimension sizes */
+ int i, j; /* Local index variables */
+ int ** buf = NULL; /* Buffer for data to write */
+ H5AC_cache_image_config_t cache_image_config = /* Cache image input configuration */
+ {H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, TRUE, FALSE, H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE};
/* Create and fill array */
H5TEST_ALLOCATE_2D_ARRAY(buf, int, 50, 100);
if (NULL == buf)
goto error;
- for(i = 0; i < 50; i++)
- for(j = 0; j < 100; j++)
+ for (i = 0; i < 50; i++)
+ for (j = 0; j < 100; j++)
buf[i][j] = i * j;
/* Create a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
/* Enable latest format in fapl */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
/* Enable metadata cache image in fapl */
- if(H5Pset_mdc_image_config(fapl, &cache_image_config) < 0)
+ if (H5Pset_mdc_image_config(fapl, &cache_image_config) < 0)
goto error;
/* Create the file */
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
/* Create dataspace */
dims[0] = 50;
dims[1] = 100;
- if((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
goto error;
/* Set up to create a chunked dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
chunks[0] = 5;
chunks[1] = 10;
- if(H5Pset_chunk(dcpl, 2, chunks) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunks) < 0)
goto error;
- if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
/* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
goto error;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto error;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
HDfree(buf);
@@ -130,14 +128,16 @@ gen_cache_image_file(const char *fname)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(did);
H5Fclose(fid);
H5Pclose(fapl);
H5Pclose(dcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
HDfree(buf);
@@ -173,61 +173,61 @@ error:
static int
gen_enhance_files(hbool_t user)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hid_t did = H5I_INVALID_HID; /* Dataset ID */
- hsize_t dim[1]; /* Dimension sizes */
- int data[NUM_ELMTS]; /* Buffer for data */
- int fd = H5I_INVALID_HID; /* The file descriptor ID */
- int64_t eoa; /* The EOA value */
- uint32_t chksum; /* The chksum value */
- int i = 0 , j = 0, u = 0; /* Local index variable */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hsize_t dim[1]; /* Dimension sizes */
+ int data[NUM_ELMTS]; /* Buffer for data */
+ int fd = H5I_INVALID_HID; /* The file descriptor ID */
+ int64_t eoa; /* The EOA value */
+ uint32_t chksum; /* The chksum value */
+ int i = 0, j = 0, u = 0; /* Local index variable */
/* Get a copy of the default file creation property */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto error;
/* Check to see if user block will be added */
- if(user) {
- if(H5Pset_userblock(fcpl, (hsize_t)USERBLOCK) < 0)
+ if (user) {
+ if (H5Pset_userblock(fcpl, (hsize_t)USERBLOCK) < 0)
goto error;
u = 3;
}
/* Set file space strategy and persisting free-space */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
goto error;
/*
* Create the file, then write invalid EOA to the file.
*/
- for(i = 0+u; i < 3+u; i++) {
+ for (i = 0 + u; i < 3 + u; i++) {
/* Create the file with the file space strategy and persisting free-space */
- if((fid = H5Fcreate(FILENAME_ENHANCE[i], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILENAME_ENHANCE[i], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
goto error;
/* Create the dataset */
dim[0] = NUM_ELMTS;
- if((sid = H5Screate_simple(1, dim, NULL)) < 0)
- goto error;
- if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((sid = H5Screate_simple(1, dim, NULL)) < 0)
+ goto error;
+ if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(j = 0; j < NUM_ELMTS; j++)
+ for (j = 0; j < NUM_ELMTS; j++)
data[j] = j;
/* Write the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto error;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto error;
/*
@@ -235,7 +235,7 @@ gen_enhance_files(hbool_t user)
* --FILENAME_ENHANCE[0]: "h5clear_fsm_persist_equal.h5"
* --FILENAME_ENHANCE[3]: "h5clear_fsm_persist_user_equal.h5",
*/
- if(!(i % 3))
+ if (!(i % 3))
continue;
/*
* For the following files:
@@ -248,27 +248,27 @@ gen_enhance_files(hbool_t user)
* update the chksum value.
*/
/* Open the file */
- if((fd = open(FILENAME_ENHANCE[i], O_RDWR, 0663)) < 0)
+ if ((fd = open(FILENAME_ENHANCE[i], O_RDWR, 0663)) < 0)
goto error;
- switch(i) {
+ switch (i) {
case 1: /* stored EOA is > EOF */
- eoa = 3048;
+ eoa = 3048;
chksum = 268376587;
break;
case 2: /* stored EOA is < EOF */
- eoa = 512;
+ eoa = 512;
chksum = 372920305;
break;
case 4: /* with userblock, stored EOA > EOF */
- eoa = 4000;
+ eoa = 4000;
chksum = 4168810027;
break;
case 5: /* with userblock, stored EOA < EOF */
- eoa = 3000;
+ eoa = 3000;
chksum = 3716054346;
break;
@@ -277,40 +277,42 @@ gen_enhance_files(hbool_t user)
}
/* location of "end of file address" */
- if(lseek(fd, (off_t)(28+(user?USERBLOCK:0)), SEEK_SET) < 0)
+ if (lseek(fd, (off_t)(28 + (user ? USERBLOCK : 0)), SEEK_SET) < 0)
goto error;
/* Write the bad eoa value to the file */
- if(write(fd, &eoa, sizeof(eoa)) < 0)
+ if (write(fd, &eoa, sizeof(eoa)) < 0)
goto error;
/* location of "superblock checksum" */
- if(lseek(fd, (off_t)(44+(user?USERBLOCK:0)), SEEK_SET) < 0)
+ if (lseek(fd, (off_t)(44 + (user ? USERBLOCK : 0)), SEEK_SET) < 0)
goto error;
/* Write the chksum value to the file */
- if(write(fd, &chksum, sizeof(chksum)) < 0)
+ if (write(fd, &chksum, sizeof(chksum)) < 0)
goto error;
/* Close the file */
- if(close(fd) < 0)
+ if (close(fd) < 0)
goto error;
} /* end for */
/* Close the property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
goto error;
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did);
H5Fclose(fid);
H5Pclose(fcpl);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
} /* gen_enhance_files() */
@@ -370,39 +372,39 @@ error:
int
main(void)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
- hid_t fapl = -1, new_fapl = H5I_INVALID_HID; /* File access property lists */
- char fname[512]; /* File name */
- unsigned new_format; /* To use latest library format or not */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- hid_t did = H5I_INVALID_HID; /* Dataset ID */
- hsize_t dim[1]; /* Dimension sizes */
- int data[NUM_ELMTS]; /* Buffer for data */
- int i; /* Local index variables */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
+ hid_t fapl = -1, new_fapl = H5I_INVALID_HID; /* File access property lists */
+ char fname[512]; /* File name */
+ unsigned new_format; /* To use latest library format or not */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hsize_t dim[1]; /* Dimension sizes */
+ int data[NUM_ELMTS]; /* Buffer for data */
+ int i; /* Local index variables */
/* Generate a file with cache image feature enabled */
- if(gen_cache_image_file(CACHE_IMAGE_FILE) < 0)
+ if (gen_cache_image_file(CACHE_IMAGE_FILE) < 0)
goto error;
/* Generate the first 6 files in FILENAME_ENHANCE[] */
- if(gen_enhance_files(FALSE) < 0)
+ if (gen_enhance_files(FALSE) < 0)
goto error;
- if(gen_enhance_files(TRUE) < 0)
+ if (gen_enhance_files(TRUE) < 0)
goto error;
/*
* Generate files in FILENAME[]
*/
/* Create a copy of the file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
/* Copy the file access property list */
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
goto error;
/* Set to latest library format */
- if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
/*
@@ -410,54 +412,56 @@ main(void)
* --FILENAME[0]: "h5clear_sec2_v3.h5", "latest_h5clear_sec2_v3.h5"
* --FILENAME[1]: "h5clear_log_v3.h5", "latest_h5clear_log_v3.h5"
*/
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- hid_t fapl2, my_fapl; /* File access property lists */
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t fapl2, my_fapl; /* File access property lists */
/* Set to use the appropriate file access property list */
- if(new_format)
+ if (new_format)
fapl2 = new_fapl;
else
fapl2 = fapl;
/*
* Create a sec2 file
*/
- if((my_fapl = H5Pcopy(fapl2)) < 0)
+ if ((my_fapl = H5Pcopy(fapl2)) < 0)
goto error;
/* Create the file */
- HDsprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[0]);
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0)
+ HDsprintf(fname, "%s%s", new_format ? "latest_" : "", FILENAME[0]);
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT,
+ my_fapl)) < 0)
goto error;
/* Flush the file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
goto error;
/* Close the property list */
- if(H5Pclose(my_fapl) < 0)
+ if (H5Pclose(my_fapl) < 0)
goto error;
/*
* Create a log file
*/
/* Create a copy of file access property list */
- if((my_fapl = H5Pcopy(fapl2)) < 0)
- goto error;
+ if ((my_fapl = H5Pcopy(fapl2)) < 0)
+ goto error;
/* Setup the fapl for the log driver */
- if(H5Pset_fapl_log(my_fapl, "append.log", (unsigned long long)H5FD_LOG_ALL, (size_t)(4 * KB)) < 0)
+ if (H5Pset_fapl_log(my_fapl, "append.log", (unsigned long long)H5FD_LOG_ALL, (size_t)(4 * KB)) < 0)
goto error;
/* Create the file */
- HDsprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[1]);
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0)
+ HDsprintf(fname, "%s%s", new_format ? "latest_" : "", FILENAME[1]);
+ if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT,
+ my_fapl)) < 0)
goto error;
/* Flush the file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
goto error;
/* Close the property list */
- if(H5Pclose(my_fapl) < 0)
+ if (H5Pclose(my_fapl) < 0)
goto error;
} /* end for */
@@ -466,39 +470,37 @@ main(void)
* Create a sec2 file with v0 superblock but nonzero status_flags:
* FILENAME[2]: "h5clear_sec2_v0.h5"
*/
- if((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
/* Flush the file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
goto error;
-
/*
* Create a sec2 file with v2 superblock but nonzero status_flags:
* FILENAME[3]: "h5clear_sec2_v2.h5"
*/
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto error;
- if(H5Pset_shared_mesg_nindexes(fcpl, 1) < 0)
+ if (H5Pset_shared_mesg_nindexes(fcpl, 1) < 0)
goto error;
- if(H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_DTYPE_FLAG, 50) < 0)
+ if (H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_DTYPE_FLAG, 50) < 0)
goto error;
- if((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
goto error;
/* Flush the file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
goto error;
-
/* Close the property lists */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
goto error;
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
goto error;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
goto error;
/*
@@ -515,42 +517,41 @@ main(void)
* --does not flush the file, just exit without closing file:
* --this file is similar to the user-suppplied test file attached with HDFFV-10347
*/
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto error;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
/* Set to latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
/* Create file with SWMR-write access */
- if((fid = H5Fcreate(FILENAME_ENHANCE[6], H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(FILENAME_ENHANCE[6], H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
goto error;
/* Create the dataset */
dim[0] = NUM_ELMTS;
- if((sid = H5Screate_simple(1, dim, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dim, NULL)) < 0)
goto error;
- if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(i = 0; i < NUM_ELMTS; i++)
+ for (i = 0; i < NUM_ELMTS; i++)
data[i] = i;
/* Write the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto error;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
goto error;
/* Does not flush and does not close the file */
-
/*
* FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5
* --stored EOA < actual EOF
@@ -559,42 +560,41 @@ main(void)
* --undefined fsinfo.fs_addr
* --does not flush the file, just exit without closing
*/
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto error;
/* Set file space strategy and persisting free-space */
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
- goto error;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ goto error;
/* Create the file with the set file space info */
- if((fid = H5Fcreate(FILENAME_ENHANCE[7], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FILENAME_ENHANCE[7], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
goto error;
/* Create the dataset */
dim[0] = NUM_ELMTS;
- if((sid = H5Screate_simple(1, dim, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, dim, NULL)) < 0)
goto error;
- if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(i = 0; i < NUM_ELMTS; i++)
+ for (i = 0; i < NUM_ELMTS; i++)
data[i] = i;
/* Write the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto error;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto error;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto error;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
goto error;
/* Does not flush and does not close the file */
-
fflush(stdout);
fflush(stderr);
diff --git a/tools/test/misc/h5perf_gentest.c b/tools/test/misc/h5perf_gentest.c
index 511a9e2..332e49c 100644
--- a/tools/test/misc/h5perf_gentest.c
+++ b/tools/test/misc/h5perf_gentest.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,70 +21,70 @@
#include <stdio.h>
#include <stdlib.h>
-#define FNAME "test_perf.h5"
-#define NGROUPS 20
-#define NDSETS 20
-#define NATTRS 20
-#define DIM0 40
-#define NROWS 100
-#define NTYPES 9
-#define MAXVLEN 10
-#define FIXED_LEN 8
+#define FNAME "test_perf.h5"
+#define NGROUPS 20
+#define NDSETS 20
+#define NATTRS 20
+#define DIM0 40
+#define NROWS 100
+#define NTYPES 9
+#define MAXVLEN 10
+#define FIXED_LEN 8
-typedef enum { SOLID=0, LIQUID, GAS, PLASMA } phase_t;
+typedef enum { SOLID = 0, LIQUID, GAS, PLASMA } phase_t;
typedef struct {
- int i;
- unsigned long long l;
- float f;
- double d;
- char s[FIXED_LEN];
- phase_t e;
- float f_array[FIXED_LEN];
- hvl_t i_vlen;
- char *s_vlen;
+ int i;
+ unsigned long long l;
+ float f;
+ double d;
+ char s[FIXED_LEN];
+ phase_t e;
+ float f_array[FIXED_LEN];
+ hvl_t i_vlen;
+ char * s_vlen;
} test_comp_t;
typedef struct {
- int zipcode;
- char *city;
+ int zipcode;
+ char *city;
} zipcode_t;
-int add_attrs(hid_t oid, int idx);
-int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) ;
-herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets,
- int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen,
- int compressed, int latest);
+int add_attrs(hid_t oid, int idx);
+int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf);
+herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsize_t nrows,
+ hsize_t dim0, hsize_t chunk, int vlen, int compressed, int latest);
-int main (int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
char fname[32];
- int i, ngrps=NGROUPS, ndsets=NDSETS, nattrs=NATTRS, dim0=DIM0,
- chunk=DIM0/10+1, nrows=NROWS, vlen=MAXVLEN, l=0, z=0;
+ int i, ngrps = NGROUPS, ndsets = NDSETS, nattrs = NATTRS, dim0 = DIM0, chunk = DIM0 / 10 + 1,
+ nrows = NROWS, vlen = MAXVLEN, l = 0, z = 0;
memset(fname, 0, 32);
- for (i=1; i<argc; i++) {
- if (strcmp(argv[i], "-f")==0)
- strcpy(fname, argv[i+1]);
- else if (strcmp(argv[i], "-g")==0)
- ngrps = atoi(argv[i+1]);
- else if (strcmp(argv[i], "-d")==0)
- ndsets = atoi(argv[i+1]);
- else if (strcmp(argv[i], "-a")==0)
- nattrs = atoi(argv[i+1]);
- else if (strcmp(argv[i], "-r")==0)
- nrows = atoi(argv[i+1]);
- else if (strcmp(argv[i], "-s")==0)
- dim0 = atoi(argv[i+1]);
- else if (strcmp(argv[i], "-c")==0)
- chunk = atoi(argv[i+1]);
- else if (strcmp(argv[i], "-v")==0)
- vlen = atoi(argv[i+1]);
- else if (strcmp(argv[i], "-l")==0)
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-f") == 0)
+ strcpy(fname, argv[i + 1]);
+ else if (strcmp(argv[i], "-g") == 0)
+ ngrps = atoi(argv[i + 1]);
+ else if (strcmp(argv[i], "-d") == 0)
+ ndsets = atoi(argv[i + 1]);
+ else if (strcmp(argv[i], "-a") == 0)
+ nattrs = atoi(argv[i + 1]);
+ else if (strcmp(argv[i], "-r") == 0)
+ nrows = atoi(argv[i + 1]);
+ else if (strcmp(argv[i], "-s") == 0)
+ dim0 = atoi(argv[i + 1]);
+ else if (strcmp(argv[i], "-c") == 0)
+ chunk = atoi(argv[i + 1]);
+ else if (strcmp(argv[i], "-v") == 0)
+ vlen = atoi(argv[i + 1]);
+ else if (strcmp(argv[i], "-l") == 0)
l = 1;
- else if (strcmp(argv[i], "-z")==0)
+ else if (strcmp(argv[i], "-z") == 0)
z = 1;
- else if (strcmp(argv[i], "-h")==0) {
+ else if (strcmp(argv[i], "-h") == 0) {
HDprintf("\nOPTONS:\n");
HDprintf("\t-f F:\tname of the test file (default: %s).\n", FNAME);
HDprintf("\t-g N:\tnumber of top level groups (default: %d).\n", NGROUPS);
@@ -92,7 +92,7 @@ int main (int argc, char *argv[])
HDprintf("\t-a N:\tnumber of attributes (default: %d).\n", NATTRS);
HDprintf("\t-r N:\tnumber of rows in the large compound dataset (default: %d).\n", NROWS);
HDprintf("\t-s N:\tsize of dim0 in datasets (default: %d).\n", DIM0);
- HDprintf("\t-c N:\tchunk size of dim0 (default: %d).\n", (DIM0/10+1));
+ HDprintf("\t-c N:\tchunk size of dim0 (default: %d).\n", (DIM0 / 10 + 1));
HDprintf("\t-v N:\tmax vlen size (default: %d).\n", MAXVLEN);
HDprintf("\t-l:\tuse latest format (default: no).\n");
HDprintf("\t-z:\tuse gzip compression (default: no).\n");
@@ -103,11 +103,11 @@ int main (int argc, char *argv[])
}
}
- if (strlen(fname)<=0)
+ if (strlen(fname) <= 0)
HDsprintf(fname, FNAME);
- create_perf_test_file(fname, ngrps, ndsets, nattrs, (hsize_t)nrows,
- (hsize_t)dim0, (hsize_t)chunk, vlen, z, l);
+ create_perf_test_file(fname, ngrps, ndsets, nattrs, (hsize_t)nrows, (hsize_t)dim0, (hsize_t)chunk, vlen,
+ z, l);
return 0;
}
@@ -130,339 +130,378 @@ int main (int argc, char *argv[])
Programmer: Peter Cao, Jan. 2013
****************************************************************************/
-herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets,
- int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen,
- int compressed, int latest)
+herr_t
+create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsize_t nrows, hsize_t dim0,
+ hsize_t chunk, int vlen, int compressed, int latest)
{
- int i, j, k;
- hid_t fid, sid_null, sid_scalar, sid_1d, sid_2d, did, aid, sid_2, sid_large,
- fapl=H5P_DEFAULT, dcpl=H5P_DEFAULT, gid1, gid2, cmp_tid, tid_str,
- tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s;
- char name[32], tmp_name1[32], tmp_name2[32], tmp_name3[32];
- hsize_t dims[1]={dim0}, dims2d[2]={dim0, (dim0/4+1)}, dims_array[1]={FIXED_LEN},
- dim1[1]={2};
- char *enum_names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"};
- test_comp_t *buf_comp=NULL, *buf_comp_large=NULL;
- int *buf_int=NULL;
- float (*buf_float_a)[FIXED_LEN]=NULL;
- double **buf_double2d=NULL;
- hvl_t *buf_vlen_i=NULL;
- char (*buf_str)[FIXED_LEN];
- char **buf_vlen_s=NULL;
- hobj_ref_t buf_ref[2];
+ int i, j, k;
+ hid_t fid, sid_null, sid_scalar, sid_1d, sid_2d, did, aid, sid_2, sid_large,
+ fapl = H5P_DEFAULT, dcpl = H5P_DEFAULT, gid1, gid2, cmp_tid, tid_str, tid_enum, tid_array_f,
+ tid_vlen_i, tid_vlen_s;
+ char name[32], tmp_name1[32], tmp_name2[32], tmp_name3[32];
+ hsize_t dims[1] = {dim0}, dims2d[2] = {dim0, (dim0 / 4 + 1)}, dims_array[1] = {FIXED_LEN}, dim1[1] = {2};
+ char * enum_names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"};
+ test_comp_t *buf_comp = NULL, *buf_comp_large = NULL;
+ int * buf_int = NULL;
+ float(*buf_float_a)[FIXED_LEN] = NULL;
+ double **buf_double2d = NULL;
+ hvl_t * buf_vlen_i = NULL;
+ char(*buf_str)[FIXED_LEN];
+ char ** buf_vlen_s = NULL;
+ hobj_ref_t buf_ref[2];
hdset_reg_ref_t buf_reg_ref[2];
- size_t offset, len;
- herr_t status;
- char *names[NTYPES] = { "int", "ulong", "float", "double", "fixed string",
- "enum", "fixed float array", "vlen int array", "vlen strings"};
- hid_t types[NTYPES] = { H5T_NATIVE_INT, H5T_NATIVE_UINT64, H5T_NATIVE_FLOAT,
- H5T_NATIVE_DOUBLE, tid_str, tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s};
- hsize_t coords[4][2] = { {0, 1}, {3, 5}, {1, 0}, {2, 4}}, start=0, stride=1, count=1;
-
- if (nrows < NROWS) nrows = NROWS;
- if (ngrps<NGROUPS) ngrps=NGROUPS;
- if (ndsets<NDSETS) ndsets=NDSETS;
- if (nattrs<NATTRS) nattrs=NATTRS;
- if (dim0<DIM0) dim0=DIM0;
- if (chunk>dim0) chunk=dim0/4;
- if (chunk<1) chunk = 1;
- if (vlen<1) vlen = MAXVLEN;
+ size_t offset, len;
+ herr_t status;
+ char * names[NTYPES] = {"int",
+ "ulong",
+ "float",
+ "double",
+ "fixed string",
+ "enum",
+ "fixed float array",
+ "vlen int array",
+ "vlen strings"};
+ hid_t types[NTYPES] = {H5T_NATIVE_INT, H5T_NATIVE_UINT64, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE, tid_str,
+ tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s};
+ hsize_t coords[4][2] = {{0, 1}, {3, 5}, {1, 0}, {2, 4}}, start = 0, stride = 1, count = 1;
+
+ if (nrows < NROWS)
+ nrows = NROWS;
+ if (ngrps < NGROUPS)
+ ngrps = NGROUPS;
+ if (ndsets < NDSETS)
+ ndsets = NDSETS;
+ if (nattrs < NATTRS)
+ nattrs = NATTRS;
+ if (dim0 < DIM0)
+ dim0 = DIM0;
+ if (chunk > dim0)
+ chunk = dim0 / 4;
+ if (chunk < 1)
+ chunk = 1;
+ if (vlen < 1)
+ vlen = MAXVLEN;
/* create fixed string datatype */
- types[4] = tid_str = H5Tcopy (H5T_C_S1);
- H5Tset_size (tid_str, FIXED_LEN);
+ types[4] = tid_str = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid_str, FIXED_LEN);
/* create enum datatype */
types[5] = tid_enum = H5Tenum_create(H5T_NATIVE_INT);
- for (i = (int) SOLID; i <= (int) PLASMA; i++) {
- phase_t val = (phase_t) i;
- status = H5Tenum_insert (tid_enum, enum_names[i], &val);
+ for (i = (int)SOLID; i <= (int)PLASMA; i++) {
+ phase_t val = (phase_t)i;
+ status = H5Tenum_insert(tid_enum, enum_names[i], &val);
}
/* create float array datatype */
- types[6] = tid_array_f = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims_array);
+ types[6] = tid_array_f = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dims_array);
/* create variable length integer datatypes */
- types[7] = tid_vlen_i = H5Tvlen_create (H5T_NATIVE_INT);
+ types[7] = tid_vlen_i = H5Tvlen_create(H5T_NATIVE_INT);
/* create variable length string datatype */
- types[8] = tid_vlen_s = H5Tcopy (H5T_C_S1);
- H5Tset_size (tid_vlen_s, H5T_VARIABLE);
+ types[8] = tid_vlen_s = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid_vlen_s, H5T_VARIABLE);
/* create compound datatypes */
- cmp_tid = H5Tcreate (H5T_COMPOUND, sizeof (test_comp_t));
- offset = 0;
- for (i=0; i<NTYPES-2; i++) {
+ cmp_tid = H5Tcreate(H5T_COMPOUND, sizeof(test_comp_t));
+ offset = 0;
+ for (i = 0; i < NTYPES - 2; i++) {
H5Tinsert(cmp_tid, names[i], offset, types[i]);
offset += H5Tget_size(types[i]);
}
H5Tinsert(cmp_tid, names[7], offset, types[7]);
- offset += sizeof (hvl_t);
+ offset += sizeof(hvl_t);
H5Tinsert(cmp_tid, names[8], offset, types[8]);
/* create dataspace */
- sid_1d = H5Screate_simple (1, dims, NULL);
- sid_2d = H5Screate_simple (2, dims2d, NULL);
- sid_2 = H5Screate_simple (1, dim1, NULL);
- sid_large = H5Screate_simple (1, &nrows, NULL);
- sid_null = H5Screate (H5S_NULL);
- sid_scalar = H5Screate (H5S_SCALAR);
+ sid_1d = H5Screate_simple(1, dims, NULL);
+ sid_2d = H5Screate_simple(2, dims2d, NULL);
+ sid_2 = H5Screate_simple(1, dim1, NULL);
+ sid_large = H5Screate_simple(1, &nrows, NULL);
+ sid_null = H5Screate(H5S_NULL);
+ sid_scalar = H5Screate(H5S_SCALAR);
/* create fid access property */
- fapl = H5Pcreate (H5P_FILE_ACCESS);
- H5Pset_libver_bounds (fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
/* create dataset creation property */
- dcpl = H5Pcreate (H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
/* set dataset chunk */
- if (chunk>0) {
- H5Pset_chunk (dcpl, 1, &chunk);
+ if (chunk > 0) {
+ H5Pset_chunk(dcpl, 1, &chunk);
}
/* set dataset compression */
if (compressed) {
- if (chunk<=0) {
- chunk = dim0/10+1;;
- H5Pset_chunk (dcpl, 1, &chunk);
+ if (chunk <= 0) {
+ chunk = dim0 / 10 + 1;
+ ;
+ H5Pset_chunk(dcpl, 1, &chunk);
}
- H5Pset_shuffle (dcpl);
- H5Pset_deflate (dcpl, 6);
+ H5Pset_shuffle(dcpl);
+ H5Pset_deflate(dcpl, 6);
}
/* allocate buffers */
- buf_comp = (test_comp_t *)calloc(dim0, sizeof(test_comp_t));
- buf_comp_large = (test_comp_t *)calloc(nrows, sizeof(test_comp_t));
- buf_int = (int *)calloc(dim0, sizeof(int));
- buf_float_a = malloc(dim0*sizeof(*buf_float_a));
- buf_vlen_i = (hvl_t *)calloc(dim0, sizeof (hvl_t));
- buf_vlen_s = (char **)calloc(dim0, sizeof(char *));
- buf_str = malloc(dim0*sizeof (*buf_str));
+ buf_comp = (test_comp_t *)calloc(dim0, sizeof(test_comp_t));
+ buf_comp_large = (test_comp_t *)calloc(nrows, sizeof(test_comp_t));
+ buf_int = (int *)calloc(dim0, sizeof(int));
+ buf_float_a = malloc(dim0 * sizeof(*buf_float_a));
+ buf_vlen_i = (hvl_t *)calloc(dim0, sizeof(hvl_t));
+ buf_vlen_s = (char **)calloc(dim0, sizeof(char *));
+ buf_str = malloc(dim0 * sizeof(*buf_str));
/* allocate array of doulbe pointers */
- buf_double2d = (double **)calloc(dims2d[0],sizeof(double *));
+ buf_double2d = (double **)calloc(dims2d[0], sizeof(double *));
/* allocate a contigous chunk of memory for the data */
- buf_double2d[0] = (double *)calloc( dims2d[0]*dims2d[1],sizeof(double) );
+ buf_double2d[0] = (double *)calloc(dims2d[0] * dims2d[1], sizeof(double));
/* assign memory city to pointer array */
- for (i=1; i <dims2d[0]; i++) buf_double2d[i] = buf_double2d[0]+i*dims2d[1];
+ for (i = 1; i < dims2d[0]; i++)
+ buf_double2d[i] = buf_double2d[0] + i * dims2d[1];
/* fill buffer values */
len = 1;
- for (i=0; i<dims[0]; i++) {
- buf_comp[i].i = buf_int[i] = i-2147483648;
- buf_comp[i].l = 0xffffffffffffffff-i;
- buf_comp[i].f = 1.0/(i+1.0);
- buf_comp[i].d = 987654321.0*i+1.0/(i+1.0);
- buf_comp[i].e = (phase_t) (i % (int) (PLASMA + 1));
-
- for (j=0; j<FIXED_LEN; j++) {
- buf_comp[i].f_array[j] = buf_float_a[i][j] = i*100+j;
- buf_str[i][j] = 'a' + (i%26);
+ for (i = 0; i < dims[0]; i++) {
+ buf_comp[i].i = buf_int[i] = i - 2147483648;
+ buf_comp[i].l = 0xffffffffffffffff - i;
+ buf_comp[i].f = 1.0 / (i + 1.0);
+ buf_comp[i].d = 987654321.0 * i + 1.0 / (i + 1.0);
+ buf_comp[i].e = (phase_t)(i % (int)(PLASMA + 1));
+
+ for (j = 0; j < FIXED_LEN; j++) {
+ buf_comp[i].f_array[j] = buf_float_a[i][j] = i * 100 + j;
+ buf_str[i][j] = 'a' + (i % 26);
}
- buf_str[i][FIXED_LEN-1] = 0;
+ buf_str[i][FIXED_LEN - 1] = 0;
strcpy(buf_comp[i].s, buf_str[i]);
- len = (1-cos(i/8.0))/2*vlen+1;
- if (!i) len = vlen;
+ len = (1 - cos(i / 8.0)) / 2 * vlen + 1;
+ if (!i)
+ len = vlen;
buf_vlen_i[i].len = len;
- buf_vlen_i[i].p = (int *)calloc(len, sizeof(int));
- for (j=0; j<len; j++) ((int*)(buf_vlen_i[i].p))[j] = i*100+j;
+ buf_vlen_i[i].p = (int *)calloc(len, sizeof(int));
+ for (j = 0; j < len; j++)
+ ((int *)(buf_vlen_i[i].p))[j] = i * 100 + j;
buf_comp[i].i_vlen = buf_vlen_i[i];
buf_vlen_s[i] = (char *)calloc(len, sizeof(char));
- for (j=0; j<len-1; j++)
- buf_vlen_s[i][j] = j%26+'A';
+ for (j = 0; j < len - 1; j++)
+ buf_vlen_s[i][j] = j % 26 + 'A';
buf_comp[i].s_vlen = buf_vlen_s[i];
- for (j=0; j<dims2d[1]; j++)
- buf_double2d[i][j] = i+j/10000.0;
+ for (j = 0; j < dims2d[1]; j++)
+ buf_double2d[i][j] = i + j / 10000.0;
}
- for (i=0; i<nrows; i++) {
- buf_comp_large[i].i = i-2147483648;
- buf_comp_large[i].l = 0xffffffffffffffff-i;
- buf_comp_large[i].f = 1.0/(i+1.0);
- buf_comp_large[i].d = 987654321.0*i+1.0/(i+1.0);
- buf_comp_large[i].e = (phase_t) (i % (int) (PLASMA + 1));
- for (j=0; j<FIXED_LEN-1; j++) {
- buf_comp_large[i].f_array[j] = i*100+j;
- buf_comp_large[i].s[j] = 'a' + (i%26);
+ for (i = 0; i < nrows; i++) {
+ buf_comp_large[i].i = i - 2147483648;
+ buf_comp_large[i].l = 0xffffffffffffffff - i;
+ buf_comp_large[i].f = 1.0 / (i + 1.0);
+ buf_comp_large[i].d = 987654321.0 * i + 1.0 / (i + 1.0);
+ buf_comp_large[i].e = (phase_t)(i % (int)(PLASMA + 1));
+ for (j = 0; j < FIXED_LEN - 1; j++) {
+ buf_comp_large[i].f_array[j] = i * 100 + j;
+ buf_comp_large[i].s[j] = 'a' + (i % 26);
}
- len = i%vlen+1;
+ len = i % vlen + 1;
buf_comp_large[i].i_vlen.len = len;
- buf_comp_large[i].i_vlen.p = (int *)calloc(len, sizeof(int));
- for (j=0; j<len; j++) ((int*)(buf_comp_large[i].i_vlen.p))[j] = i*100+j;
- buf_comp_large[i].s_vlen = (char *)calloc(i+2, sizeof(char));
- for (j=0; j<i+1; j++) (buf_comp_large[i].s_vlen)[j] = j%26+'A';
+ buf_comp_large[i].i_vlen.p = (int *)calloc(len, sizeof(int));
+ for (j = 0; j < len; j++)
+ ((int *)(buf_comp_large[i].i_vlen.p))[j] = i * 100 + j;
+ buf_comp_large[i].s_vlen = (char *)calloc(i + 2, sizeof(char));
+ for (j = 0; j < i + 1; j++)
+ (buf_comp_large[i].s_vlen)[j] = j % 26 + 'A';
}
/* create file */
if (latest)
- fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
else
- fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
add_attrs(fid, 0);
HDsprintf(name, "a cmp ds of %d rows", nrows);
- did = H5Dcreate (fid, name, cmp_tid, sid_large, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp_large);
+ did = H5Dcreate(fid, name, cmp_tid, sid_large, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite(did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp_large);
add_attrs(did, 0);
H5Dclose(did);
// /* add attributes*/
- gid1 = H5Gcreate (fid, "attributes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (nattrs<1) nattrs = 1;
- i=0;
- while (i<nattrs) i += add_attrs(gid1, i);
+ gid1 = H5Gcreate(fid, "attributes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (nattrs < 1)
+ nattrs = 1;
+ i = 0;
+ while (i < nattrs)
+ i += add_attrs(gid1, i);
H5Gclose(gid1);
/* add many sub groups to a group*/
- gid1 = H5Gcreate (fid, "groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid1 = H5Gcreate(fid, "groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
add_attrs(gid1, 0);
- for (i=0; i<ngrps; i++) {
+ for (i = 0; i < ngrps; i++) {
/* create sub groups */
HDsprintf(name, "g%02d", i);
- gid2 = H5Gcreate (gid1, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (i<10) add_attrs(gid2, 0);
+ gid2 = H5Gcreate(gid1, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (i < 10)
+ add_attrs(gid2, 0);
H5Gclose(gid2);
}
H5Gclose(gid1);
/* add many datasets to a group */
- gid1 = H5Gcreate (fid, "datasets", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid1 = H5Gcreate(fid, "datasets", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
add_attrs(gid1, 0);
- for (j=0; j<ndsets; j+=12) {
+ for (j = 0; j < ndsets; j += 12) {
/* 1 add a null dataset */
HDsprintf(name, "%05d null dataset", j);
- did = H5Dcreate (gid1, name, H5T_STD_I32LE, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (!j) add_attrs(did, j);
+ did = H5Dcreate(gid1, name, H5T_STD_I32LE, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 2 add scalar int point */
HDsprintf(name, "%05d scalar int point", j);
- did = H5Dcreate (gid1, name, H5T_NATIVE_INT, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &j);
- if (!j) add_attrs(did, j);
+ did = H5Dcreate(gid1, name, H5T_NATIVE_INT, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &j);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 3 scalar vlen string */
HDsprintf(name, "%05d scalar vlen string", j);
- did = H5Dcreate (gid1, name, tid_vlen_s, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf_vlen_s[0]);
- if (!j) add_attrs(did, j);
+ did = H5Dcreate(gid1, name, tid_vlen_s, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf_vlen_s[0]);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 4 add fixed-length float array */
HDsprintf(name, "%05d fixed-length float array", j);
- did = H5Dcreate (gid1, name, tid_array_f, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- H5Dwrite (did, tid_array_f, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_float_a);
- if (!j) add_attrs(did, j);
+ did = H5Dcreate(gid1, name, tid_array_f, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite(did, tid_array_f, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_float_a);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 5 add fixed-length strings */
HDsprintf(name, "%05d fixed-length strings", j);
- did = H5Dcreate (gid1, name, tid_str, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- H5Dwrite (did, tid_str, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_str);
- if (!j) add_attrs(did, j);
+ did = H5Dcreate(gid1, name, tid_str, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite(did, tid_str, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_str);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 6 add compound data */
HDsprintf(name, "%05d compund data", j);
- did = H5Dcreate (gid1, name, cmp_tid, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp);
- if (!j) add_attrs(did, j);
+ did = H5Dcreate(gid1, name, cmp_tid, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite(did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 7 add 2D double */
HDsprintf(name, "%05d 2D double", j);
- strcpy (tmp_name1, name);
- did = H5Dcreate (gid1, name, H5T_NATIVE_DOUBLE, sid_2d, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Dwrite (did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_double2d[0]);
- if (!j) add_attrs(did, j);
+ strcpy(tmp_name1, name);
+ did = H5Dcreate(gid1, name, H5T_NATIVE_DOUBLE, sid_2d, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_double2d[0]);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 8 add 1D int array */
HDsprintf(name, "%05d 1D int array", j);
- did = H5Dcreate (gid1, name, H5T_NATIVE_INT, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_int);
- if (!j) add_attrs(did, j);
+ did = H5Dcreate(gid1, name, H5T_NATIVE_INT, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_int);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 9 add vlen int array */
HDsprintf(name, "%05d vlen int array", j);
- strcpy (tmp_name2, name);
- did = H5Dcreate (gid1, name, tid_vlen_i, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- H5Dwrite (did, tid_vlen_i, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_i);
- if (!j) add_attrs(did, j);
+ strcpy(tmp_name2, name);
+ did = H5Dcreate(gid1, name, tid_vlen_i, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite(did, tid_vlen_i, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_i);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 10 add vlen strings */
HDsprintf(name, "%05d vlen strings", j);
- strcpy (tmp_name3, name);
- did = H5Dcreate (gid1, name, tid_vlen_s, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_s);
- if (!j) add_attrs(did, j);
+ strcpy(tmp_name3, name);
+ did = H5Dcreate(gid1, name, tid_vlen_s, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite(did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_s);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 11 add object refs */
- H5Rcreate(&buf_ref[0],gid1, ".", H5R_OBJECT, (hid_t)-1);
- H5Rcreate(&buf_ref[1],gid1, tmp_name3, H5R_OBJECT, (hid_t)-1);
+ H5Rcreate(&buf_ref[0], gid1, ".", H5R_OBJECT, (hid_t)-1);
+ H5Rcreate(&buf_ref[1], gid1, tmp_name3, H5R_OBJECT, (hid_t)-1);
HDsprintf(name, "%05d obj refs", j);
- did = H5Dcreate (gid1, name, H5T_STD_REF_OBJ, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Dwrite (did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ref);
- if (!j) add_attrs(did, j);
+ did = H5Dcreate(gid1, name, H5T_STD_REF_OBJ, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ref);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
/* 12 add region refs */
- H5Sselect_elements (sid_2d, H5S_SELECT_SET, 4, coords[0]);
- H5Rcreate(&buf_reg_ref[0],gid1, tmp_name1, H5R_DATASET_REGION, sid_2d);
+ H5Sselect_elements(sid_2d, H5S_SELECT_SET, 4, coords[0]);
+ H5Rcreate(&buf_reg_ref[0], gid1, tmp_name1, H5R_DATASET_REGION, sid_2d);
H5Sselect_none(sid_2d);
- count = dims[0]/2+1;
- H5Sselect_hyperslab (sid_1d, H5S_SELECT_SET, &start, &stride, &count,NULL);
- H5Rcreate(&buf_reg_ref[1],gid1, tmp_name2, H5R_DATASET_REGION, sid_1d);
+ count = dims[0] / 2 + 1;
+ H5Sselect_hyperslab(sid_1d, H5S_SELECT_SET, &start, &stride, &count, NULL);
+ H5Rcreate(&buf_reg_ref[1], gid1, tmp_name2, H5R_DATASET_REGION, sid_1d);
H5Sselect_none(sid_1d);
HDsprintf(name, "%05d region refs", j);
- did = H5Dcreate (gid1, name, H5T_STD_REF_DSETREG, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Dwrite (did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_reg_ref);
- if (!j) add_attrs(did, j);
+ did = H5Dcreate(gid1, name, H5T_STD_REF_DSETREG, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_reg_ref);
+ if (!j)
+ add_attrs(did, j);
H5Dclose(did);
}
H5Gclose(gid1);
- H5Tclose (tid_array_f);
- H5Tclose (tid_vlen_i);
- H5Tclose (tid_vlen_s);
- H5Tclose (tid_enum);
- H5Tclose (tid_str);
- H5Tclose (cmp_tid);
- H5Pclose (dcpl);
- H5Pclose (fapl);
- H5Sclose (sid_1d);
- H5Sclose (sid_2d);
- H5Sclose (sid_2);
- H5Sclose (sid_large);
- H5Sclose (sid_null);
- H5Sclose (sid_scalar);
- H5Fclose (fid);
-
- for (i=0; i<dims[0]; i++) {
- if (buf_vlen_i[i].p) free(buf_vlen_i[i].p);
- if (buf_vlen_s[i]) free(buf_vlen_s[i]);
+ H5Tclose(tid_array_f);
+ H5Tclose(tid_vlen_i);
+ H5Tclose(tid_vlen_s);
+ H5Tclose(tid_enum);
+ H5Tclose(tid_str);
+ H5Tclose(cmp_tid);
+ H5Pclose(dcpl);
+ H5Pclose(fapl);
+ H5Sclose(sid_1d);
+ H5Sclose(sid_2d);
+ H5Sclose(sid_2);
+ H5Sclose(sid_large);
+ H5Sclose(sid_null);
+ H5Sclose(sid_scalar);
+ H5Fclose(fid);
+
+ for (i = 0; i < dims[0]; i++) {
+ if (buf_vlen_i[i].p)
+ free(buf_vlen_i[i].p);
+ if (buf_vlen_s[i])
+ free(buf_vlen_s[i]);
}
- for (i=0; i<nrows; i++) {
- if (buf_comp_large[i].i_vlen.p) free(buf_comp_large[i].i_vlen.p);
- if (buf_comp_large[i].s_vlen) free(buf_comp_large[i].s_vlen);
+ for (i = 0; i < nrows; i++) {
+ if (buf_comp_large[i].i_vlen.p)
+ free(buf_comp_large[i].i_vlen.p);
+ if (buf_comp_large[i].s_vlen)
+ free(buf_comp_large[i].s_vlen);
}
- free (buf_comp);
- free (buf_comp_large);
- free (buf_int);
- free (buf_float_a);
- free (buf_double2d[0]);
- free (buf_double2d);
- free (buf_str);
+ free(buf_comp);
+ free(buf_comp_large);
+ free(buf_int);
+ free(buf_float_a);
+ free(buf_double2d[0]);
+ free(buf_double2d);
+ free(buf_str);
free(buf_vlen_i);
free(buf_vlen_s);
@@ -470,13 +509,14 @@ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets,
}
/* add a single attribute */
-int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf)
+int
+add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf)
{
hid_t aid;
- aid = H5Acreate (oid, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT);
- if (aid <0)
- return 0;
+ aid = H5Acreate(oid, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ if (aid < 0)
+ return 0;
H5Awrite(aid, tid, buf);
@@ -490,60 +530,61 @@ int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf)
returns the number of attributes added to the objects.
*/
-int add_attrs(hid_t oid, int idx)
+int
+add_attrs(hid_t oid, int idx)
{
- char name[32];
- int i0, i1, i2, j, nattrs=0;
- hid_t aid, tid, tid1, sid;
- hvl_t i_vlen[4];
- hobj_ref_t ref;
- zipcode_t cmp_data[4];
- unsigned int i = 0xffffffff;
- long long l = -2147483647;
- float f = 123456789.987654321;
- double d = 987654321.123456789;
- char *s[7] = {"Parting", "is such", "sweeter", "sorrow."};
- float f_array[4] = {1.0, 2.22, 3.333, 4.444};
- char *s_vlen[4] = {"Parting", "is such", "sweet", "sorrow."};
- hsize_t dims1[1]={1}, dims2[1]={4}, dims3[2]={3,5};
- int int3d[4][3][5];
- size_t offset = 0;
-
- for (i0=0; i0<4; i0++) {
- i_vlen[i0].len = (i0+1);
- i_vlen[i0].p = (int *)calloc(i_vlen[i0].len, sizeof(int));
- for (j=0; j<i_vlen[i0].len; j++)
- ((int *)i_vlen[i0].p)[j] = i0*100+j;
- for (i1=0; i1<3; i1++) {
- for (i2=0; i2<5; i2++)
- int3d[i0][i1][i2] = i0*i1-i1*i2+i0*i2;
+ char name[32];
+ int i0, i1, i2, j, nattrs = 0;
+ hid_t aid, tid, tid1, sid;
+ hvl_t i_vlen[4];
+ hobj_ref_t ref;
+ zipcode_t cmp_data[4];
+ unsigned int i = 0xffffffff;
+ long long l = -2147483647;
+ float f = 123456789.987654321;
+ double d = 987654321.123456789;
+ char * s[7] = {"Parting", "is such", "sweeter", "sorrow."};
+ float f_array[4] = {1.0, 2.22, 3.333, 4.444};
+ char * s_vlen[4] = {"Parting", "is such", "sweet", "sorrow."};
+ hsize_t dims1[1] = {1}, dims2[1] = {4}, dims3[2] = {3, 5};
+ int int3d[4][3][5];
+ size_t offset = 0;
+
+ for (i0 = 0; i0 < 4; i0++) {
+ i_vlen[i0].len = (i0 + 1);
+ i_vlen[i0].p = (int *)calloc(i_vlen[i0].len, sizeof(int));
+ for (j = 0; j < i_vlen[i0].len; j++)
+ ((int *)i_vlen[i0].p)[j] = i0 * 100 + j;
+ for (i1 = 0; i1 < 3; i1++) {
+ for (i2 = 0; i2 < 5; i2++)
+ int3d[i0][i1][i2] = i0 * i1 - i1 * i2 + i0 * i2;
}
}
cmp_data[0].zipcode = 01001;
- cmp_data[0].city = "Agawam, Massachusetts";
+ cmp_data[0].city = "Agawam, Massachusetts";
cmp_data[1].zipcode = 99950;
- cmp_data[1].city = "Ketchikan, Alaska";
+ cmp_data[1].city = "Ketchikan, Alaska";
cmp_data[2].zipcode = 00501;
- cmp_data[2].city = "Holtsville, New York";
+ cmp_data[2].city = "Holtsville, New York";
cmp_data[3].zipcode = 61820;
- cmp_data[3].city = "Champaign, Illinois";
+ cmp_data[3].city = "Champaign, Illinois";
/* 1 scalar point */
- sid = H5Screate (H5S_SCALAR);
+ sid = H5Screate(H5S_SCALAR);
HDsprintf(name, "%05d scalar int", idx);
nattrs += add_attr(oid, name, H5T_NATIVE_UINT, sid, &i);
HDsprintf(name, "%05d scalar ulong", idx);
nattrs += add_attr(oid, name, H5T_NATIVE_INT64, sid, &l);
HDsprintf(name, "%05d scalar str", idx);
- tid = H5Tcopy (H5T_C_S1);
- H5Tset_size (tid, H5T_VARIABLE);
+ tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid, H5T_VARIABLE);
nattrs += add_attr(oid, name, tid, sid, &s[2]);
H5Tclose(tid);
H5Sclose(sid);
/* 4 single point */
- sid = H5Screate_simple (1, dims1, NULL);
+ sid = H5Screate_simple(1, dims1, NULL);
H5Rcreate(&ref, oid, ".", H5R_OBJECT, (hid_t)-1);
HDsprintf(name, "%05d single float", idx);
nattrs += add_attr(oid, name, H5T_NATIVE_FLOAT, sid, &f);
@@ -554,14 +595,14 @@ int add_attrs(hid_t oid, int idx)
H5Sclose(sid);
/* 7 fixed length 1D array */
- sid = H5Screate_simple (1, dims1, NULL);
- tid = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims2);
+ sid = H5Screate_simple(1, dims1, NULL);
+ tid = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dims2);
HDsprintf(name, "%05d array float", idx);
nattrs += add_attr(oid, name, tid, sid, &f_array[0]);
H5Tclose(tid);
- tid = H5Tcopy (H5T_C_S1);
- H5Tset_size (tid, strlen(s[0])+1);
- tid1 = H5Tarray_create (tid, 1, dims2);
+ tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid, strlen(s[0]) + 1);
+ tid1 = H5Tarray_create(tid, 1, dims2);
HDsprintf(name, "%05d array str", idx);
nattrs += add_attr(oid, name, tid1, sid, s);
H5Tclose(tid1);
@@ -569,40 +610,43 @@ int add_attrs(hid_t oid, int idx)
H5Sclose(sid);
/* 9 fixed length 2D int arrays */
- sid = H5Screate_simple (1, dims2, NULL);
- tid = H5Tarray_create (H5T_NATIVE_INT, 2, dims3);
+ sid = H5Screate_simple(1, dims2, NULL);
+ tid = H5Tarray_create(H5T_NATIVE_INT, 2, dims3);
HDsprintf(name, "%05d array int 2D", idx);
nattrs += add_attr(oid, name, tid, sid, int3d[0][0]);
H5Tclose(tid);
H5Sclose(sid);
/* 10 variable length arrays */
- sid = H5Screate_simple (1, dims2, NULL);
- tid = H5Tcopy (H5T_C_S1);
- H5Tset_size (tid, H5T_VARIABLE);
+ sid = H5Screate_simple(1, dims2, NULL);
+ tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid, H5T_VARIABLE);
HDsprintf(name, "%05d vlen strings", idx);
nattrs += add_attr(oid, name, tid, sid, s_vlen);
H5Tclose(tid);
- tid = H5Tvlen_create (H5T_NATIVE_INT);;
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ ;
HDsprintf(name, "%05d vlen int array", idx);
nattrs += add_attr(oid, name, tid, sid, i_vlen);
H5Tclose(tid);
H5Sclose(sid);
/* 12 compound data */
- sid = H5Screate_simple (1, dims2, NULL);
- tid = H5Tcreate (H5T_COMPOUND, sizeof (zipcode_t));
- tid1 = H5Tcopy (H5T_C_S1);
- H5Tset_size (tid1, H5T_VARIABLE);
- H5Tinsert (tid, "zip code", 0, H5T_NATIVE_INT); offset += sizeof(H5T_NATIVE_INT);
- H5Tinsert (tid, "City", offset, tid1); offset += sizeof(char *);
+ sid = H5Screate_simple(1, dims2, NULL);
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(zipcode_t));
+ tid1 = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid1, H5T_VARIABLE);
+ H5Tinsert(tid, "zip code", 0, H5T_NATIVE_INT);
+ offset += sizeof(H5T_NATIVE_INT);
+ H5Tinsert(tid, "City", offset, tid1);
+ offset += sizeof(char *);
HDsprintf(name, "%05d compound data", idx);
nattrs += add_attr(oid, name, tid, sid, cmp_data);
H5Tclose(tid1);
H5Tclose(tid);
H5Sclose(sid);
- for (i0=0; i0<4; i0++)
+ for (i0 = 0; i0 < 4; i0++)
free(i_vlen[i0].p);
return nattrs;
diff --git a/tools/test/misc/h5repart_gentest.c b/tools/test/misc/h5repart_gentest.c
index 520069f..b068985 100644
--- a/tools/test/misc/h5repart_gentest.c
+++ b/tools/test/misc/h5repart_gentest.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,26 +21,27 @@
#include "hdf5.h"
#include "H5private.h"
-#define FAMILY_NUMBER 4
-#define FAMILY_SIZE 1024
-#define FILENAME "family_file%05d.h5"
+#define FAMILY_NUMBER 4
+#define FAMILY_SIZE 1024
+#define FILENAME "family_file%05d.h5"
-int **buf = NULL;
-int *buf_data = NULL;
+int **buf = NULL;
+int * buf_data = NULL;
-int main(void)
+int
+main(void)
{
- hid_t file=(-1), fapl, space=(-1), dset=(-1);
- char dname[]="dataset";
- int i, j;
- hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
+ hid_t file = (-1), fapl, space = (-1), dset = (-1);
+ char dname[] = "dataset";
+ int i, j;
+ hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
/* Set up data array */
- if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) {
+ if (NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) {
HDperror("HDcalloc");
HDexit(EXIT_FAILURE);
}
- if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) {
+ if (NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) {
HDperror("HDcalloc");
HDexit(EXIT_FAILURE);
}
@@ -53,55 +54,52 @@ int main(void)
HDexit(EXIT_FAILURE);
}
- if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) {
+ if (H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) {
HDperror("H5Pset_fapl_family");
HDexit(EXIT_FAILURE);
}
- if((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
+ if ((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
HDperror("H5Fcreate");
HDexit(EXIT_FAILURE);
}
/* Create and write dataset */
- if((space = H5Screate_simple(2, dims, NULL)) < 0) {
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0) {
HDperror("H5Screate_simple");
HDexit(EXIT_FAILURE);
}
-
- if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ if ((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
HDperror("H5Dcreate2");
HDexit(EXIT_FAILURE);
}
-
- for(i = 0; i < FAMILY_NUMBER; i++)
- for(j = 0; j < FAMILY_SIZE; j++)
+ for (i = 0; i < FAMILY_NUMBER; i++)
+ for (j = 0; j < FAMILY_SIZE; j++)
buf[i][j] = i * 10000 + j;
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) {
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) {
HDperror("H5Dwrite");
HDexit(EXIT_FAILURE);
}
-
- if(H5Sclose(space) < 0) {
+ if (H5Sclose(space) < 0) {
HDperror("H5Sclose");
HDexit(EXIT_FAILURE);
}
- if(H5Dclose(dset) < 0) {
+ if (H5Dclose(dset) < 0) {
HDperror("H5Dclose");
HDexit(EXIT_FAILURE);
}
- if(H5Pclose(fapl) < 0) {
+ if (H5Pclose(fapl) < 0) {
HDperror("H5Pclose");
HDexit(EXIT_FAILURE);
}
- if(H5Fclose(file) < 0) {
+ if (H5Fclose(file) < 0) {
HDperror("H5Fclose");
HDexit(EXIT_FAILURE);
}
diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c
index 7227de0..7aa5ad9 100644
--- a/tools/test/misc/repart_test.c
+++ b/tools/test/misc/repart_test.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -19,22 +19,16 @@
#include "hdf5.h"
#include "H5private.h"
-#define KB 1024
-#define FAMILY_H5REPART_SIZE1 20000
-#define FAMILY_H5REPART_SIZE2 (5*KB)
+#define KB 1024
+#define FAMILY_H5REPART_SIZE1 20000
+#define FAMILY_H5REPART_SIZE2 (5 * KB)
-const char *FILENAME[] = {
- "fst_family%05d.h5",
- "scd_family%05d.h5",
- "family_to_single.h5",
- "family_to_sec2.h5",
- NULL
-};
+const char *FILENAME[] = {"fst_family%05d.h5", "scd_family%05d.h5", "family_to_single.h5",
+ "family_to_sec2.h5", NULL};
herr_t test_family_h5repart_opens(void);
herr_t test_single_h5repart_opens(void);
-
/*-------------------------------------------------------------------------
* Function: test_family_h5repart_opens
*
@@ -47,8 +41,8 @@ herr_t test_single_h5repart_opens(void);
herr_t
test_family_h5repart_opens(void)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
/* open 1st file(single member file) with correct family size(20000 byte) */
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
@@ -57,7 +51,7 @@ test_family_h5repart_opens(void)
if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_H5REPART_SIZE1, H5P_DEFAULT) < 0)
goto error;
- if ((fid = H5Fopen(FILENAME[0], H5F_ACC_RDWR, fapl_id))<0)
+ if ((fid = H5Fopen(FILENAME[0], H5F_ACC_RDWR, fapl_id)) < 0)
goto error;
if (H5Fclose(fid) < 0)
@@ -79,17 +73,17 @@ test_family_h5repart_opens(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl_id);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_family_h5repart_opens() */
-
-
/*-------------------------------------------------------------------------
* Function: test_single_h5repart_opens
*
@@ -102,7 +96,7 @@ error:
herr_t
test_single_h5repart_opens(void)
{
- hid_t fid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
/* open the single file */
if ((fid = H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
@@ -119,15 +113,16 @@ test_single_h5repart_opens(void)
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end test_single_h5repart_opens() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -140,10 +135,10 @@ error:
int
main(void)
{
- int nerrors = 0;
+ int nerrors = 0;
- nerrors += test_family_h5repart_opens() < 0 ? 1 : 0;
- nerrors += test_single_h5repart_opens() < 0 ? 1 : 0;
+ nerrors += test_family_h5repart_opens() < 0 ? 1 : 0;
+ nerrors += test_single_h5repart_opens() < 0 ? 1 : 0;
if (nerrors)
goto error;
@@ -152,8 +147,6 @@ main(void)
error:
nerrors = MAX(1, nerrors);
- HDprintf("***** %d FAMILY FILE TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d FAMILY FILE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
} /* end main() */
-
diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c
index c69d1f7..f214527 100644
--- a/tools/test/misc/talign.c
+++ b/tools/test/misc/talign.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -20,7 +20,7 @@
#include "H5private.h"
#include "h5tools.h"
-const char *fname = "talign.h5";
+const char *fname = "talign.h5";
const char *setname = "align";
/*
@@ -30,26 +30,27 @@ const char *setname = "align";
* another per construction)
*/
-int main(void)
+int
+main(void)
{
- hid_t fil=H5I_INVALID_HID, spc=H5I_INVALID_HID, set=H5I_INVALID_HID;
- hid_t cs6=H5I_INVALID_HID, cmp=H5I_INVALID_HID, fix=H5I_INVALID_HID;
- hid_t cmp1=H5I_INVALID_HID, cmp2=H5I_INVALID_HID, cmp3=H5I_INVALID_HID;
- hid_t plist=H5I_INVALID_HID;
- hid_t array_dt=H5I_INVALID_HID;
+ hid_t fil = H5I_INVALID_HID, spc = H5I_INVALID_HID, set = H5I_INVALID_HID;
+ hid_t cs6 = H5I_INVALID_HID, cmp = H5I_INVALID_HID, fix = H5I_INVALID_HID;
+ hid_t cmp1 = H5I_INVALID_HID, cmp2 = H5I_INVALID_HID, cmp3 = H5I_INVALID_HID;
+ hid_t plist = H5I_INVALID_HID;
+ hid_t array_dt = H5I_INVALID_HID;
hsize_t dim[2];
hsize_t cdim[4];
- char string5[5];
- float fok[2] = {1234.0f, 2341.0f};
- float fnok[2] = {5678.0f, 6785.0f};
- float *fptr = NULL;
+ char string5[5];
+ float fok[2] = {1234.0f, 2341.0f};
+ float fnok[2] = {5678.0f, 6785.0f};
+ float *fptr = NULL;
char *data = NULL;
- int result = 0;
- herr_t error = 1;
+ int result = 0;
+ herr_t error = 1;
HDprintf("%-70s", "Testing alignment in compound datatypes");
@@ -62,9 +63,11 @@ int main(void)
return 1;
}
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
(void)H5Ldelete(fil, setname, H5P_DEFAULT);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
cs6 = H5Tcopy(H5T_C_S1);
H5Tset_size(cs6, sizeof(string5));
@@ -73,20 +76,20 @@ int main(void)
cmp = H5Tcreate(H5T_COMPOUND, sizeof(fok) + sizeof(string5) + sizeof(fnok));
H5Tinsert(cmp, "Awkward length", 0, cs6);
- cdim[0] = sizeof(fok) / sizeof(float);
+ cdim[0] = sizeof(fok) / sizeof(float);
array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim);
H5Tinsert(cmp, "Ok", sizeof(string5), array_dt);
H5Tclose(array_dt);
- cdim[0] = sizeof(fnok) / sizeof(float);
+ cdim[0] = sizeof(fnok) / sizeof(float);
array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim);
H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt);
H5Tclose(array_dt);
- fix = H5Tget_native_type(cmp, H5T_DIR_DEFAULT);
+ fix = H5Tget_native_type(cmp, H5T_DIR_DEFAULT);
cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok));
- cdim[0] = sizeof(fok) / sizeof(float);
+ cdim[0] = sizeof(fok) / sizeof(float);
array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim);
H5Tinsert(cmp1, "Ok", 0, array_dt);
H5Tclose(array_dt);
@@ -96,13 +99,13 @@ int main(void)
cmp3 = H5Tcreate(H5T_COMPOUND, sizeof(fnok));
- cdim[0] = sizeof(fnok) / sizeof(float);
+ cdim[0] = sizeof(fnok) / sizeof(float);
array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim);
H5Tinsert(cmp3, "Not Ok", 0, array_dt);
H5Tclose(array_dt);
plist = H5Pcreate(H5P_DATASET_XFER);
- if((error = H5Pset_preserve(plist, 1)) < 0)
+ if ((error = H5Pset_preserve(plist, 1)) < 0)
goto out;
/*
@@ -110,8 +113,8 @@ int main(void)
* in turn so that we are avoid alignment issues at this point
*/
dim[0] = 1;
- spc = H5Screate_simple(1, dim, NULL);
- set = H5Dcreate2(fil, setname, cmp, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ spc = H5Screate_simple(1, dim, NULL);
+ set = H5Dcreate2(fil, setname, cmp, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(set, cmp1, spc, H5S_ALL, plist, fok);
H5Dwrite(set, cmp2, spc, H5S_ALL, plist, string5);
@@ -122,7 +125,7 @@ int main(void)
/* Now open the set, and read it back in */
data = (char *)HDmalloc(H5Tget_size(fix));
- if(!data) {
+ if (!data) {
HDperror("malloc() failed");
HDabort();
}
@@ -134,61 +137,56 @@ int main(void)
H5Dclose(set);
out:
- if(error < 0) {
+ if (error < 0) {
result = 1;
HDputs("*FAILED - HDF5 library error*");
- } else if(!(H5_FLT_ABS_EQUAL(fok[0], fptr[0]))
- || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1]))
- || !(H5_FLT_ABS_EQUAL(fnok[0], fptr[2]))
- || !(H5_FLT_ABS_EQUAL(fnok[1], fptr[3]))) {
+ }
+ else if (!(H5_FLT_ABS_EQUAL(fok[0], fptr[0])) || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1])) ||
+ !(H5_FLT_ABS_EQUAL(fnok[0], fptr[2])) || !(H5_FLT_ABS_EQUAL(fnok[1], fptr[3]))) {
char *mname;
result = 1;
- mname = H5Tget_member_name(fix, 0);
- HDprintf("%14s (%2d) %6s = %s\n",
- mname ? mname : "(null)", (int)H5Tget_member_offset(fix,0),
- string5, (char *)(data + H5Tget_member_offset(fix, 0)));
- if(mname)
+ mname = H5Tget_member_name(fix, 0);
+ HDprintf("%14s (%2d) %6s = %s\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix, 0),
+ string5, (char *)(data + H5Tget_member_offset(fix, 0)));
+ if (mname)
H5free_memory(mname);
- fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1)));
+ fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1)));
mname = H5Tget_member_name(fix, 1);
HDprintf("Data comparison:\n"
- "%14s (%2d) %6f = %f\n"
- " %6f = %f\n",
- mname ? mname : "(null)", (int)H5Tget_member_offset(fix,1),
- (double)fok[0], (double)fptr[0],
- (double)fok[1], (double)fptr[1]);
- if(mname)
+ "%14s (%2d) %6f = %f\n"
+ " %6f = %f\n",
+ mname ? mname : "(null)", (int)H5Tget_member_offset(fix, 1), (double)fok[0], (double)fptr[0],
+ (double)fok[1], (double)fptr[1]);
+ if (mname)
H5free_memory(mname);
- fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2)));
+ fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2)));
mname = H5Tget_member_name(fix, 2);
HDprintf("%14s (%2d) %6f = %f\n"
- " %6f = %6f\n",
- mname ? mname : "(null)", (int)H5Tget_member_offset(fix,2),
- (double)fnok[0], (double)fptr[0],
- (double)fnok[1], (double)fptr[1]);
- if(mname)
+ " %6f = %6f\n",
+ mname ? mname : "(null)", (int)H5Tget_member_offset(fix, 2), (double)fnok[0],
+ (double)fptr[0], (double)fnok[1], (double)fptr[1]);
+ if (mname)
H5free_memory(mname);
fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1)));
HDprintf("\n"
- "Short circuit\n"
- " %6f = %f\n"
- " %6f = %f\n"
- " %6f = %f\n"
- " %6f = %f\n",
- (double)fok[0], (double)fptr[0],
- (double)fok[1], (double)fptr[1],
- (double)fnok[0], (double)fptr[2],
- (double)fnok[1], (double)fptr[3]);
+ "Short circuit\n"
+ " %6f = %f\n"
+ " %6f = %f\n"
+ " %6f = %f\n"
+ " %6f = %f\n",
+ (double)fok[0], (double)fptr[0], (double)fok[1], (double)fptr[1], (double)fnok[0],
+ (double)fptr[2], (double)fnok[1], (double)fptr[3]);
HDputs("*FAILED - compound type alignmnent problem*");
- } else {
+ }
+ else {
HDputs(" PASSED");
}
- if(data)
+ if (data)
HDfree(data);
H5Sclose(spc);
H5Tclose(cs6);
@@ -203,4 +201,3 @@ out:
HDfflush(stdout);
return result;
}
-
diff --git a/tools/test/misc/testh5clear.sh.in b/tools/test/misc/testh5clear.sh.in
index 3f2b32f..a01fa4a 100644
--- a/tools/test/misc/testh5clear.sh.in
+++ b/tools/test/misc/testh5clear.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -315,7 +315,7 @@ TOOLTEST_ERR orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.err
#
# The following are tests to verify the expected exit code from h5clear:
# "h5clear -m h5clear_mdc_image.h5" (valid option, existing file, succeed exit code)
-# "h5clear --vers" (valid option, version #, succeed exit code)
+# "h5clear --version" (valid option, version #, succeed exit code)
# "h5clear -k" (invalid 1 option, no file, fail exit code)
# "h5clear -k junk.h5" (invalid 1 option, nonexisting file, fail exit code)
# "h5clear -l h5clear_sec2_v2.h5" (invalid 1 option, existing file, fail exit code)
@@ -326,7 +326,7 @@ TOOLTEST_ERR orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.err
# "h5clear -m -l h5clear_sec2_v0.h5" (valid/invalid 2 options, existing file, fail exit code)
# "h5clear -l -m h5clear_sec2_v0.h5" (invalid/valid 2 options, existing file, fail exit code)
TOOLTEST h5clear_mdc_image.h5 -m "" $SUCCEED
-TOOLTEST "" --vers "" $SUCCEED
+TOOLTEST "" --version "" $SUCCEED
TOOLTEST "" -k "" $FAIL
TOOLTEST junk.h5 -k "" $FAIL
TOOLTEST h5clear_sec2_v2.h5 -l "" $FAIL
diff --git a/tools/test/misc/testh5mkgrp.sh.in b/tools/test/misc/testh5mkgrp.sh.in
index 7dc8155..5cd852a 100644
--- a/tools/test/misc/testh5mkgrp.sh.in
+++ b/tools/test/misc/testh5mkgrp.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/misc/testh5repart.sh.in b/tools/test/misc/testh5repart.sh.in
index 143f607..be07f0d 100644
--- a/tools/test/misc/testh5repart.sh.in
+++ b/tools/test/misc/testh5repart.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt
index 71261c4..e8eb960 100644
--- a/tools/test/misc/vds/CMakeLists.txt
+++ b/tools/test/misc/vds/CMakeLists.txt
@@ -1,9 +1,9 @@
cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_MISC_VDS C)
-MACRO (ADD_H5_GENERATOR genfile)
+macro (ADD_H5_GENERATOR genfile)
add_executable (${genfile} ${HDF5_TOOLS_TEST_MISC_VDS_SOURCE_DIR}/${genfile}.c)
- target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (${genfile} STATIC)
target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -12,7 +12,14 @@ MACRO (ADD_H5_GENERATOR genfile)
target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
endif ()
set_target_properties (${genfile} PROPERTIES FOLDER generator/tools)
-ENDMACRO ()
+
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_MISC_VDS_${genfile}_FORMAT ${genfile})
+ endif ()
+endmacro ()
# generator executables
set (H5_GENERATORS
diff --git a/tools/test/misc/vds/Makefile.am b/tools/test/misc/vds/Makefile.am
index 73c335f..90923fa 100644
--- a/tools/test/misc/vds/Makefile.am
+++ b/tools/test/misc/vds/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
diff --git a/tools/test/misc/vds/Makefile.in b/tools/test/misc/vds/Makefile.in
index 657f615..0cc66fa 100644
--- a/tools/test/misc/vds/Makefile.in
+++ b/tools/test/misc/vds/Makefile.in
@@ -22,7 +22,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -114,6 +114,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -436,12 +437,12 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
# Include src directory
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/tools/lib -I$(top_srcdir)/tools/test/misc/vds
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -479,11 +480,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -515,8 +561,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -530,7 +574,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -540,6 +586,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -733,7 +780,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -1293,8 +1340,9 @@ uninstall-am:
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/misc/vds/UC_1.h b/tools/test/misc/vds/UC_1.h
index d922d22..f38ed54 100644
--- a/tools/test/misc/vds/UC_1.h
+++ b/tools/test/misc/vds/UC_1.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -63,57 +63,40 @@
*/
-
-#define UC_1_N_SOURCES 6
+#define UC_1_N_SOURCES 6
/* Dataset dimensions */
-#define UC_1_SM_HEIGHT 2 /* K */
-#define UC_1_LG_HEIGHT 4 /* N */
-#define UC_1_SM_LG_HEIGHT 6 /* SM_HEIGHT + LG_HEIGHT */
-#define UC_1_FULL_HEIGHT 18 /* (3 * K) + (3 * N) */
-#define UC_1_HALF_HEIGHT 9
-#define UC_1_WIDTH 8 /* M */
-#define UC_1_HALF_WIDTH 4
+#define UC_1_SM_HEIGHT 2 /* K */
+#define UC_1_LG_HEIGHT 4 /* N */
+#define UC_1_SM_LG_HEIGHT 6 /* SM_HEIGHT + LG_HEIGHT */
+#define UC_1_FULL_HEIGHT 18 /* (3 * K) + (3 * N) */
+#define UC_1_HALF_HEIGHT 9
+#define UC_1_WIDTH 8 /* M */
+#define UC_1_HALF_WIDTH 4
-#define UC_1_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */
-#define UC_1_N_TEST_PLANES 5 /* number of planes we write */
+#define UC_1_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */
+#define UC_1_N_TEST_PLANES 5 /* number of planes we write */
/* Dataset datatypes */
-#define UC_1_SOURCE_DATATYPE H5T_STD_I32LE
-#define UC_1_VDS_DATATYPE H5T_STD_I32LE
+#define UC_1_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_1_VDS_DATATYPE H5T_STD_I32LE
/* Starting size of datasets, both source and VDS */
static hsize_t UC_1_DIMS[UC_1_N_SOURCES][RANK] = {
- {0, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {0, UC_1_LG_HEIGHT, UC_1_WIDTH},
- {0, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {0, UC_1_LG_HEIGHT, UC_1_WIDTH},
- {0, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {0, UC_1_LG_HEIGHT, UC_1_WIDTH}
-};
+ {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, {0, UC_1_LG_HEIGHT, UC_1_WIDTH}, {0, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_LG_HEIGHT, UC_1_WIDTH}, {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, {0, UC_1_LG_HEIGHT, UC_1_WIDTH}};
/* Maximum size of datasets, both source and VDS */
static hsize_t UC_1_MAX_DIMS[UC_1_N_SOURCES][RANK] = {
- {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH},
- {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH},
- {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}
-};
+ {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}};
/* File names for source datasets */
-static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = {
- {"1_a.h5"},
- {"1_b.h5"},
- {"1_c.h5"},
- {"1_d.h5"},
- {"1_e.h5"},
- {"1_f.h5"}
-};
+static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = {{"1_a.h5"}, {"1_b.h5"}, {"1_c.h5"},
+ {"1_d.h5"}, {"1_e.h5"}, {"1_f.h5"}};
/* Dataset names */
static char UC_1_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
#endif /* UC_1_H */
-
diff --git a/tools/test/misc/vds/UC_1_one_dim_gen.c b/tools/test/misc/vds/UC_1_one_dim_gen.c
index 7c4201e..a816fb8 100644
--- a/tools/test/misc/vds/UC_1_one_dim_gen.c
+++ b/tools/test/misc/vds/UC_1_one_dim_gen.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -25,18 +25,13 @@
#include "UC_common.h"
#include "UC_1.h"
-static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH};
+static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH};
static hsize_t UC_1_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_1_FULL_HEIGHT, UC_1_WIDTH};
/* Planes */
static hsize_t UC_1_PLANES[UC_1_N_SOURCES][RANK] = {
- {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {1, UC_1_LG_HEIGHT, UC_1_WIDTH},
- {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {1, UC_1_LG_HEIGHT, UC_1_WIDTH},
- {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
- {1, UC_1_LG_HEIGHT, UC_1_WIDTH}
-};
+ {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, {1, UC_1_LG_HEIGHT, UC_1_WIDTH}};
/* VDS file name */
static char UC_1_VDS_FILE_NAME[NAME_LEN] = "1_vds.h5";
@@ -46,43 +41,35 @@ static char UC_1_SOURCE_DSET_NAME[NAME_LEN] = "source_dset";
static char UC_1_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
/* Fill values */
-static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = {
- -1,
- -2,
- -3,
- -4,
- -5,
- -6
-};
-static int UC_1_VDS_FILL_VALUE = -9;
+static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = {-1, -2, -3, -4, -5, -6};
+static int UC_1_VDS_FILL_VALUE = -9;
int
main(void)
{
- hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
- hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
- hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
- hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
- hid_t did = H5I_INVALID_HID; /* dataset ID */
- hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
- hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
+ hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
- hsize_t extent[RANK]; /* dataset extents */
- hsize_t start[RANK]; /* starting point for hyperslab */
- hsize_t map_start = 0; /* starting point in the VDS map */
+ hsize_t extent[RANK]; /* dataset extents */
+ hsize_t start[RANK]; /* starting point for hyperslab */
+ hsize_t map_start = 0; /* starting point in the VDS map */
- int *buffer = NULL; /* data buffer */
- hsize_t count = 0; /* number of elements in a plane */
- int n_planes = -1; /* number of planes to write */
- int value = -1; /* value written to datasets */
-
- int i; /* iterator */
- int j; /* iterator */
- hsize_t k; /* iterator */
+ int * buffer = NULL; /* data buffer */
+ hsize_t count = 0; /* number of elements in a plane */
+ int n_planes = -1; /* number of planes to write */
+ int value = -1; /* value written to datasets */
+ int i; /* iterator */
+ int j; /* iterator */
+ hsize_t k; /* iterator */
/* Start by creating the virtual dataset (VDS) dataspace and creation
* property list. The individual source datasets are then created
@@ -90,86 +77,80 @@ main(void)
*/
/* Create VDS dcpl */
- if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
UC_ERROR
- if(H5Pset_fill_value(vds_dcplid, UC_1_VDS_DATATYPE,
- &UC_1_VDS_FILL_VALUE) < 0)
+ if (H5Pset_fill_value(vds_dcplid, UC_1_VDS_DATATYPE, &UC_1_VDS_FILL_VALUE) < 0)
UC_ERROR
/* Create VDS dataspace */
- if((vds_sid = H5Screate_simple(RANK, UC_1_VDS_DIMS,
- UC_1_VDS_MAX_DIMS)) < 0)
+ if ((vds_sid = H5Screate_simple(RANK, UC_1_VDS_DIMS, UC_1_VDS_MAX_DIMS)) < 0)
UC_ERROR
/************************************
* Create source files and datasets *
************************************/
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
map_start = 0;
- for(i = 0; i < UC_1_N_SOURCES; i++) {
+ for (i = 0; i < UC_1_N_SOURCES; i++) {
/* Create source dataset dcpl */
- if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
UC_ERROR
- if(H5Pset_chunk(src_dcplid, RANK, UC_1_PLANES[i]) < 0)
+ if (H5Pset_chunk(src_dcplid, RANK, UC_1_PLANES[i]) < 0)
UC_ERROR
- if(H5Pset_fill_value(src_dcplid, UC_1_SOURCE_DATATYPE,
- &UC_1_FILL_VALUES[i]) < 0)
+ if (H5Pset_fill_value(src_dcplid, UC_1_SOURCE_DATATYPE, &UC_1_FILL_VALUES[i]) < 0)
UC_ERROR
- if(0 != i % 2)
- if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ if (0 != i % 2)
+ if (H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
UC_ERROR
/* Create source file, dataspace, and dataset */
- if((fid = H5Fcreate(UC_1_FILE_NAMES[i], H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(UC_1_FILE_NAMES[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
UC_ERROR
- if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i],
- UC_1_MAX_DIMS[i])) < 0)
+ if ((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i], UC_1_MAX_DIMS[i])) < 0)
UC_ERROR
- if((did = H5Dcreate2(fid, UC_1_SOURCE_DSET_NAME,
- UC_1_SOURCE_DATATYPE, src_sid,
- H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, UC_1_SOURCE_DSET_NAME, UC_1_SOURCE_DATATYPE, src_sid, H5P_DEFAULT,
+ src_dcplid, H5P_DEFAULT)) < 0)
UC_ERROR
/* Set the dataset's extent (will eventually vary with i) */
extent[0] = UC_1_N_TEST_PLANES;
extent[1] = UC_1_PLANES[i][1];
extent[2] = UC_1_PLANES[i][2];
- if(H5Dset_extent(did, extent) < 0)
+ if (H5Dset_extent(did, extent) < 0)
UC_ERROR
/* Create a data buffer that represents a plane */
count = UC_1_PLANES[i][1] * UC_1_PLANES[i][2];
- if(NULL == (buffer = (int *)malloc(count * sizeof(int))))
+ if (NULL == (buffer = (int *)malloc(count * sizeof(int))))
UC_ERROR
/* Create the memory dataspace */
- if((msid = H5Screate_simple(RANK, UC_1_PLANES[i], NULL)) < 0)
+ if ((msid = H5Screate_simple(RANK, UC_1_PLANES[i], NULL)) < 0)
UC_ERROR
/* Get the file dataspace */
- if((fsid = H5Dget_space(did)) < 0)
+ if ((fsid = H5Dget_space(did)) < 0)
UC_ERROR
/* Write planes to the dataset, number will eventually vary with i */
n_planes = UC_1_N_TEST_PLANES;
- for(j = 0; j < n_planes; j++) {
+ for (j = 0; j < n_planes; j++) {
value = ((i + 1) * 10) + j;
- for(k = 0; k < count; k++)
- buffer[k] = value;
+ for (k = 0; k < count; k++)
+ buffer[k] = value;
start[0] = (hsize_t)j;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_1_PLANES[i], NULL) < 0)
+ if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_1_PLANES[i], NULL) < 0)
UC_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
UC_ERROR
} /* end for */
@@ -178,90 +159,86 @@ main(void)
start[0] = 0;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
- UC_1_MAX_DIMS[i], NULL) < 0)
+ if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_1_MAX_DIMS[i], NULL) < 0)
UC_ERROR
start[0] = 0;
start[1] = map_start;
start[2] = 0;
- if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL,
- UC_1_MAX_DIMS[i], NULL) < 0)
+ if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL, UC_1_MAX_DIMS[i], NULL) < 0)
UC_ERROR
map_start += UC_1_PLANES[i][1];
/* Add VDS mapping */
- if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i],
- UC_1_SOURCE_DSET_PATH, src_sid) < 0)
+ if (H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i], UC_1_SOURCE_DSET_PATH, src_sid) < 0)
UC_ERROR
/* close */
- if(H5Sclose(src_sid) < 0)
+ if (H5Sclose(src_sid) < 0)
UC_ERROR
- if(H5Pclose(src_dcplid) < 0)
+ if (H5Pclose(src_dcplid) < 0)
UC_ERROR
- if(H5Sclose(msid) < 0)
+ if (H5Sclose(msid) < 0)
UC_ERROR
- if(H5Sclose(fsid) < 0)
+ if (H5Sclose(fsid) < 0)
UC_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
UC_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
UC_ERROR
free(buffer);
} /* end for */
-
/*******************
* Create VDS file *
*******************/
/* file */
- if((fid = H5Fcreate(UC_1_VDS_FILE_NAME, H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(UC_1_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
UC_ERROR
/* dataset */
- if((did = H5Dcreate2(fid, UC_1_VDS_DSET_NAME, UC_1_VDS_DATATYPE, vds_sid,
- H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, UC_1_VDS_DSET_NAME, UC_1_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid,
+ H5P_DEFAULT)) < 0)
UC_ERROR
/* close */
- if(H5Pclose(vds_dcplid) < 0)
+ if (H5Pclose(vds_dcplid) < 0)
UC_ERROR
- if(H5Sclose(vds_sid) < 0)
+ if (H5Sclose(vds_sid) < 0)
UC_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
UC_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
UC_ERROR
return EXIT_SUCCESS;
error:
- H5E_BEGIN_TRY {
- if(src_sid >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (src_sid >= 0)
(void)H5Sclose(src_sid);
- if(src_dcplid >= 0)
+ if (src_dcplid >= 0)
(void)H5Pclose(src_dcplid);
- if(vds_sid >= 0)
+ if (vds_sid >= 0)
(void)H5Sclose(vds_sid);
- if(vds_dcplid >= 0)
+ if (vds_dcplid >= 0)
(void)H5Pclose(vds_dcplid);
- if(fid >= 0)
+ if (fid >= 0)
(void)H5Fclose(fid);
- if(did >= 0)
+ if (did >= 0)
(void)H5Dclose(did);
- if(msid >= 0)
+ if (msid >= 0)
(void)H5Sclose(msid);
- if(fsid >= 0)
+ if (fsid >= 0)
(void)H5Sclose(fsid);
- if(buffer != NULL)
+ if (buffer != NULL)
free(buffer);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return EXIT_FAILURE;
} /* end main */
-
diff --git a/tools/test/misc/vds/UC_2.h b/tools/test/misc/vds/UC_2.h
index 07f9b9a..8165756 100644
--- a/tools/test/misc/vds/UC_2.h
+++ b/tools/test/misc/vds/UC_2.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -48,61 +48,51 @@
*/
-#define UC_2_N_SOURCES 5
+#define UC_2_N_SOURCES 5
/* Dataset dimensions */
-#define UC_2_A_HEIGHT 2
-#define UC_2_B_HEIGHT 4
-#define UC_2_AB_HEIGHT 6 /* For hyperslab start position */
-#define UC_2_C_HEIGHT 2
-#define UC_2_D_HEIGHT 5
-#define UC_2_E_HEIGHT 3
-#define UC_2_FULL_HEIGHT 8 /* A+B+C and D+E */
-#define UC_2_WIDTH 7
-#define UC_2_FULL_WIDTH 14 /* 2*width */
-
-#define UC_2_N_PLANES_IN_SERIES 3 /* number of planes in a series of sub-images */
-#define UC_2_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */
-#define UC_2_N_TEST_PLANES 6 /* number of planes we write */
+#define UC_2_A_HEIGHT 2
+#define UC_2_B_HEIGHT 4
+#define UC_2_AB_HEIGHT 6 /* For hyperslab start position */
+#define UC_2_C_HEIGHT 2
+#define UC_2_D_HEIGHT 5
+#define UC_2_E_HEIGHT 3
+#define UC_2_FULL_HEIGHT 8 /* A+B+C and D+E */
+#define UC_2_WIDTH 7
+#define UC_2_FULL_WIDTH 14 /* 2*width */
+
+#define UC_2_N_PLANES_IN_SERIES 3 /* number of planes in a series of sub-images */
+#define UC_2_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */
+#define UC_2_N_TEST_PLANES 6 /* number of planes we write */
/* Dataset datatypes */
-#define UC_2_SOURCE_DATATYPE H5T_STD_I32LE
-#define UC_2_VDS_DATATYPE H5T_STD_I32LE
+#define UC_2_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_2_VDS_DATATYPE H5T_STD_I32LE
/* Starting size of datasets, both source and VDS */
-static hsize_t UC_2_DIMS[UC_2_N_SOURCES][RANK] = {
- {0, UC_2_A_HEIGHT, UC_2_WIDTH},
- {0, UC_2_B_HEIGHT, UC_2_WIDTH},
- {0, UC_2_C_HEIGHT, UC_2_WIDTH},
- {0, UC_2_D_HEIGHT, UC_2_WIDTH},
- {0, UC_2_E_HEIGHT, UC_2_WIDTH}
-};
+static hsize_t UC_2_DIMS[UC_2_N_SOURCES][RANK] = {{0, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_E_HEIGHT, UC_2_WIDTH}};
/* Maximum size of datasets, both source and VDS */
-static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = {
- {UC_2_N_MAX_PLANES, UC_2_A_HEIGHT, UC_2_WIDTH},
- {UC_2_N_MAX_PLANES, UC_2_B_HEIGHT, UC_2_WIDTH},
- {UC_2_N_MAX_PLANES, UC_2_C_HEIGHT, UC_2_WIDTH},
- {UC_2_N_MAX_PLANES, UC_2_D_HEIGHT, UC_2_WIDTH},
- {UC_2_N_MAX_PLANES, UC_2_E_HEIGHT, UC_2_WIDTH}
-};
+static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = {{UC_2_N_MAX_PLANES, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_E_HEIGHT, UC_2_WIDTH}};
/* File names for source datasets */
static char UC_2_FILE_NAMES[UC_2_N_SOURCES][NAME_LEN] = {
- {"2_a.h5"},
- {"2_b.h5"},
- {"2_c.h5"},
- {"2_d.h5"},
- {"2_e.h5"}
-};
+ {"2_a.h5"}, {"2_b.h5"}, {"2_c.h5"}, {"2_d.h5"}, {"2_e.h5"}};
/* VDS file name */
-#define UC_2_VDS_FILE_NAME "2_vds.h5"
+#define UC_2_VDS_FILE_NAME "2_vds.h5"
/* Dataset names */
-#define UC_2_SOURCE_DSET_NAME "source_dset"
-#define UC_2_SOURCE_DSET_PATH "/source_dset"
-#define UC_2_VDS_DSET_NAME "vds_dset"
+#define UC_2_SOURCE_DSET_NAME "source_dset"
+#define UC_2_SOURCE_DSET_PATH "/source_dset"
+#define UC_2_VDS_DSET_NAME "vds_dset"
#endif /* UC_2_H */
-
diff --git a/tools/test/misc/vds/UC_2_two_dims_gen.c b/tools/test/misc/vds/UC_2_two_dims_gen.c
index b9799d6..85bd63d 100644
--- a/tools/test/misc/vds/UC_2_two_dims_gen.c
+++ b/tools/test/misc/vds/UC_2_two_dims_gen.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,7 +17,6 @@
* See the header file for a description.
*/
-
#include <stdlib.h>
#include "hdf5.h"
@@ -25,72 +24,60 @@
#include "UC_common.h"
#include "UC_2.h"
-static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
-static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
+static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
+static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
/* Positions of source datasets in the VDS */
static hsize_t UC_2_POSITIONS[UC_2_N_SOURCES][RANK] = {
- /* A */ {0, 0, 0},
- /* B */ {0, UC_2_A_HEIGHT, 0},
+ /* A */ {0, 0, 0},
+ /* B */ {0, UC_2_A_HEIGHT, 0},
/* C */ {0, UC_2_AB_HEIGHT, 0},
- /* D */ {0, 0, UC_2_WIDTH},
- /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH}
-};
+ /* D */ {0, 0, UC_2_WIDTH},
+ /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH}};
/* Planes */
-static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = {
- {1, UC_2_A_HEIGHT, UC_2_WIDTH},
- {1, UC_2_B_HEIGHT, UC_2_WIDTH},
- {1, UC_2_C_HEIGHT, UC_2_WIDTH},
- {1, UC_2_D_HEIGHT, UC_2_WIDTH},
- {1, UC_2_E_HEIGHT, UC_2_WIDTH}
-};
+static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = {{1, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_E_HEIGHT, UC_2_WIDTH}};
/* Chunk dimensions */
-static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = {
- {UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH},
- {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH},
- {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH},
- {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH},
- {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH}
-};
+static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = {{UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH}};
/* Fill values */
-static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = {
- -1,
- -2,
- -3,
- -4,
- -5
-};
-static int UC_2_VDS_FILL_VALUE = -9;
+static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = {-1, -2, -3, -4, -5};
+static int UC_2_VDS_FILL_VALUE = -9;
int
main(void)
{
- hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
- hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
-
- hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
- hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
- hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
- hid_t did = H5I_INVALID_HID; /* dataset ID */
- hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
- hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hsize_t start[RANK]; /* starting point for hyperslab */
- hsize_t extent[RANK]; /* dataset extents */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
+ hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
- int *buffer = NULL; /* data buffer */
- int value = -1; /* value written to datasets */
- hsize_t count = 0; /* number of elements in a plane */
- int n_planes = -1; /* number of planes to write */
+ hsize_t start[RANK]; /* starting point for hyperslab */
+ hsize_t extent[RANK]; /* dataset extents */
- int i; /* iterator */
- int j; /* iterator */
- hsize_t k; /* iterator */
+ int * buffer = NULL; /* data buffer */
+ int value = -1; /* value written to datasets */
+ hsize_t count = 0; /* number of elements in a plane */
+ int n_planes = -1; /* number of planes to write */
+ int i; /* iterator */
+ int j; /* iterator */
+ hsize_t k; /* iterator */
/* Start by creating the virtual dataset (VDS) dataspace and creation
* property list. The individual source datasets are then created
@@ -98,15 +85,13 @@ main(void)
*/
/* Create VDS dcpl */
- if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
UC_ERROR
- if(H5Pset_fill_value(vds_dcplid, UC_2_VDS_DATATYPE,
- &UC_2_VDS_FILL_VALUE) < 0)
+ if (H5Pset_fill_value(vds_dcplid, UC_2_VDS_DATATYPE, &UC_2_VDS_FILL_VALUE) < 0)
UC_ERROR
/* Create VDS dataspace */
- if((vds_sid = H5Screate_simple(RANK, UC_2_VDS_DIMS,
- UC_2_VDS_MAX_DIMS)) < 0)
+ if ((vds_sid = H5Screate_simple(RANK, UC_2_VDS_DIMS, UC_2_VDS_MAX_DIMS)) < 0)
UC_ERROR
/************************************
@@ -117,65 +102,61 @@ main(void)
start[1] = 0;
start[2] = 0;
- for(i = 0; i < UC_2_N_SOURCES; i++) {
+ for (i = 0; i < UC_2_N_SOURCES; i++) {
/* source dataset dcpl */
- if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
UC_ERROR
- if(H5Pset_chunk(src_dcplid, RANK, UC_2_CHUNK_DIMS[i]) < 0)
+ if (H5Pset_chunk(src_dcplid, RANK, UC_2_CHUNK_DIMS[i]) < 0)
UC_ERROR
- if(H5Pset_fill_value(src_dcplid, UC_2_SOURCE_DATATYPE,
- &UC_2_FILL_VALUES[i]) < 0)
+ if (H5Pset_fill_value(src_dcplid, UC_2_SOURCE_DATATYPE, &UC_2_FILL_VALUES[i]) < 0)
UC_ERROR
- if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ if (H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
UC_ERROR
/* Create source file, dataspace, and dataset */
- if((fid = H5Fcreate(UC_2_FILE_NAMES[i], H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(UC_2_FILE_NAMES[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
UC_ERROR
- if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i],
- UC_2_MAX_DIMS[i])) < 0)
+ if ((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i], UC_2_MAX_DIMS[i])) < 0)
UC_ERROR
- if((did = H5Dcreate2(fid, UC_2_SOURCE_DSET_NAME,
- UC_2_SOURCE_DATATYPE, src_sid,
- H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, UC_2_SOURCE_DSET_NAME, UC_2_SOURCE_DATATYPE, src_sid, H5P_DEFAULT,
+ src_dcplid, H5P_DEFAULT)) < 0)
UC_ERROR
/* Set the dataset's extent (will eventually vary with i) */
extent[0] = UC_2_N_TEST_PLANES;
extent[1] = UC_2_PLANES[i][1];
extent[2] = UC_2_PLANES[i][2];
- if(H5Dset_extent(did, extent) < 0)
+ if (H5Dset_extent(did, extent) < 0)
UC_ERROR
/* Create a data buffer that represents a plane */
count = UC_2_PLANES[i][1] * UC_2_PLANES[i][2];
- if(NULL == (buffer = (int *)malloc(count * sizeof(int))))
+ if (NULL == (buffer = (int *)malloc(count * sizeof(int))))
UC_ERROR
/* Create the memory dataspace */
- if((msid = H5Screate_simple(RANK, UC_2_PLANES[i], NULL)) < 0)
+ if ((msid = H5Screate_simple(RANK, UC_2_PLANES[i], NULL)) < 0)
UC_ERROR
/* Get the file dataspace */
- if((fsid = H5Dget_space(did)) < 0)
+ if ((fsid = H5Dget_space(did)) < 0)
UC_ERROR
/* Write planes to the dataset, number will eventually vary with i */
n_planes = UC_2_N_TEST_PLANES;
- for(j = 0; j < n_planes; j++) {
+ for (j = 0; j < n_planes; j++) {
value = ((i + 1) * 10) + j;
- for(k = 0; k < count; k++)
- buffer[k] = value;
+ for (k = 0; k < count; k++)
+ buffer[k] = value;
start[0] = (hsize_t)j;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_2_PLANES[i], NULL) < 0)
+ if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_2_PLANES[i], NULL) < 0)
UC_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
UC_ERROR
} /* end for */
@@ -184,30 +165,27 @@ main(void)
start[0] = 0;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
- UC_2_MAX_DIMS[i], NULL) < 0)
+ if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_2_MAX_DIMS[i], NULL) < 0)
UC_ERROR
- if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_2_POSITIONS[i], NULL,
- UC_2_MAX_DIMS[i], NULL) < 0)
+ if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_2_POSITIONS[i], NULL, UC_2_MAX_DIMS[i], NULL) < 0)
UC_ERROR
/* Add VDS mapping */
- if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i],
- UC_2_SOURCE_DSET_PATH, src_sid) < 0)
+ if (H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i], UC_2_SOURCE_DSET_PATH, src_sid) < 0)
UC_ERROR
/* close */
- if(H5Sclose(msid) < 0)
+ if (H5Sclose(msid) < 0)
UC_ERROR
- if(H5Sclose(fsid) < 0)
+ if (H5Sclose(fsid) < 0)
UC_ERROR
- if(H5Sclose(src_sid) < 0)
+ if (H5Sclose(src_sid) < 0)
UC_ERROR
- if(H5Pclose(src_dcplid) < 0)
+ if (H5Pclose(src_dcplid) < 0)
UC_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
UC_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
UC_ERROR
free(buffer);
@@ -218,51 +196,51 @@ main(void)
*******************************/
/* file */
- if((fid = H5Fcreate(UC_2_VDS_FILE_NAME, H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(UC_2_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
UC_ERROR
/* dataset */
- if((did = H5Dcreate2(fid, UC_2_VDS_DSET_NAME, UC_2_VDS_DATATYPE, vds_sid,
- H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, UC_2_VDS_DSET_NAME, UC_2_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid,
+ H5P_DEFAULT)) < 0)
UC_ERROR
/* close */
- if(H5Pclose(vds_dcplid) < 0)
+ if (H5Pclose(vds_dcplid) < 0)
UC_ERROR
- if(H5Sclose(vds_sid) < 0)
+ if (H5Sclose(vds_sid) < 0)
UC_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
UC_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
UC_ERROR
return EXIT_SUCCESS;
error:
- H5E_BEGIN_TRY {
- if(src_sid >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (src_sid >= 0)
(void)H5Sclose(src_sid);
- if(src_dcplid >= 0)
+ if (src_dcplid >= 0)
(void)H5Pclose(src_dcplid);
- if(vds_sid >= 0)
+ if (vds_sid >= 0)
(void)H5Sclose(vds_sid);
- if(vds_dcplid >= 0)
+ if (vds_dcplid >= 0)
(void)H5Pclose(vds_dcplid);
- if(fid >= 0)
+ if (fid >= 0)
(void)H5Fclose(fid);
- if(did >= 0)
+ if (did >= 0)
(void)H5Dclose(did);
- if(msid >= 0)
+ if (msid >= 0)
(void)H5Sclose(msid);
- if(fsid >= 0)
+ if (fsid >= 0)
(void)H5Sclose(fsid);
- if(buffer != NULL)
+ if (buffer != NULL)
free(buffer);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/tools/test/misc/vds/UC_3.h b/tools/test/misc/vds/UC_3.h
index 0c26dfb..f7e84eb 100644
--- a/tools/test/misc/vds/UC_3.h
+++ b/tools/test/misc/vds/UC_3.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -31,42 +31,40 @@
* Height and width are large enough to encompass the
* mapped source datasets with gaps.
*/
-#define UC_31_VDS_HEIGHT 25 /* full height + 7 (gaps of 1) */
-#define UC_31_VDS_WIDTH 8 /* full width + 0 (no gaps) */
-#define UC_32_VDS_HEIGHT 13 /* full height + 5 */
-#define UC_32_VDS_WIDTH 19 /* full width + 5 */
-#define UC_31_GAP 1
+#define UC_31_VDS_HEIGHT 25 /* full height + 7 (gaps of 1) */
+#define UC_31_VDS_WIDTH 8 /* full width + 0 (no gaps) */
+#define UC_32_VDS_HEIGHT 13 /* full height + 5 */
+#define UC_32_VDS_WIDTH 19 /* full width + 5 */
+#define UC_31_GAP 1
/* VDS datatypes */
-#define UC_31_VDS_DATATYPE H5T_STD_I32LE
-#define UC_32_VDS_DATATYPE H5T_STD_I32LE
+#define UC_31_VDS_DATATYPE H5T_STD_I32LE
+#define UC_32_VDS_DATATYPE H5T_STD_I32LE
/* Starting size of virtual datasets */
-static hsize_t UC_31_VDS_DIMS[RANK] = {0, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH};
-static hsize_t UC_32_VDS_DIMS[RANK] = {0, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH};
+static hsize_t UC_31_VDS_DIMS[RANK] = {0, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH};
+static hsize_t UC_32_VDS_DIMS[RANK] = {0, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH};
/* Maximum size of virtual datasets */
-static hsize_t UC_31_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH};
-static hsize_t UC_32_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH};
+static hsize_t UC_31_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH};
+static hsize_t UC_32_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH};
/* Positions of mapped source datasets */
static hsize_t UC_32_POSITIONS[UC_2_N_SOURCES][RANK] = {
- /* A */ {0, 1, 1},
- /* B */ {0, 4, 0},
- /* C */ {0, 11, 4},
- /* D */ {0, 1, 9},
- /* E */ {0, 8, 12}
-};
+ /* A */ {0, 1, 1},
+ /* B */ {0, 4, 0},
+ /* C */ {0, 11, 4},
+ /* D */ {0, 1, 9},
+ /* E */ {0, 8, 12}};
/* VDS file names */
-#define UC_31_VDS_FILE_NAME "3_1_vds.h5"
-#define UC_32_VDS_FILE_NAME "3_2_vds.h5"
+#define UC_31_VDS_FILE_NAME "3_1_vds.h5"
+#define UC_32_VDS_FILE_NAME "3_2_vds.h5"
/* Dataset name */
-#define UC_3_VDS_DSET_NAME "vds_dset"
+#define UC_3_VDS_DSET_NAME "vds_dset"
/* Fill value */
-static int UC_3_VDS_FILL_VALUE = -9;
+static int UC_3_VDS_FILL_VALUE = -9;
#endif /* UC_3_H */
-
diff --git a/tools/test/misc/vds/UC_3_gaps_gen.c b/tools/test/misc/vds/UC_3_gaps_gen.c
index 74a23dc..e6e311a 100644
--- a/tools/test/misc/vds/UC_3_gaps_gen.c
+++ b/tools/test/misc/vds/UC_3_gaps_gen.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -29,28 +29,26 @@
static herr_t
create_3_1_vds(void)
{
- hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
- hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
- hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
- hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
- hsize_t start[RANK]; /* source starting point for hyperslab */
- hsize_t position[RANK]; /* vds mapping positions */
+ hsize_t start[RANK]; /* source starting point for hyperslab */
+ hsize_t position[RANK]; /* vds mapping positions */
- int i; /* iterator */
+ int i; /* iterator */
/* Create VDS dcpl */
- if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
UC_ERROR
- if(H5Pset_fill_value(vds_dcplid, UC_31_VDS_DATATYPE,
- &UC_3_VDS_FILL_VALUE) < 0)
+ if (H5Pset_fill_value(vds_dcplid, UC_31_VDS_DATATYPE, &UC_3_VDS_FILL_VALUE) < 0)
UC_ERROR
/* Create VDS dataspace */
- if((vds_sid = H5Screate_simple(RANK, UC_31_VDS_DIMS,
- UC_31_VDS_MAX_DIMS)) < 0)
+ if ((vds_sid = H5Screate_simple(RANK, UC_31_VDS_DIMS, UC_31_VDS_MAX_DIMS)) < 0)
UC_ERROR
/* Set starting positions */
@@ -65,26 +63,22 @@ create_3_1_vds(void)
/******************************
* Create source-VDS mappings *
******************************/
- for(i = 0; i < UC_1_N_SOURCES; i++) {
+ for (i = 0; i < UC_1_N_SOURCES; i++) {
- if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i],
- UC_1_MAX_DIMS[i])) < 0)
- UC_ERROR
+ if ((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i], UC_1_MAX_DIMS[i])) < 0)
+ UC_ERROR
/* set up hyperslabs for source and destination datasets */
- if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
- UC_1_MAX_DIMS[i], NULL) < 0)
+ if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_1_MAX_DIMS[i], NULL) < 0)
UC_ERROR
- if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, position,
- NULL, UC_1_MAX_DIMS[i], NULL) < 0)
+ if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, position, NULL, UC_1_MAX_DIMS[i], NULL) < 0)
UC_ERROR
position[1] += UC_1_DIMS[i][1] + UC_31_GAP;
/* Add VDS mapping */
- if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i],
- UC_1_SOURCE_DSET_PATH, src_sid) < 0)
+ if (H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i], UC_1_SOURCE_DSET_PATH, src_sid) < 0)
UC_ERROR
- if(H5Sclose(src_sid) < 0)
+ if (H5Sclose(src_sid) < 0)
UC_ERROR
} /* end for */
@@ -94,39 +88,40 @@ create_3_1_vds(void)
*******************************/
/* file */
- if((fid = H5Fcreate(UC_31_VDS_FILE_NAME, H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(UC_31_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
UC_ERROR
/* dataset */
- if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_31_VDS_DATATYPE, vds_sid,
- H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_31_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid,
+ H5P_DEFAULT)) < 0)
UC_ERROR
/* close */
- if(H5Pclose(vds_dcplid) < 0)
+ if (H5Pclose(vds_dcplid) < 0)
UC_ERROR
- if(H5Sclose(vds_sid) < 0)
+ if (H5Sclose(vds_sid) < 0)
UC_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
UC_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
UC_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
- if(vds_sid >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (vds_sid >= 0)
(void)H5Sclose(vds_sid);
- if(vds_dcplid >= 0)
+ if (vds_dcplid >= 0)
(void)H5Pclose(vds_dcplid);
- if(fid >= 0)
+ if (fid >= 0)
(void)H5Fclose(fid);
- if(did >= 0)
+ if (did >= 0)
(void)H5Dclose(did);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return -1;
@@ -136,27 +131,25 @@ error:
static herr_t
create_3_2_vds(void)
{
- hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
- hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
- hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
- hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
- hsize_t start[RANK]; /* source starting point for hyperslab */
+ hsize_t start[RANK]; /* source starting point for hyperslab */
- int i; /* iterator */
+ int i; /* iterator */
/* Create VDS dcpl */
- if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
UC_ERROR
- if(H5Pset_fill_value(vds_dcplid, UC_32_VDS_DATATYPE,
- &UC_3_VDS_FILL_VALUE) < 0)
+ if (H5Pset_fill_value(vds_dcplid, UC_32_VDS_DATATYPE, &UC_3_VDS_FILL_VALUE) < 0)
UC_ERROR
/* Create VDS dataspace */
- if((vds_sid = H5Screate_simple(RANK, UC_32_VDS_DIMS,
- UC_32_VDS_MAX_DIMS)) < 0)
+ if ((vds_sid = H5Screate_simple(RANK, UC_32_VDS_DIMS, UC_32_VDS_MAX_DIMS)) < 0)
UC_ERROR
/* Set starting positions */
@@ -167,25 +160,22 @@ create_3_2_vds(void)
/******************************
* Create source-VDS mappings *
******************************/
- for(i = 0; i < UC_2_N_SOURCES; i++) {
+ for (i = 0; i < UC_2_N_SOURCES; i++) {
- if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i],
- UC_2_MAX_DIMS[i])) < 0)
- UC_ERROR
+ if ((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i], UC_2_MAX_DIMS[i])) < 0)
+ UC_ERROR
/* set up hyperslabs for source and destination datasets */
- if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
- UC_2_MAX_DIMS[i], NULL) < 0)
+ if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_2_MAX_DIMS[i], NULL) < 0)
UC_ERROR
- if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_32_POSITIONS[i],
- NULL, UC_2_MAX_DIMS[i], NULL) < 0)
+ if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_32_POSITIONS[i], NULL, UC_2_MAX_DIMS[i], NULL) <
+ 0)
UC_ERROR
/* Add VDS mapping */
- if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i],
- UC_2_SOURCE_DSET_PATH, src_sid) < 0)
+ if (H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i], UC_2_SOURCE_DSET_PATH, src_sid) < 0)
UC_ERROR
- if(H5Sclose(src_sid) < 0)
+ if (H5Sclose(src_sid) < 0)
UC_ERROR
} /* end for */
@@ -195,39 +185,40 @@ create_3_2_vds(void)
*******************************/
/* file */
- if((fid = H5Fcreate(UC_32_VDS_FILE_NAME, H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(UC_32_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
UC_ERROR
/* dataset */
- if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_32_VDS_DATATYPE, vds_sid,
- H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_32_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid,
+ H5P_DEFAULT)) < 0)
UC_ERROR
/* close */
- if(H5Pclose(vds_dcplid) < 0)
+ if (H5Pclose(vds_dcplid) < 0)
UC_ERROR
- if(H5Sclose(vds_sid) < 0)
+ if (H5Sclose(vds_sid) < 0)
UC_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
UC_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
UC_ERROR
return 0;
error:
- H5E_BEGIN_TRY {
- if(vds_sid >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (vds_sid >= 0)
(void)H5Sclose(vds_sid);
- if(vds_dcplid >= 0)
+ if (vds_dcplid >= 0)
(void)H5Pclose(vds_dcplid);
- if(fid >= 0)
+ if (fid >= 0)
(void)H5Fclose(fid);
- if(did >= 0)
+ if (did >= 0)
(void)H5Dclose(did);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return -1;
@@ -237,10 +228,10 @@ int
main(void)
{
- if(create_3_1_vds() < 0)
+ if (create_3_1_vds() < 0)
UC_ERROR
- if(create_3_2_vds() < 0)
+ if (create_3_2_vds() < 0)
UC_ERROR
return EXIT_SUCCESS;
@@ -250,4 +241,3 @@ error:
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/tools/test/misc/vds/UC_4.h b/tools/test/misc/vds/UC_4.h
index 5dba4fb..9efd077 100644
--- a/tools/test/misc/vds/UC_4.h
+++ b/tools/test/misc/vds/UC_4.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -29,39 +29,35 @@
/* virtual dataset <---> source dataset mapping and sizes */
-#define UC_4_N_SOURCES 3
+#define UC_4_N_SOURCES 3
/* Dataset dimensions */
-#define UC_4_SRC_PLANES 3
-#define UC_4_HEIGHT 4
-#define UC_4_WIDTH 4
+#define UC_4_SRC_PLANES 3
+#define UC_4_HEIGHT 4
+#define UC_4_WIDTH 4
/* max number of planes for VDS (sources are finite) */
-#define UC_4_VDS_MAX_PLANES H5S_UNLIMITED
-#define UC_4_N_TEST_PLANES 9 /* number of planes in the VDS */
+#define UC_4_VDS_MAX_PLANES H5S_UNLIMITED
+#define UC_4_N_TEST_PLANES 9 /* number of planes in the VDS */
/* Dataset datatypes */
-#define UC_4_SOURCE_DATATYPE H5T_STD_I32LE
-#define UC_4_VDS_DATATYPE H5T_STD_I32LE
+#define UC_4_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_4_VDS_DATATYPE H5T_STD_I32LE
/* Starting size of datasets, both source and VDS */
static hsize_t UC_4_SOURCE_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH};
-static hsize_t UC_4_VDS_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH};
+static hsize_t UC_4_VDS_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH};
/* Max size of datasets, both source and VDS */
static hsize_t UC_4_SOURCE_MAX_DIMS[RANK] = {UC_4_SRC_PLANES, UC_4_HEIGHT, UC_4_WIDTH};
-static hsize_t UC_4_VDS_MAX_DIMS[RANK] = {UC_4_VDS_MAX_PLANES, UC_4_HEIGHT, UC_4_WIDTH};
+static hsize_t UC_4_VDS_MAX_DIMS[RANK] = {UC_4_VDS_MAX_PLANES, UC_4_HEIGHT, UC_4_WIDTH};
/* Planes (both source and VDS) */
static hsize_t UC_4_PLANE[RANK] = {1, UC_4_HEIGHT, UC_4_WIDTH};
/* File names for source datasets */
-static char UC_4_FILE_NAMES[UC_4_N_SOURCES][NAME_LEN] = {
- {"4_0.h5"},
- {"4_1.h5"},
- {"4_2.h5"}
-};
-static char UC_4_MAPPING_FILE_NAME[NAME_LEN] = "4_%b.h5";
+static char UC_4_FILE_NAMES[UC_4_N_SOURCES][NAME_LEN] = {{"4_0.h5"}, {"4_1.h5"}, {"4_2.h5"}};
+static char UC_4_MAPPING_FILE_NAME[NAME_LEN] = "4_%b.h5";
/* VDS file name */
static char UC_4_VDS_FILE_NAME[NAME_LEN] = "4_vds.h5";
@@ -72,13 +68,7 @@ static char UC_4_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
static char UC_4_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
/* Fill values */
-static int UC_4_FILL_VALUES[UC_4_N_SOURCES] = {
- -1,
- -2,
- -3
-};
-static int UC_4_VDS_FILL_VALUE = -9;
+static int UC_4_FILL_VALUES[UC_4_N_SOURCES] = {-1, -2, -3};
+static int UC_4_VDS_FILL_VALUE = -9;
#endif /* UC_4_H */
-
-
diff --git a/tools/test/misc/vds/UC_4_printf_gen.c b/tools/test/misc/vds/UC_4_printf_gen.c
index 24451e9..206e1f3 100644
--- a/tools/test/misc/vds/UC_4_printf_gen.c
+++ b/tools/test/misc/vds/UC_4_printf_gen.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -27,109 +27,104 @@
int
main(void)
{
- hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
- hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
- hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
- hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
- hid_t did = H5I_INVALID_HID; /* dataset ID */
- hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
- hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
+ hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
/* Hyperslab arrays */
hsize_t start[RANK] = {0, 0, 0};
hsize_t count[RANK] = {H5S_UNLIMITED, 1, 1};
- int *buffer = NULL; /* data buffer */
- int value = -1; /* value written to datasets */
+ int *buffer = NULL; /* data buffer */
+ int value = -1; /* value written to datasets */
- hsize_t n = 0; /* number of elements in a plane */
+ hsize_t n = 0; /* number of elements in a plane */
- int i; /* iterator */
- int j; /* iterator */
- hsize_t k; /* iterator */
+ int i; /* iterator */
+ int j; /* iterator */
+ hsize_t k; /* iterator */
/************************************
* Create source files and datasets *
************************************/
/* Create source dataspace ID */
- if((src_sid = H5Screate_simple(RANK, UC_4_SOURCE_DIMS,
- UC_4_SOURCE_MAX_DIMS)) < 0)
+ if ((src_sid = H5Screate_simple(RANK, UC_4_SOURCE_DIMS, UC_4_SOURCE_MAX_DIMS)) < 0)
UC_ERROR
- if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
- UC_4_SOURCE_MAX_DIMS, NULL) < 0)
+ if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_4_SOURCE_MAX_DIMS, NULL) < 0)
UC_ERROR
/* Create source files and datasets */
- for(i = 0; i < UC_4_N_SOURCES; i++) {
+ for (i = 0; i < UC_4_N_SOURCES; i++) {
/* source dataset dcpl */
- if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
UC_ERROR
- if(H5Pset_chunk(src_dcplid, RANK, UC_4_PLANE) < 0)
+ if (H5Pset_chunk(src_dcplid, RANK, UC_4_PLANE) < 0)
UC_ERROR
- if(H5Pset_fill_value(src_dcplid, UC_4_SOURCE_DATATYPE,
- &UC_4_FILL_VALUES[i]) < 0)
+ if (H5Pset_fill_value(src_dcplid, UC_4_SOURCE_DATATYPE, &UC_4_FILL_VALUES[i]) < 0)
UC_ERROR
- if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ if (H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
UC_ERROR
/* Create source file and dataset */
- if((fid = H5Fcreate(UC_4_FILE_NAMES[i], H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(UC_4_FILE_NAMES[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
UC_ERROR
- if((did = H5Dcreate2(fid, UC_4_SOURCE_DSET_NAME,
- UC_4_SOURCE_DATATYPE, src_sid,
- H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, UC_4_SOURCE_DSET_NAME, UC_4_SOURCE_DATATYPE, src_sid, H5P_DEFAULT,
+ src_dcplid, H5P_DEFAULT)) < 0)
UC_ERROR
/* Set the dataset's extent */
- if(H5Dset_extent(did, UC_4_SOURCE_MAX_DIMS) < 0)
+ if (H5Dset_extent(did, UC_4_SOURCE_MAX_DIMS) < 0)
UC_ERROR
/* Create a data buffer that represents a plane */
n = UC_4_PLANE[1] * UC_4_PLANE[2];
- if(NULL == (buffer = (int *)malloc(n * sizeof(int))))
+ if (NULL == (buffer = (int *)malloc(n * sizeof(int))))
UC_ERROR
/* Create the memory dataspace */
- if((msid = H5Screate_simple(RANK, UC_4_PLANE, NULL)) < 0)
+ if ((msid = H5Screate_simple(RANK, UC_4_PLANE, NULL)) < 0)
UC_ERROR
/* Get the file dataspace */
- if((fsid = H5Dget_space(did)) < 0)
+ if ((fsid = H5Dget_space(did)) < 0)
UC_ERROR
/* Write planes to the dataset */
- for(j = 0; j < UC_4_SRC_PLANES; j++) {
+ for (j = 0; j < UC_4_SRC_PLANES; j++) {
value = ((i + 1) * 10) + j;
- for(k = 0; k < n; k++)
- buffer[k] = value;
+ for (k = 0; k < n; k++)
+ buffer[k] = value;
start[0] = (hsize_t)j;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_4_PLANE, NULL) < 0)
+ if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_4_PLANE, NULL) < 0)
UC_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
UC_ERROR
} /* end for */
/* close */
- if(H5Sclose(msid) < 0)
+ if (H5Sclose(msid) < 0)
UC_ERROR
- if(H5Sclose(fsid) < 0)
+ if (H5Sclose(fsid) < 0)
UC_ERROR
- if(H5Pclose(src_dcplid) < 0)
+ if (H5Pclose(src_dcplid) < 0)
UC_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
UC_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
UC_ERROR
free(buffer);
@@ -140,78 +135,75 @@ main(void)
*******************/
/* Create file */
- if((fid = H5Fcreate(UC_4_VDS_FILE_NAME, H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(UC_4_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
UC_ERROR
/* Create VDS dcpl */
- if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
UC_ERROR
- if(H5Pset_fill_value(vds_dcplid, UC_4_VDS_DATATYPE,
- &UC_4_VDS_FILL_VALUE) < 0)
+ if (H5Pset_fill_value(vds_dcplid, UC_4_VDS_DATATYPE, &UC_4_VDS_FILL_VALUE) < 0)
UC_ERROR
/* Create VDS dataspace */
- if((vds_sid = H5Screate_simple(RANK, UC_4_VDS_DIMS,
- UC_4_VDS_MAX_DIMS)) < 0)
+ if ((vds_sid = H5Screate_simple(RANK, UC_4_VDS_DIMS, UC_4_VDS_MAX_DIMS)) < 0)
UC_ERROR
start[0] = 0;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start,
- UC_4_SOURCE_MAX_DIMS, count, UC_4_SOURCE_MAX_DIMS) < 0)
+ if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, UC_4_SOURCE_MAX_DIMS, count,
+ UC_4_SOURCE_MAX_DIMS) < 0)
UC_ERROR
/* Add VDS mapping - The mapped file name uses a printf-like
* naming scheme that automatically maps new files.
*/
- if(H5Pset_virtual(vds_dcplid, vds_sid, UC_4_MAPPING_FILE_NAME,
- UC_4_SOURCE_DSET_PATH, src_sid) < 0)
+ if (H5Pset_virtual(vds_dcplid, vds_sid, UC_4_MAPPING_FILE_NAME, UC_4_SOURCE_DSET_PATH, src_sid) < 0)
UC_ERROR
/* Create dataset */
- if((did = H5Dcreate2(fid, UC_4_VDS_DSET_NAME, UC_4_VDS_DATATYPE, vds_sid,
- H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, UC_4_VDS_DSET_NAME, UC_4_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid,
+ H5P_DEFAULT)) < 0)
UC_ERROR
/* close */
- if(H5Sclose(src_sid) < 0)
+ if (H5Sclose(src_sid) < 0)
UC_ERROR
- if(H5Pclose(vds_dcplid) < 0)
+ if (H5Pclose(vds_dcplid) < 0)
UC_ERROR
- if(H5Sclose(vds_sid) < 0)
+ if (H5Sclose(vds_sid) < 0)
UC_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
UC_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
UC_ERROR
return EXIT_SUCCESS;
error:
- H5E_BEGIN_TRY {
- if(src_sid >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (src_sid >= 0)
(void)H5Sclose(src_sid);
- if(src_dcplid >= 0)
+ if (src_dcplid >= 0)
(void)H5Pclose(src_dcplid);
- if(vds_sid >= 0)
+ if (vds_sid >= 0)
(void)H5Sclose(vds_sid);
- if(vds_dcplid >= 0)
+ if (vds_dcplid >= 0)
(void)H5Pclose(vds_dcplid);
- if(fid >= 0)
+ if (fid >= 0)
(void)H5Fclose(fid);
- if(did >= 0)
+ if (did >= 0)
(void)H5Dclose(did);
- if(msid >= 0)
+ if (msid >= 0)
(void)H5Sclose(msid);
- if(fsid >= 0)
+ if (fsid >= 0)
(void)H5Sclose(fsid);
- if(buffer != NULL)
+ if (buffer != NULL)
free(buffer);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/tools/test/misc/vds/UC_5.h b/tools/test/misc/vds/UC_5.h
index 3f8fe41..a81960f 100644
--- a/tools/test/misc/vds/UC_5.h
+++ b/tools/test/misc/vds/UC_5.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -28,20 +28,20 @@
/* virtual dataset <---> source dataset mapping and sizes */
-#define UC_5_N_SOURCES 3
+#define UC_5_N_SOURCES 3
/* Dataset dimensions */
-#define UC_5_SRC_PLANES 3
-#define UC_5_HEIGHT 4
-#define UC_5_WIDTH 4
+#define UC_5_SRC_PLANES 3
+#define UC_5_HEIGHT 4
+#define UC_5_WIDTH 4
/* max number of planes for datasets */
-#define UC_5_MAX_PLANES H5S_UNLIMITED
-#define UC_5_N_TEST_PLANES 9 /* number of planes in VDS */
+#define UC_5_MAX_PLANES H5S_UNLIMITED
+#define UC_5_N_TEST_PLANES 9 /* number of planes in VDS */
/* Dataset datatypes */
-#define UC_5_SOURCE_DATATYPE H5T_STD_I32LE
-#define UC_5_VDS_DATATYPE H5T_STD_I32LE
+#define UC_5_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_5_VDS_DATATYPE H5T_STD_I32LE
/* Starting size of datasets, both source and VDS */
static hsize_t UC_5_SOURCE_DIMS[RANK] = {0, UC_5_HEIGHT, UC_5_WIDTH};
@@ -55,11 +55,7 @@ static hsize_t UC_5_VDS_MAX_DIMS[RANK] = {UC_5_MAX_PLANES, UC_5_HEIGHT, UC_5_
static hsize_t UC_5_PLANE[RANK] = {1, UC_5_HEIGHT, UC_5_WIDTH};
/* File names for source datasets */
-static char UC_5_FILE_NAMES[UC_5_N_SOURCES][NAME_LEN] = {
- {"5_a.h5"},
- {"5_b.h5"},
- {"5_c.h5"}
-};
+static char UC_5_FILE_NAMES[UC_5_N_SOURCES][NAME_LEN] = {{"5_a.h5"}, {"5_b.h5"}, {"5_c.h5"}};
/* VDS file name */
static char UC_5_VDS_FILE_NAME[NAME_LEN] = "5_vds.h5";
@@ -70,12 +66,7 @@ static char UC_5_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
static char UC_5_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
/* Fill values */
-static int UC_5_FILL_VALUES[UC_5_N_SOURCES] = {
- -1,
- -2,
- -3
-};
-static int UC_5_VDS_FILL_VALUE = -9;
+static int UC_5_FILL_VALUES[UC_5_N_SOURCES] = {-1, -2, -3};
+static int UC_5_VDS_FILL_VALUE = -9;
#endif /* UC_5_H */
-
diff --git a/tools/test/misc/vds/UC_5_stride_gen.c b/tools/test/misc/vds/UC_5_stride_gen.c
index 726ce6e..d4ba139 100644
--- a/tools/test/misc/vds/UC_5_stride_gen.c
+++ b/tools/test/misc/vds/UC_5_stride_gen.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -27,31 +27,31 @@
int
main(void)
{
- hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
- hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
- hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
- hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
- hid_t did = H5I_INVALID_HID; /* dataset ID */
- hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
- hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
+ hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
- hsize_t extent[RANK]; /* source dataset extents */
- hsize_t start[RANK]; /* starting point for hyperslab */
- hsize_t stride[RANK]; /* hypserslab stride */
- hsize_t count[RANK]; /* hypserslab count */
- hsize_t map_start = 0; /* starting point in the VDS map */
+ hsize_t extent[RANK]; /* source dataset extents */
+ hsize_t start[RANK]; /* starting point for hyperslab */
+ hsize_t stride[RANK]; /* hypserslab stride */
+ hsize_t count[RANK]; /* hypserslab count */
+ hsize_t map_start = 0; /* starting point in the VDS map */
- int *buffer = NULL; /* data buffer */
- int value = -1; /* value written to datasets */
+ int *buffer = NULL; /* data buffer */
+ int value = -1; /* value written to datasets */
- hsize_t n = 0; /* number of elements in a plane */
+ hsize_t n = 0; /* number of elements in a plane */
- int i; /* iterator */
- int j; /* iterator */
- hsize_t k; /* iterator */
+ int i; /* iterator */
+ int j; /* iterator */
+ hsize_t k; /* iterator */
/* Start by creating the virtual dataset (VDS) dataspace and creation
* property list. The individual source datasets are then created
@@ -59,15 +59,13 @@ main(void)
*/
/* Create VDS dcpl */
- if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
UC_ERROR
- if(H5Pset_fill_value(vds_dcplid, UC_5_VDS_DATATYPE,
- &UC_5_VDS_FILL_VALUE) < 0)
+ if (H5Pset_fill_value(vds_dcplid, UC_5_VDS_DATATYPE, &UC_5_VDS_FILL_VALUE) < 0)
UC_ERROR
/* Create VDS dataspace */
- if((vds_sid = H5Screate_simple(RANK, UC_5_VDS_DIMS,
- UC_5_VDS_MAX_DIMS)) < 0)
+ if ((vds_sid = H5Screate_simple(RANK, UC_5_VDS_DIMS, UC_5_VDS_MAX_DIMS)) < 0)
UC_ERROR
/*********************************
@@ -75,9 +73,9 @@ main(void)
*********************************/
/* Hyperslab array setup */
- start[0] = 0;
- start[1] = 0;
- start[2] = 0;
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
map_start = 0;
stride[0] = UC_5_N_SOURCES;
@@ -92,61 +90,57 @@ main(void)
extent[1] = UC_5_HEIGHT;
extent[2] = UC_5_WIDTH;
- for(i = 0; i < UC_5_N_SOURCES; i++) {
+ for (i = 0; i < UC_5_N_SOURCES; i++) {
/* source dataset dcpl */
- if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
UC_ERROR
- if(H5Pset_chunk(src_dcplid, RANK, UC_5_PLANE) < 0)
+ if (H5Pset_chunk(src_dcplid, RANK, UC_5_PLANE) < 0)
UC_ERROR
- if(H5Pset_fill_value(src_dcplid, UC_5_SOURCE_DATATYPE,
- &UC_5_FILL_VALUES[i]) < 0)
+ if (H5Pset_fill_value(src_dcplid, UC_5_SOURCE_DATATYPE, &UC_5_FILL_VALUES[i]) < 0)
UC_ERROR
- if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ if (H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
UC_ERROR
/* Create source file, dataspace, and dataset */
- if((fid = H5Fcreate(UC_5_FILE_NAMES[i], H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(UC_5_FILE_NAMES[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
UC_ERROR
- if((src_sid = H5Screate_simple(RANK, UC_5_SOURCE_DIMS,
- UC_5_SOURCE_MAX_DIMS)) < 0)
+ if ((src_sid = H5Screate_simple(RANK, UC_5_SOURCE_DIMS, UC_5_SOURCE_MAX_DIMS)) < 0)
UC_ERROR
- if((did = H5Dcreate2(fid, UC_5_SOURCE_DSET_NAME,
- UC_5_SOURCE_DATATYPE, src_sid,
- H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, UC_5_SOURCE_DSET_NAME, UC_5_SOURCE_DATATYPE, src_sid, H5P_DEFAULT,
+ src_dcplid, H5P_DEFAULT)) < 0)
UC_ERROR
/* Set the dataset's extent */
- if(H5Dset_extent(did, extent) < 0)
+ if (H5Dset_extent(did, extent) < 0)
UC_ERROR
/* Create a data buffer that represents a plane */
n = UC_5_PLANE[1] * UC_5_PLANE[2];
- if(NULL == (buffer = (int *)malloc(n * sizeof(int))))
+ if (NULL == (buffer = (int *)malloc(n * sizeof(int))))
UC_ERROR
/* Create the memory dataspace */
- if((msid = H5Screate_simple(RANK, UC_5_PLANE, NULL)) < 0)
+ if ((msid = H5Screate_simple(RANK, UC_5_PLANE, NULL)) < 0)
UC_ERROR
/* Get the file dataspace */
- if((fsid = H5Dget_space(did)) < 0)
+ if ((fsid = H5Dget_space(did)) < 0)
UC_ERROR
/* Write planes to the dataset */
- for(j = 0; j < UC_5_SRC_PLANES; j++) {
+ for (j = 0; j < UC_5_SRC_PLANES; j++) {
value = ((i + 1) * 10) + j;
- for(k = 0; k < n; k++)
- buffer[k] = value;
+ for (k = 0; k < n; k++)
+ buffer[k] = value;
start[0] = (hsize_t)j;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_5_PLANE, NULL) < 0)
+ if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_5_PLANE, NULL) < 0)
UC_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
UC_ERROR
} /* end for */
@@ -155,32 +149,29 @@ main(void)
start[0] = 0;
start[1] = 0;
start[2] = 0;
- if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
- UC_5_SOURCE_MAX_DIMS, NULL) < 0)
+ if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_5_SOURCE_MAX_DIMS, NULL) < 0)
UC_ERROR
start[0] = map_start;
- if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, stride,
- count, UC_5_PLANE) < 0)
+ if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, stride, count, UC_5_PLANE) < 0)
UC_ERROR
map_start += 1;
/* Add VDS mapping */
- if(H5Pset_virtual(vds_dcplid, vds_sid, UC_5_FILE_NAMES[i],
- UC_5_SOURCE_DSET_PATH, src_sid) < 0)
+ if (H5Pset_virtual(vds_dcplid, vds_sid, UC_5_FILE_NAMES[i], UC_5_SOURCE_DSET_PATH, src_sid) < 0)
UC_ERROR
/* close */
- if(H5Sclose(msid) < 0)
+ if (H5Sclose(msid) < 0)
UC_ERROR
- if(H5Sclose(fsid) < 0)
+ if (H5Sclose(fsid) < 0)
UC_ERROR
- if(H5Sclose(src_sid) < 0)
+ if (H5Sclose(src_sid) < 0)
UC_ERROR
- if(H5Pclose(src_dcplid) < 0)
+ if (H5Pclose(src_dcplid) < 0)
UC_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
UC_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
UC_ERROR
free(buffer);
@@ -191,51 +182,51 @@ main(void)
*******************/
/* file */
- if((fid = H5Fcreate(UC_5_VDS_FILE_NAME, H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(UC_5_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
UC_ERROR
/* dataset */
- if((did = H5Dcreate2(fid, UC_5_VDS_DSET_NAME, UC_5_VDS_DATATYPE, vds_sid,
- H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, UC_5_VDS_DSET_NAME, UC_5_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid,
+ H5P_DEFAULT)) < 0)
UC_ERROR
/* close */
- if(H5Pclose(vds_dcplid) < 0)
+ if (H5Pclose(vds_dcplid) < 0)
UC_ERROR
- if(H5Sclose(vds_sid) < 0)
+ if (H5Sclose(vds_sid) < 0)
UC_ERROR
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
UC_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
UC_ERROR
return EXIT_SUCCESS;
error:
- H5E_BEGIN_TRY {
- if(src_sid >= 0)
+ H5E_BEGIN_TRY
+ {
+ if (src_sid >= 0)
(void)H5Sclose(src_sid);
- if(src_dcplid >= 0)
+ if (src_dcplid >= 0)
(void)H5Pclose(src_dcplid);
- if(vds_sid >= 0)
+ if (vds_sid >= 0)
(void)H5Sclose(vds_sid);
- if(vds_dcplid >= 0)
+ if (vds_dcplid >= 0)
(void)H5Pclose(vds_dcplid);
- if(fid >= 0)
+ if (fid >= 0)
(void)H5Fclose(fid);
- if(did >= 0)
+ if (did >= 0)
(void)H5Dclose(did);
- if(msid >= 0)
+ if (msid >= 0)
(void)H5Sclose(msid);
- if(fsid >= 0)
+ if (fsid >= 0)
(void)H5Sclose(fsid);
- if(buffer != NULL)
+ if (buffer != NULL)
free(buffer);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
return EXIT_FAILURE;
} /* end main() */
-
diff --git a/tools/test/misc/vds/UC_common.h b/tools/test/misc/vds/UC_common.h
index 78d8a11..bfa1ed9 100644
--- a/tools/test/misc/vds/UC_common.h
+++ b/tools/test/misc/vds/UC_common.h
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -28,21 +28,26 @@
******************************************/
/* All datasets are 3D */
-#define RANK 3
+#define RANK 3
/* Lengths of string identifiers (file, dataset names, etc.) */
-#define NAME_LEN 32
+#define NAME_LEN 32
/* Compression level */
-#define COMPRESSION_LEVEL 7
+#define COMPRESSION_LEVEL 7
/* Booleans */
-#define TRUE 1
+#define TRUE 1
#define FALSE 0
/* Testing macros */
-#define AT() printf (" at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC);
-#define UC_ERROR {puts("*ERROR*"); fflush(stdout); AT(); goto error;}
+#define AT() printf(" at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC);
+#define UC_ERROR \
+ { \
+ puts("*ERROR*"); \
+ fflush(stdout); \
+ AT(); \
+ goto error; \
+ }
#endif /* USE_CASE_COMMON_H */
-
diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt
index 3c45e85..7bf79c5 100644
--- a/tools/test/perform/CMakeLists.txt
+++ b/tools/test/perform/CMakeLists.txt
@@ -4,32 +4,17 @@ project (HDF5_TOOLS_TEST_PERFORM C)
# --------------------------------------------------------------------
# Add the executables
# --------------------------------------------------------------------
-#-- Adding test for h5perf_serial
-set (h5perf_serial_SOURCES
- ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c
- ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c
-)
-add_executable (h5perf_serial ${h5perf_serial_SOURCES})
-target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-if (NOT BUILD_SHARED_LIBS)
- TARGET_C_PROPERTIES (h5perf_serial STATIC)
- target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-else ()
- TARGET_C_PROPERTIES (h5perf_serial SHARED)
- target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
-endif ()
-set_target_properties (h5perf_serial PROPERTIES FOLDER perform)
if (HDF5_BUILD_PERFORM_STANDALONE)
#-- Adding test for h5perf_serial_alone - io_timer.c includes
set (h5perf_serial_alone_SOURCES
${HDF5_TOOLS_DIR}/lib/io_timer.c
- ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c
- ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c
+ ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_perf.c
+ ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_engine.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_standalone.c
)
add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES})
- target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR};${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (h5perf_serial_alone STATIC)
target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
@@ -38,9 +23,14 @@ if (HDF5_BUILD_PERFORM_STANDALONE)
target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
endif ()
set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform)
- set_property (TARGET h5perf_serial_alone
- APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE
- )
+ set_property (TARGET h5perf_serial_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE)
+
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_serial_alone_FORMAT h5perf_serial_alone)
+ endif ()
endif ()
#-- Adding test for chunk
@@ -48,7 +38,7 @@ set (chunk_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk.c
)
add_executable(chunk ${chunk_SOURCES})
-target_include_directories (chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (chunk STATIC)
target_link_libraries (chunk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -58,12 +48,19 @@ else ()
endif ()
set_target_properties (chunk PROPERTIES FOLDER perform)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_PERFORM_chunk_FORMAT chunk)
+endif ()
+
#-- Adding test for iopipe
set (iopipe_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/iopipe.c
)
add_executable (iopipe ${iopipe_SOURCES})
-target_include_directories (iopipe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (iopipe PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (iopipe STATIC)
target_link_libraries (iopipe PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -73,12 +70,19 @@ else ()
endif ()
set_target_properties (iopipe PROPERTIES FOLDER perform)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_PERFORM_iopipe_FORMAT iopipe)
+endif ()
+
#-- Adding test for chunk_cache
set (chunk_cache_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk_cache.c
)
add_executable (chunk_cache ${chunk_cache_SOURCES})
-target_include_directories (chunk_cache PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (chunk_cache PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (chunk_cache STATIC)
target_link_libraries (chunk_cache PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -88,12 +92,19 @@ else ()
endif ()
set_target_properties (chunk_cache PROPERTIES FOLDER perform)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_PERFORM_chunk_cache_FORMAT chunk_cache)
+endif ()
+
#-- Adding test for overhead
set (overhead_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c
)
add_executable (overhead ${overhead_SOURCES})
-target_include_directories (overhead PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (overhead PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (overhead STATIC)
target_link_libraries (overhead PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -103,12 +114,19 @@ else ()
endif ()
set_target_properties (overhead PROPERTIES FOLDER perform)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_PERFORM_overhead_FORMAT overhead)
+endif ()
+
#-- Adding test for perf_meta
set (perf_meta_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf_meta.c
)
add_executable (perf_meta ${perf_meta_SOURCES})
-target_include_directories (perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (perf_meta STATIC)
target_link_libraries (perf_meta PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
@@ -118,12 +136,19 @@ else ()
endif ()
set_target_properties (perf_meta PROPERTIES FOLDER perform)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_PERFORM_perf_meta_FORMAT perf_meta)
+endif ()
+
#-- Adding test for zip_perf
set (zip_perf_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c
)
add_executable (zip_perf ${zip_perf_SOURCES})
-target_include_directories (zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (zip_perf STATIC)
target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_COMP_LIBS})
@@ -133,50 +158,24 @@ else ()
endif ()
set_target_properties (zip_perf PROPERTIES FOLDER perform)
-if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
- if (UNIX)
- #-- Adding test for perf - only on unix systems
- set (perf_SOURCES
- ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c
- )
- add_executable (perf ${perf_SOURCES})
- target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- if (NOT BUILD_SHARED_LIBS)
- TARGET_C_PROPERTIES (perf STATIC)
- target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
- else ()
- TARGET_C_PROPERTIES (perf SHARED)
- target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- endif ()
- set_target_properties (perf PROPERTIES FOLDER perform)
- endif ()
-
- #-- Adding test for h5perf
- set (h5perf_SOURCES
- ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c
- ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c
- )
- add_executable (h5perf ${h5perf_SOURCES})
- target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- if (NOT BUILD_SHARED_LIBS)
- TARGET_C_PROPERTIES (h5perf STATIC)
- target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
- else ()
- TARGET_C_PROPERTIES (h5perf SHARED)
- target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- endif ()
- set_target_properties (h5perf PROPERTIES FOLDER perform)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_PERFORM_zip_perf_FORMAT zip_perf)
+endif ()
+if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
if (HDF5_BUILD_PERFORM_STANDALONE)
#-- Adding test for h5perf
set (h5perf_alone_SOURCES
${HDF5_TOOLS_DIR}/lib/io_timer.c
- ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c
- ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c
+ ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_perf.c
+ ${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_engine.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_standalone.c
)
add_executable (h5perf_alone ${h5perf_alone_SOURCES})
- target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR};${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (h5perf_alone STATIC)
target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} ${LINK_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
@@ -188,6 +187,13 @@ if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
set_property (TARGET h5perf_alone
APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE
)
+
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_alone_FORMAT h5perf_alone)
+ endif ()
endif ()
endif ()
diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake
index 5d61f7b..73b2260 100644
--- a/tools/test/perform/CMakeTests.cmake
+++ b/tools/test/perform/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/perform/COPYING b/tools/test/perform/COPYING
deleted file mode 100644
index 6497ace..0000000
--- a/tools/test/perform/COPYING
+++ /dev/null
@@ -1,13 +0,0 @@
-
- Copyright by The HDF Group and
- The Board of Trustees of the University of Illinois.
- All rights reserved.
-
- The files and subdirectories in this directory are part of HDF5.
- The full HDF5 copyright notice, including terms governing use,
- modification, and redistribution, is contained in the COPYING file
- which can be found at the root of the source code distribution tree
- or in https://support.hdfgroup.org/ftp/HDF5/releases. If you do
- not have access to either file, you may request a copy from
- help@hdfgroup.org.
-
diff --git a/tools/test/perform/Makefile.am b/tools/test/perform/Makefile.am
index 39800d7..10b13fe 100644
--- a/tools/test/perform/Makefile.am
+++ b/tools/test/perform/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
@@ -21,17 +21,6 @@ include $(top_srcdir)/config/commence.am
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
-# bin_PROGRAMS will be installed.
-if BUILD_PARALLEL_CONDITIONAL
- bin_PROGRAMS=h5perf_serial h5perf
-else
- bin_PROGRAMS=h5perf_serial
-endif
-
-# Add h5perf and h5perf_serial specific linker flags here
-h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
-h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
-
# Some programs are not built or run by default, but can be built by hand or by
# specifying --enable-build-all at configure time.
# Also, some of these programs should only be built in parallel.
@@ -47,18 +36,15 @@ endif
# List them in the order they should be run.
# Parallel test programs.
if BUILD_PARALLEL_CONDITIONAL
- TEST_PROG_PARA=h5perf perf
+ TEST_PROG_PARA=
endif
# Serial test programs.
-TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS)
+TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta $(BUILD_ALL_PROGS)
# check_PROGRAMS will be built but not installed. Do not any executable
# that is in bin_PROGRAMS already. Otherwise, it will be removed twice in
# "make clean" and some systems, e.g., AIX, do not like it.
-check_PROGRAMS= iopipe chunk chunk_cache overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf
-
-h5perf_SOURCES=pio_perf.c pio_engine.c
-h5perf_serial_SOURCES=sio_perf.c sio_engine.c
+check_PROGRAMS= $(TEST_PROG) $(BUILD_ALL_PROGS)
# These are the files that `make clean' (and derivatives) will remove from
# this directory.
@@ -67,9 +53,6 @@ CLEANFILES=*.h5 *.raw *.dat x-gnuplot perftest.out
# All of the programs depend on the main hdf5 library, and some of them
# depend on test or tools library.
LDADD=$(LIBHDF5)
-h5perf_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
-h5perf_serial_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
-perf_LDADD=$(LIBH5TEST) $(LIBHDF5)
iopipe_LDADD=$(LIBH5TEST) $(LIBHDF5)
zip_perf_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
perf_meta_LDADD=$(LIBH5TEST) $(LIBHDF5)
diff --git a/tools/test/perform/Makefile.in b/tools/test/perform/Makefile.in
index efd772d..79e8036 100644
--- a/tools/test/perform/Makefile.in
+++ b/tools/test/perform/Makefile.in
@@ -22,13 +22,12 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
# HDF5 Library Performance Makefile(.in)
#
-
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
@@ -103,14 +102,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-@BUILD_PARALLEL_CONDITIONAL_FALSE@bin_PROGRAMS = \
-@BUILD_PARALLEL_CONDITIONAL_FALSE@ h5perf_serial$(EXEEXT)
-@BUILD_PARALLEL_CONDITIONAL_TRUE@bin_PROGRAMS = \
-@BUILD_PARALLEL_CONDITIONAL_TRUE@ h5perf_serial$(EXEEXT) \
-@BUILD_PARALLEL_CONDITIONAL_TRUE@ h5perf$(EXEEXT)
-check_PROGRAMS = iopipe$(EXEEXT) chunk$(EXEEXT) chunk_cache$(EXEEXT) \
- overhead$(EXEEXT) zip_perf$(EXEEXT) perf_meta$(EXEEXT) \
- $(am__EXEEXT_2) perf$(EXEEXT)
+check_PROGRAMS = $(am__EXEEXT_3) $(am__EXEEXT_2)
TESTS = $(am__EXEEXT_3)
subdir = tools/test/perform
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -122,6 +114,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
$(top_srcdir)/m4/ax_check_junit.m4 \
$(top_srcdir)/m4/ax_java_options.m4 \
$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+ $(top_srcdir)/m4/ax_prog_doxygen.m4 \
$(top_srcdir)/m4/ax_prog_jar.m4 \
$(top_srcdir)/m4/ax_prog_java.m4 \
$(top_srcdir)/m4/ax_prog_java_works.m4 \
@@ -140,10 +133,11 @@ CONFIG_HEADER = $(top_builddir)/src/H5config.h \
$(top_builddir)/fortran/src/H5config_f.inc
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
am__EXEEXT_1 =
@BUILD_ALL_CONDITIONAL_TRUE@am__EXEEXT_2 = $(am__EXEEXT_1)
-PROGRAMS = $(bin_PROGRAMS)
+am__EXEEXT_3 = iopipe$(EXEEXT) chunk$(EXEEXT) chunk_cache$(EXEEXT) \
+ overhead$(EXEEXT) zip_perf$(EXEEXT) perf_meta$(EXEEXT) \
+ $(am__EXEEXT_2)
chunk_SOURCES = chunk.c
chunk_OBJECTS = chunk.$(OBJEXT)
chunk_LDADD = $(LDADD)
@@ -156,18 +150,6 @@ chunk_cache_SOURCES = chunk_cache.c
chunk_cache_OBJECTS = chunk_cache.$(OBJEXT)
chunk_cache_LDADD = $(LDADD)
chunk_cache_DEPENDENCIES = $(LIBHDF5)
-am_h5perf_OBJECTS = pio_perf.$(OBJEXT) pio_engine.$(OBJEXT)
-h5perf_OBJECTS = $(am_h5perf_OBJECTS)
-h5perf_DEPENDENCIES = $(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
-h5perf_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(h5perf_LDFLAGS) $(LDFLAGS) -o $@
-am_h5perf_serial_OBJECTS = sio_perf.$(OBJEXT) sio_engine.$(OBJEXT)
-h5perf_serial_OBJECTS = $(am_h5perf_serial_OBJECTS)
-h5perf_serial_DEPENDENCIES = $(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
-h5perf_serial_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(h5perf_serial_LDFLAGS) $(LDFLAGS) -o $@
iopipe_SOURCES = iopipe.c
iopipe_OBJECTS = iopipe.$(OBJEXT)
iopipe_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5)
@@ -175,9 +157,6 @@ overhead_SOURCES = overhead.c
overhead_OBJECTS = overhead.$(OBJEXT)
overhead_LDADD = $(LDADD)
overhead_DEPENDENCIES = $(LIBHDF5)
-perf_SOURCES = perf.c
-perf_OBJECTS = perf.$(OBJEXT)
-perf_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5)
perf_meta_SOURCES = perf_meta.c
perf_meta_OBJECTS = perf_meta.$(OBJEXT)
perf_meta_DEPENDENCIES = $(LIBH5TEST) $(LIBHDF5)
@@ -218,12 +197,10 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = chunk.c chunk_cache.c $(h5perf_SOURCES) \
- $(h5perf_serial_SOURCES) iopipe.c overhead.c perf.c \
- perf_meta.c zip_perf.c
-DIST_SOURCES = chunk.c chunk_cache.c $(h5perf_SOURCES) \
- $(h5perf_serial_SOURCES) iopipe.c overhead.c perf.c \
- perf_meta.c zip_perf.c
+SOURCES = chunk.c chunk_cache.c iopipe.c overhead.c perf_meta.c \
+ zip_perf.c
+DIST_SOURCES = chunk.c chunk_cache.c iopipe.c overhead.c perf_meta.c \
+ zip_perf.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -432,9 +409,6 @@ am__set_TESTS_bases = \
bases=`echo $$bases`
RECHECK_LOGS = $(TEST_LOGS)
AM_RECURSIVE_TARGETS = check recheck
-am__EXEEXT_3 = iopipe$(EXEEXT) chunk$(EXEEXT) chunk_cache$(EXEEXT) \
- overhead$(EXEEXT) zip_perf$(EXEEXT) perf_meta$(EXEEXT) \
- h5perf_serial$(EXEEXT) $(am__EXEEXT_2)
TEST_SUITE_LOG = test-suite.log
LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
@@ -455,7 +429,7 @@ SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/bin/depcomp \
$(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \
- $(top_srcdir)/config/conclude.am COPYING
+ $(top_srcdir)/config/conclude.am
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
@@ -466,10 +440,10 @@ AMTAR = @AMTAR@
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -507,11 +481,56 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
-DEV_WARNINGS = @DEV_WARNINGS@
+DIAGS = @DIAGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
+DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@
+DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@
+DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@
+DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@
+DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@
+DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@
+DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@
+DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@
+DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@
+DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@
+DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@
+DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@
+DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@
+DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@
+DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@
+DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@
+DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@
+DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -543,8 +562,6 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
-H5_ECFLAGS = @H5_ECFLAGS@
-H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_IS_DARWIN = @H5_IS_DARWIN@
@@ -558,7 +575,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
+HDF5_DOXYGEN = @HDF5_DOXYGEN@
HDF5_HL = @HDF5_HL@
+HDF5_HL_TOOLS = @HDF5_HL_TOOLS@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF5_TESTS = @HDF5_TESTS@
HDF5_TOOLS = @HDF5_TOOLS@
@@ -568,6 +587,7 @@ HDF_JAVA = @HDF_JAVA@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
+HL_TOOLS = @HL_TOOLS@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
@@ -761,7 +781,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
+# has been removed. According to the official description of DESTDIR by GNU at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
@@ -789,10 +809,6 @@ TRACE = perl $(top_srcdir)/bin/trace
# *.clog and *.clog2 are from the MPE option.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
-# Add h5perf and h5perf_serial specific linker flags here
-h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
-h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
-
# Some programs are not built or run by default, but can be built by hand or by
# specifying --enable-build-all at configure time.
# Also, some of these programs should only be built in parallel.
@@ -803,11 +819,9 @@ h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Define programs that will be run in 'make check'
# List them in the order they should be run.
# Parallel test programs.
-@BUILD_PARALLEL_CONDITIONAL_TRUE@TEST_PROG_PARA = h5perf perf
+@BUILD_PARALLEL_CONDITIONAL_TRUE@TEST_PROG_PARA =
# Serial test programs.
-TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS)
-h5perf_SOURCES = pio_perf.c pio_engine.c
-h5perf_serial_SOURCES = sio_perf.c sio_engine.c
+TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta $(BUILD_ALL_PROGS)
# These are the files that `make clean' (and derivatives) will remove from
# this directory.
@@ -816,9 +830,6 @@ CLEANFILES = *.h5 *.raw *.dat x-gnuplot perftest.out
# All of the programs depend on the main hdf5 library, and some of them
# depend on test or tools library.
LDADD = $(LIBHDF5)
-h5perf_LDADD = $(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
-h5perf_serial_LDADD = $(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
-perf_LDADD = $(LIBH5TEST) $(LIBHDF5)
iopipe_LDADD = $(LIBH5TEST) $(LIBHDF5)
zip_perf_LDADD = $(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
perf_meta_LDADD = $(LIBH5TEST) $(LIBHDF5)
@@ -877,55 +888,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
-install-binPROGRAMS: $(bin_PROGRAMS)
- @$(NORMAL_INSTALL)
- @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
- fi; \
- for p in $$list; do echo "$$p $$p"; done | \
- sed 's/$(EXEEXT)$$//' | \
- while read p p1; do if test -f $$p \
- || test -f $$p1 \
- ; then echo "$$p"; echo "$$p"; else :; fi; \
- done | \
- sed -e 'p;s,.*/,,;n;h' \
- -e 's|.*|.|' \
- -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
- sed 'N;N;N;s,\n, ,g' | \
- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
- { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
- if ($$2 == $$4) files[d] = files[d] " " $$1; \
- else { print "f", $$3 "/" $$4, $$1; } } \
- END { for (d in files) print "f", d, files[d] }' | \
- while read type dir files; do \
- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- test -z "$$files" || { \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
- } \
- ; done
-
-uninstall-binPROGRAMS:
- @$(NORMAL_UNINSTALL)
- @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
- files=`for p in $$list; do echo "$$p"; done | \
- sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
- -e 's/$$/$(EXEEXT)/' \
- `; \
- test -n "$$list" || exit 0; \
- echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
- @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -944,14 +906,6 @@ chunk_cache$(EXEEXT): $(chunk_cache_OBJECTS) $(chunk_cache_DEPENDENCIES) $(EXTRA
@rm -f chunk_cache$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(chunk_cache_OBJECTS) $(chunk_cache_LDADD) $(LIBS)
-h5perf$(EXEEXT): $(h5perf_OBJECTS) $(h5perf_DEPENDENCIES) $(EXTRA_h5perf_DEPENDENCIES)
- @rm -f h5perf$(EXEEXT)
- $(AM_V_CCLD)$(h5perf_LINK) $(h5perf_OBJECTS) $(h5perf_LDADD) $(LIBS)
-
-h5perf_serial$(EXEEXT): $(h5perf_serial_OBJECTS) $(h5perf_serial_DEPENDENCIES) $(EXTRA_h5perf_serial_DEPENDENCIES)
- @rm -f h5perf_serial$(EXEEXT)
- $(AM_V_CCLD)$(h5perf_serial_LINK) $(h5perf_serial_OBJECTS) $(h5perf_serial_LDADD) $(LIBS)
-
iopipe$(EXEEXT): $(iopipe_OBJECTS) $(iopipe_DEPENDENCIES) $(EXTRA_iopipe_DEPENDENCIES)
@rm -f iopipe$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(iopipe_OBJECTS) $(iopipe_LDADD) $(LIBS)
@@ -960,10 +914,6 @@ overhead$(EXEEXT): $(overhead_OBJECTS) $(overhead_DEPENDENCIES) $(EXTRA_overhead
@rm -f overhead$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(overhead_OBJECTS) $(overhead_LDADD) $(LIBS)
-perf$(EXEEXT): $(perf_OBJECTS) $(perf_DEPENDENCIES) $(EXTRA_perf_DEPENDENCIES)
- @rm -f perf$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(perf_OBJECTS) $(perf_LDADD) $(LIBS)
-
perf_meta$(EXEEXT): $(perf_meta_OBJECTS) $(perf_meta_DEPENDENCIES) $(EXTRA_perf_meta_DEPENDENCIES)
@rm -f perf_meta$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(perf_meta_OBJECTS) $(perf_meta_LDADD) $(LIBS)
@@ -982,12 +932,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunk_cache.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iopipe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/overhead.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf_meta.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_engine.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_perf.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio_engine.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio_perf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_perf.Po@am__quote@
.c.o:
@@ -1244,13 +1189,6 @@ perf_meta.log: perf_meta$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
-h5perf_serial.log: h5perf_serial$(EXEEXT)
- @p='h5perf_serial$(EXEEXT)'; \
- b='h5perf_serial'; \
- $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
- --log-file $$b.log --trs-file $$b.trs \
- $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
- "$$tst" $(AM_TESTS_FD_REDIRECT)
.sh.log:
@p='$<'; \
$(am__set_b); \
@@ -1300,11 +1238,8 @@ check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
-all-am: Makefile $(PROGRAMS) all-local
+all-am: Makefile all-local
installdirs:
- for dir in "$(DESTDIR)$(bindir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@@ -1341,8 +1276,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
- clean-libtool mostlyclean-am
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -1368,7 +1303,7 @@ install-dvi: install-dvi-am
install-dvi-am:
-install-exec-am: install-binPROGRAMS
+install-exec-am:
install-html: install-html-am
@@ -1408,16 +1343,15 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-binPROGRAMS
+uninstall-am:
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \
- check-am clean clean-binPROGRAMS clean-checkPROGRAMS \
- clean-generic clean-libtool cscopelist-am ctags ctags-am \
- distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-binPROGRAMS \
+ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
@@ -1425,8 +1359,7 @@ uninstall-am: uninstall-binPROGRAMS
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
- pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am \
- uninstall-binPROGRAMS
+ pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
@@ -1436,8 +1369,9 @@ uninstall-am: uninstall-binPROGRAMS
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
- build-tests check-clean check-install check-p check-s check-vfd \
- install-doc lib progs tests uninstall-doc _exec_check-s _test help
+ build-tests check-clean check-install check-p check-s check-vfd \
+ install-doc lib progs tests uninstall-doc \
+ _exec_check-s _test help trace doxygen
help:
@$(top_srcdir)/bin/makehelp
diff --git a/tools/test/perform/build_h5perf_alone.sh b/tools/test/perform/build_h5perf_alone.sh
index 30d272f..95a437b 100644
--- a/tools/test/perform/build_h5perf_alone.sh
+++ b/tools/test/perform/build_h5perf_alone.sh
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/perform/build_h5perf_serial_alone.sh b/tools/test/perform/build_h5perf_serial_alone.sh
index 099e7f9..d2a0660 100644
--- a/tools/test/perform/build_h5perf_serial_alone.sh
+++ b/tools/test/perform/build_h5perf_serial_alone.sh
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c
index bd16e1d..1b6793a 100644
--- a/tools/test/perform/chunk.c
+++ b/tools/test/perform/chunk.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -25,73 +25,70 @@
#include "hdf5.h"
#ifdef H5_STDC_HEADERS
-# include <assert.h>
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#endif
/* Solaris Studio defines attribute, but for the attributes we need */
#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus || defined(__SUNPRO_C)
-# undef __attribute__
-# define __attribute__(X) /*void*/
-# define H5_ATTR_UNUSED /*void*/
+#undef __attribute__
+#define __attribute__(X) /*void*/
+#define H5_ATTR_UNUSED /*void*/
#else
-# define H5_ATTR_UNUSED __attribute__((unused))
+#define H5_ATTR_UNUSED __attribute__((unused))
#endif
-#define FILE_NAME "chunk.h5"
-#define LINESPOINTS "lines"
-#define CH_SIZE 100 /*squared in terms of bytes */
-#define DS_SIZE 20 /*squared in terms of chunks */
-#define FILTER_COUNTER 305
-#define READ 0
-#define WRITE 1
-#define MIN(X,Y) ((X)<(Y)?(X):(Y))
-#define MAX(X,Y) ((X)>(Y)?(X):(Y))
-#define SQUARE(X) ((X)*(X))
+#define FILE_NAME "chunk.h5"
+#define LINESPOINTS "lines"
+#define CH_SIZE 100 /*squared in terms of bytes */
+#define DS_SIZE 20 /*squared in terms of chunks */
+#define FILTER_COUNTER 305
+#define READ 0
+#define WRITE 1
+#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
+#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
+#define SQUARE(X) ((X) * (X))
/* The row-major test */
-#define RM_CACHE_STRT 25
-#define RM_CACHE_END 25
-#define RM_CACHE_DELT 5
-#define RM_START (double)0.50F
-#define RM_END (double)5.00F
-#define RM_DELTA (double)0.50F
-#define RM_W0 0.0F
-#define RM_NRDCC 521
+#define RM_CACHE_STRT 25
+#define RM_CACHE_END 25
+#define RM_CACHE_DELT 5
+#define RM_START 0.50
+#define RM_END 5.00
+#define RM_DELTA 0.50
+#define RM_W0 0.0
+#define RM_NRDCC 521
/* Diagonal test */
-#define DIAG_CACHE_STRT 25
-#define DIAG_CACHE_END 25
-#define DIAG_CACHE_DELT 5
-#define DIAG_START (double)0.50F
-#define DIAG_END (double)5.00F
-#define DIAG_DELTA (double)0.50F
-/* #define DIAG_W0 0.65F */
+#define DIAG_CACHE_STRT 25
+#define DIAG_CACHE_END 25
+#define DIAG_CACHE_DELT 5
+#define DIAG_START 0.50
+#define DIAG_END 5.00
+#define DIAG_DELTA 0.50
+/* #define DIAG_W0 0.65 */
/* #define DIAG_NRDCC 521 */
-static size_t nio_g;
-static hid_t fapl_g = H5I_INVALID_HID;
+static size_t nio_g;
+static hid_t fapl_g = H5I_INVALID_HID;
/* Local function prototypes */
-static size_t
-counter (unsigned H5_ATTR_UNUSED flags, size_t cd_nelmts,
- const unsigned *cd_values, size_t nbytes,
- size_t *buf_size, void **buf);
+static size_t counter(unsigned H5_ATTR_UNUSED flags, size_t cd_nelmts, const unsigned *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_COUNTER[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- FILTER_COUNTER, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "counter", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- counter, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER_COUNTER, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "counter", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ counter, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: counter
*
@@ -109,15 +106,14 @@ const H5Z_class2_t H5Z_COUNTER[1] = {{
*-------------------------------------------------------------------------
*/
static size_t
-counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+counter(unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
+ const unsigned H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
+ void H5_ATTR_UNUSED **buf)
{
nio_g += nbytes;
return nbytes;
}
-
/*-------------------------------------------------------------------------
* Function: create_dataset
*
@@ -136,21 +132,21 @@ counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
*-------------------------------------------------------------------------
*/
static void
-create_dataset (void)
+create_dataset(void)
{
- hid_t file, space, dcpl, dset;
- hsize_t size[2];
- signed char *buf;
+ hid_t file, space, dcpl, dset;
+ hsize_t size[2];
+ signed char *buf;
/* The file */
- file = H5Fcreate (FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_g);
+ file = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_g);
/* The data space */
size[0] = size[1] = DS_SIZE * CH_SIZE;
- space = H5Screate_simple(2, size, size);
+ space = H5Screate_simple(2, size, size);
/* The storage layout and compression */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
size[0] = size[1] = CH_SIZE;
H5Pset_chunk(dcpl, 2, size);
H5Zregister(H5Z_COUNTER);
@@ -158,10 +154,10 @@ create_dataset (void)
/* The dataset */
dset = H5Dcreate2(file, "dset", H5T_NATIVE_SCHAR, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- assert(dset>=0);
+ assert(dset >= 0);
/* The data */
- buf = (signed char *)calloc(1, SQUARE (DS_SIZE*CH_SIZE));
+ buf = (signed char *)calloc(1, SQUARE(DS_SIZE * CH_SIZE));
H5Dwrite(dset, H5T_NATIVE_SCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
free(buf);
@@ -172,7 +168,6 @@ create_dataset (void)
H5Fclose(file);
}
-
/*-------------------------------------------------------------------------
* Function: test_rowmaj
*
@@ -189,64 +184,60 @@ create_dataset (void)
*-------------------------------------------------------------------------
*/
static double
-test_rowmaj (int op, size_t cache_size, size_t io_size)
+test_rowmaj(int op, size_t cache_size, size_t io_size)
{
- hid_t file, dset, mem_space, file_space;
- signed char *buf = (signed char *)calloc (1, (size_t)(SQUARE(io_size)));
- hsize_t i, j, hs_size[2];
- hsize_t hs_offset[2];
- int mdc_nelmts;
- size_t rdcc_nelmts;
- double w0;
-
- H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0);
+ hid_t file, dset, mem_space, file_space;
+ signed char *buf = (signed char *)calloc(1, (size_t)(SQUARE(io_size)));
+ hsize_t i, j, hs_size[2];
+ hsize_t hs_offset[2];
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ double w0;
+
+ H5Pget_cache(fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0);
#ifdef RM_W0
w0 = RM_W0;
#endif
#ifdef RM_NRDCC
rdcc_nelmts = RM_NRDCC;
#endif
- H5Pset_cache (fapl_g, mdc_nelmts, rdcc_nelmts,
- cache_size*SQUARE (CH_SIZE), w0);
- file = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_g);
- dset = H5Dopen2(file, "dset", H5P_DEFAULT);
+ H5Pset_cache(fapl_g, mdc_nelmts, rdcc_nelmts, cache_size * SQUARE(CH_SIZE), w0);
+ file = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_g);
+ dset = H5Dopen2(file, "dset", H5P_DEFAULT);
file_space = H5Dget_space(dset);
- nio_g = 0;
+ nio_g = 0;
- for (i=0; i<CH_SIZE*DS_SIZE; i+=io_size) {
+ for (i = 0; i < CH_SIZE * DS_SIZE; i += io_size) {
#if 0
fprintf (stderr, "%5d\b\b\b\b\b", (int)i);
fflush (stderr);
#endif
- for (j=0; j<CH_SIZE*DS_SIZE; j+=io_size) {
- hs_offset[0] = i;
- hs_size[0] = MIN (io_size, CH_SIZE*DS_SIZE-i);
- hs_offset[1] = j;
- hs_size[1] = MIN (io_size, CH_SIZE*DS_SIZE-j);
- mem_space = H5Screate_simple (2, hs_size, hs_size);
- H5Sselect_hyperslab (file_space, H5S_SELECT_SET, hs_offset,
- NULL, hs_size, NULL);
-
- if (READ==op) {
- H5Dread (dset, H5T_NATIVE_SCHAR, mem_space, file_space,
- H5P_DEFAULT, buf);
- } else {
- H5Dwrite (dset, H5T_NATIVE_SCHAR, mem_space, file_space,
- H5P_DEFAULT, buf);
- }
- H5Sclose (mem_space);
- }
+ for (j = 0; j < CH_SIZE * DS_SIZE; j += io_size) {
+ hs_offset[0] = i;
+ hs_size[0] = MIN(io_size, CH_SIZE * DS_SIZE - i);
+ hs_offset[1] = j;
+ hs_size[1] = MIN(io_size, CH_SIZE * DS_SIZE - j);
+ mem_space = H5Screate_simple(2, hs_size, hs_size);
+ H5Sselect_hyperslab(file_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL);
+
+ if (READ == op) {
+ H5Dread(dset, H5T_NATIVE_SCHAR, mem_space, file_space, H5P_DEFAULT, buf);
+ }
+ else {
+ H5Dwrite(dset, H5T_NATIVE_SCHAR, mem_space, file_space, H5P_DEFAULT, buf);
+ }
+ H5Sclose(mem_space);
+ }
}
- free (buf);
- H5Sclose (file_space);
- H5Dclose (dset);
- H5Fclose (file);
+ free(buf);
+ H5Sclose(file_space);
+ H5Dclose(dset);
+ H5Fclose(file);
- return (double)SQUARE(CH_SIZE*DS_SIZE)/(double)nio_g;
+ return (double)SQUARE(CH_SIZE * DS_SIZE) / (double)nio_g;
}
-
/*-------------------------------------------------------------------------
* Function: test_diag
*
@@ -265,63 +256,60 @@ test_rowmaj (int op, size_t cache_size, size_t io_size)
*-------------------------------------------------------------------------
*/
static double
-test_diag (int op, size_t cache_size, size_t io_size, size_t offset)
+test_diag(int op, size_t cache_size, size_t io_size, size_t offset)
{
- hid_t file, dset, mem_space, file_space;
- hsize_t i, hs_size[2];
- hsize_t nio = 0;
- hsize_t hs_offset[2];
- signed char *buf = (signed char *)calloc(1, (size_t)(SQUARE (io_size)));
- int mdc_nelmts;
- size_t rdcc_nelmts;
- double w0;
-
- H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0);
+ hid_t file, dset, mem_space, file_space;
+ hsize_t i, hs_size[2];
+ hsize_t nio = 0;
+ hsize_t hs_offset[2];
+ signed char *buf = (signed char *)calloc(1, (size_t)(SQUARE(io_size)));
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ double w0;
+
+ H5Pget_cache(fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0);
#ifdef DIAG_W0
w0 = DIAG_W0;
#endif
#ifdef DIAG_NRDCC
rdcc_nelmts = DIAG_NRDCC;
#endif
- H5Pset_cache (fapl_g, mdc_nelmts, rdcc_nelmts,
- cache_size*SQUARE (CH_SIZE), w0);
- file = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_g);
- dset = H5Dopen2(file, "dset", H5P_DEFAULT);
+ H5Pset_cache(fapl_g, mdc_nelmts, rdcc_nelmts, cache_size * SQUARE(CH_SIZE), w0);
+ file = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_g);
+ dset = H5Dopen2(file, "dset", H5P_DEFAULT);
file_space = H5Dget_space(dset);
- nio_g = 0;
-
- for (i=0, hs_size[0]=io_size; hs_size[0]==io_size; i+=offset) {
- hs_offset[0] = hs_offset[1] = i;
- hs_size[0] = hs_size[1] = MIN (io_size, CH_SIZE*DS_SIZE-i);
- mem_space = H5Screate_simple (2, hs_size, hs_size);
- H5Sselect_hyperslab (file_space, H5S_SELECT_SET, hs_offset, NULL,
- hs_size, NULL);
- if (READ==op) {
- H5Dread (dset, H5T_NATIVE_SCHAR, mem_space, file_space,
- H5P_DEFAULT, buf);
- } else {
- H5Dwrite (dset, H5T_NATIVE_SCHAR, mem_space, file_space,
- H5P_DEFAULT, buf);
- }
- H5Sclose (mem_space);
- nio += hs_size[0]*hs_size[1];
- if (i>0) nio -= SQUARE (io_size-offset);
+ nio_g = 0;
+
+ for (i = 0, hs_size[0] = io_size; hs_size[0] == io_size; i += offset) {
+ hs_offset[0] = hs_offset[1] = i;
+ hs_size[0] = hs_size[1] = MIN(io_size, CH_SIZE * DS_SIZE - i);
+ mem_space = H5Screate_simple(2, hs_size, hs_size);
+ H5Sselect_hyperslab(file_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL);
+ if (READ == op) {
+ H5Dread(dset, H5T_NATIVE_SCHAR, mem_space, file_space, H5P_DEFAULT, buf);
+ }
+ else {
+ H5Dwrite(dset, H5T_NATIVE_SCHAR, mem_space, file_space, H5P_DEFAULT, buf);
+ }
+ H5Sclose(mem_space);
+ nio += hs_size[0] * hs_size[1];
+ if (i > 0)
+ nio -= SQUARE(io_size - offset);
}
- free (buf);
- H5Sclose (file_space);
- H5Dclose (dset);
- H5Fclose (file);
+ free(buf);
+ H5Sclose(file_space);
+ H5Dclose(dset);
+ H5Fclose(file);
/*
* The extra cast in the following statement is a bug workaround for the
* Win32 version 5.0 compiler.
* 1998-11-06 ptl
*/
- return (double)nio/(double)nio_g;
+ return (double)nio / (double)nio_g;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -339,25 +327,25 @@ test_diag (int op, size_t cache_size, size_t io_size, size_t offset)
*-------------------------------------------------------------------------
*/
int
-main (void)
+main(void)
{
- size_t io_size;
- double effic, io_percent;
- FILE *f, *d;
- size_t cache_size;
- double w0;
+ size_t io_size;
+ double effic, io_percent;
+ FILE * f, *d;
+ size_t cache_size;
+ double w0;
/*
* Create a global file access property list.
*/
- fapl_g = H5Pcreate (H5P_FILE_ACCESS);
- H5Pget_cache (fapl_g, NULL, NULL, NULL, &w0);
+ fapl_g = H5Pcreate(H5P_FILE_ACCESS);
+ H5Pget_cache(fapl_g, NULL, NULL, NULL, &w0);
/* Create the file */
- create_dataset ();
- f = fopen ("x-gnuplot", "w");
+ create_dataset();
+ f = fopen("x-gnuplot", "w");
- printf("Test %8s %8s %8s\n", "CacheSz", "ChunkSz", "Effic");
+ printf("Test %8s %8s %8s\n", "CacheSz", "ChunkSz", "Effic");
printf("--------- -------- -------- --------\n");
#if 1
@@ -365,45 +353,44 @@ main (void)
* Test row-major reading of the dataset with various sizes of request
* windows.
*/
- if (RM_CACHE_STRT==RM_CACHE_END) {
- fprintf (f, "set yrange [0:1.2]\n");
- fprintf (f, "set ytics 0, 0.1, 1\n");
- fprintf (f, "set xlabel \"%s\"\n",
- "Request size as a fraction of chunk size");
- fprintf (f, "set ylabel \"Efficiency\"\n");
- fprintf (f, "set title \"Cache %d chunks, w0=%g, "
- "Size=(total=%d, chunk=%d)\"\n",
- RM_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE);
- } else {
- fprintf (f, "set autoscale\n");
- fprintf (f, "set hidden3d\n");
+ if (RM_CACHE_STRT == RM_CACHE_END) {
+ fprintf(f, "set yrange [0:1.2]\n");
+ fprintf(f, "set ytics 0, 0.1, 1\n");
+ fprintf(f, "set xlabel \"%s\"\n", "Request size as a fraction of chunk size");
+ fprintf(f, "set ylabel \"Efficiency\"\n");
+ fprintf(f,
+ "set title \"Cache %d chunks, w0=%g, "
+ "Size=(total=%d, chunk=%d)\"\n",
+ RM_CACHE_STRT, w0, DS_SIZE * CH_SIZE, CH_SIZE);
+ }
+ else {
+ fprintf(f, "set autoscale\n");
+ fprintf(f, "set hidden3d\n");
}
- fprintf (f, "set terminal postscript\nset output \"x-rowmaj-rd.ps\"\n");
- fprintf (f, "%s \"x-rowmaj-rd.dat\" title \"RowMaj-Read\" with %s\n",
- RM_CACHE_STRT==RM_CACHE_END?"plot":"splot",
- LINESPOINTS);
- fprintf (f, "set terminal x11\nreplot\n");
- d = fopen ("x-rowmaj-rd.dat", "w");
- for (cache_size=RM_CACHE_STRT;
- cache_size<=RM_CACHE_END;
- cache_size+=RM_CACHE_DELT) {
- for (io_percent=RM_START; io_percent<=RM_END; io_percent+=RM_DELTA) {
- io_size = MAX (1, (size_t)(CH_SIZE*io_percent));
- printf ("Rowmaj-rd %8d %8.2f", (int)cache_size, io_percent);
- fflush (stdout);
- effic = test_rowmaj (READ, cache_size, io_size);
- printf (" %8.2f\n", effic);
- if (RM_CACHE_STRT==RM_CACHE_END) {
- fprintf (d, "%g %g\n", io_percent, effic);
- } else {
- fprintf (d, "%g\n", effic);
- }
- }
- fprintf (d, "\n");
+ fprintf(f, "set terminal postscript\nset output \"x-rowmaj-rd.ps\"\n");
+ fprintf(f, "%s \"x-rowmaj-rd.dat\" title \"RowMaj-Read\" with %s\n",
+ RM_CACHE_STRT == RM_CACHE_END ? "plot" : "splot", LINESPOINTS);
+ fprintf(f, "set terminal x11\nreplot\n");
+ d = fopen("x-rowmaj-rd.dat", "w");
+ for (cache_size = RM_CACHE_STRT; cache_size <= RM_CACHE_END; cache_size += RM_CACHE_DELT) {
+ for (io_percent = RM_START; io_percent <= RM_END; io_percent += RM_DELTA) {
+ io_size = MAX(1, (size_t)(CH_SIZE * io_percent));
+ printf("Rowmaj-rd %8d %8.2f", (int)cache_size, io_percent);
+ fflush(stdout);
+ effic = test_rowmaj(READ, cache_size, io_size);
+ printf(" %8.2f\n", effic);
+ if (RM_CACHE_STRT == RM_CACHE_END) {
+ fprintf(d, "%g %g\n", io_percent, effic);
+ }
+ else {
+ fprintf(d, "%g\n", effic);
+ }
+ }
+ fprintf(d, "\n");
}
- fclose (d);
- fprintf (f, "pause -1\n");
+ fclose(d);
+ fprintf(f, "pause -1\n");
#endif
#if 1
@@ -411,138 +398,133 @@ main (void)
* Test row-major writing of the dataset with various sizes of request
* windows.
*/
- if (RM_CACHE_STRT==RM_CACHE_END) {
- fprintf (f, "set yrange [0:1.2]\n");
- fprintf (f, "set ytics 0, 0.1, 1\n");
- fprintf (f, "set xlabel \"%s\"\n",
- "Request size as a fraction of chunk size");
- fprintf (f, "set ylabel \"Efficiency\"\n");
- fprintf (f, "set title \"Cache %d chunks,w0=%g, "
- "Size=(total=%d, chunk=%d)\"\n",
- RM_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE);
- } else {
- fprintf (f, "set autoscale\n");
- fprintf (f, "set hidden3d\n");
+ if (RM_CACHE_STRT == RM_CACHE_END) {
+ fprintf(f, "set yrange [0:1.2]\n");
+ fprintf(f, "set ytics 0, 0.1, 1\n");
+ fprintf(f, "set xlabel \"%s\"\n", "Request size as a fraction of chunk size");
+ fprintf(f, "set ylabel \"Efficiency\"\n");
+ fprintf(f,
+ "set title \"Cache %d chunks,w0=%g, "
+ "Size=(total=%d, chunk=%d)\"\n",
+ RM_CACHE_STRT, w0, DS_SIZE * CH_SIZE, CH_SIZE);
+ }
+ else {
+ fprintf(f, "set autoscale\n");
+ fprintf(f, "set hidden3d\n");
}
- fprintf (f, "set terminal postscript\nset output \"x-rowmaj-wr.ps\"\n");
- fprintf (f, "%s \"x-rowmaj-wr.dat\" title \"RowMaj-Write\" with %s\n",
- RM_CACHE_STRT==RM_CACHE_END?"plot":"splot",
- LINESPOINTS);
- fprintf (f, "set terminal x11\nreplot\n");
- d = fopen ("x-rowmaj-wr.dat", "w");
- for (cache_size=RM_CACHE_STRT;
- cache_size<=RM_CACHE_END;
- cache_size+=RM_CACHE_DELT) {
- for (io_percent=RM_START; io_percent<=RM_END; io_percent+=RM_DELTA) {
- io_size = MAX (1, (size_t)(CH_SIZE*io_percent));
- printf ("Rowmaj-wr %8d %8.2f", (int)cache_size, io_percent);
- fflush (stdout);
- effic = test_rowmaj (WRITE, cache_size, io_size);
- printf (" %8.2f\n", effic);
- if (RM_CACHE_STRT==RM_CACHE_END) {
- fprintf (d, "%g %g\n", io_percent, effic);
- } else {
- fprintf (d, "%g\n", effic);
- }
- }
- fprintf (d, "\n");
+ fprintf(f, "set terminal postscript\nset output \"x-rowmaj-wr.ps\"\n");
+ fprintf(f, "%s \"x-rowmaj-wr.dat\" title \"RowMaj-Write\" with %s\n",
+ RM_CACHE_STRT == RM_CACHE_END ? "plot" : "splot", LINESPOINTS);
+ fprintf(f, "set terminal x11\nreplot\n");
+ d = fopen("x-rowmaj-wr.dat", "w");
+ for (cache_size = RM_CACHE_STRT; cache_size <= RM_CACHE_END; cache_size += RM_CACHE_DELT) {
+ for (io_percent = RM_START; io_percent <= RM_END; io_percent += RM_DELTA) {
+ io_size = MAX(1, (size_t)(CH_SIZE * io_percent));
+ printf("Rowmaj-wr %8d %8.2f", (int)cache_size, io_percent);
+ fflush(stdout);
+ effic = test_rowmaj(WRITE, cache_size, io_size);
+ printf(" %8.2f\n", effic);
+ if (RM_CACHE_STRT == RM_CACHE_END) {
+ fprintf(d, "%g %g\n", io_percent, effic);
+ }
+ else {
+ fprintf(d, "%g\n", effic);
+ }
+ }
+ fprintf(d, "\n");
}
- fclose (d);
- fprintf (f, "pause -1\n");
+ fclose(d);
+ fprintf(f, "pause -1\n");
#endif
#if 1
/*
* Test diagonal read
*/
- if (DIAG_CACHE_STRT==DIAG_CACHE_END) {
- fprintf (f, "set yrange [0:1.2]\n");
- fprintf (f, "set ytics 0, 0.1, 1\n");
- fprintf (f, "set xlabel \"%s\"\n",
- "Request size as a fraction of chunk size");
- fprintf (f, "set ylabel \"Efficiency\"\n");
- fprintf (f, "set title \"Cache %d chunks,w0=%g, "
- "Size=(total=%d, chunk=%d)\"\n",
- DIAG_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE);
- } else {
- fprintf (f, "set autoscale\n");
- fprintf (f, "set hidden3d\n");
+ if (DIAG_CACHE_STRT == DIAG_CACHE_END) {
+ fprintf(f, "set yrange [0:1.2]\n");
+ fprintf(f, "set ytics 0, 0.1, 1\n");
+ fprintf(f, "set xlabel \"%s\"\n", "Request size as a fraction of chunk size");
+ fprintf(f, "set ylabel \"Efficiency\"\n");
+ fprintf(f,
+ "set title \"Cache %d chunks,w0=%g, "
+ "Size=(total=%d, chunk=%d)\"\n",
+ DIAG_CACHE_STRT, w0, DS_SIZE * CH_SIZE, CH_SIZE);
+ }
+ else {
+ fprintf(f, "set autoscale\n");
+ fprintf(f, "set hidden3d\n");
}
- fprintf (f, "set terminal postscript\nset output \"x-diag-rd.ps\"\n");
- fprintf (f, "%s \"x-diag-rd.dat\" title \"Diag-Read\" with %s\n",
- DIAG_CACHE_STRT==DIAG_CACHE_END?"plot":"splot", LINESPOINTS);
- fprintf (f, "set terminal x11\nreplot\n");
- d = fopen ("x-diag-rd.dat", "w");
- for (cache_size=DIAG_CACHE_STRT;
- cache_size<=DIAG_CACHE_END;
- cache_size+=DIAG_CACHE_DELT) {
- for (io_percent=DIAG_START; io_percent<=DIAG_END; io_percent+=DIAG_DELTA) {
- io_size = MAX (1, (size_t)(CH_SIZE*io_percent));
- printf ("Diag-rd %8d %8.2f", (int)cache_size, io_percent);
- fflush (stdout);
- effic = test_diag (READ, cache_size, io_size, MAX (1, io_size/2));
- printf (" %8.2f\n", effic);
- if (DIAG_CACHE_STRT==DIAG_CACHE_END) {
- fprintf (d, "%g %g\n", io_percent, effic);
- } else {
- fprintf (d, "%g\n", effic);
- }
- }
- fprintf (d, "\n");
+ fprintf(f, "set terminal postscript\nset output \"x-diag-rd.ps\"\n");
+ fprintf(f, "%s \"x-diag-rd.dat\" title \"Diag-Read\" with %s\n",
+ DIAG_CACHE_STRT == DIAG_CACHE_END ? "plot" : "splot", LINESPOINTS);
+ fprintf(f, "set terminal x11\nreplot\n");
+ d = fopen("x-diag-rd.dat", "w");
+ for (cache_size = DIAG_CACHE_STRT; cache_size <= DIAG_CACHE_END; cache_size += DIAG_CACHE_DELT) {
+ for (io_percent = DIAG_START; io_percent <= DIAG_END; io_percent += DIAG_DELTA) {
+ io_size = MAX(1, (size_t)(CH_SIZE * io_percent));
+ printf("Diag-rd %8d %8.2f", (int)cache_size, io_percent);
+ fflush(stdout);
+ effic = test_diag(READ, cache_size, io_size, MAX(1, io_size / 2));
+ printf(" %8.2f\n", effic);
+ if (DIAG_CACHE_STRT == DIAG_CACHE_END) {
+ fprintf(d, "%g %g\n", io_percent, effic);
+ }
+ else {
+ fprintf(d, "%g\n", effic);
+ }
+ }
+ fprintf(d, "\n");
}
- fclose (d);
- fprintf (f, "pause -1\n");
+ fclose(d);
+ fprintf(f, "pause -1\n");
#endif
#if 1
/*
* Test diagonal write
*/
- if (DIAG_CACHE_STRT==DIAG_CACHE_END) {
- fprintf (f, "set yrange [0:1.2]\n");
- fprintf (f, "set ytics 0, 0.1, 1\n");
- fprintf (f, "set xlabel \"%s\"\n",
- "Request size as a fraction of chunk size");
- fprintf (f, "set ylabel \"Efficiency\"\n");
- fprintf (f, "set title \"Cache %d chunks, w0=%g, "
- "Size=(total=%d, chunk=%d)\"\n",
- DIAG_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE);
- } else {
- fprintf (f, "set autoscale\n");
- fprintf (f, "set hidden3d\n");
+ if (DIAG_CACHE_STRT == DIAG_CACHE_END) {
+ fprintf(f, "set yrange [0:1.2]\n");
+ fprintf(f, "set ytics 0, 0.1, 1\n");
+ fprintf(f, "set xlabel \"%s\"\n", "Request size as a fraction of chunk size");
+ fprintf(f, "set ylabel \"Efficiency\"\n");
+ fprintf(f,
+ "set title \"Cache %d chunks, w0=%g, "
+ "Size=(total=%d, chunk=%d)\"\n",
+ DIAG_CACHE_STRT, w0, DS_SIZE * CH_SIZE, CH_SIZE);
}
- fprintf (f, "set terminal postscript\nset output \"x-diag-wr.ps\"\n");
- fprintf (f, "%s \"x-diag-wr.dat\" title \"Diag-Write\" with %s\n",
- DIAG_CACHE_STRT==DIAG_CACHE_END?"plot":"splot", LINESPOINTS);
- fprintf (f, "set terminal x11\nreplot\n");
- d = fopen ("x-diag-wr.dat", "w");
- for (cache_size=DIAG_CACHE_STRT;
- cache_size<=DIAG_CACHE_END;
- cache_size+=DIAG_CACHE_DELT) {
- for (io_percent=DIAG_START;
- io_percent<=DIAG_END;
- io_percent+=DIAG_DELTA) {
- io_size = MAX (1, (size_t)(CH_SIZE*io_percent));
- printf ("Diag-wr %8d %8.2f", (int)cache_size, io_percent);
- fflush (stdout);
- effic = test_diag (WRITE, cache_size, io_size, MAX (1, io_size/2));
- printf (" %8.2f\n", effic);
- if (DIAG_CACHE_STRT==DIAG_CACHE_END) {
- fprintf (d, "%g %g\n", io_percent, effic);
- } else {
- fprintf (d, "%g\n", effic);
- }
- }
- fprintf (d, "\n");
+ else {
+ fprintf(f, "set autoscale\n");
+ fprintf(f, "set hidden3d\n");
}
- fclose (d);
- fprintf (f, "pause -1\n");
+ fprintf(f, "set terminal postscript\nset output \"x-diag-wr.ps\"\n");
+ fprintf(f, "%s \"x-diag-wr.dat\" title \"Diag-Write\" with %s\n",
+ DIAG_CACHE_STRT == DIAG_CACHE_END ? "plot" : "splot", LINESPOINTS);
+ fprintf(f, "set terminal x11\nreplot\n");
+ d = fopen("x-diag-wr.dat", "w");
+ for (cache_size = DIAG_CACHE_STRT; cache_size <= DIAG_CACHE_END; cache_size += DIAG_CACHE_DELT) {
+ for (io_percent = DIAG_START; io_percent <= DIAG_END; io_percent += DIAG_DELTA) {
+ io_size = MAX(1, (size_t)(CH_SIZE * io_percent));
+ printf("Diag-wr %8d %8.2f", (int)cache_size, io_percent);
+ fflush(stdout);
+ effic = test_diag(WRITE, cache_size, io_size, MAX(1, io_size / 2));
+ printf(" %8.2f\n", effic);
+ if (DIAG_CACHE_STRT == DIAG_CACHE_END) {
+ fprintf(d, "%g %g\n", io_percent, effic);
+ }
+ else {
+ fprintf(d, "%g\n", effic);
+ }
+ }
+ fprintf(d, "\n");
+ }
+ fclose(d);
+ fprintf(f, "pause -1\n");
#endif
-
- H5Pclose (fapl_g);
- fclose (f);
+ H5Pclose(fapl_g);
+ fclose(f);
return 0;
}
-
diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c
index d7c56af..b515961 100644
--- a/tools/test/perform/chunk_cache.c
+++ b/tools/test/perform/chunk_cache.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,28 +21,28 @@
#include "H5private.h"
#include "h5test.h"
-#define FILENAME "chunk_cache_perf.h5"
+#define FILENAME "chunk_cache_perf.h5"
-#define RANK 2
+#define RANK 2
#define DSET1_NAME "partial_chunks"
-#define DSET1_DIM1 9 * 1000
-#define DSET1_DIM2 9
-#define CHUNK1_DIM1 2 * 1000
-#define CHUNK1_DIM2 2
+#define DSET1_DIM1 (9 * 1000)
+#define DSET1_DIM2 9
+#define CHUNK1_DIM1 (2 * 1000)
+#define CHUNK1_DIM2 2
#define DSET2_NAME "hash_value"
-#define DSET2_DIM1 300
-#define DSET2_DIM2 600
-#define CHUNK2_DIM1 100
-#define CHUNK2_DIM2 100
+#define DSET2_DIM1 300
+#define DSET2_DIM2 600
+#define CHUNK2_DIM1 100
+#define CHUNK2_DIM2 100
-#define RDCC_NSLOTS 5
-#define RDCC_NBYTES 1024 * 1024 * 10
-#define RDCC_W0 0.75F
+#define RDCC_NSLOTS 5
+#define RDCC_NBYTES (1024 * 1024 * 10)
+#define RDCC_W0 0.75F
-#define FILTER_COUNTER 306
-static size_t nbytes_global;
+#define FILTER_COUNTER 306
+static size_t nbytes_global;
typedef struct test_time_t {
long tv_sec;
@@ -50,20 +50,18 @@ typedef struct test_time_t {
} test_time_t;
/* Local function prototypes for the dummy filter */
-static size_t
-counter (unsigned flags, size_t cd_nelmts,
- const unsigned *cd_values, size_t nbytes,
- size_t *buf_size, void **buf);
+static size_t counter(unsigned flags, size_t cd_nelmts, const unsigned *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_COUNTER[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- FILTER_COUNTER, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "counter", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- counter, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER_COUNTER, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "counter", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ counter, /* The actual filter function */
}};
/*-------------------------------------------------------------------------
@@ -71,9 +69,9 @@ const H5Z_class2_t H5Z_COUNTER[1] = {{
* track of the data of chunks being read from file into memory.
*/
static size_t
-counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
- const unsigned H5_ATTR_UNUSED *cd_values, size_t nbytes,
- size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+counter(unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
+ const unsigned H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
+ void H5_ATTR_UNUSED **buf)
{
nbytes_global += nbytes;
return nbytes;
@@ -81,10 +79,10 @@ counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
/*---------------------------------------------------------------------------*/
static void
-cleanup (void)
+cleanup(void)
{
- if (!getenv ("HDF5_NOCLEANUP")) {
- remove (FILENAME);
+ if (!getenv("HDF5_NOCLEANUP")) {
+ remove(FILENAME);
}
}
@@ -93,58 +91,61 @@ cleanup (void)
* dataset dimension: 9000 x 9
* chunk dimension: 2000 x 2
*/
-static int create_dset1(hid_t file)
+static int
+create_dset1(hid_t file)
{
- hid_t dataspace = H5I_INVALID_HID, dataset = H5I_INVALID_HID;
- hid_t dcpl = H5I_INVALID_HID;
- hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2};
- hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2};
- int **data; /* data for writing */
+ hid_t dataspace = H5I_INVALID_HID, dataset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2};
+ hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2};
+ int ** data = NULL; /* data for writing */
/* Create the data space. */
- if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* Modify dataset creation properties, i.e. enable chunking */
- if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk (dcpl, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
/* Set the dummy filter simply for counting the number of bytes being read into the memory */
- if(H5Zregister(H5Z_COUNTER) < 0)
+ if (H5Zregister(H5Z_COUNTER) < 0)
goto error;
- if(H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL) < 0)
+ if (H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL) < 0)
goto error;
/* Create a new dataset within the file using chunk creation properties. */
- if((dataset = H5Dcreate2 (file, DSET1_NAME, H5T_NATIVE_INT, dataspace,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) <
+ 0)
goto error;
/* Create & fill array */
- H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2);
+ H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2);
H5TEST_FILL_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2);
-
/* Write data to dataset */
- if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto error;
/* Close resources */
- H5Dclose (dataset);
- H5Pclose (dcpl);
- H5Sclose (dataspace);
+ H5Dclose(dataset);
+ H5Pclose(dcpl);
+ H5Sclose(dataspace);
+ HDfree(data);
return 0;
error:
- H5E_BEGIN_TRY {
- H5Dclose (dataset);
- H5Pclose (dcpl);
- H5Sclose (dataspace);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dataset);
+ H5Pclose(dcpl);
+ H5Sclose(dataspace);
+ }
+ H5E_END_TRY;
+ HDfree(data);
return 1;
}
@@ -154,56 +155,61 @@ error:
* dataset dimensions: 300 x 600
* chunk dimensions: 100 x 100
*/
-static int create_dset2(hid_t file)
+static int
+create_dset2(hid_t file)
{
- hid_t dataspace = H5I_INVALID_HID, dataset = H5I_INVALID_HID;
- hid_t dcpl = H5I_INVALID_HID;
- hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2};
- hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2};
- int **data; /* data for writing */
+ hid_t dataspace = H5I_INVALID_HID, dataset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2};
+ hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2};
+ int ** data = NULL; /* data for writing */
/* Create the data space. */
- if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* Modify dataset creation properties, i.e. enable chunking */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
/* Set the dummy filter simply for counting the number of bytes being read into the memory */
- if(H5Zregister(H5Z_COUNTER) < 0)
+ if (H5Zregister(H5Z_COUNTER) < 0)
goto error;
- if(H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL) < 0)
+ if (H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL) < 0)
goto error;
/* Create a new dataset within the file using chunk creation properties. */
- if((dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, dataspace,
- H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) <
+ 0)
goto error;
/* Create & fill array */
- H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2);
+ H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2);
H5TEST_FILL_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2);
/* Write data to dataset */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto error;
/* Close resources */
H5Dclose(dataset);
H5Pclose(dcpl);
H5Sclose(dataspace);
+ HDfree(data);
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Pclose(dcpl);
H5Sclose(dataspace);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+ HDfree(data);
return 1;
}
@@ -212,31 +218,32 @@ error:
* Check the performance of the chunk cache when partial chunks exist
* along the dataset dimensions.
*/
-static int check_partial_chunks_perf(hid_t file)
+static int
+check_partial_chunks_perf(hid_t file)
{
- hid_t dataset = H5I_INVALID_HID;
- hid_t filespace = H5I_INVALID_HID;
- hid_t memspace = H5I_INVALID_HID;
- hid_t dapl = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t filespace = H5I_INVALID_HID;
+ hid_t memspace = H5I_INVALID_HID;
+ hid_t dapl = H5I_INVALID_HID;
- int rdata[DSET1_DIM2]; /* data for reading */
- int i;
+ int rdata[DSET1_DIM2]; /* data for reading */
+ int i;
- hsize_t row_rank = 1;
- hsize_t row_dim[1] = {DSET1_DIM2};
- hsize_t start[RANK] = {0, 0};
- hsize_t count[RANK] = {1, DSET1_DIM2};
- double start_t, end_t;
+ hsize_t row_rank = 1;
+ hsize_t row_dim[1] = {DSET1_DIM2};
+ hsize_t start[RANK] = {0, 0};
+ hsize_t count[RANK] = {1, DSET1_DIM2};
+ double start_t, end_t;
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
goto error;
- if(H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0) < 0)
+ if (H5Pset_chunk_cache(dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0) < 0)
goto error;
- dataset = H5Dopen2 (file, DSET1_NAME, dapl);
+ dataset = H5Dopen2(file, DSET1_NAME, dapl);
H5_CHECK_OVERFLOW(row_rank, hsize_t, int);
- memspace = H5Screate_simple((int)row_rank, row_dim, NULL);
+ memspace = H5Screate_simple((int)row_rank, row_dim, NULL);
filespace = H5Dget_space(dataset);
nbytes_global = 0;
@@ -244,37 +251,41 @@ static int check_partial_chunks_perf(hid_t file)
start_t = H5_get_time();
/* Read the data row by row */
- for(i = 0; i < DSET1_DIM1; i++) {
+ for (i = 0; i < DSET1_DIM1; i++) {
start[0] = (hsize_t)i;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET,
- start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
goto error;
- if(H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace,
- H5P_DEFAULT, rdata) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rdata) < 0)
goto error;
}
end_t = H5_get_time();
- if((end_t - start_t) > (double)0.0f)
- printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global);
+ if ((end_t - start_t) > 0.0)
+ HDprintf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %zu\n",
+ (end_t - start_t), nbytes_global);
else
- printf("1. Partial chunks: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global);
+ HDprintf(
+ "1. Partial chunks: no total read time because timer is not available; number of bytes being "
+ "read from file is %zu\n",
+ nbytes_global);
- H5Dclose (dataset);
- H5Sclose (filespace);
- H5Sclose (memspace);
- H5Pclose (dapl);
+ H5Dclose(dataset);
+ H5Sclose(filespace);
+ H5Sclose(memspace);
+ H5Pclose(dapl);
return 0;
error:
- H5E_BEGIN_TRY {
- H5Dclose (dataset);
- H5Sclose (filespace);
- H5Sclose (memspace);
- H5Pclose (dapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dataset);
+ H5Sclose(filespace);
+ H5Sclose(memspace);
+ H5Pclose(dapl);
+ }
+ H5E_END_TRY;
return 1;
}
@@ -283,34 +294,35 @@ error:
* is smaller than the number of chunks along the fastest-growing
* dimension of the dataset.
*/
-static int check_hash_value_perf(hid_t file)
+static int
+check_hash_value_perf(hid_t file)
{
- hid_t dataset = H5I_INVALID_HID;
- hid_t filespace = H5I_INVALID_HID;
- hid_t memspace = H5I_INVALID_HID;
- hid_t dapl = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t filespace = H5I_INVALID_HID;
+ hid_t memspace = H5I_INVALID_HID;
+ hid_t dapl = H5I_INVALID_HID;
- int rdata[DSET2_DIM1]; /* data for reading */
- int i;
+ int rdata[DSET2_DIM1]; /* data for reading */
+ int i;
- hsize_t column_rank = 1;
- hsize_t column_dim[1] = {DSET2_DIM1};
- hsize_t start[RANK] = {0, 0};
- hsize_t count[RANK] = {DSET2_DIM1, 1};
- double start_t, end_t;
+ hsize_t column_rank = 1;
+ hsize_t column_dim[1] = {DSET2_DIM1};
+ hsize_t start[RANK] = {0, 0};
+ hsize_t count[RANK] = {DSET2_DIM1, 1};
+ double start_t, end_t;
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
goto error;
- if(H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0) < 0)
+ if (H5Pset_chunk_cache(dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0) < 0)
goto error;
- if((dataset = H5Dopen2 (file, DSET2_NAME, dapl)) < 0)
+ if ((dataset = H5Dopen2(file, DSET2_NAME, dapl)) < 0)
goto error;
H5_CHECK_OVERFLOW(column_rank, hsize_t, int);
- if((memspace = H5Screate_simple((int)column_rank, column_dim, NULL)) < 0)
+ if ((memspace = H5Screate_simple((int)column_rank, column_dim, NULL)) < 0)
goto error;
- if((filespace = H5Dget_space(dataset)) < 0)
+ if ((filespace = H5Dget_space(dataset)) < 0)
goto error;
nbytes_global = 0;
@@ -318,37 +330,41 @@ static int check_hash_value_perf(hid_t file)
start_t = H5_get_time();
/* Read the data column by column */
- for(i = 0; i < DSET2_DIM2; i++) {
+ for (i = 0; i < DSET2_DIM2; i++) {
start[1] = (hsize_t)i;
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET,
- start, NULL, count, NULL) < 0)
+ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
goto error;
- if(H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace,
- H5P_DEFAULT, rdata) < 0)
+ if (H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, rdata) < 0)
goto error;
}
end_t = H5_get_time();
- if((end_t - start_t) > (double)0.0f)
- printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global);
+ if ((end_t - start_t) > 0.0)
+ HDprintf("2. Hash value: total read time is %lf; number of bytes being read from file is %zu\n",
+ (end_t - start_t), nbytes_global);
else
- printf("2. Hash value: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global);
+ HDprintf(
+ "2. Hash value: no total read time because timer is not available; number of bytes being read "
+ "from file is %zu\n",
+ nbytes_global);
- H5Dclose (dataset);
- H5Sclose (filespace);
- H5Sclose (memspace);
- H5Pclose (dapl);
+ H5Dclose(dataset);
+ H5Sclose(filespace);
+ H5Sclose(memspace);
+ H5Pclose(dapl);
return 0;
error:
- H5E_BEGIN_TRY {
- H5Dclose (dataset);
- H5Sclose (filespace);
- H5Sclose (memspace);
- H5Pclose (dapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dataset);
+ H5Sclose(filespace);
+ H5Sclose(memspace);
+ H5Pclose(dapl);
+ }
+ H5E_END_TRY;
return 1;
}
@@ -359,36 +375,37 @@ error:
* in the fastest-growing dimension.
*-------------------------------------------------------------------------------------*/
int
-main (void)
+main(void)
{
- hid_t file; /* handles */
- int nerrors = 0;
+ hid_t file = H5I_INVALID_HID; /* file ID */
+ int nerrors = 0;
/* Create a new file. If file exists its contents will be overwritten. */
- if((file = H5Fcreate (FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
nerrors += create_dset1(file);
nerrors += create_dset2(file);
- if(H5Fclose (file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
/* Re-open the file for testing performance. */
- if((file = H5Fopen (FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((file = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
goto error;
nerrors += check_partial_chunks_perf(file);
nerrors += check_hash_value_perf(file);
- if(H5Fclose (file) < 0)
+ if (H5Fclose(file) < 0)
goto error;
- if (nerrors>0) goto error;
+ if (nerrors > 0)
+ goto error;
cleanup();
return 0;
error:
- fprintf(stderr, "*** ERRORS DETECTED ***\n");
+ HDfprintf(stderr, "*** ERRORS DETECTED ***\n");
return 1;
}
diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c
index 20b7237..b3ae54d 100644
--- a/tools/test/perform/direct_write_perf.c
+++ b/tools/test/perform/direct_write_perf.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -26,213 +26,226 @@
#include <math.h>
#ifdef H5_STDC_HEADERS
-# include <errno.h>
-# include <fcntl.h>
-# include <stdio.h>
-# include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
#endif
#ifdef H5_HAVE_UNISTD_H
-# include <sys/types.h>
-# include <unistd.h>
+#include <sys/types.h>
+#include <unistd.h>
#endif
#ifdef H5_HAVE_SYS_STAT_H
-# include <sys/stat.h>
+#include <sys/stat.h>
#endif
#if defined(H5_TIME_WITH_SYS_TIME)
-# include <sys/time.h>
-# include <time.h>
+#include <sys/time.h>
+#include <time.h>
#elif defined(H5_HAVE_SYS_TIME_H)
-# include <sys/time.h>
+#include <sys/time.h>
#else
-# include <time.h>
+#include <time.h>
#endif
-const char *FILENAME[] = {
- "direct_write",
- "unix.raw",
- NULL
-};
+const char *FILENAME[] = {"direct_write", "unix.raw", NULL};
/*
* Print the current location on the standard output stream.
*/
#define FUNC __func__
-#define AT() printf (" at %s:%d in %s()...\n", \
- __FILE__, __LINE__, FUNC);
-#define H5_FAILED() {puts("*FAILED*");fflush(stdout);}
-#define TEST_ERROR {H5_FAILED(); AT(); goto error;}
-#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);}
-#define PASSED() {puts(" PASSED");fflush(stdout);}
-
-#define DIRECT_UNCOMPRESSED_DSET "direct_uncompressed_dset"
-#define DIRECT_COMPRESSED_DSET "direct_compressed_dset"
-#define REG_COMPRESSED_DSET "reg_compressed_dset"
-#define REG_NO_COMPRESS_DSET "reg_no_compress_dset"
-#define RANK 3
-#define NX 100
-#define NY 1000
-#define NZ 250
-#define CHUNK_NX 1
-#define CHUNK_NY 1000
-#define CHUNK_NZ 250
-
-#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12)
-char filename[1024];
+#define AT() printf(" at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC);
+#define H5_FAILED() \
+ { \
+ puts("*FAILED*"); \
+ fflush(stdout); \
+ }
+#define TEST_ERROR \
+ { \
+ H5_FAILED(); \
+ AT(); \
+ goto error; \
+ }
+#define TESTING(WHAT) \
+ { \
+ printf("Testing %-62s", WHAT); \
+ fflush(stdout); \
+ }
+#define PASSED() \
+ { \
+ puts(" PASSED"); \
+ fflush(stdout); \
+ }
+
+#define DIRECT_UNCOMPRESSED_DSET "direct_uncompressed_dset"
+#define DIRECT_COMPRESSED_DSET "direct_compressed_dset"
+#define REG_COMPRESSED_DSET "reg_compressed_dset"
+#define REG_NO_COMPRESS_DSET "reg_no_compress_dset"
+#define RANK 3
+#define NX 100
+#define NY 1000
+#define NZ 250
+#define CHUNK_NX 1
+#define CHUNK_NY 1000
+#define CHUNK_NZ 250
+
+#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s)) * 1.001) + 12)
+char filename[1024];
unsigned int *outbuf[NX];
-size_t data_size[NX];
-double total_size = 0.0;
+size_t data_size[NX];
+double total_size = 0.0;
unsigned int *direct_buf[NX];
-double MB = 1048576.0;
+double MB = 1048576.0;
/*--------------------------------------------------
* Function to report IO rate
*--------------------------------------------------
*/
-void reportTime(struct timeval start, double mbytes)
+void
+reportTime(struct timeval start, double mbytes)
{
- struct timeval timeval_stop,timeval_diff;
+ struct timeval timeval_stop, timeval_diff;
/*end timing*/
- gettimeofday(&timeval_stop,NULL);
+ gettimeofday(&timeval_stop, NULL);
/* Calculate the elapsed gettimeofday time */
- timeval_diff.tv_usec=timeval_stop.tv_usec-start.tv_usec;
- timeval_diff.tv_sec=timeval_stop.tv_sec-start.tv_sec;
+ timeval_diff.tv_usec = timeval_stop.tv_usec - start.tv_usec;
+ timeval_diff.tv_sec = timeval_stop.tv_sec - start.tv_sec;
- if(timeval_diff.tv_usec<0) {
- timeval_diff.tv_usec+=1000000;
+ if (timeval_diff.tv_usec < 0) {
+ timeval_diff.tv_usec += 1000000;
timeval_diff.tv_sec--;
} /* end if */
-/*printf("mbytes=%lf, sec=%lf, usec=%lf\n", mbytes, (double)timeval_diff.tv_sec, (double)timeval_diff.tv_usec);*/
- printf("MBytes/second: %lf\n", (double)mbytes/((double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0)));
+ /*printf("mbytes=%lf, sec=%lf, usec=%lf\n", mbytes, (double)timeval_diff.tv_sec,
+ * (double)timeval_diff.tv_usec);*/
+ printf("MBytes/second: %lf\n", (double)mbytes / ((double)timeval_diff.tv_sec +
+ ((double)timeval_diff.tv_usec / (double)1000000.0)));
}
/*--------------------------------------------------
* Create file, datasets, and initialize data
*--------------------------------------------------
*/
-int create_file(hid_t fapl_id)
+int
+create_file(hid_t fapl_id)
{
- hid_t file; /* handles */
- hid_t fapl;
- hid_t cparms;
- hid_t dataspace, dataset;
- hsize_t dims[RANK] = {NX, NY, NZ};
- hsize_t chunk_dims[RANK] ={CHUNK_NX, CHUNK_NY, CHUNK_NZ};
- unsigned int aggression = 9; /* Compression aggression setting */
- int ret;
- int i, j, n;
+ hid_t file; /* handles */
+ hid_t fapl;
+ hid_t cparms;
+ hid_t dataspace, dataset;
+ hsize_t dims[RANK] = {NX, NY, NZ};
+ hsize_t chunk_dims[RANK] = {CHUNK_NX, CHUNK_NY, CHUNK_NZ};
+ unsigned int aggression = 9; /* Compression aggression setting */
+ int ret;
+ int i, j, n;
int flag;
int unix_file;
unsigned int *p;
- size_t buf_size = CHUNK_NY*CHUNK_NZ*sizeof(unsigned int);
+ size_t buf_size = CHUNK_NY * CHUNK_NZ * sizeof(unsigned int);
const Bytef *z_src;
- Bytef *z_dst; /*destination buffer */
- uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- uLong z_src_nbytes = (uLong)buf_size;
+ Bytef * z_dst; /*destination buffer */
+ uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
+ uLong z_src_nbytes = (uLong)buf_size;
TESTING("Create a file and dataset");
/*
* Create the data space with unlimited dimensions.
*/
- if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ if ((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
TEST_ERROR;
/*
* Create a new file. If file exists its contents will be overwritten.
*/
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
/*
* Modify dataset creation properties, i.e. enable chunking and compression
*/
- if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR;
- if(H5Pset_chunk( cparms, RANK, chunk_dims) < 0)
+ if (H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
TEST_ERROR;
/*
* Create a new dataset within the file using cparms
* creation properties.
*/
- if((dataset = H5Dcreate2(file, DIRECT_UNCOMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DIRECT_UNCOMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR;
- if((dataset = H5Dcreate2(file, REG_NO_COMPRESS_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, REG_NO_COMPRESS_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR;
/* Set compression */
- if(H5Pset_deflate( cparms, aggression) < 0)
+ if (H5Pset_deflate(cparms, aggression) < 0)
TEST_ERROR;
- if((dataset = H5Dcreate2(file, DIRECT_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, DIRECT_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR;
-
- if((dataset = H5Dcreate2(file, REG_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, REG_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms,
+ H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR;
- if(H5Sclose(dataspace) < 0)
+ if (H5Sclose(dataspace) < 0)
TEST_ERROR;
- if(H5Pclose(cparms) < 0)
+ if (H5Pclose(cparms) < 0)
TEST_ERROR;
/* create a unix file*/
- flag = O_CREAT|O_TRUNC|O_WRONLY;
+ flag = O_CREAT | O_TRUNC | O_WRONLY;
- if ((unix_file=open(FILENAME[1],flag,S_IRWXU))== -1)
+ if ((unix_file = open(FILENAME[1], flag, S_IRWXU)) == -1)
TEST_ERROR;
- if (close(unix_file) < 0)
- {
+ if (close(unix_file) < 0) {
printf(" unable to close the file\n");
TEST_ERROR;
}
-
/* Initialize data for chunks */
- for(i = 0; i < NX; i++) {
- p = direct_buf[i] = (unsigned int*)malloc(CHUNK_NY*CHUNK_NZ*sizeof(unsigned int));
+ for (i = 0; i < NX; i++) {
+ p = direct_buf[i] = (unsigned int *)malloc(CHUNK_NY * CHUNK_NZ * sizeof(unsigned int));
- for(j=0; j < CHUNK_NY*CHUNK_NZ; j++, p++)
+ for (j = 0; j < CHUNK_NY * CHUNK_NZ; j++, p++)
*p = rand() % 65000;
- z_src = (const Bytef*)direct_buf[i];
+ z_src = (const Bytef *)direct_buf[i];
z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
/* Allocate output (compressed) buffer */
- outbuf[i] = (unsigned int*)malloc((size_t)z_dst_nbytes);
- z_dst = (Bytef *)outbuf[i];
+ outbuf[i] = (unsigned int *)malloc((size_t)z_dst_nbytes);
+ z_dst = (Bytef *)outbuf[i];
/* Perform compression from the source to the destination buffer */
ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
@@ -241,28 +254,31 @@ int create_file(hid_t fapl_id)
total_size += data_size[i];
/* Check for various zlib errors */
- if(Z_BUF_ERROR == ret) {
+ if (Z_BUF_ERROR == ret) {
fprintf(stderr, "overflow");
TEST_ERROR;
- } else if(Z_MEM_ERROR == ret) {
- fprintf(stderr, "deflate memory error");
+ }
+ else if (Z_MEM_ERROR == ret) {
+ fprintf(stderr, "deflate memory error");
TEST_ERROR;
- } else if(Z_OK != ret) {
- fprintf(stderr, "other deflate error");
+ }
+ else if (Z_OK != ret) {
+ fprintf(stderr, "other deflate error");
TEST_ERROR;
}
}
-
PASSED();
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
@@ -274,37 +290,37 @@ error:
int
test_direct_write_uncompressed_data(hid_t fapl_id)
{
- hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t dxpl;
- herr_t status;
- int i;
+ hid_t file; /* handles */
+ hid_t dataspace, dataset;
+ hid_t dxpl;
+ herr_t status;
+ int i;
- unsigned filter_mask = 0;
- hsize_t offset[RANK] = {0, 0, 0};
+ unsigned filter_mask = 0;
+ hsize_t offset[RANK] = {0, 0, 0};
struct timeval timeval_start;
TESTING("H5Dwrite_chunk for uncompressed data");
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
TEST_ERROR;
/* Start the timer */
- gettimeofday(&timeval_start,NULL);
+ gettimeofday(&timeval_start, NULL);
/* Reopen the file and dataset */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
- if((dataset = H5Dopen2(file, DIRECT_UNCOMPRESSED_DSET, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DIRECT_UNCOMPRESSED_DSET, H5P_DEFAULT)) < 0)
TEST_ERROR;
-
/* Write the compressed chunk data repeatedly to cover all the chunks in the
* dataset, using the direct writing function. */
- for(i=0; i<NX; i++) {
- status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, CHUNK_NY*CHUNK_NZ*sizeof(unsigned int), direct_buf[i]);
+ for (i = 0; i < NX; i++) {
+ status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset,
+ CHUNK_NY * CHUNK_NZ * sizeof(unsigned int), direct_buf[i]);
(offset[0])++;
}
@@ -316,21 +332,22 @@ test_direct_write_uncompressed_data(hid_t fapl_id)
H5Fclose(file);
/* Report the performance */
- reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
+ reportTime(timeval_start, (double)(NX * NY * NZ * sizeof(unsigned int) / MB));
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Pclose(dxpl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
-
/*--------------------------------------------------
* Benchmark the performance of the new function
* with precompressed data.
@@ -339,36 +356,35 @@ error:
int
test_direct_write_compressed_data(hid_t fapl_id)
{
- hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t dxpl;
- herr_t status;
- int i;
+ hid_t file; /* handles */
+ hid_t dataspace, dataset;
+ hid_t dxpl;
+ herr_t status;
+ int i;
- unsigned filter_mask = 0;
- hsize_t offset[RANK] = {0, 0, 0};
+ unsigned filter_mask = 0;
+ hsize_t offset[RANK] = {0, 0, 0};
struct timeval timeval_start;
TESTING("H5DOwrite_chunk for pre-compressed data");
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
TEST_ERROR;
/* Start the timer */
- gettimeofday(&timeval_start,NULL);
+ gettimeofday(&timeval_start, NULL);
/* Reopen the file and dataset */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
- if((dataset = H5Dopen2(file, DIRECT_COMPRESSED_DSET, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DIRECT_COMPRESSED_DSET, H5P_DEFAULT)) < 0)
TEST_ERROR;
-
/* Write the compressed chunk data repeatedly to cover all the chunks in the
* dataset, using the direct writing function. */
- for(i=0; i<NX; i++) {
+ for (i = 0; i < NX; i++) {
status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, data_size[i], outbuf[i]);
(offset[0])++;
}
@@ -381,17 +397,19 @@ test_direct_write_compressed_data(hid_t fapl_id)
H5Fclose(file);
/* Report the performance */
- reportTime(timeval_start, (double)(total_size/MB));
+ reportTime(timeval_start, (double)(total_size / MB));
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Pclose(dxpl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
@@ -403,13 +421,13 @@ error:
int
test_compressed_write(hid_t fapl_id)
{
- hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t mem_space;
- hsize_t chunk_dims[RANK] ={CHUNK_NX, CHUNK_NY, CHUNK_NZ};
- hid_t dxpl;
- herr_t status;
- int i;
+ hid_t file; /* handles */
+ hid_t dataspace, dataset;
+ hid_t mem_space;
+ hsize_t chunk_dims[RANK] = {CHUNK_NX, CHUNK_NY, CHUNK_NZ};
+ hid_t dxpl;
+ herr_t status;
+ int i;
hsize_t start[RANK]; /* Start of hyperslab */
hsize_t stride[RANK]; /* Stride of hyperslab */
@@ -420,40 +438,42 @@ test_compressed_write(hid_t fapl_id)
TESTING("H5Dwrite with compression enabled");
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
TEST_ERROR;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
TEST_ERROR;
/* Start the timer */
- gettimeofday(&timeval_start,NULL);
+ gettimeofday(&timeval_start, NULL);
/* Reopen the file and dataset */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
- if((dataset = H5Dopen2(file, REG_COMPRESSED_DSET, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, REG_COMPRESSED_DSET, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if((dataspace = H5Dget_space(dataset)) < 0)
+ if ((dataspace = H5Dget_space(dataset)) < 0)
TEST_ERROR;
- start[0] = start[1] = start[2] = 0;
+ start[0] = start[1] = start[2] = 0;
stride[0] = stride[1] = stride[2] = 1;
- count[0] = count[1] = count[2] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY; block[2] = CHUNK_NZ;
+ count[0] = count[1] = count[2] = 1;
+ block[0] = CHUNK_NX;
+ block[1] = CHUNK_NY;
+ block[2] = CHUNK_NZ;
- for(i=0; i<NX; i++) {
+ for (i = 0; i < NX; i++) {
/*
* Select hyperslab for one chunk in the file
*/
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ if ((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
TEST_ERROR;
(start[0])++;
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, dataspace,
- H5P_DEFAULT, direct_buf[i])) < 0)
+ if ((status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, direct_buf[i])) <
+ 0)
TEST_ERROR;
}
@@ -467,19 +487,21 @@ test_compressed_write(hid_t fapl_id)
H5Fclose(file);
/* Report the performance */
- reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
+ reportTime(timeval_start, (double)(NX * NY * NZ * sizeof(unsigned int) / MB));
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(dataspace);
H5Sclose(mem_space);
H5Pclose(dxpl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
@@ -491,13 +513,13 @@ error:
int
test_no_compress_write(hid_t fapl_id)
{
- hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t mem_space;
- hsize_t chunk_dims[RANK] ={CHUNK_NX, CHUNK_NY, CHUNK_NZ};
- hid_t dxpl;
- herr_t status;
- int i;
+ hid_t file; /* handles */
+ hid_t dataspace, dataset;
+ hid_t mem_space;
+ hsize_t chunk_dims[RANK] = {CHUNK_NX, CHUNK_NY, CHUNK_NZ};
+ hid_t dxpl;
+ herr_t status;
+ int i;
hsize_t start[RANK]; /* Start of hyperslab */
hsize_t stride[RANK]; /* Stride of hyperslab */
@@ -508,40 +530,42 @@ test_no_compress_write(hid_t fapl_id)
TESTING("H5Dwrite without compression");
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
TEST_ERROR;
- if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+ if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
TEST_ERROR;
/* Start the timer */
- gettimeofday(&timeval_start,NULL);
+ gettimeofday(&timeval_start, NULL);
/* Reopen the file and dataset */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
- if((dataset = H5Dopen2(file, REG_NO_COMPRESS_DSET, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, REG_NO_COMPRESS_DSET, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if((dataspace = H5Dget_space(dataset)) < 0)
+ if ((dataspace = H5Dget_space(dataset)) < 0)
TEST_ERROR;
- start[0] = start[1] = start[2] = 0;
+ start[0] = start[1] = start[2] = 0;
stride[0] = stride[1] = stride[2] = 1;
- count[0] = count[1] = count[2] = 1;
- block[0] = CHUNK_NX; block[1] = CHUNK_NY; block[2] = CHUNK_NZ;
+ count[0] = count[1] = count[2] = 1;
+ block[0] = CHUNK_NX;
+ block[1] = CHUNK_NY;
+ block[2] = CHUNK_NZ;
- for(i=0; i<NX; i++) {
+ for (i = 0; i < NX; i++) {
/*
* Select hyperslab for one chunk in the file
*/
- if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
+ if ((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
TEST_ERROR;
(start[0])++;
- if((status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, dataspace,
- H5P_DEFAULT, direct_buf[i])) < 0)
+ if ((status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, direct_buf[i])) <
+ 0)
TEST_ERROR;
}
@@ -555,19 +579,21 @@ test_no_compress_write(hid_t fapl_id)
H5Fclose(file);
/* Report the performance */
- reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
+ reportTime(timeval_start, (double)(NX * NY * NZ * sizeof(unsigned int) / MB));
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(dataset);
H5Sclose(dataspace);
H5Sclose(mem_space);
H5Pclose(dxpl);
H5Fclose(file);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
}
@@ -579,9 +605,9 @@ error:
int
test_unix_write(void)
{
- int file, flag;
- ssize_t op_size;
- int i;
+ int file, flag;
+ ssize_t op_size;
+ int i;
struct timeval timeval_start;
TESTING("Write compressed data to a Unix file");
@@ -590,35 +616,32 @@ test_unix_write(void)
flag = O_WRONLY;
/* Start the timer */
- gettimeofday(&timeval_start,NULL);
+ gettimeofday(&timeval_start, NULL);
- if ((file=open(FILENAME[1],flag))== -1)
+ if ((file = open(FILENAME[1], flag)) == -1)
TEST_ERROR;
/* Write the compressed chunk data repeatedly to cover all the chunks in the
* dataset, using the direct writing function. */
- for(i=0; i<NX; i++) {
- op_size = write(file, outbuf[i],data_size[i]);
- if (op_size < 0)
- {
+ for (i = 0; i < NX; i++) {
+ op_size = write(file, outbuf[i], data_size[i]);
+ if (op_size < 0) {
printf(" Error in writing data to file because %s \n", strerror(errno));
TEST_ERROR;
}
- else if (op_size == 0)
- {
+ else if (op_size == 0) {
printf(" unable to write sufficent data to file because %s \n", strerror(errno));
TEST_ERROR;
}
}
- if (close(file) < 0)
- {
+ if (close(file) < 0) {
printf(" unable to close the file\n");
TEST_ERROR;
}
/* Report the performance */
- reportTime(timeval_start, (double)(total_size/MB));
+ reportTime(timeval_start, (double)(total_size / MB));
PASSED();
return 0;
@@ -632,10 +655,10 @@ error:
*--------------------------------------------------
*/
int
-main (void)
+main(void)
{
- hid_t fapl = H5P_DEFAULT;
- int i;
+ hid_t fapl = H5P_DEFAULT;
+ int i;
sprintf(filename, "%s.h5", FILENAME[0]);
@@ -646,7 +669,7 @@ main (void)
test_compressed_write(fapl);
test_unix_write();
- for(i=0; i<NX; i++) {
+ for (i = 0; i < NX; i++) {
free(outbuf[i]);
free(direct_buf[i]);
}
@@ -665,7 +688,7 @@ main(void)
#endif /* WIN32 / MINGW32 */
-#else /* !H5_HAVE_FILTER_DEFLATE */
+#else /* !H5_HAVE_FILTER_DEFLATE */
/*
* Function: main
@@ -680,5 +703,4 @@ main(void)
return EXIT_SUCCESS;
}
-#endif /* !H5_HAVE_FILTER_DEFLATE */
-
+#endif /* !H5_HAVE_FILTER_DEFLATE */
diff --git a/tools/test/perform/gen_report.pl b/tools/test/perform/gen_report.pl
index 34b3a83..a1fbeb0 100644
--- a/tools/test/perform/gen_report.pl
+++ b/tools/test/perform/gen_report.pl
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c
index bb74a1b..d0db06a 100644
--- a/tools/test/perform/iopipe.c
+++ b/tools/test/perform/iopipe.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,27 +21,25 @@
#include "H5private.h"
-
#define RAW_FILE_NAME "iopipe.raw"
-#define HDF5_FILE_NAME "iopipe.h5"
-#define HEADING "%-16s"
-#define PROGRESS '='
+#define HDF5_FILE_NAME "iopipe.h5"
+#define HEADING "%-16s"
+#define PROGRESS '='
#if 0
/* Normal testing */
#define REQUEST_SIZE_X 4579
#define REQUEST_SIZE_Y 4579
#define NREAD_REQUESTS 45
-#define NWRITE_REQUESTS 45
+#define NWRITE_REQUESTS 45
#else
/* Speedy testing */
#define REQUEST_SIZE_X 1000
#define REQUEST_SIZE_Y 1000
#define NREAD_REQUESTS 45
-#define NWRITE_REQUESTS 45
+#define NWRITE_REQUESTS 45
#endif
-
/*-------------------------------------------------------------------------
* Function: print_stats
*
@@ -57,39 +55,31 @@
static void
print_stats(const char *prefix,
#ifdef H5_HAVE_GETRUSAGE
- struct rusage *r_start, struct rusage *r_stop,
+ struct rusage *r_start, struct rusage *r_stop,
#endif /* H5_HAVE_GETRUSAGE */
- double t_start, double t_stop,
- size_t nbytes)
+ double t_start, double t_stop, size_t nbytes)
{
- double e_time;
- char bw[16];
+ double e_time;
+ char bw[16];
#ifdef H5_HAVE_GETRUSAGE
- double u_time, s_time;
+ double u_time, s_time;
- u_time = ((double)(r_stop->ru_utime.tv_sec)+
- (double)(r_stop->ru_utime.tv_usec)/(double)1000000.0F) -
- ((double)(r_start->ru_utime.tv_sec)+
- (double)(r_start->ru_utime.tv_usec)/(double)1000000.0F);
+ u_time = ((double)(r_stop->ru_utime.tv_sec) + (double)(r_stop->ru_utime.tv_usec) / 1000000.0) -
+ ((double)(r_start->ru_utime.tv_sec) + (double)(r_start->ru_utime.tv_usec) / 1000000.0);
- s_time = ((double)(r_stop->ru_stime.tv_sec)+
- (double)(r_stop->ru_stime.tv_usec)/(double)1000000.0F) -
- ((double)(r_start->ru_stime.tv_sec)+
- (double)(r_start->ru_stime.tv_usec)/(double)1000000.0F);
+ s_time = ((double)(r_stop->ru_stime.tv_sec) + (double)(r_stop->ru_stime.tv_usec) / 1000000.0) -
+ ((double)(r_start->ru_stime.tv_sec) + (double)(r_start->ru_stime.tv_usec) / 1000000.0);
#endif
e_time = t_stop - t_start;
H5_bandwidth(bw, (double)nbytes, e_time);
#ifdef H5_HAVE_GETRUSAGE
- HDprintf(HEADING "%1.2fuser %1.2fsystem %1.2felapsed %s\n",
- prefix, u_time, s_time, e_time, bw);
+ HDprintf(HEADING "%1.2fuser %1.2fsystem %1.2felapsed %s\n", prefix, u_time, s_time, e_time, bw);
#else
- HDprintf(HEADING "%1.2felapsed %s\n",
- prefix, e_time, bw);
+ HDprintf(HEADING "%1.2felapsed %s\n", prefix, e_time, bw);
#endif
}
-
/*-------------------------------------------------------------------------
* Function: synchronize
*
@@ -106,7 +96,7 @@ static void
synchronize(void)
{
#ifdef H5_HAVE_SYSTEM
-#if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__)
+#if defined(H5_HAVE_WIN32_API) && !defined(__CYGWIN__)
_flushall();
#else
int H5_ATTR_NDEBUG_UNUSED status;
@@ -120,7 +110,6 @@ synchronize(void)
#endif
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -139,35 +128,33 @@ int
main(void)
{
hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
- unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS;
+ unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS;
- unsigned char *the_data = NULL;
- hid_t file, dset, file_space = H5I_INVALID_HID;
+ unsigned char *the_data = NULL;
+ hid_t file, dset, file_space = H5I_INVALID_HID;
#ifdef H5_HAVE_GETRUSAGE
- struct rusage r_start, r_stop;
+ struct rusage r_start, r_stop;
#endif
- double t_start, t_stop;
- int fd;
- unsigned u;
- herr_t H5_ATTR_NDEBUG_UNUSED status;
- hssize_t H5_ATTR_NDEBUG_UNUSED n;
- off_t H5_ATTR_NDEBUG_UNUSED offset;
- hsize_t start[2];
- hsize_t count[2];
-
+ double t_start, t_stop;
+ int fd;
+ unsigned u;
+ herr_t H5_ATTR_NDEBUG_UNUSED status;
+ hssize_t H5_ATTR_NDEBUG_UNUSED n;
+ off_t H5_ATTR_NDEBUG_UNUSED offset;
+ hsize_t start[2];
+ hsize_t count[2];
/*
* The extra cast in the following statement is a bug workaround for the
* Win32 version 5.0 compiler.
* 1998-11-06 ptl
*/
- HDprintf("I/O request size is %1.1fMB\n",
- (double)(hssize_t)(size[0] * size[1]) / (double)1024.0F * (double)1024);
+ HDprintf("I/O request size is %1.1fMB\n", (double)(hssize_t)(size[0] * size[1]) / 1024.0 * 1024.0);
/* Open the files */
file = H5Fcreate(HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
HDassert(file >= 0);
- fd = HDopen(RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666);
+ fd = HDopen(RAW_FILE_NAME, O_RDWR | O_CREAT | O_TRUNC, 0666);
HDassert(fd >= 0);
/* Create the dataset */
@@ -180,7 +167,6 @@ main(void)
/* initial fill for lazy malloc */
HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
-
/* Fill raw */
synchronize();
#ifdef H5_HAVE_GETRUSAGE
@@ -188,10 +174,10 @@ main(void)
#endif
t_start = H5_get_time();
HDfprintf(stderr, HEADING, "fill raw");
- for(u = 0; u < nwrite; u++) {
- HDputc(PROGRESS, stderr);
- HDfflush(stderr);
- HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
+ for (u = 0; u < nwrite; u++) {
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -200,10 +186,9 @@ main(void)
HDputc('\n', stderr);
print_stats("fill raw",
#ifdef H5_HAVE_GETRUSAGE
- &r_start, &r_stop,
+ &r_start, &r_stop,
#endif /* H5_HAVE_GETRUSAGE */
- t_start, t_stop, (size_t)(nread * size[0] * size[1]));
-
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Fill hdf5 */
synchronize();
@@ -212,12 +197,11 @@ main(void)
#endif
t_start = H5_get_time();
HDfprintf(stderr, HEADING, "fill hdf5");
- for(u = 0; u < nread; u++) {
- HDputc(PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space,
- H5P_DEFAULT, the_data);
- HDassert(status >= 0);
+ for (u = 0; u < nread; u++) {
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -226,9 +210,9 @@ main(void)
HDputc('\n', stderr);
print_stats("fill hdf5",
#ifdef H5_HAVE_GETRUSAGE
- &r_start, &r_stop,
+ &r_start, &r_stop,
#endif /* H5_HAVE_GETRUSAGE */
- t_start, t_stop, (size_t)(nread * size[0] * size[1]));
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Write the raw dataset */
synchronize();
@@ -237,13 +221,13 @@ main(void)
#endif
t_start = H5_get_time();
HDfprintf(stderr, HEADING, "out raw");
- for(u = 0; u < nwrite; u++) {
- HDputc(PROGRESS, stderr);
- HDfflush(stderr);
- offset = HDlseek(fd, (off_t)0, SEEK_SET);
- HDassert(0 == offset);
- n = HDwrite(fd, the_data, (size_t)(size[0] * size[1]));
- HDassert(n >= 0 && (size_t)n == (size[0] * size[1]));
+ for (u = 0; u < nwrite; u++) {
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ offset = HDlseek(fd, (off_t)0, SEEK_SET);
+ HDassert(0 == offset);
+ n = HDwrite(fd, the_data, (size_t)(size[0] * size[1]));
+ HDassert(n >= 0 && (size_t)n == (size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -252,9 +236,9 @@ main(void)
HDputc('\n', stderr);
print_stats("out raw",
#ifdef H5_HAVE_GETRUSAGE
- &r_start, &r_stop,
+ &r_start, &r_stop,
#endif /* H5_HAVE_GETRUSAGE */
- t_start, t_stop, (size_t)(nread * size[0] * size[1]));
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Write the hdf5 dataset */
synchronize();
@@ -263,12 +247,11 @@ main(void)
#endif
t_start = H5_get_time();
HDfprintf(stderr, HEADING, "out hdf5");
- for(u = 0; u < nwrite; u++) {
- HDputc(PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dwrite(dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, the_data);
- HDassert(status >= 0);
+ for (u = 0; u < nwrite; u++) {
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dwrite(dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -277,9 +260,9 @@ main(void)
HDputc('\n', stderr);
print_stats("out hdf5",
#ifdef H5_HAVE_GETRUSAGE
- &r_start, &r_stop,
+ &r_start, &r_stop,
#endif /* H5_HAVE_GETRUSAGE */
- t_start, t_stop, (size_t)(nread * size[0] * size[1]));
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Read the raw dataset */
synchronize();
@@ -288,13 +271,13 @@ main(void)
#endif
t_start = H5_get_time();
HDfprintf(stderr, HEADING, "in raw");
- for(u = 0; u < nread; u++) {
- HDputc(PROGRESS, stderr);
- HDfflush(stderr);
- offset = HDlseek(fd, (off_t)0, SEEK_SET);
- HDassert(0 == offset);
- n = HDread(fd, the_data, (size_t)(size[0] * size[1]));
- HDassert(n >= 0 && (size_t)n == (size[0] * size[1]));
+ for (u = 0; u < nread; u++) {
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ offset = HDlseek(fd, (off_t)0, SEEK_SET);
+ HDassert(0 == offset);
+ n = HDread(fd, the_data, (size_t)(size[0] * size[1]));
+ HDassert(n >= 0 && (size_t)n == (size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -303,10 +286,9 @@ main(void)
HDputc('\n', stderr);
print_stats("in raw",
#ifdef H5_HAVE_GETRUSAGE
- &r_start, &r_stop,
+ &r_start, &r_stop,
#endif /* H5_HAVE_GETRUSAGE */
- t_start, t_stop, (size_t)(nread * size[0] * size[1]));
-
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Read the hdf5 dataset */
synchronize();
@@ -315,12 +297,11 @@ main(void)
#endif
t_start = H5_get_time();
HDfprintf(stderr, HEADING, "in hdf5");
- for(u = 0; u < nread; u++) {
- HDputc(PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space,
- H5P_DEFAULT, the_data);
- HDassert(status >= 0);
+ for (u = 0; u < nread; u++) {
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -329,15 +310,15 @@ main(void)
HDputc('\n', stderr);
print_stats("in hdf5",
#ifdef H5_HAVE_GETRUSAGE
- &r_start, &r_stop,
+ &r_start, &r_stop,
#endif /* H5_HAVE_GETRUSAGE */
- t_start, t_stop, (size_t)(nread * size[0] * size[1]));
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Read hyperslab */
HDassert(size[0] > 20 && size[1] > 20);
start[0] = start[1] = 10;
count[0] = count[1] = size[0] - 20;
- status = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, NULL, count, NULL);
+ status = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, NULL, count, NULL);
HDassert(status >= 0);
synchronize();
#ifdef H5_HAVE_GETRUSAGE
@@ -345,12 +326,11 @@ main(void)
#endif
t_start = H5_get_time();
HDfprintf(stderr, HEADING, "in hdf5 partial");
- for(u = 0; u < nread; u++) {
- HDputc(PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space,
- H5P_DEFAULT, the_data);
- HDassert(status >= 0);
+ for (u = 0; u < nread; u++) {
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -359,9 +339,9 @@ main(void)
HDputc('\n', stderr);
print_stats("in hdf5 partial",
#ifdef H5_HAVE_GETRUSAGE
- &r_start, &r_stop,
+ &r_start, &r_stop,
#endif /* H5_HAVE_GETRUSAGE */
- t_start, t_stop, (size_t)(nread * size[0] * size[1]));
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Close everything */
HDclose(fd);
@@ -374,4 +354,3 @@ main(void)
return 0;
}
-
diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c
index bb3aff5..dba8220 100644
--- a/tools/test/perform/overhead.c
+++ b/tools/test/perform/overhead.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,49 +24,41 @@
#include "H5private.h"
#ifdef H5_STDC_HEADERS
-# include <ctype.h>
-# include <fcntl.h>
-# include <stdlib.h>
-# include <sys/stat.h>
-# include <string.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <string.h>
#endif
#ifdef H5_HAVE_IO_H
-# include <io.h>
+#include <io.h>
#endif
#ifdef H5_HAVE_UNISTD_H
-# include <sys/types.h>
-# include <unistd.h>
+#include <sys/types.h>
+#include <unistd.h>
#endif
/* Solaris Studio defines attribute, but for the attributes we need */
#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus || defined(__SUNPRO_C)
-# undef __attribute__
-# define __attribute__(X) /*void*/
-# define H5_ATTR_UNUSED /*void*/
+#undef __attribute__
+#define __attribute__(X) /*void*/
+#define H5_ATTR_UNUSED /*void*/
#else
-# define H5_ATTR_UNUSED __attribute__((unused))
+#define H5_ATTR_UNUSED __attribute__((unused))
#endif
-#define FILE_NAME_1 "overhead.h5"
+#define FILE_NAME_1 "overhead.h5"
#ifndef FALSE
-#define FALSE 0
+#define FALSE 0
#endif /* FALSE */
#ifndef TRUE
-#define TRUE 1
+#define TRUE 1
#endif /* TRUE */
-typedef enum fill_t {
- FILL_ALL,
- FILL_FORWARD,
- FILL_REVERSE,
- FILL_INWARD,
- FILL_OUTWARD,
- FILL_RANDOM
-} fill_t;
+typedef enum fill_t { FILL_ALL, FILL_FORWARD, FILL_REVERSE, FILL_INWARD, FILL_OUTWARD, FILL_RANDOM } fill_t;
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -84,8 +76,7 @@ typedef enum fill_t {
static void
usage(const char *prog)
{
- HDfprintf(stderr, "usage: %s [STYLE|cache] [LEFT [MIDDLE [RIGHT]]]\n",
- prog);
+ HDfprintf(stderr, "usage: %s [STYLE|cache] [LEFT [MIDDLE [RIGHT]]]\n", prog);
HDfprintf(stderr, "\
STYLE is the order that the dataset is filled and should be one of:\n\
forward -- Fill the dataset from lowest address to highest\n\
@@ -117,7 +108,6 @@ usage(const char *prog)
exit(1);
}
-
/*-------------------------------------------------------------------------
* Function: cleanup
*
@@ -133,14 +123,13 @@ usage(const char *prog)
*-------------------------------------------------------------------------
*/
static void
-cleanup (void)
+cleanup(void)
{
- if (!getenv ("HDF5_NOCLEANUP")) {
- remove (FILE_NAME_1);
+ if (!getenv("HDF5_NOCLEANUP")) {
+ remove(FILE_NAME_1);
}
}
-
/*-------------------------------------------------------------------------
* Function: display_error_cb
*
@@ -158,15 +147,14 @@ cleanup (void)
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (hid_t estack, void H5_ATTR_UNUSED *client_data)
+display_error_cb(hid_t estack, void H5_ATTR_UNUSED *client_data)
{
- puts ("*FAILED*");
+ puts("*FAILED*");
H5Eprint2(estack, stdout);
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: test
*
@@ -184,92 +172,103 @@ display_error_cb (hid_t estack, void H5_ATTR_UNUSED *client_data)
*-------------------------------------------------------------------------
*/
static int
-test(fill_t fill_style, const double splits[],
- hbool_t verbose, hbool_t use_rdcc)
+test(fill_t fill_style, const double splits[], hbool_t verbose, hbool_t use_rdcc)
{
- hid_t file = (-1), fapl = (-1), dcpl = (-1), xfer = (-1), mspace = (-1), fspace = (-1), dset = (-1);
- hsize_t ch_size[1] = {1}; /*chunk size */
- hsize_t cur_size[1] = {1000}; /*current dataset size */
- hsize_t max_size[1] = {H5S_UNLIMITED}; /*maximum dataset size */
- hsize_t hs_start[1]; /*hyperslab start offset*/
- hsize_t hs_count[1] = {1}; /*hyperslab nelmts */
- int fd = (-1); /*h5 file direct */
- int *had = NULL; /*for random filling */
- const char *sname=NULL; /*fill style nam */
- int mdc_nelmts; /*num meta objs to cache*/
- hsize_t i, k;
- int j;
- h5_stat_t sb;
+ hid_t file = (-1), fapl = (-1), dcpl = (-1), xfer = (-1), mspace = (-1), fspace = (-1), dset = (-1);
+ hsize_t ch_size[1] = {1}; /*chunk size */
+ hsize_t cur_size[1] = {1000}; /*current dataset size */
+ hsize_t max_size[1] = {H5S_UNLIMITED}; /*maximum dataset size */
+ hsize_t hs_start[1]; /*hyperslab start offset*/
+ hsize_t hs_count[1] = {1}; /*hyperslab nelmts */
+ int fd = (-1); /*h5 file direct */
+ int * had = NULL; /*for random filling */
+ const char *sname = NULL; /*fill style nam */
+ int mdc_nelmts; /*num meta objs to cache*/
+ hsize_t i, k;
+ int j;
+ h5_stat_t sb;
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error;
- if(!use_rdcc) {
- if(H5Pget_cache(fapl, &mdc_nelmts, NULL, NULL, NULL) < 0) goto error;
- if(H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0F) < 0) goto error;
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if (!use_rdcc) {
+ if (H5Pget_cache(fapl, &mdc_nelmts, NULL, NULL, NULL) < 0)
+ goto error;
+ if (H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0F) < 0)
+ goto error;
}
- if((file = H5Fcreate(FILE_NAME_1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dcpl, 1, ch_size) < 0) goto error;
- if((xfer = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error;
- if(H5Pset_btree_ratios(xfer, splits[0], splits[1], splits[2]) < 0) goto error;
- if((fspace = H5Screate_simple(1, cur_size, max_size)) < 0) goto error;
- if((mspace = H5Screate_simple(1, ch_size, ch_size)) < 0) goto error;
- if((dset = H5Dcreate2(file, "chunked", H5T_NATIVE_INT,
- fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
- if ((fd=HDopen(FILE_NAME_1, O_RDONLY, 0666)) < 0) goto error;
+ if ((file = H5Fcreate(FILE_NAME_1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl, 1, ch_size) < 0)
+ goto error;
+ if ((xfer = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if (H5Pset_btree_ratios(xfer, splits[0], splits[1], splits[2]) < 0)
+ goto error;
+ if ((fspace = H5Screate_simple(1, cur_size, max_size)) < 0)
+ goto error;
+ if ((mspace = H5Screate_simple(1, ch_size, ch_size)) < 0)
+ goto error;
+ if ((dset = H5Dcreate2(file, "chunked", H5T_NATIVE_INT, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if ((fd = HDopen(FILE_NAME_1, O_RDONLY, 0666)) < 0)
+ goto error;
- if(FILL_RANDOM==fill_style)
+ if (FILL_RANDOM == fill_style)
had = (int *)calloc((size_t)cur_size[0], sizeof(int));
- for (i=1; i<=cur_size[0]; i++) {
+ for (i = 1; i <= cur_size[0]; i++) {
/* Decide which chunk to write to */
switch (fill_style) {
- case FILL_FORWARD:
- hs_start[0] = i-1;
- break;
- case FILL_REVERSE:
- hs_start[0] = cur_size[0]-i;
- break;
- case FILL_INWARD:
- hs_start[0] = i%2 ? i/2 : cur_size[0]-i/2;
- break;
- case FILL_OUTWARD:
- k = (cur_size[0] - i) + 1;
- hs_start[0] = k % 2 ? (k / 2) : (hsize_t)((hssize_t)cur_size[0] - (hssize_t)(k / 2));
- break;
- case FILL_RANDOM:
- for (j=HDrand()%(int)cur_size[0]; had[j]; j=(j+1)%(int)cur_size[0])
- /*void*/;
- hs_start[0] = (hsize_t)j;
- had[j] = 1;
- break;
- case FILL_ALL:
- abort();
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown fill style\n");
- goto error;
- break;
+ case FILL_FORWARD:
+ hs_start[0] = i - 1;
+ break;
+ case FILL_REVERSE:
+ hs_start[0] = cur_size[0] - i;
+ break;
+ case FILL_INWARD:
+ hs_start[0] = i % 2 ? i / 2 : cur_size[0] - i / 2;
+ break;
+ case FILL_OUTWARD:
+ k = (cur_size[0] - i) + 1;
+ hs_start[0] = k % 2 ? (k / 2) : (hsize_t)((hssize_t)cur_size[0] - (hssize_t)(k / 2));
+ break;
+ case FILL_RANDOM:
+ for (j = HDrand() % (int)cur_size[0]; had[j]; j = (j + 1) % (int)cur_size[0])
+ /*void*/;
+ hs_start[0] = (hsize_t)j;
+ had[j] = 1;
+ break;
+ case FILL_ALL:
+ abort();
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown fill style\n");
+ goto error;
+ break;
}
/* Write the chunk */
- if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_start, NULL,
- hs_count, NULL) < 0) goto error;
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_start, NULL, hs_count, NULL) < 0)
+ goto error;
if (H5Dwrite(dset, H5T_NATIVE_INT, mspace, fspace, xfer, &i) < 0) {
goto error;
}
/* Determine overhead */
if (verbose) {
- if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error;
- if (HDfstat(fd, &sb) < 0) goto error;
- printf("%4lu %8.3f ***\n",
- (unsigned long)i,
- (double)(sb.st_size - (HDoff_t)(i * sizeof(int))) / (double)i);
+ if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ goto error;
+ if (HDfstat(fd, &sb) < 0)
+ goto error;
+ printf("%4lu %8.3f ***\n", (unsigned long)i,
+ (double)(sb.st_size - (HDoff_t)(i * sizeof(int))) / (double)i);
}
}
- if(had) {
+ if (had) {
free(had);
had = NULL;
} /* end if */
@@ -283,53 +282,52 @@ test(fill_t fill_style, const double splits[],
if (!verbose) {
switch (fill_style) {
- case FILL_FORWARD:
- sname = "forward";
- break;
- case FILL_REVERSE:
- sname = "reverse";
- break;
- case FILL_INWARD:
- sname = "inward";
- break;
- case FILL_OUTWARD:
- sname = "outward";
- break;
- case FILL_RANDOM:
- sname = "random";
- break;
- case FILL_ALL:
- abort();
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown fill style\n");
- goto error;
- break;
+ case FILL_FORWARD:
+ sname = "forward";
+ break;
+ case FILL_REVERSE:
+ sname = "reverse";
+ break;
+ case FILL_INWARD:
+ sname = "inward";
+ break;
+ case FILL_OUTWARD:
+ sname = "outward";
+ break;
+ case FILL_RANDOM:
+ sname = "random";
+ break;
+ case FILL_ALL:
+ abort();
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown fill style\n");
+ goto error;
+ break;
}
- if (HDfstat(fd, &sb) < 0) goto error;
+ if (HDfstat(fd, &sb) < 0)
+ goto error;
printf("%-7s %8.3f\n", sname,
- (double)(sb.st_size - (HDoff_t)(cur_size[0] * sizeof(int))) /
- (double)cur_size[0]);
+ (double)(sb.st_size - (HDoff_t)(cur_size[0] * sizeof(int))) / (double)cur_size[0]);
}
HDclose(fd);
return 0;
- error:
+error:
H5Dclose(dset);
H5Sclose(mspace);
H5Sclose(fspace);
H5Pclose(dcpl);
H5Pclose(xfer);
H5Fclose(file);
- if(had)
+ if (had)
free(had);
HDclose(fd);
return 1;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -349,58 +347,70 @@ test(fill_t fill_style, const double splits[],
int
main(int argc, char *argv[])
{
- hid_t xfer;
+ hid_t xfer;
fill_t fill_style = FILL_ALL;
- hbool_t use_cache = FALSE;
+ hbool_t use_cache = FALSE;
double splits[3];
- int i, j, nerrors=0;
+ int i, j, nerrors = 0;
/* Default split ratios */
H5Eset_auto2(H5E_DEFAULT, display_error_cb, NULL);
- if((xfer = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error;
- if(H5Pget_btree_ratios(xfer, splits+0, splits+1, splits+2) < 0) goto error;
- if(H5Pclose(xfer) < 0) goto error;
+ if ((xfer = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if (H5Pget_btree_ratios(xfer, splits + 0, splits + 1, splits + 2) < 0)
+ goto error;
+ if (H5Pclose(xfer) < 0)
+ goto error;
/* Parse command-line options */
- for(i = 1, j = 0; i < argc; i++) {
+ for (i = 1, j = 0; i < argc; i++) {
if (!strcmp(argv[i], "forward")) {
fill_style = FILL_FORWARD;
- } else if (!strcmp(argv[i], "reverse")) {
+ }
+ else if (!strcmp(argv[i], "reverse")) {
fill_style = FILL_REVERSE;
- } else if (!strcmp(argv[i], "inward")) {
+ }
+ else if (!strcmp(argv[i], "inward")) {
fill_style = FILL_INWARD;
- } else if (!strcmp(argv[i], "outward")) {
+ }
+ else if (!strcmp(argv[i], "outward")) {
fill_style = FILL_OUTWARD;
- } else if (!strcmp(argv[i], "random")) {
+ }
+ else if (!strcmp(argv[i], "random")) {
fill_style = FILL_RANDOM;
- } else if (!strcmp(argv[i], "cache")) {
+ }
+ else if (!strcmp(argv[i], "cache")) {
use_cache = TRUE;
- } else if (j<3 && (isdigit(argv[i][0]) || '.'==argv[i][0])) {
+ }
+ else if (j < 3 && (isdigit(argv[i][0]) || '.' == argv[i][0])) {
splits[j++] = strtod(argv[i], NULL);
- } else {
+ }
+ else {
usage(argv[0]);
}
}
- if (FILL_ALL==fill_style) {
+ if (FILL_ALL == fill_style) {
printf("%-7s %8s\n", "Style", "Bytes/Chunk");
printf("%-7s %8s\n", "-----", "-----------");
nerrors += test(FILL_FORWARD, splits, FALSE, use_cache);
nerrors += test(FILL_REVERSE, splits, FALSE, use_cache);
- nerrors += test(FILL_INWARD, splits, FALSE, use_cache);
+ nerrors += test(FILL_INWARD, splits, FALSE, use_cache);
nerrors += test(FILL_OUTWARD, splits, FALSE, use_cache);
- nerrors += test(FILL_RANDOM, splits, FALSE, use_cache);
+ nerrors += test(FILL_RANDOM, splits, FALSE, use_cache);
}
else {
- if (use_cache) usage(argv[0]);
- nerrors += test(fill_style, splits, TRUE, FALSE);
+ if (use_cache)
+ usage(argv[0]);
+ nerrors += test(fill_style, splits, TRUE, FALSE);
}
- if (nerrors>0) goto error;
+ if (nerrors > 0)
+ goto error;
cleanup();
return 0;
- error:
+error:
HDfprintf(stderr, "*** ERRORS DETECTED ***\n");
return 1;
}
diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c
deleted file mode 100644
index 364836f..0000000
--- a/tools/test/perform/perf.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Author: Albert Cheng of NCSA, May 1, 2001.
- * This is derived from code given to me by Robert Ross.
- *
- * NOTE: This code assumes that all command line arguments make it out to all
- * the processes that make up the parallel job, which isn't always the case.
- * So if it doesn't work on some platform, that might be why.
- */
-
-#include "hdf5.h"
-#include "H5private.h"
-#include "h5test.h"
-
-#ifdef H5_HAVE_PARALLEL
-
-#ifdef H5_STDC_HEADERS
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#endif
-
-#ifdef H5_HAVE_UNISTD_H
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#ifdef H5_HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#if defined(H5_TIME_WITH_SYS_TIME)
-# include <sys/time.h>
-# include <time.h>
-#elif defined(H5_HAVE_SYS_TIME_H)
-# include <sys/time.h>
-#else
-# include <time.h>
-#endif
-
-#include <mpi.h>
-#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
-# include <mpio.h>
-#endif
-
-/* Macro definitions */
-/* Verify:
- * if val is false (0), print mesg and if fatal is true (non-zero), die.
- */
-#define H5FATAL 1
-#define VRFY(val, mesg, fatal) do { \
- if (!val) { \
- printf("Proc %d: ", mynod); \
- printf("*** Assertion failed (%s) at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
- if (fatal){ \
- fflush(stdout); \
- goto die_jar_jar_die; \
- } \
- } \
-} while(0)
-#define RANK 1
-#define MAX_PATH 1024
-
-hsize_t dims[RANK]; /* dataset dim sizes */
-hsize_t block[RANK], stride[RANK], count[RANK];
-hsize_t start[RANK];
-hid_t fid; /* HDF5 file ID */
-hid_t acc_tpl; /* File access templates */
-hid_t sid; /* Dataspace ID */
-hid_t file_dataspace; /* File dataspace ID */
-hid_t mem_dataspace; /* memory dataspace ID */
-hid_t dataset; /* Dataset ID */
-hsize_t opt_alignment = 1;
-hsize_t opt_threshold = 1;
-int opt_split_vfd = 0;
-char *meta_ext, *raw_ext; /* holds the meta and raw file extension if */
- /* opt_split_vfd is set */
-
-
-/* DEFAULT VALUES FOR OPTIONS */
-int64_t opt_block = 1048576*16;
-int opt_iter = 1;
-int opt_stripe = -1;
-int opt_correct = 0;
-int amode = O_RDWR | O_CREAT;
-char opt_file[256] = "perftest.out";
-char opt_pvfstab[256] = "notset";
-int opt_pvfstab_set = 0;
-
-const char *FILENAME[] = {
- opt_file,
- NULL
-};
-
-/* function prototypes */
-static int parse_args(int argc, char **argv);
-
-#ifndef H5_HAVE_UNISTD_H
-/* globals needed for getopt */
-extern char *optarg;
-#endif
-
-int main(int argc, char **argv)
-{
- char *buf, *tmp, *buf2 = NULL, *tmp2 = NULL, *check;
- int i, j, mynod=0, nprocs=1, my_correct = 1, correct, myerrno;
- double stim, etim;
- double write_tim = 0;
- double read_tim = 0;
- double read_bw, write_bw;
- double max_read_tim, max_write_tim;
- double min_read_tim, min_write_tim;
- double ave_read_tim, ave_write_tim;
- int64_t iter_jump = 0;
- char filename[MAX_PATH];
- herr_t ret; /* Generic return value */
-
- /* startup MPI and determine the rank of this process */
- MPI_Init(&argc,&argv);
- MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
- MPI_Comm_rank(MPI_COMM_WORLD, &mynod);
-
- /* parse the command line arguments */
- parse_args(argc, argv);
-
- if (mynod == 0) printf("# Using hdf5-io calls.\n");
-
- /* kindof a weird hack- if the location of the pvfstab file was
- * specified on the command line, then spit out this location into
- * the appropriate environment variable: */
-
-#if H5_HAVE_SETENV
-/* no setenv or unsetenv */
- if (opt_pvfstab_set) {
- if((setenv("PVFSTAB_FILE", opt_pvfstab, 1)) < 0){
- perror("setenv");
- goto die_jar_jar_die;
- }
- }
-#endif
-
- /* this is how much of the file data is covered on each iteration of
- * the test. used to help determine the seek offset on each
- * iteration */
- iter_jump = nprocs * opt_block;
-
- /* setup a buffer of data to write */
- if (!(tmp = (char *) malloc((size_t)opt_block + 256))) {
- perror("malloc");
- goto die_jar_jar_die;
- }
- buf = tmp + 128 - (((long)tmp) % 128); /* align buffer */
-
- if (opt_correct) {
- /* do the same buffer setup for verifiable data */
- if (!(tmp2 = (char *) malloc((size_t)opt_block + 256))) {
- perror("malloc2");
- goto die_jar_jar_die;
- }
- buf2 = tmp + 128 - (((long)tmp) % 128);
- }
-
- /* setup file access template with parallel IO access. */
- if (opt_split_vfd){
- hid_t mpio_pl;
-
- mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl >= 0), "", H5FATAL);
- ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL);
- VRFY((ret >= 0), "", H5FATAL);
-
- /* set optional allocation alignment */
- if (opt_alignment*opt_threshold != 1){
- ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
- VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
- }
-
- /* setup file access template */
- acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl >= 0), "", H5FATAL);
- ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl);
- VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL);
- ret = H5Pclose(mpio_pl);
- VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL);
- }else{
- /* setup file access template */
- acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl >= 0), "", H5FATAL);
- ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL);
- VRFY((ret >= 0), "", H5FATAL);
-
- /* set optional allocation alignment */
- if (opt_alignment*opt_threshold != 1){
- ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
- VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
- }
- }
-
- h5_fixname_no_suffix(FILENAME[0], acc_tpl, filename, sizeof filename);
-
- /* create the parallel file */
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
- VRFY((fid >= 0), "H5Fcreate succeeded", H5FATAL);
-
- /* define a contiquous dataset of opt_iter*nprocs*opt_block chars */
- dims[0] = (hsize_t)opt_iter * (hsize_t)nprocs * (hsize_t)opt_block;
- sid = H5Screate_simple(RANK, dims, NULL);
- VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL);
- dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL);
-
- /* create the memory dataspace and the file dataspace */
- dims[0] = (hsize_t)opt_block;
- mem_dataspace = H5Screate_simple(RANK, dims, NULL);
- VRFY((mem_dataspace >= 0), "", H5FATAL);
- file_dataspace = H5Dget_space(dataset);
- VRFY((file_dataspace >= 0), "H5Dget_space succeeded", H5FATAL);
-
- /* now each process writes a block of opt_block chars in round robbin
- * fashion until the whole dataset is covered.
- */
- for(j=0; j < opt_iter; j++) {
- /* setup a file dataspace selection */
- start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block));
- stride[0] = block[0] = (hsize_t)opt_block;
- count[0]= 1;
- ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL);
-
- if (opt_correct) /* fill in buffer for iteration */ {
- for (i=mynod+j, check=buf; i<opt_block; i++,check++) *check=(char)i;
- }
-
- /* discover the starting time of the operation */
- MPI_Barrier(MPI_COMM_WORLD);
- stim = MPI_Wtime();
-
- /* write data */
- ret = H5Dwrite(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace,
- H5P_DEFAULT, buf);
- VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL);
-
- /* discover the ending time of the operation */
- etim = MPI_Wtime();
-
- write_tim += (etim - stim);
-
- /* we are done with this "write" iteration */
- }
-
- /* close dataset and file */
- ret=H5Dclose(dataset);
- VRFY((ret >= 0), "H5Dclose succeeded", H5FATAL);
- ret=H5Fclose(fid);
- VRFY((ret >= 0), "H5Fclose succeeded", H5FATAL);
-
-
-
- /* wait for everyone to synchronize at this point */
- MPI_Barrier(MPI_COMM_WORLD);
-
- /* reopen the file for reading */
- fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl);
- VRFY((fid >= 0), "", H5FATAL);
-
- /* open the dataset */
- dataset = H5Dopen2(fid, "Dataset1", H5P_DEFAULT);
- VRFY((dataset >= 0), "H5Dopen succeeded", H5FATAL);
-
- /* we can re-use the same mem_dataspace and file_dataspace
- * the H5Dwrite used since the dimension size is the same.
- */
-
- /* we are going to repeat the read the same pattern the write used */
- for (j=0; j < opt_iter; j++) {
- /* setup a file dataspace selection */
- start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block));
- stride[0] = block[0] = (hsize_t)opt_block;
- count[0]= 1;
- ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL);
- /* seek to the appropriate spot give the current iteration and
- * rank within the MPI processes */
-
- /* discover the start time */
- MPI_Barrier(MPI_COMM_WORLD);
- stim = MPI_Wtime();
-
- /* read in the file data */
- if (!opt_correct){
- ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf);
- }
- else{
- ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf2);
- }
- myerrno = errno;
-
- /* discover the end time */
- etim = MPI_Wtime();
- read_tim += (etim - stim);
- VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL);
-
-
- if (ret < 0) HDfprintf(stderr, "node %d, read error, loc = %Ld: %s\n",
- mynod, mynod*opt_block, strerror(myerrno));
-
- /* if the user wanted to check correctness, compare the write
- * buffer to the read buffer */
- if (opt_correct && memcmp(buf, buf2, (size_t)opt_block)) {
- HDfprintf(stderr, "node %d, correctness test failed\n", mynod);
- my_correct = 0;
- MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN,
- MPI_COMM_WORLD);
- }
-
- /* we are done with this read iteration */
- }
-
- /* close dataset and file */
- ret=H5Dclose(dataset);
- VRFY((ret >= 0), "H5Dclose succeeded", H5FATAL);
- ret=H5Fclose(fid);
- VRFY((ret >= 0), "H5Fclose succeeded", H5FATAL);
- ret=H5Pclose(acc_tpl);
- VRFY((ret >= 0), "H5Pclose succeeded", H5FATAL);
-
- /* compute the read and write times */
- MPI_Allreduce(&read_tim, &max_read_tim, 1, MPI_DOUBLE, MPI_MAX,
- MPI_COMM_WORLD);
- MPI_Allreduce(&read_tim, &min_read_tim, 1, MPI_DOUBLE, MPI_MIN,
- MPI_COMM_WORLD);
- MPI_Allreduce(&read_tim, &ave_read_tim, 1, MPI_DOUBLE, MPI_SUM,
- MPI_COMM_WORLD);
-
- /* calculate the average from the sum */
- ave_read_tim = ave_read_tim / nprocs;
-
- MPI_Allreduce(&write_tim, &max_write_tim, 1, MPI_DOUBLE, MPI_MAX,
- MPI_COMM_WORLD);
- MPI_Allreduce(&write_tim, &min_write_tim, 1, MPI_DOUBLE, MPI_MIN,
- MPI_COMM_WORLD);
- MPI_Allreduce(&write_tim, &ave_write_tim, 1, MPI_DOUBLE, MPI_SUM,
- MPI_COMM_WORLD);
-
- /* calculate the average from the sum */
- ave_write_tim = ave_write_tim / nprocs;
-
- /* print out the results on one node */
- if (mynod == 0) {
- read_bw = (double)((int64_t)(opt_block*nprocs*opt_iter))/(max_read_tim*1000000.0);
- write_bw = (double)((int64_t)(opt_block*nprocs*opt_iter))/(max_write_tim*1000000.0);
-
- printf("nr_procs = %d, nr_iter = %d, blk_sz = %ld\n", nprocs,
- opt_iter, (long)opt_block);
-
- printf("# total_size = %ld\n", (long)(opt_block*nprocs*opt_iter));
-
- printf("# Write: min_time = %f, max_time = %f, mean_time = %f\n",
- min_write_tim, max_write_tim, ave_write_tim);
- printf("# Read: min_time = %f, max_time = %f, mean_time = %f\n",
- min_read_tim, max_read_tim, ave_read_tim);
-
- printf("Write bandwidth = %f Mbytes/sec\n", write_bw);
- printf("Read bandwidth = %f Mbytes/sec\n", read_bw);
-
- if (opt_correct) {
- printf("Correctness test %s.\n", correct ? "passed" : "failed");
- }
- }
-
-
-die_jar_jar_die:
-
-#if H5_HAVE_SETENV
-/* no setenv or unsetenv */
- /* clear the environment variable if it was set earlier */
- if (opt_pvfstab_set){
- unsetenv("PVFSTAB_FILE");
- }
-#endif
-
- free(tmp);
- if (opt_correct) free(tmp2);
-
- MPI_Finalize();
-
- return(0);
-}
-
-static int
-parse_args(int argc, char **argv)
-{
- int c;
-
- while ((c = getopt(argc, argv, "s:b:i:f:p:a:2:c")) != EOF) {
- switch (c) {
- case 's': /* stripe */
- opt_stripe = atoi(optarg);
- break;
- case 'b': /* block size */
- opt_block = atoi(optarg);
- break;
- case 'i': /* iterations */
- opt_iter = atoi(optarg);
- break;
- case 'f': /* filename */
- strncpy(opt_file, optarg, 255);
- FILENAME[0] = opt_file;
- break;
- case 'p': /* pvfstab file */
- strncpy(opt_pvfstab, optarg, 255);
- opt_pvfstab_set = 1;
- break;
- case 'a': /* aligned allocation.
- * syntax: -a<alignment>/<threshold>
- * e.g., -a4096/512 allocate at 4096 bytes
- * boundary if request size >= 512.
- */
- {
- char *p;
-
- opt_alignment = (hsize_t)HDatoi(optarg);
- if(NULL != (p = (char*)HDstrchr(optarg, '/')))
- opt_threshold = (hsize_t)HDatoi(p + 1);
- }
- HDfprintf(stdout,
- "alignment/threshold=%Hu/%Hu\n",
- opt_alignment, opt_threshold);
- break;
- case '2': /* use 2-files, i.e., split file driver */
- opt_split_vfd=1;
- /* get meta and raw file extension. */
- /* syntax is <raw_ext>,<meta_ext> */
- meta_ext = raw_ext = optarg;
- while (*raw_ext != '\0'){
- if (*raw_ext == ','){
- *raw_ext = '\0';
- raw_ext++;
- break;
- }
- raw_ext++;
- }
- printf("split-file-vfd used: %s,%s\n",
- meta_ext, raw_ext);
- break;
- case 'c': /* correctness */
- opt_correct = 1;
- break;
- case '?': /* unknown */
- default:
- break;
- }
- }
-
- return(0);
-}
-
-/*
- * Local variables:
- * c-indent-level: 3
- * c-basic-offset: 3
- * tab-width: 3
- * End:
- */
-
-#else /* H5_HAVE_PARALLEL */
-/* dummy program since H5_HAVE_PARALLEL is not configured in */
-int
-main(int H5_ATTR_UNUSED argc, char H5_ATTR_UNUSED **argv)
-{
- printf("No parallel performance because parallel is not configured in\n");
- return(0);
-}
-#endif /* H5_HAVE_PARALLEL */
-
diff --git a/tools/test/perform/perf_meta.c b/tools/test/perform/perf_meta.c
index 77248cc..d8ed9ec 100644
--- a/tools/test/perform/perf_meta.c
+++ b/tools/test/perform/perf_meta.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,39 +21,33 @@
#include "h5test.h"
#ifdef H5_HAVE_PARALLEL
-#define MAINPROCESS (!mpi_rank) /* define process 0 as main process */
-#endif /*H5_HAVE_PARALLEL*/
+#define MAINPROCESS (!mpi_rank) /* define process 0 as main process */
+#endif /*H5_HAVE_PARALLEL*/
/* File_Access_type bits */
-#define FACC_DEFAULT 0x0 /* serial as default */
-#define FACC_MPIO 0x1 /* MPIO */
+#define FACC_DEFAULT 0x0 /* serial as default */
+#define FACC_MPIO 0x1 /* MPIO */
/* Which test to run */
-int RUN_TEST = 0x0; /* all tests as default */
-int TEST_1 = 0x1; /* Test 1 */
-int TEST_2 = 0x2; /* Test 2 */
-int TEST_3 = 0x4; /* Test 3 */
-
+int RUN_TEST = 0x0; /* all tests as default */
+int TEST_1 = 0x1; /* Test 1 */
+int TEST_2 = 0x2; /* Test 2 */
+int TEST_3 = 0x4; /* Test 3 */
-const char *FILENAME[] = {
- "meta_perf_1",
- "meta_perf_2",
- "meta_perf_3",
- NULL
-};
+const char *FILENAME[] = {"meta_perf_1", "meta_perf_2", "meta_perf_3", NULL};
/* Default values for performance. Can be changed through command line options */
-int NUM_DSETS = 16;
-int NUM_ATTRS = 8;
-int BATCH_ATTRS = 2;
-hbool_t flush_dset = FALSE;
-hbool_t flush_attr = FALSE;
-int nerrors = 0; /* errors count */
-hid_t fapl;
+int NUM_DSETS = 16;
+int NUM_ATTRS = 8;
+int BATCH_ATTRS = 2;
+hbool_t flush_dset = FALSE;
+hbool_t flush_attr = FALSE;
+int nerrors = 0; /* errors count */
+hid_t fapl;
/* Data space IDs */
-hid_t space;
-hid_t small_space;
+hid_t space;
+hid_t small_space;
/* Performance data */
typedef struct p_time {
@@ -68,11 +62,10 @@ typedef struct p_time {
/*Test file access type for parallel. MPIO as default */
int facc_type = FACC_DEFAULT;
-double retrieve_time(void);
-void perf(p_time *perf_t, double start_t, double end_t);
-void print_perf(p_time, p_time, p_time);
+double retrieve_time(void);
+void perf(p_time *perf_t, double start_t, double end_t);
+void print_perf(p_time, p_time, p_time);
-
/*-------------------------------------------------------------------------
* Function: parse_options
*
@@ -91,108 +84,108 @@ parse_options(int argc, char **argv)
int t;
/* Use default values */
- if(argc==1)
- return(0);
-
- while (--argc){
- if (**(++argv) != '-'){
- break;
- }else{
- switch(*(*argv+1)){
- case 'h': /* Help page */
- return(1);
-
- case 'd': /* Number of datasets */
- NUM_DSETS = atoi((*argv+1)+1);
- if (NUM_DSETS < 0){
- nerrors++;
- return(1);
- }
- break;
-
- case 'a': /* Number of attributes per dataset */
- NUM_ATTRS = atoi((*argv+1)+1);
- if (NUM_ATTRS < 0){
- nerrors++;
- return(1);
- }
- break;
-
- case 'n': /* Number of attributes to be created in batch */
- BATCH_ATTRS = atoi((*argv+1)+1);
- if (BATCH_ATTRS < 0){
- nerrors++;
- return(1);
- }
- break;
-
- case 'm': /* Use the MPI-IO driver */
- facc_type = FACC_MPIO;
- break;
-
- case 'f': /* Call H5Fflush for each dataset or attribute */
- if(!strcmp("a", (*argv+2)))
- flush_attr = TRUE;
- else if(!strcmp("d", (*argv+2)))
- flush_dset = TRUE;
- else {
- nerrors++;
- return(1);
- }
- break;
-
- case 't': /* Which test to run */
- t = atoi((*argv+1)+1);
- if (t < 1 || t > 3){
- nerrors++;
- return(1);
- }
- if(t == 1)
- RUN_TEST |= TEST_1;
- else if(t == 2)
- RUN_TEST |= TEST_2;
- else
- RUN_TEST |= TEST_3;
-
- break;
-
- default: nerrors++;
- return(1);
- }
- }
+ if (argc == 1)
+ return (0);
+
+ while (--argc) {
+ if (**(++argv) != '-') {
+ break;
+ }
+ else {
+ switch (*(*argv + 1)) {
+ case 'h': /* Help page */
+ return (1);
+
+ case 'd': /* Number of datasets */
+ NUM_DSETS = atoi((*argv + 1) + 1);
+ if (NUM_DSETS < 0) {
+ nerrors++;
+ return (1);
+ }
+ break;
+
+ case 'a': /* Number of attributes per dataset */
+ NUM_ATTRS = atoi((*argv + 1) + 1);
+ if (NUM_ATTRS < 0) {
+ nerrors++;
+ return (1);
+ }
+ break;
+
+ case 'n': /* Number of attributes to be created in batch */
+ BATCH_ATTRS = atoi((*argv + 1) + 1);
+ if (BATCH_ATTRS < 0) {
+ nerrors++;
+ return (1);
+ }
+ break;
+
+ case 'm': /* Use the MPI-IO driver */
+ facc_type = FACC_MPIO;
+ break;
+
+ case 'f': /* Call H5Fflush for each dataset or attribute */
+ if (!strcmp("a", (*argv + 2)))
+ flush_attr = TRUE;
+ else if (!strcmp("d", (*argv + 2)))
+ flush_dset = TRUE;
+ else {
+ nerrors++;
+ return (1);
+ }
+ break;
+
+ case 't': /* Which test to run */
+ t = atoi((*argv + 1) + 1);
+ if (t < 1 || t > 3) {
+ nerrors++;
+ return (1);
+ }
+ if (t == 1)
+ RUN_TEST |= TEST_1;
+ else if (t == 2)
+ RUN_TEST |= TEST_2;
+ else
+ RUN_TEST |= TEST_3;
+
+ break;
+
+ default:
+ nerrors++;
+ return (1);
+ }
+ }
} /*while*/
/* Check valid values */
#ifndef H5_HAVE_PARALLEL
- if(facc_type == FACC_MPIO)
- {
+ if (facc_type == FACC_MPIO) {
nerrors++;
- return(1);
+ return (1);
}
#endif /*H5_HAVE_PARALLEL*/
- if(NUM_ATTRS && !BATCH_ATTRS)
+ if (NUM_ATTRS && !BATCH_ATTRS)
NUM_ATTRS = 0;
- if(!NUM_ATTRS && BATCH_ATTRS)
+ if (!NUM_ATTRS && BATCH_ATTRS)
BATCH_ATTRS = 0;
- if(!NUM_DSETS) {
+ if (!NUM_DSETS) {
nerrors++;
- return(1);
+ return (1);
}
- if(NUM_ATTRS && BATCH_ATTRS) {
- if(BATCH_ATTRS > NUM_ATTRS || NUM_ATTRS % BATCH_ATTRS) {
- nerrors++;
- return(1);
+ if (NUM_ATTRS && BATCH_ATTRS) {
+ if (BATCH_ATTRS > NUM_ATTRS || NUM_ATTRS % BATCH_ATTRS) {
+ nerrors++;
+ return (1);
}
}
- return(0);
+ return (0);
}
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -212,39 +205,38 @@ usage(void)
"[-a<num_attributes>]\n"
"\t[-n<batch_attributes>] [-f<option>] [-t<test>]\n");
printf("\t-h"
- "\t\t\thelp page.\n");
+ "\t\t\thelp page.\n");
printf("\t-m"
- "\t\t\tset MPIO as the file driver when parallel HDF5\n"
- "\t\t\t\tis enabled. -m must be specified\n"
- "\t\t\t\twhen running parallel program.\n");
+ "\t\t\tset MPIO as the file driver when parallel HDF5\n"
+ "\t\t\t\tis enabled. -m must be specified\n"
+ "\t\t\t\twhen running parallel program.\n");
printf("\t-d<num_datasets>"
- "\tset number of datasets for meta data \n"
- "\t\t\t\tperformance test\n");
+ "\tset number of datasets for meta data \n"
+ "\t\t\t\tperformance test\n");
printf("\t-a<num_attributes>"
- "\tset number of attributes per dataset for meta \n"
- "\t\t\t\tdata performance test.\n");
+ "\tset number of attributes per dataset for meta \n"
+ "\t\t\t\tdata performance test.\n");
printf("\t-n<batch_attributes>"
- "\tset batch number of attributes for dataset \n"
- "\t\t\t\tfor meta data performance test.\n");
+ "\tset batch number of attributes for dataset \n"
+ "\t\t\t\tfor meta data performance test.\n");
printf("\t-f<option>"
- "\t\tflush data to disk after closing a dataset \n"
- "\t\t\t\tor attribute. Valid options are \"d\" for \n"
- "\t\t\t\tdataset, \"a\" for attribute. Disabled is \n"
- "\t\t\t\tthe default.\n");
+ "\t\tflush data to disk after closing a dataset \n"
+ "\t\t\t\tor attribute. Valid options are \"d\" for \n"
+ "\t\t\t\tdataset, \"a\" for attribute. Disabled is \n"
+ "\t\t\t\tthe default.\n");
printf("\t-t<tests>"
- "\t\trun specific test. Give only one number each \n"
- "\t\t\t\ttime. i.e. \"-t1 -t3\" will run test 1 and 3. \n"
- "\t\t\t\tDefault is all three tests. The 3 tests are: \n\n"
- "\t\t\t\t1. Create <num_attributes> attributes for each \n"
- "\t\t\t\t of <num_datasets> existing datasets.\n"
- "\t\t\t\t2. Create <num_attributes> attributes for each \n"
- "\t\t\t\t of <num_datasets> new datasets.\n"
- "\t\t\t\t3. Create <batch_attributes> attributes for \n"
- "\t\t\t\t each of <num_dataset> new datasets for \n"
- "\t\t\t\t <num_attributes>/<batch_attributes> times.\n");
+ "\t\trun specific test. Give only one number each \n"
+ "\t\t\t\ttime. i.e. \"-t1 -t3\" will run test 1 and 3. \n"
+ "\t\t\t\tDefault is all three tests. The 3 tests are: \n\n"
+ "\t\t\t\t1. Create <num_attributes> attributes for each \n"
+ "\t\t\t\t of <num_datasets> existing datasets.\n"
+ "\t\t\t\t2. Create <num_attributes> attributes for each \n"
+ "\t\t\t\t of <num_datasets> new datasets.\n"
+ "\t\t\t\t3. Create <batch_attributes> attributes for \n"
+ "\t\t\t\t each of <num_dataset> new datasets for \n"
+ "\t\t\t\t <num_attributes>/<batch_attributes> times.\n");
}
-
/*-------------------------------------------------------------------------
* Function: create_dspace
*
@@ -264,20 +256,20 @@ usage(void)
static herr_t
create_dspace(void)
{
- hsize_t dims[2];
- hsize_t small_dims[2];
+ hsize_t dims[2];
+ hsize_t small_dims[2];
/* Create the data space */
dims[0] = 256;
dims[1] = 512;
- if((space = H5Screate_simple(2, dims, NULL)) < 0)
- goto error;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
/* Create a small data space for attributes */
small_dims[0] = 16;
small_dims[1] = 8;
- if((small_space = H5Screate_simple(2, small_dims, NULL)) < 0)
- goto error;
+ if ((small_space = H5Screate_simple(2, small_dims, NULL)) < 0)
+ goto error;
return 0;
@@ -285,7 +277,6 @@ error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_dsets
*
@@ -305,20 +296,20 @@ error:
static herr_t
create_dsets(hid_t file)
{
- hid_t dataset;
- char dset_name[32];
- int i;
+ hid_t dataset;
+ char dset_name[32];
+ int i;
/*
* Create a dataset using the default dataset creation properties.
*/
- for(i = 0; i < NUM_DSETS; i++) {
- HDsprintf(dset_name, "dataset %d", i);
- if((dataset = H5Dcreate2(file, dset_name, H5T_NATIVE_DOUBLE, space,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for (i = 0; i < NUM_DSETS; i++) {
+ HDsprintf(dset_name, "dataset %d", i);
+ if ((dataset = H5Dcreate2(file, dset_name, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto error;
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
} /* end for */
@@ -326,10 +317,8 @@ create_dsets(hid_t file)
error:
return -1;
-
}
-
/*-------------------------------------------------------------------------
* Function: create_attrs_1
*
@@ -349,63 +338,62 @@ error:
static herr_t
create_attrs_1(void)
{
- hid_t file, dataset, attr;
- char filename[128];
- char dset_name[64];
- char attr_name[128];
- int i, j;
- p_time attr_t = {0, 0, 0, 1000000, 0, ""};
- p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen2"};
- p_time close_t = {0, 0, 0, 1000000, 0, ""};
+ hid_t file, dataset, attr;
+ char filename[128];
+ char dset_name[64];
+ char attr_name[128];
+ int i, j;
+ p_time attr_t = {0, 0, 0, 1000000, 0, ""};
+ p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen2"};
+ p_time close_t = {0, 0, 0, 1000000, 0, ""};
#ifdef H5_HAVE_PARALLEL
/* need the rank for printing data */
- int mpi_rank;
- if(facc_type == FACC_MPIO)
+ int mpi_rank;
+ if (facc_type == FACC_MPIO)
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
#endif /*H5_HAVE_PARALLEL*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
- fapl)) < 0)
- goto error;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
- if(create_dsets(file) < 0)
- goto error;
+ if (create_dsets(file) < 0)
+ goto error;
/*
* Create all(user specifies the number) attributes for each dataset
*/
- for(i = 0; i < NUM_DSETS; i++) {
- HDsprintf(dset_name, "dataset %d", i);
+ for (i = 0; i < NUM_DSETS; i++) {
+ HDsprintf(dset_name, "dataset %d", i);
open_t.start = retrieve_time();
- if((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0)
- goto error;
- perf(&open_t, open_t.start, retrieve_time());
+ if ((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0)
+ goto error;
+ perf(&open_t, open_t.start, retrieve_time());
- for(j = 0; j < NUM_ATTRS; j++) {
+ for (j = 0; j < NUM_ATTRS; j++) {
HDsprintf(attr_name, "all attrs for each dset %d", j);
attr_t.start = retrieve_time();
- if((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE,
- small_space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto error;
- if(H5Aclose(attr) < 0)
+ if (H5Aclose(attr) < 0)
goto error;
perf(&attr_t, attr_t.start, retrieve_time());
- if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ if (flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
- } /* end for */
+ } /* end for */
- close_t.start = retrieve_time();
- if(H5Dclose(dataset) < 0)
+ close_t.start = retrieve_time();
+ if (H5Dclose(dataset) < 0)
goto error;
- perf(&close_t, close_t.start, retrieve_time());
- if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ perf(&close_t, close_t.start, retrieve_time());
+ if (flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
} /* end for */
- if(facc_type == FACC_MPIO) {
+ if (facc_type == FACC_MPIO) {
#ifdef H5_HAVE_PARALLEL
MPI_Barrier(MPI_COMM_WORLD);
#endif /*H5_HAVE_PARALLEL*/
@@ -413,21 +401,22 @@ create_attrs_1(void)
#ifdef H5_HAVE_PARALLEL
if (facc_type == FACC_DEFAULT || (facc_type != FACC_DEFAULT && MAINPROCESS)) /* only process 0 reports */
-#endif /*H5_HAVE_PARALLEL*/
+#endif /*H5_HAVE_PARALLEL*/
{
/* Calculate the average time */
open_t.avg = open_t.total / NUM_DSETS;
close_t.avg = close_t.total / NUM_DSETS;
- if(NUM_ATTRS)
- attr_t.avg = attr_t.total / (NUM_ATTRS*NUM_DSETS);
+ if (NUM_ATTRS)
+ attr_t.avg = attr_t.total / (NUM_ATTRS * NUM_DSETS);
/* Print out the performance result */
- HDfprintf(stderr, "1. Create %d attributes for each of %d existing datasets\n",
- NUM_ATTRS, NUM_DSETS);
+ HDfprintf(stderr, "1. Create %d attributes for each of %d existing datasets\n", NUM_ATTRS,
+ NUM_DSETS);
print_perf(open_t, close_t, attr_t);
}
- if (H5Fclose(file) < 0) goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
return 0;
@@ -435,7 +424,6 @@ error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_attrs_2
*
@@ -455,61 +443,61 @@ error:
static herr_t
create_attrs_2(void)
{
- hid_t file, dataset, attr;
- char filename[128];
- char dset_name[64];
- char attr_name[128];
- int i, j;
- p_time attr_t = {0, 0, 0, 1000000, 0, ""};
- p_time create_t = {0, 0, 0, 1000000, 0, "H5Dcreate2"};
- p_time close_t = {0, 0, 0, 1000000, 0, ""};
+ hid_t file, dataset, attr;
+ char filename[128];
+ char dset_name[64];
+ char attr_name[128];
+ int i, j;
+ p_time attr_t = {0, 0, 0, 1000000, 0, ""};
+ p_time create_t = {0, 0, 0, 1000000, 0, "H5Dcreate2"};
+ p_time close_t = {0, 0, 0, 1000000, 0, ""};
#ifdef H5_HAVE_PARALLEL
/* need the rank for printing data */
- int mpi_rank;
- if(facc_type == FACC_MPIO)
+ int mpi_rank;
+ if (facc_type == FACC_MPIO)
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
#endif /*H5_HAVE_PARALLEL*/
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto error;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
/*
* Create all(user specifies the number) attributes for each new dataset
*/
- for(i = 0; i < NUM_DSETS; i++) {
- HDsprintf(dset_name, "dataset %d", i);
+ for (i = 0; i < NUM_DSETS; i++) {
+ HDsprintf(dset_name, "dataset %d", i);
create_t.start = retrieve_time();
- if((dataset = H5Dcreate2(file, dset_name, H5T_NATIVE_DOUBLE,
- space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate2(file, dset_name, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto error;
- perf(&create_t, create_t.start, retrieve_time());
+ perf(&create_t, create_t.start, retrieve_time());
- for(j = 0; j < NUM_ATTRS; j++) {
+ for (j = 0; j < NUM_ATTRS; j++) {
HDsprintf(attr_name, "all attrs for each dset %d", j);
attr_t.start = retrieve_time();
- if((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE,
- small_space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto error;
- if(H5Aclose(attr) < 0)
+ if (H5Aclose(attr) < 0)
goto error;
perf(&attr_t, attr_t.start, retrieve_time());
- if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ if (flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
- } /* end for */
+ } /* end for */
- close_t.start = retrieve_time();
- if(H5Dclose(dataset) < 0)
+ close_t.start = retrieve_time();
+ if (H5Dclose(dataset) < 0)
goto error;
- perf(&close_t, close_t.start, retrieve_time());
- if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ perf(&close_t, close_t.start, retrieve_time());
+ if (flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
} /* end for */
#ifdef H5_HAVE_PARALLEL
- if(facc_type == FACC_MPIO)
+ if (facc_type == FACC_MPIO)
MPI_Barrier(MPI_COMM_WORLD);
#endif /*H5_HAVE_PARALLEL*/
@@ -521,16 +509,16 @@ create_attrs_2(void)
/* Calculate the average time */
create_t.avg = create_t.total / NUM_DSETS;
close_t.avg = close_t.total / NUM_DSETS;
- if(NUM_ATTRS)
- attr_t.avg = attr_t.total / (NUM_ATTRS*NUM_DSETS);
+ if (NUM_ATTRS)
+ attr_t.avg = attr_t.total / (NUM_ATTRS * NUM_DSETS);
/* Print out the performance result */
- HDfprintf(stderr, "2. Create %d attributes for each of %d new datasets\n",
- NUM_ATTRS, NUM_DSETS);
+ HDfprintf(stderr, "2. Create %d attributes for each of %d new datasets\n", NUM_ATTRS, NUM_DSETS);
print_perf(create_t, close_t, attr_t);
}
- if (H5Fclose(file) < 0) goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
return 0;
@@ -538,7 +526,6 @@ error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: create_attrs_3
*
@@ -559,70 +546,69 @@ error:
static herr_t
create_attrs_3(void)
{
- hid_t file, dataset, attr;
- char filename[128];
- char dset_name[64];
- char attr_name[128];
- int loop_num;
- int i, j, k;
- p_time attr_t = {0, 0, 0, 1000000, 0, ""};
- p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen2"};
- p_time close_t = {0, 0, 0, 1000000, 0, ""};
+ hid_t file, dataset, attr;
+ char filename[128];
+ char dset_name[64];
+ char attr_name[128];
+ int loop_num;
+ int i, j, k;
+ p_time attr_t = {0, 0, 0, 1000000, 0, ""};
+ p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen2"};
+ p_time close_t = {0, 0, 0, 1000000, 0, ""};
#ifdef H5_HAVE_PARALLEL
/* need the rank for printing data */
- int mpi_rank;
- if(facc_type == FACC_MPIO)
+ int mpi_rank;
+ if (facc_type == FACC_MPIO)
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
#endif /*H5_HAVE_PARALLEL*/
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
- fapl)) < 0)
- goto error;
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
- if(create_dsets(file) < 0)
- goto error;
+ if (create_dsets(file) < 0)
+ goto error;
/*
* Create some(user specifies the number) attributes for each dataset
* in a loop
*/
- loop_num = NUM_ATTRS/BATCH_ATTRS;
+ loop_num = NUM_ATTRS / BATCH_ATTRS;
- for(i = 0; i < loop_num; i++) {
- for(j = 0; j < NUM_DSETS; j++) {
+ for (i = 0; i < loop_num; i++) {
+ for (j = 0; j < NUM_DSETS; j++) {
HDsprintf(dset_name, "dataset %d", j);
open_t.start = retrieve_time();
- if((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0)
goto error;
perf(&open_t, open_t.start, retrieve_time());
- for(k = 0; k < BATCH_ATTRS; k++) {
+ for (k = 0; k < BATCH_ATTRS; k++) {
HDsprintf(attr_name, "some attrs for each dset %d %d", i, k);
attr_t.start = retrieve_time();
- if((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE,
- small_space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto error;
- if(H5Aclose(attr) < 0)
+ if (H5Aclose(attr) < 0)
goto error;
perf(&attr_t, attr_t.start, retrieve_time());
- if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ if (flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
} /* end for */
close_t.start = retrieve_time();
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
goto error;
perf(&close_t, close_t.start, retrieve_time());
- if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ if (flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
#ifdef H5_HAVE_PARALLEL
- if(facc_type == FACC_MPIO)
+ if (facc_type == FACC_MPIO)
MPI_Barrier(MPI_COMM_WORLD);
#endif /*H5_HAVE_PARALLEL*/
@@ -632,17 +618,18 @@ create_attrs_3(void)
#endif /*H5_HAVE_PARALLEL*/
{
/* Calculate the average time */
- open_t.avg = open_t.total / (loop_num*NUM_DSETS);
- close_t.avg = close_t.total / (loop_num*NUM_DSETS);
- attr_t.avg = attr_t.total / (NUM_ATTRS*NUM_DSETS);
+ open_t.avg = open_t.total / (loop_num * NUM_DSETS);
+ close_t.avg = close_t.total / (loop_num * NUM_DSETS);
+ attr_t.avg = attr_t.total / (NUM_ATTRS * NUM_DSETS);
/* Print out the performance result */
HDfprintf(stderr, "3. Create %d attributes for each of %d existing datasets for %d times\n",
- BATCH_ATTRS, NUM_DSETS, loop_num);
+ BATCH_ATTRS, NUM_DSETS, loop_num);
print_perf(open_t, close_t, attr_t);
}
- if (H5Fclose(file) < 0) goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
return 0;
@@ -650,7 +637,6 @@ error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: retrieve_time
*
@@ -663,22 +649,23 @@ error:
*
*-------------------------------------------------------------------------
*/
-double retrieve_time(void)
+double
+retrieve_time(void)
{
#ifdef H5_HAVE_PARALLEL
- if(facc_type == FACC_DEFAULT) {
+ if (facc_type == FACC_DEFAULT) {
#endif /*H5_HAVE_PARALLEL*/
struct timeval t;
HDgettimeofday(&t, NULL);
return ((double)t.tv_sec + (double)t.tv_usec / 1000000);
#ifdef H5_HAVE_PARALLEL
- } else {
+ }
+ else {
return MPI_Wtime();
}
#endif /*H5_HAVE_PARALLEL*/
}
-
/*-------------------------------------------------------------------------
* Function: perf
*
@@ -692,12 +679,13 @@ double retrieve_time(void)
*
*-------------------------------------------------------------------------
*/
-void perf(p_time *perf_t, double start_t, double end_t)
+void
+perf(p_time *perf_t, double start_t, double end_t)
{
- double t = end_t - start_t;
+ double t = end_t - start_t;
#ifdef H5_HAVE_PARALLEL
- if(facc_type == FACC_MPIO) {
+ if (facc_type == FACC_MPIO) {
double reduced_t;
double t_max, t_min;
int mpi_size, mpi_rank;
@@ -706,36 +694,33 @@ void perf(p_time *perf_t, double start_t, double end_t)
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Barrier(MPI_COMM_WORLD);
- MPI_Reduce(&t, &reduced_t, 1, MPI_DOUBLE, MPI_SUM, 0,
- MPI_COMM_WORLD);
+ MPI_Reduce(&t, &reduced_t, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
reduced_t /= mpi_size;
- MPI_Reduce(&t, &t_max, 1, MPI_DOUBLE, MPI_MAX, 0,
- MPI_COMM_WORLD);
- MPI_Reduce(&t, &t_min, 1, MPI_DOUBLE, MPI_MIN, 0,
- MPI_COMM_WORLD);
+ MPI_Reduce(&t, &t_max, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+ MPI_Reduce(&t, &t_min, 1, MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD);
if (MAINPROCESS) {
perf_t->total += reduced_t;
- if(t_max > perf_t->max)
- perf_t->max = t_max;
- if(t_min < perf_t->min)
- perf_t->min = t_min;
+ if (t_max > perf_t->max)
+ perf_t->max = t_max;
+ if (t_min < perf_t->min)
+ perf_t->min = t_min;
}
- } else
+ }
+ else
#endif /*H5_HAVE_PARALLEL*/
{
- perf_t->total += t;
+ perf_t->total += t;
- if(t > perf_t->max)
- perf_t->max = t;
- if(t < perf_t->min)
- perf_t->min = t;
+ if (t > perf_t->max)
+ perf_t->max = t;
+ if (t < perf_t->min)
+ perf_t->min = t;
}
}
-
/*-------------------------------------------------------------------------
* Function: print_perf
*
@@ -748,18 +733,18 @@ void perf(p_time *perf_t, double start_t, double end_t)
*
*-------------------------------------------------------------------------
*/
-void print_perf(p_time open_t, p_time close_t, p_time attr_t)
+void
+print_perf(p_time open_t, p_time close_t, p_time attr_t)
{
- HDfprintf(stderr, "\t%s:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n",
- open_t.func, open_t.avg, open_t.max, open_t.min);
- HDfprintf(stderr, "\tH5Dclose:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n",
- close_t.avg, close_t.max, close_t.min);
- if(NUM_ATTRS)
- HDfprintf(stderr, "\tH5A(create & close):\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n",
- attr_t.avg, attr_t.max, attr_t.min);
+ HDfprintf(stderr, "\t%s:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", open_t.func, open_t.avg, open_t.max,
+ open_t.min);
+ HDfprintf(stderr, "\tH5Dclose:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", close_t.avg, close_t.max,
+ close_t.min);
+ if (NUM_ATTRS)
+ HDfprintf(stderr, "\tH5A(create & close):\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", attr_t.avg,
+ attr_t.max, attr_t.min);
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -780,16 +765,16 @@ int
main(int argc, char **argv)
{
#ifdef H5_HAVE_PARALLEL
- int mpi_size, mpi_rank; /* mpi variables */
-#endif /*H5_HAVE_PARALLEL*/
+ int mpi_size, mpi_rank; /* mpi variables */
+#endif /*H5_HAVE_PARALLEL*/
- if(parse_options(argc, argv) != 0) {
- usage();
- return 0;
+ if (parse_options(argc, argv) != 0) {
+ usage();
+ return 0;
}
#ifdef H5_HAVE_PARALLEL
- if(facc_type == FACC_MPIO) {
+ if (facc_type == FACC_MPIO) {
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -801,48 +786,51 @@ main(int argc, char **argv)
#endif /*H5_HAVE_PARALLEL*/
HDfprintf(stderr, "\t\tPerformance result of metadata for datasets and attributes\n\n");
- fapl = H5Pcreate (H5P_FILE_ACCESS);
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
#ifdef H5_HAVE_PARALLEL
- if(facc_type == FACC_MPIO)
+ if (facc_type == FACC_MPIO)
H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
#endif /*H5_HAVE_PARALLEL*/
- nerrors += create_dspace() < 0 ?1:0;
+ nerrors += create_dspace() < 0 ? 1 : 0;
- if((RUN_TEST & TEST_1) || !RUN_TEST)
- nerrors += create_attrs_1() < 0 ?1:0;
- if((RUN_TEST & TEST_2) || !RUN_TEST)
- nerrors += create_attrs_2() < 0 ?1:0;
- if(((RUN_TEST & TEST_3) || !RUN_TEST) && BATCH_ATTRS && NUM_ATTRS)
- nerrors += create_attrs_3() < 0 ?1:0;
+ if ((RUN_TEST & TEST_1) || !RUN_TEST)
+ nerrors += create_attrs_1() < 0 ? 1 : 0;
+ if ((RUN_TEST & TEST_2) || !RUN_TEST)
+ nerrors += create_attrs_2() < 0 ? 1 : 0;
+ if (((RUN_TEST & TEST_3) || !RUN_TEST) && BATCH_ATTRS && NUM_ATTRS)
+ nerrors += create_attrs_3() < 0 ? 1 : 0;
- if (H5Sclose(space) < 0) goto error;
- if (H5Sclose(small_space) < 0) goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Sclose(small_space) < 0)
+ goto error;
h5_clean_files(FILENAME, fapl);
#ifdef H5_HAVE_PARALLEL
- if(facc_type == FACC_MPIO)
+ if (facc_type == FACC_MPIO)
/* MPI_Finalize must be called AFTER H5close which may use MPI calls */
MPI_Finalize();
#endif /*H5_HAVE_PARALLEL*/
- if (nerrors) goto error;
+ if (nerrors)
+ goto error;
#ifdef H5_HAVE_PARALLEL
if (facc_type != FACC_DEFAULT && MAINPROCESS)
-#endif /*H5_HAVE_PARALLEL*/
printf("All metadata performance tests passed.\n");
+#else
+ printf("All metadata performance tests passed.\n");
+#endif /*H5_HAVE_PARALLEL*/
return 0;
- error:
+error:
nerrors = MAX(1, nerrors);
#ifdef H5_HAVE_PARALLEL
if (facc_type != FACC_DEFAULT && MAINPROCESS)
#endif /*H5_HAVE_PARALLEL*/
- printf("***** %d PERFORMANCE TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ printf("***** %d PERFORMANCE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return 1;
}
-
diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c
deleted file mode 100644
index cdd698e..0000000
--- a/tools/test/perform/pio_engine.c
+++ /dev/null
@@ -1,2713 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Author: Albert Cheng of NCSA, Oct 24, 2001.
- */
-
-#include "hdf5.h"
-
-#ifdef H5_STDC_HEADERS
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#endif
-
-#ifdef H5_HAVE_UNISTD_H
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#ifdef H5_HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#ifdef H5_HAVE_PARALLEL
-
-#include <mpi.h>
-
-#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
-# include <mpio.h>
-#endif /* !MPI_FILE_NULL */
-
-#include "pio_perf.h"
-
-/* Macro definitions */
-
-#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 6
-# define H5DCREATE(fd, name, type, space, dcpl) H5Dcreate(fd, name, type, space, dcpl)
-# define H5DOPEN(fd, name) H5Dopen(fd, name)
-#else
-# define H5DCREATE(fd, name, type, space, dcpl) H5Dcreate2(fd, name, type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)
-# define H5DOPEN(fd, name) H5Dopen2(fd, name, H5P_DEFAULT)
-#endif
-
-/* sizes of various items. these sizes won't change during program execution */
-/* The following three must have the same type */
-#define ELMT_H5_TYPE H5T_NATIVE_UCHAR
-
-#define GOTOERROR(errcode) { ret_code = errcode; goto done; }
-#define ERRMSG(mesg) { \
- HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \
- HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
-}
-
-/* verify: if val is false (0), print mesg. */
-#define VRFY(val, mesg) do { \
- if (!val) { \
- ERRMSG(mesg); \
- GOTOERROR(FAIL); \
- } \
-} while(0)
-
-
-/* POSIX I/O macros */
-#ifdef H5_HAVE_WIN32_API
-/* Can't link against the library, so this test will use the older, non-Unicode
- * _open() call on Windows.
- */
-#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__)
-#endif /* H5_HAVE_WIN32_API */
-#define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
-#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
-#define POSIXCLOSE(F) HDclose(F)
-#define POSIXSEEK(F,L) HDlseek(F, L, SEEK_SET)
-#define POSIXWRITE(F,B,S) HDwrite(F,B,S)
-#define POSIXREAD(F,B,S) HDread(F,B,S)
-
-enum {
- PIO_CREATE = 1,
- PIO_WRITE = 2,
- PIO_READ = 4
-};
-
-/* Global variables */
-static int clean_file_g = -1; /*whether to cleanup temporary test */
-/*files. -1 is not defined; */
-/*0 is no cleanup; 1 is do cleanup */
-
-/*
- * In a parallel machine, the filesystem suitable for compiling is
- * unlikely a parallel file system that is suitable for parallel I/O.
- * There is no standard pathname for the parallel file system. /tmp
- * is about the best guess.
- */
-#ifndef HDF5_PARAPREFIX
-# define HDF5_PARAPREFIX ""
-#endif /* !HDF5_PARAPREFIX */
-
-#ifndef MIN
-# define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif /* !MIN */
-
-/* the different types of file descriptors we can expect */
-typedef union _file_descr {
- int posixfd; /* POSIX file handle*/
- MPI_File mpifd; /* MPI file */
- hid_t h5fd; /* HDF5 file */
-} file_descr;
-
-/* local functions */
-static char *pio_create_filename(iotype iot, const char *base_name,
- char *fullname, size_t size);
-static herr_t do_write(results *res, file_descr *fd, parameters *parms,
- long ndsets, off_t nelmts, size_t buf_size, void *buffer);
-static herr_t do_read(results *res, file_descr *fd, parameters *parms,
- long ndsets, off_t nelmts, size_t buf_size, void *buffer /*out*/);
-static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/,
- int flags);
-static herr_t do_fclose(iotype iot, file_descr *fd);
-static void do_cleanupfile(iotype iot, char *fname);
-static off_t sqrto(off_t);
-
-/*
- * Function: do_pio
- * Purpose: PIO Engine where Parallel IO are executed.
- * Return: results
- * Programmer: Albert Cheng, Bill Wendling 2001/12/12
- * Modifications:
- * Added 2D testing (Christian Chilan, 10. August 2005)
- */
- results
-do_pio(parameters param)
-{
- /* return codes */
- herr_t ret_code = 0; /*return code */
- results res;
-
- file_descr fd;
- iotype iot;
-
- char fname[FILENAME_MAX];
- long nf;
- long ndsets;
- off_t nbytes; /*number of bytes per dataset */
- off_t snbytes; /*general dataset size */
- /*for 1D, it is the actual dataset size */
- /*for 2D, it is the size of a side of the dataset square */
- char *buffer = NULL; /*data buffer pointer */
- size_t buf_size; /*general buffer size in bytes */
- /*for 1D, it is the actual buffer size */
- /*for 2D, it is the length of the buffer rectangle */
- size_t blk_size; /*data block size in bytes */
- size_t bsize; /*actual buffer size */
-
- /* HDF5 variables */
- herr_t hrc; /*HDF5 return code */
-
- /* Sanity check parameters */
-
- /* IO type */
- iot = param.io_type;
-
- switch (iot) {
- case MPIO:
- fd.mpifd = MPI_FILE_NULL;
- res.timers = io_time_new(MPI_CLOCK);
- break;
- case POSIXIO:
- fd.posixfd = -1;
- res.timers = io_time_new(MPI_CLOCK);
- break;
- case PHDF5:
- fd.h5fd = -1;
- res.timers = io_time_new(MPI_CLOCK);
- break;
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", iot);
- GOTOERROR(FAIL);
- }
-
- ndsets = param.num_dsets; /* number of datasets per file */
- nbytes = param.num_bytes; /* number of bytes per dataset */
- buf_size = param.buf_size;
- blk_size = param.blk_size;
-
- if (!param.dim2d){
- snbytes = nbytes; /* General dataset size */
- bsize = buf_size; /* Actual buffer size */
- }
- else {
- snbytes = sqrto(nbytes); /* General dataset size */
- bsize = buf_size * blk_size; /* Actual buffer size */
- }
-
- if (param.num_files < 0 ) {
- HDfprintf(stderr,
- "number of files must be >= 0 (%ld)\n",
- param.num_files);
- GOTOERROR(FAIL);
- }
-
- if (ndsets < 0 ) {
- HDfprintf(stderr,
- "number of datasets per file must be >= 0 (%ld)\n",
- ndsets);
- GOTOERROR(FAIL);
- }
-
- if (param.num_procs <= 0 ) {
- HDfprintf(stderr,
- "maximum number of process to use must be > 0 (%d)\n",
- param.num_procs);
- GOTOERROR(FAIL);
- }
-
- /* Validate transfer buffer size & block size*/
- if(blk_size<=0) {
- HDfprintf(stderr,
- "Transfer block size (%zu) must be > 0\n", blk_size);
- GOTOERROR(FAIL);
- }
- if(buf_size<=0) {
- HDfprintf(stderr,
- "Transfer buffer size (%zu) must be > 0\n", buf_size);
- GOTOERROR(FAIL);
- }
- if ((buf_size % blk_size) != 0){
- HDfprintf(stderr,
- "Transfer buffer size (%zu) must be a multiple of the "
- "interleaved I/O block size (%zu)\n",
- buf_size, blk_size);
- GOTOERROR(FAIL);
- }
- if((snbytes%pio_mpi_nprocs_g)!=0) {
- HDfprintf(stderr,
- "Dataset size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
- "number of processes (%d)\n",
- (long long)snbytes, pio_mpi_nprocs_g);
- GOTOERROR(FAIL);
- }
-
- if (!param.dim2d){
- if(((size_t)(snbytes/pio_mpi_nprocs_g)%buf_size)!=0) {
- HDfprintf(stderr,
- "Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
- "trasfer buffer size (%zu)\n",
- (long long)(snbytes/pio_mpi_nprocs_g), buf_size);
- GOTOERROR(FAIL);
- }
- }
- else {
- if(((size_t)snbytes%buf_size)!=0) {
- HDfprintf(stderr,
- "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
- "trasfer buffer size (%zu)\n",
- (long long)snbytes, buf_size);
- GOTOERROR(FAIL);
- }
- }
-
- /* Allocate transfer buffer */
- if ((buffer = malloc(bsize)) == NULL){
- HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n",
- bsize);
- GOTOERROR(FAIL);
- }
-
- if (pio_debug_level >= 4) {
- int myrank;
-
- MPI_Comm_rank(pio_comm_g, &myrank);
-
- /* output all of the times for all iterations */
- if (myrank == 0)
- HDfprintf(output, "Timer details:\n");
- }
-
- for (nf = 1; nf <= param.num_files; nf++) {
- /*
- * Write performance measurement
- */
- /* Open file for write */
- char base_name[256];
-
- HDsprintf(base_name, "#pio_tmp_%lu", nf);
- pio_create_filename(iot, base_name, fname, sizeof(fname));
- if (pio_debug_level > 0)
- HDfprintf(output, "rank %d: data filename=%s\n",
- pio_mpi_rank_g, fname);
-
- /* Need barrier to make sure everyone starts at the same time */
- MPI_Barrier(pio_comm_g);
-
- io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
- hrc = do_fopen(&param, fname, &fd, PIO_CREATE | PIO_WRITE);
-
- VRFY((hrc == SUCCESS), "do_fopen failed");
-
- io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
- hrc = do_write(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
- io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
-
- VRFY((hrc == SUCCESS), "do_write failed");
-
- /* Close file for write */
- hrc = do_fclose(iot, &fd);
-
- io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_fclose failed");
-
- if (!param.h5_write_only) {
- /*
- * Read performance measurement
- */
- /* Need barrier to make sure everyone is done writing and has
- * closed the file. Also to make sure everyone starts reading
- * at the same time.
- */
- MPI_Barrier(pio_comm_g);
-
- /* Open file for read */
- io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
- hrc = do_fopen(&param, fname, &fd, PIO_READ);
-
- VRFY((hrc == SUCCESS), "do_fopen failed");
-
- io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
- hrc = do_read(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
- io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_read failed");
-
- /* Close file for read */
- hrc = do_fclose(iot, &fd);
-
- io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_fclose failed");
- }
-
- /* Need barrier to make sure everyone is done with the file */
- /* before it may be removed by do_cleanupfile */
- MPI_Barrier(pio_comm_g);
- do_cleanupfile(iot, fname);
- }
-
-done:
- /* clean up */
- /* release HDF5 objects */
-
- /* close any opened files */
- /* no remove(fname) because that should have happened normally. */
- switch (iot) {
- case POSIXIO:
- if (fd.posixfd != -1)
- hrc = do_fclose(iot, &fd);
- break;
- case MPIO:
- if (fd.mpifd != MPI_FILE_NULL)
- hrc = do_fclose(iot, &fd);
- break;
- case PHDF5:
- if (fd.h5fd != -1)
- hrc = do_fclose(iot, &fd);
- break;
- default:
- break;
- }
-
- /* release generic resources */
- if(buffer)
- HDfree(buffer);
- res.ret_code = ret_code;
- return res;
-}
-
-/*
- * Function: pio_create_filename
- * Purpose: Create a new filename to write to. Determine the correct
- * suffix to append to the filename by the type of I/O we're
- * doing. Also, place in the /tmp/{$USER,$LOGIN} directory if
- * USER or LOGIN are specified in the environment.
- * Return: Pointer to filename or NULL
- * Programmer: Bill Wendling, 21. November 2001
- * Modifications:
- */
- static char *
-pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size)
-{
- const char *prefix, *suffix = "";
- char *ptr, last = '\0';
- size_t i, j;
-
- if (!base_name || !fullname || size < 1)
- return NULL;
-
- HDmemset(fullname, 0, size);
-
- switch (iot) {
- case POSIXIO:
- suffix = ".posix";
- break;
- case MPIO:
- suffix = ".mpio";
- break;
- case PHDF5:
- suffix = ".h5";
- break;
- default:
- break;
- }
-
- /* First use the environment variable and then try the constant */
- prefix = HDgetenv("HDF5_PARAPREFIX");
-
-#ifdef HDF5_PARAPREFIX
- if (!prefix)
- prefix = HDF5_PARAPREFIX;
-#endif /* HDF5_PARAPREFIX */
-
- /* Prepend the prefix value to the base name */
- if (prefix && *prefix) {
- /* If the prefix specifies the HDF5_PARAPREFIX directory, then
- * default to using the "/tmp/$USER" or "/tmp/$LOGIN"
- * directory instead. */
- register char *user, *login, *subdir;
-
- user = HDgetenv("USER");
- login = HDgetenv("LOGIN");
- subdir = (user ? user : login);
-
- if (subdir) {
- for (i = 0; i < size-1 && prefix[i]; i++)
- fullname[i] = prefix[i];
-
- fullname[i++] = '/';
-
- for (j = 0; i < size && subdir[j]; i++, j++)
- fullname[i] = subdir[j];
- }
- else {
- /* We didn't append the prefix yet */
- HDstrncpy(fullname, prefix, size);
- fullname[size - 1] = '\0';
- }
-
- if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) {
- /* Append the base_name with a slash first. Multiple slashes are
- * handled below. */
- h5_stat_t buf;
-
- if (HDstat(fullname, &buf) < 0)
- /* The directory doesn't exist just yet */
- if (HDmkdir(fullname, (mode_t) 0755) < 0 && errno != EEXIST) {
- /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory.
- * Default to PREFIX's original prefix value. */
- HDstrcpy(fullname, prefix);
- }
-
- HDstrcat(fullname, "/");
- HDstrcat(fullname, base_name);
- }
- else {
- /* Buffer is too small */
- return NULL;
- }
- }
- else if (HDstrlen(base_name) >= size) {
- /* Buffer is too small */
- return NULL;
- }
- else {
- HDstrcpy(fullname, base_name);
- }
-
- /* Append a suffix */
- if (suffix) {
- if (HDstrlen(fullname) + HDstrlen(suffix) >= size)
- return NULL;
-
- HDstrcat(fullname, suffix);
- }
-
- /* Remove any double slashes in the filename */
- for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) {
- if (*ptr != '/' || last != '/')
- fullname[j++] = *ptr;
-
- last = *ptr;
- }
-
- return fullname;
-}
-
-/*
- * Function: do_write
- * Purpose: Write the required amount of data to the file.
- * Return: SUCCESS or FAIL
- * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
- * Modifications:
- * Added 2D testing (Christian Chilan, 10. August 2005)
- */
- static herr_t
-do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
- off_t nbytes, size_t buf_size, void *buffer)
-{
- int ret_code = SUCCESS;
- int rc; /*routine return code */
- long ndset;
- size_t blk_size; /* The block size to subdivide the xfer buffer into */
- off_t nbytes_xfer; /* Total number of bytes transferred so far */
- size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */
- size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */
- char dname[64];
- off_t dset_offset=0; /*dataset offset in a file */
- off_t bytes_begin[2]; /*first elmt this process transfer */
- off_t bytes_count; /*number of elmts this process transfer */
- off_t snbytes=0; /*size of a side of the dataset square */
- unsigned char *buf_p; /* Current buffer pointer */
-
- /* POSIX variables */
- off_t file_offset; /* File offset of the next transfer */
- off_t file_offset_advance; /* File offset advance after each I/O operation */
- off_t posix_file_offset; /* Base file offset of the next transfer */
-
- /* MPI variables */
- MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/
- MPI_Offset mpi_offset; /* Offset in MPI file */
- MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */
- MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */
- MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */
- MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */
- MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */
- MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */
- MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */
- MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */
- MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */
- MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */
- MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */
- MPI_Status mpi_status;
- int mrc; /* MPI return code */
-
- /* HDF5 variables */
- herr_t hrc; /*HDF5 return code */
- hsize_t h5dims[2]; /*dataset dim sizes */
- hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
- hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
- hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
- hsize_t h5block[2]; /*dataspace selection */
- hsize_t h5stride[2];
- hsize_t h5count[2];
- hsize_t h5start[2];
- hssize_t h5offset[2]; /* Selection offset within dataspace */
- hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */
- hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
-
- /* Get the parameters from the parameter block */
- blk_size=parms->blk_size;
-
- /* There are two kinds of transfer patterns, contiguous and interleaved.
- * Let 0,1,2,...,n be data accessed by process 0,1,2,...,n
- * where n is rank of the last process.
- * In contiguous pattern, data are accessed as
- * 000...111...222...nnn...
- * In interleaved pattern, data are accessed as
- * 012...n012...n...
- * These are all in the scope of one dataset.
- */
-
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Contiguous Pattern: */
- if (!parms->interleaved) {
- bytes_begin[0] = (off_t)(((double)nbytes*pio_mpi_rank_g)/pio_mpi_nprocs_g);
- } /* end if */
- /* Interleaved Pattern: */
- else {
- bytes_begin[0] = (off_t)(blk_size*(size_t)pio_mpi_rank_g);
- } /* end else */
-
- /* Prepare buffer for verifying data */
- if (parms->verify)
- memset(buffer,pio_mpi_rank_g+1,buf_size);
- }/* end if */
- /* 2D dataspace */
- else {
- /* nbytes is always the number of bytes per dataset (1D or 2D). If the
- dataspace is 2D, snbytes is the size of a side of the dataset square.
- */
- snbytes = sqrto(nbytes);
-
- /* Contiguous Pattern: */
- if (!parms->interleaved) {
- bytes_begin[0] = (off_t)((double)snbytes*pio_mpi_rank_g / pio_mpi_nprocs_g);
- bytes_begin[1] = 0;
- } /* end if */
- /* Interleaved Pattern: */
- else {
- bytes_begin[0] = 0;
-
- if(!parms->h5_use_chunks || parms->io_type==PHDF5)
- bytes_begin[1] = (off_t)(blk_size*(size_t)pio_mpi_rank_g);
- else
- bytes_begin[1] = (off_t)(blk_size*blk_size*(size_t)pio_mpi_rank_g);
- } /* end else */
-
- /* Prepare buffer for verifying data */
- if (parms->verify)
- HDmemset(buffer,pio_mpi_rank_g+1,buf_size*blk_size);
- } /* end else */
-
-
- /* Calculate the total number of bytes (bytes_count) to be
- * transferred by this process. It may be different for different
- * transfer pattern due to rounding to integral values.
- */
- /*
- * Calculate the beginning bytes of this process and the next.
- * bytes_count is the difference between these two beginnings.
- * This way, it eliminates any rounding errors.
- * (This is tricky, don't mess with the formula, rounding errors
- * can easily get introduced) */
- bytes_count = (off_t)(((double)nbytes*(pio_mpi_rank_g+1)) / pio_mpi_nprocs_g)
- - (off_t)(((double)nbytes*pio_mpi_rank_g) / pio_mpi_nprocs_g);
-
- /* debug */
- if (pio_debug_level >= 4) {
- HDprint_rank(output);
- if (!parms->dim2d) {
- HDfprintf(output, "Debug(do_write): "
- "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
- buf_size, (long long)bytes_begin[0],
- (long long)bytes_count);
- } else {
- HDfprintf(output, "Debug(do_write): "
- "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
- buf_size*blk_size, (long long)bytes_begin[0],
- (long long)bytes_begin[1], (long long)bytes_count);
- }
- }
-
- /* I/O Access specific setup */
- switch (parms->io_type) {
- case POSIXIO:
- /* No extra setup */
- break;
-
- case MPIO: /* MPI-I/O setup */
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Build block's derived type */
- mrc = MPI_Type_contiguous((int)blk_size,
- MPI_BYTE, &mpi_blk_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Build file's derived type */
- mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1,
- (int)pio_mpi_nprocs_g, mpi_blk_type, &mpi_file_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit file type */
- mrc = MPI_Type_commit( &mpi_file_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Commit buffer type */
- mrc = MPI_Type_commit( &mpi_blk_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- } /* end if */
- /* 2D dataspace */
- else {
- /* Build partial buffer derived type for contiguous access */
-
- mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE,
- &mpi_partial_buffer_cont);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit partial buffer derived type */
- mrc = MPI_Type_commit(&mpi_partial_buffer_cont);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build contiguous file's derived type */
- mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes/buf_size),
- mpi_partial_buffer_cont, &mpi_cont_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit contiguous file type */
- mrc = MPI_Type_commit(&mpi_cont_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build partial buffer derived type for interleaved access */
- mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE,
- &mpi_partial_buffer_inter);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit partial buffer derived type */
- mrc = MPI_Type_commit(&mpi_partial_buffer_inter);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build interleaved file's derived type */
- mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes/blk_size),
- mpi_partial_buffer_inter, &mpi_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit interleaved file type */
- mrc = MPI_Type_commit(&mpi_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build full buffer derived type */
- mrc = MPI_Type_contiguous((int)(blk_size*buf_size), MPI_BYTE,
- &mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit full buffer derived type */
- mrc = MPI_Type_commit(&mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build full chunk derived type */
- mrc = MPI_Type_contiguous((int)(blk_size*blk_size), MPI_BYTE,
- &mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit full chunk derived type */
- mrc = MPI_Type_commit(&mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build chunk interleaved file's derived type */
- mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)((size_t)snbytes/blk_size),
- mpi_full_chunk, &mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit chunk interleaved file type */
- mrc = MPI_Type_commit(&mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- } /* end else */
- break;
-
- case PHDF5: /* HDF5 setup */
- /* 1D dataspace */
- if (!parms->dim2d){
- if(nbytes>0) {
- /* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = (hsize_t)nbytes;
- h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
-
- /* Set up the file dset space id to select the pattern to access */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5start[0] = (hsize_t)bytes_begin[0];
- h5stride[0] = h5block[0] = blk_size;
- h5count[0] = buf_size/blk_size;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5start[0] = (hsize_t)bytes_begin[0];
- h5stride[0] = blk_size*(size_t)pio_mpi_nprocs_g;
- h5block[0] = blk_size;
- h5count[0] = buf_size/blk_size;
- } /* end else */
- hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
- h5start, h5stride, h5count, h5block);
- VRFY((hrc >= 0), "H5Sselect_hyperslab");
- } /* end if */
- else {
- h5dset_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5dset_space_id >= 0), "H5Screate");
- } /* end else */
-
- /* Create the memory dataspace that corresponds to the xfer buffer */
- if(buf_size>0) {
- h5dims[0] = buf_size;
- h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
- } /* end if */
- else {
- h5mem_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5mem_space_id >= 0), "H5Screate");
- } /* end else */
- } /* end if */
- /* 2D dataspace */
- else {
- if(nbytes>0) {
- /* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = (hsize_t)snbytes;
- h5dims[1] = (hsize_t)snbytes;
- h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
-
- /* Set up the file dset space id to select the pattern to access */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5start[0] = (hsize_t)bytes_begin[0];
- h5start[1] = (hsize_t)bytes_begin[1];
- h5stride[0] = 1;
- h5stride[1] = h5block[0] = h5block[1] = blk_size;
- h5count[0] = 1;
- h5count[1] = buf_size/blk_size;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5start[0] = (hsize_t)bytes_begin[0];
- h5start[1] = (hsize_t)bytes_begin[1];
- h5stride[0] = blk_size;
- h5stride[1] = blk_size*(size_t)pio_mpi_nprocs_g;
- h5block[0] = h5block[1] = blk_size;
- h5count[0] = buf_size/blk_size;
- h5count[1] = 1;
- } /* end else */
- hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
- h5start, h5stride, h5count, h5block);
- VRFY((hrc >= 0), "H5Sselect_hyperslab");
- } /* end if */
- else {
- h5dset_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5dset_space_id >= 0), "H5Screate");
- } /* end else */
-
- /* Create the memory dataspace that corresponds to the xfer buffer */
- if(buf_size>0) {
- if (!parms->interleaved){
- h5dims[0] = blk_size;
- h5dims[1] = buf_size;
- }else{
- h5dims[0] = buf_size;
- h5dims[1] = blk_size;
- }
- h5mem_space_id = H5Screate_simple(2, h5dims, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
- } /* end if */
- else {
- h5mem_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5mem_space_id >= 0), "H5Screate");
- } /* end else */
- } /* end else */
-
- /* Create the dataset transfer property list */
- h5dxpl = H5Pcreate(H5P_DATASET_XFER);
- if (h5dxpl < 0) {
- HDfprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
-
- /* Change to collective I/O, if asked */
- if(parms->collective) {
- hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
- } /* end if */
- break;
-
- default:
- break;
- } /* end switch */
-
- for (ndset = 1; ndset <= ndsets; ++ndset) {
-
- /* Calculate dataset offset within a file */
-
- /* create dataset */
- switch (parms->io_type) {
- case POSIXIO:
- case MPIO:
- /* both posix and mpi io just need dataset offset in file*/
- dset_offset = (ndset - 1) * nbytes;
- break;
-
- case PHDF5:
- h5dcpl = H5Pcreate(H5P_DATASET_CREATE);
- if (h5dcpl < 0) {
- HDfprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Make the dataset chunked if asked */
- if(parms->h5_use_chunks) {
- /* Set the chunk size to be the same as the buffer size */
- h5dims[0] = blk_size;
- hrc = H5Pset_chunk(h5dcpl, 1, h5dims);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
- } /* end if */
- }/* end if */
- else{
- /* 2D dataspace */
- if(parms->h5_use_chunks) {
- /* Set the chunk size to be the same as the block size */
- h5dims[0] = blk_size;
- h5dims[1] = blk_size;
- hrc = H5Pset_chunk(h5dcpl, 2, h5dims);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
- } /* end if */
- }/* end else */
-
- HDsprintf(dname, "Dataset_%ld", ndset);
- h5ds_id = H5DCREATE(fd->h5fd, dname, ELMT_H5_TYPE,
- h5dset_space_id, h5dcpl);
-
- if (h5ds_id < 0) {
- HDfprintf(stderr, "HDF5 Dataset Create failed\n");
- GOTOERROR(FAIL);
- }
-
- hrc = H5Pclose(h5dcpl);
- /* verifying the close of the dcpl */
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Property List Close failed\n");
- GOTOERROR(FAIL);
- }
- break;
-
- default:
- break;
- }
-
- /* The task is to transfer bytes_count bytes, starting at
- * bytes_begin position, using transfer buffer of buf_size bytes.
- * If interleaved, select buf_size at a time, in round robin
- * fashion, according to number of process. Otherwise, select
- * all bytes_count in contiguous.
- */
- nbytes_xfer = 0 ;
-
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Set base file offset for all I/O patterns and POSIX access */
- posix_file_offset = dset_offset + bytes_begin[0];
-
- /* Set base file offset for all I/O patterns and MPI access */
- mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]);
- } /* end if */
- else {
- /* Set base file offset for all I/O patterns and POSIX access */
- posix_file_offset=dset_offset + bytes_begin[0]*snbytes+
- bytes_begin[1];
-
- /* Set base file offset for all I/O patterns and MPI access */
- mpi_file_offset=(MPI_Offset)(dset_offset + bytes_begin[0]*snbytes+
- bytes_begin[1]);
- } /* end else */
-
- /* Start "raw data" write timer */
- io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
-
- while (nbytes_xfer < bytes_count){
- /* Write */
- /* Calculate offset of write within a dataset/file */
- switch (parms->io_type) {
- case POSIXIO:
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Contiguous pattern */
- if (!parms->interleaved) {
- /* Compute file offset */
- file_offset = posix_file_offset + (off_t)nbytes_xfer;
-
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
-
- /* check if all bytes are written */
- rc = ((ssize_t)buf_size ==
- POSIXWRITE(fd->posixfd, buffer, buf_size));
- VRFY((rc != 0), "POSIXWRITE");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(ssize_t)buf_size;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Set the base of user's buffer */
- buf_p=(unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size;
-
- /* Loop over the buffers to write */
- while(nbytes_toxfer>0) {
- /* Skip offset over blocks of other processes */
- file_offset = posix_file_offset +
- (off_t)(nbytes_xfer*pio_mpi_nprocs_g);
-
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
-
- /* check if all bytes are written */
- rc = ((ssize_t)blk_size ==
- POSIXWRITE(fd->posixfd, buf_p, blk_size));
- VRFY((rc != 0), "POSIXWRITE");
-
- /* Advance location in buffer */
- buf_p+=blk_size;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(ssize_t)blk_size;
-
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=blk_size;
- } /* end while */
- } /* end else */
- } /* end if */
- /* 2D dataspace */
- else {
- /* Contiguous storage */
- if (!parms->h5_use_chunks) {
- /* Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/blk_size)
- /(size_t)snbytes)*(blk_size*(size_t)snbytes)+(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes));
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = buf_size;
-
- /* Global offset advance after each I/O operation */
- file_offset_advance = (off_t)snbytes;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)(((((size_t)nbytes_xfer/buf_size)
- *(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)*(buf_size*(size_t)snbytes)
- +(((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes);
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size;
-
- /* Global offset advance after each I/O operation */
- file_offset_advance = (off_t)snbytes;
- } /* end else */
- } /* end if */
- /* Chunked storage */
- else {
- /*Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)nbytes_xfer;
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * buf_size;
-
- /* Global offset advance after each I/O operation */
- file_offset_advance = 0;
- } /* end if */
- /*Interleaved access pattern */
- else {
- /* Compute file offset */
- /* Before simplification */
- /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size
- *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
- *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
-
- file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/(buf_size/blk_size)
- *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes)+(((size_t)nbytes_xfer/(buf_size/blk_size))
- *(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size));
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * blk_size;
-
- /* Global offset advance after each I/O operation */
- /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
- file_offset_advance = (off_t)snbytes*(off_t)blk_size;
- } /* end else */
- } /* end else */
-
- /* Common code for file access */
-
- /* Set the base of user's buffer */
- buf_p = (unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size*blk_size;
-
- /* Loop over portions of the buffer to write */
- while(nbytes_toxfer>0){
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
-
- /* check if all bytes are written */
- rc = ((ssize_t)nbytes_xfer_advance ==
- POSIXWRITE(fd->posixfd, buf_p, nbytes_xfer_advance));
- VRFY((rc != 0), "POSIXWRITE");
-
- /* Advance location in buffer */
- buf_p+=nbytes_xfer_advance;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(ssize_t)nbytes_xfer_advance;
-
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=nbytes_xfer_advance;
-
- /* Partially advance file offset */
- file_offset+=file_offset_advance;
- } /* end while */
-
- } /* end else */
-
- break;
-
- case MPIO:
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Independent file access */
- if(!parms->collective) {
- /* Contiguous pattern */
- if (!parms->interleaved){
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- nbytes_xfer;
-
- /* Perform independent write */
- mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buffer,
- (int)(buf_size/blk_size), mpi_blk_type,
- &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(ssize_t)buf_size;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Set the base of user's buffer */
- buf_p=(unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size;
-
- /* Loop over the buffers to write */
- while(nbytes_toxfer>0) {
- /* Skip offset over blocks of other processes */
- mpi_offset = mpi_file_offset +
- (nbytes_xfer*pio_mpi_nprocs_g);
-
- /* Perform independent write */
- mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p,
- (int)1, mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance location in buffer */
- buf_p+=blk_size;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(ssize_t)blk_size;
-
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=blk_size;
- } /* end while */
- } /* end else */
- } /* end if */
- /* Collective file access */
- else {
- /* Contiguous access pattern */
- if (!parms->interleaved){
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- nbytes_xfer;
-
- /* Perform independent write */
- mrc = MPI_File_write_at_all(fd->mpifd, mpi_offset, buffer,
- (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(ssize_t)buf_size;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- (nbytes_xfer*pio_mpi_nprocs_g);
-
- /* Set the file view */
- mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type,
- mpi_file_type, (char*)"native", h5_io_info_g);
- VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
-
- /* Perform write */
- mrc = MPI_File_write_at_all(fd->mpifd, 0, buffer,
- (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(ssize_t)buf_size;
- } /* end else */
- } /* end else */
- } /* end if */
- /* 2D dataspace */
- else {
- /* Contiguous storage */
- if (!parms->h5_use_chunks) {
- /* Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/blk_size)/(size_t)snbytes)*
- (blk_size*(size_t)snbytes))+(MPI_Offset)(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes);
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = buf_size;
-
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = snbytes;
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_cont_type;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+(MPI_Offset)(((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)*
- (buf_size*(size_t)snbytes))+(MPI_Offset)((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes);
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size;
-
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = snbytes;
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_inter_type;
- } /* end else */
- } /* end if */
- /* Chunked storage */
- else {
- /*Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+nbytes_xfer;
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * buf_size;
-
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = 0;
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_full_buffer;
- } /* end if */
- /*Interleaved access pattern */
- else {
- /* Compute offset in file */
- /* Before simplification */
- /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*
- (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
- ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
- /blk_size*(blk_size*blk_size)); */
- mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size)
- *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes))
- +(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size))*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size));
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * blk_size;
-
- /* Global offset advance after each I/O operation */
- /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
- mpi_offset_advance = (MPI_Offset)((size_t)snbytes*blk_size);
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_chunk_inter_type;
- } /* end else */
- } /* end else */
-
- /* Common code for independent file access */
- if (!parms->collective) {
- /* Set the base of user's buffer */
- buf_p = (unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size * blk_size;
-
- /* Loop over portions of the buffer to write */
- while(nbytes_toxfer>0){
- /* Perform independent write */
- mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p,
- (int)nbytes_xfer_advance, MPI_BYTE, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance location in buffer */
- buf_p+=nbytes_xfer_advance;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(ssize_t)nbytes_xfer_advance;
-
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=nbytes_xfer_advance;
-
- /* Partially advance global offset in dataset */
- mpi_offset+=mpi_offset_advance;
- } /* end while */
- } /* end if */
-
- /* Common code for collective file access */
- else {
- /* Set the file view */
- mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE,
- mpi_collective_type, (char *)"native", h5_io_info_g);
- VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
-
- /* Perform write */
- MPI_File_write_at_all(fd->mpifd, 0, buffer,(int)(buf_size*blk_size),
- MPI_BYTE, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(off_t)buf_size*(off_t)blk_size;
- } /* end else */
-
- } /* end else */
-
- break;
-
- case PHDF5:
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Set up the file dset space id to move the selection to process */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5offset[0] = nbytes_xfer;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5offset[0] = (nbytes_xfer*pio_mpi_nprocs_g);
- } /* end else */
- hrc = H5Soffset_simple(h5dset_space_id, h5offset);
- VRFY((hrc >= 0), "H5Soffset_simple");
-
- /* Write the buffer out */
- hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
- h5dset_space_id, h5dxpl, buffer);
- VRFY((hrc >= 0), "H5Dwrite");
-
- /* Increment number of bytes transferred */
- nbytes_xfer += (ssize_t)buf_size;
- } /* end if */
- /* 2D dataspace */
- else {
- /* Set up the file dset space id to move the selection to process */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5offset[0] = (hssize_t)(((size_t)nbytes_xfer/((size_t)snbytes*blk_size))*blk_size);
- h5offset[1] = (hssize_t)(((size_t)nbytes_xfer%((size_t)snbytes*blk_size))/blk_size);
-
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5offset[0] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*buf_size))*buf_size);
- h5offset[1] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*buf_size))/buf_size);
-
- } /* end else */
- hrc = H5Soffset_simple(h5dset_space_id, h5offset);
- VRFY((hrc >= 0), "H5Soffset_simple");
-
- /* Write the buffer out */
- hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
- h5dset_space_id, h5dxpl, buffer);
- VRFY((hrc >= 0), "H5Dwrite");
-
- /* Increment number of bytes transferred */
- nbytes_xfer += (off_t)buf_size*(off_t)blk_size;
-
- } /* end else */
-
- break;
-
- default:
- break;
- } /* switch (parms->io_type) */
- } /* end while */
-
- /* Stop "raw data" write timer */
- io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
-
- /* Calculate write time */
-
- /* Close dataset. Only HDF5 needs to do an explicit close. */
- if (parms->io_type == PHDF5) {
- hrc = H5Dclose(h5ds_id);
-
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Dataset Close failed\n");
- GOTOERROR(FAIL);
- }
-
- h5ds_id = H5I_INVALID_HID;
- } /* end if */
- } /* end for */
-
-done:
- /* release MPI-I/O objects */
- if (parms->io_type == MPIO) {
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Free file type */
- mrc = MPI_Type_free( &mpi_file_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free buffer type */
- mrc = MPI_Type_free( &mpi_blk_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
- } /* end if */
- /* 2D dataspace */
- else {
- /* Free partial buffer type for contiguous access */
- mrc = MPI_Type_free( &mpi_partial_buffer_cont );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free contiguous file type */
- mrc = MPI_Type_free( &mpi_cont_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free partial buffer type for interleaved access */
- mrc = MPI_Type_free( &mpi_partial_buffer_inter );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free interleaved file type */
- mrc = MPI_Type_free( &mpi_inter_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free full buffer type */
- mrc = MPI_Type_free(&mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free full chunk type */
- mrc = MPI_Type_free(&mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free chunk interleaved file type */
- mrc = MPI_Type_free(&mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
- } /* end else */
- } /* end if */
-
- /* release HDF5 objects */
- if (h5dset_space_id != -1) {
- hrc = H5Sclose(h5dset_space_id);
- if (hrc < 0){
- HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5dset_space_id = H5I_INVALID_HID;
- }
- }
-
- if (h5mem_space_id != -1) {
- hrc = H5Sclose(h5mem_space_id);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5mem_space_id = H5I_INVALID_HID;
- }
- }
-
- if (h5dxpl != -1) {
- hrc = H5Pclose(h5dxpl);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
- ret_code = FAIL;
- } else {
- h5dxpl = H5I_INVALID_HID;
- }
- }
-
- return ret_code;
-}
-
-static off_t
-sqrto(off_t x)
-{
- double root_x = sqrt((double)x);
- return (off_t)root_x;
-}
-
-/*
- * Function: do_read
- * Purpose: read the required amount of data from the file.
- * Return: SUCCESS or FAIL
- * Programmer: Albert Cheng 2001/12/13
- * Modifications:
- * Added 2D testing (Christian Chilan, 10. August 2005)
- */
- static herr_t
-do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
- off_t nbytes, size_t buf_size, void *buffer /*out*/)
-{
- int ret_code = SUCCESS;
- int rc; /*routine return code */
- long ndset;
- size_t blk_size; /* The block size to subdivide the xfer buffer into */
- size_t bsize; /* Size of the actual buffer */
- off_t nbytes_xfer; /* Total number of bytes transferred so far */
- size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */
- size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */
- char dname[64];
- off_t dset_offset=0; /*dataset offset in a file */
- off_t bytes_begin[2]; /*first elmt this process transfer */
- off_t bytes_count; /*number of elmts this process transfer */
- off_t snbytes=0; /*size of a side of the dataset square */
- unsigned char *buf_p; /* Current buffer pointer */
-
- /* POSIX variables */
- off_t file_offset; /* File offset of the next transfer */
- off_t file_offset_advance; /* File offset advance after each I/O operation */
- off_t posix_file_offset; /* Base file offset of the next transfer */
-
- /* MPI variables */
- MPI_Offset mpi_file_offset;/* Base file offset of the next transfer*/
- MPI_Offset mpi_offset; /* Offset in MPI file */
- MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */
- MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */
- MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */
- MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */
- MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */
- MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */
- MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */
- MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */
- MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */
- MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */
- MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */
- MPI_Status mpi_status;
- int mrc; /* MPI return code */
-
- /* HDF5 variables */
- herr_t hrc; /*HDF5 return code */
- hsize_t h5dims[2]; /*dataset dim sizes */
- hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
- hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
- hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
- hsize_t h5block[2]; /*dataspace selection */
- hsize_t h5stride[2];
- hsize_t h5count[2];
- hsize_t h5start[2];
- hssize_t h5offset[2]; /* Selection offset within dataspace */
- hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
-
- /* Get the parameters from the parameter block */
- blk_size=parms->blk_size;
-
- /* There are two kinds of transfer patterns, contiguous and interleaved.
- * Let 0,1,2,...,n be data accessed by process 0,1,2,...,n
- * where n is rank of the last process.
- * In contiguous pattern, data are accessed as
- * 000...111...222...nnn...
- * In interleaved pattern, data are accessed as
- * 012...n012...n...
- * These are all in the scope of one dataset.
- */
-
- /* 1D dataspace */
- if (!parms->dim2d){
- bsize = buf_size;
- /* Contiguous Pattern: */
- if (!parms->interleaved) {
- bytes_begin[0] = (off_t)(((double)nbytes*pio_mpi_rank_g)/pio_mpi_nprocs_g);
- } /* end if */
- /* Interleaved Pattern: */
- else {
- bytes_begin[0] = (off_t)blk_size*(off_t)pio_mpi_rank_g;
- } /* end else */
- }/* end if */
- /* 2D dataspace */
- else {
- /* nbytes is always the number of bytes per dataset (1D or 2D). If the
- dataspace is 2D, snbytes is the size of a side of the 'dataset square'.
- */
- snbytes = sqrto(nbytes);
-
- bsize = buf_size * blk_size;
-
- /* Contiguous Pattern: */
- if (!parms->interleaved) {
- bytes_begin[0] = (off_t)((double)snbytes*pio_mpi_rank_g / pio_mpi_nprocs_g);
- bytes_begin[1] = 0;
- } /* end if */
- /* Interleaved Pattern: */
- else {
- bytes_begin[0] = 0;
-
- if (!parms->h5_use_chunks || parms->io_type==PHDF5)
- bytes_begin[1] = (off_t)blk_size*(off_t)pio_mpi_rank_g;
- else
- bytes_begin[1] = (off_t)blk_size*(off_t)blk_size*(off_t)pio_mpi_rank_g;
- } /* end else */
- } /* end else */
-
- /* Calculate the total number of bytes (bytes_count) to be
- * transferred by this process. It may be different for different
- * transfer pattern due to rounding to integral values.
- */
- /*
- * Calculate the beginning bytes of this process and the next.
- * bytes_count is the difference between these two beginnings.
- * This way, it eliminates any rounding errors.
- * (This is tricky, don't mess with the formula, rounding errors
- * can easily get introduced) */
- bytes_count = (off_t)(((double)nbytes*(pio_mpi_rank_g+1)) / pio_mpi_nprocs_g)
- - (off_t)(((double)nbytes*pio_mpi_rank_g) / pio_mpi_nprocs_g);
-
- /* debug */
- if (pio_debug_level >= 4) {
- HDprint_rank(output);
- if (!parms->dim2d) {
- HDfprintf(output, "Debug(do_write): "
- "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
- buf_size, (long long)bytes_begin[0],
- (long long)bytes_count);
- } else {
- HDfprintf(output, "Debug(do_write): "
- "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
- buf_size*blk_size, (long long)bytes_begin[0],
- (long long)bytes_begin[1], (long long)bytes_count);
- }
- }
-
- /* I/O Access specific setup */
- switch (parms->io_type) {
- case POSIXIO:
- /* No extra setup */
- break;
-
- case MPIO: /* MPI-I/O setup */
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Build block's derived type */
- mrc = MPI_Type_contiguous((int)blk_size,
- MPI_BYTE, &mpi_blk_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Build file's derived type */
- mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1,
- (int)pio_mpi_nprocs_g, mpi_blk_type, &mpi_file_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit file type */
- mrc = MPI_Type_commit( &mpi_file_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Commit buffer type */
- mrc = MPI_Type_commit( &mpi_blk_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- } /* end if */
- /* 2D dataspace */
- else {
- /* Build partial buffer derived type for contiguous access */
- mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE,
- &mpi_partial_buffer_cont);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit partial buffer derived type */
- mrc = MPI_Type_commit(&mpi_partial_buffer_cont);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build contiguous file's derived type */
- mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes/buf_size),
- mpi_partial_buffer_cont, &mpi_cont_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit contiguous file type */
- mrc = MPI_Type_commit(&mpi_cont_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build partial buffer derived type for interleaved access */
- mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE,
- &mpi_partial_buffer_inter);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit partial buffer derived type */
- mrc = MPI_Type_commit(&mpi_partial_buffer_inter);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build interleaved file's derived type */
- mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes/blk_size),
- mpi_partial_buffer_inter, &mpi_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit interleaved file type */
- mrc = MPI_Type_commit(&mpi_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build full buffer derived type */
- mrc = MPI_Type_contiguous((int)(blk_size*buf_size), MPI_BYTE,
- &mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit full buffer derived type */
- mrc = MPI_Type_commit(&mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build full chunk derived type */
- mrc = MPI_Type_contiguous((int)(blk_size*blk_size), MPI_BYTE,
- &mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit full chunk derived type */
- mrc = MPI_Type_commit(&mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build chunk interleaved file's derived type */
- mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)((size_t)snbytes/blk_size),
- mpi_full_chunk, &mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit chunk interleaved file type */
- mrc = MPI_Type_commit(&mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- } /* end else */
- break;
-
- case PHDF5: /* HDF5 setup */
- /* 1D dataspace */
- if (!parms->dim2d){
- if(nbytes>0) {
- /* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = (hsize_t)nbytes;
- h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
-
- /* Set up the file dset space id to select the pattern to access */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5start[0] = (hsize_t)bytes_begin[0];
- h5stride[0] = h5block[0] = blk_size;
- h5count[0] = buf_size/blk_size;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5start[0] = (hsize_t)bytes_begin[0];
- h5stride[0] = blk_size*(size_t)pio_mpi_nprocs_g;
- h5block[0] = blk_size;
- h5count[0] = buf_size/blk_size;
- } /* end else */
- hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
- h5start, h5stride, h5count, h5block);
- VRFY((hrc >= 0), "H5Sselect_hyperslab");
- } /* end if */
- else {
- h5dset_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5dset_space_id >= 0), "H5Screate");
- } /* end else */
-
- /* Create the memory dataspace that corresponds to the xfer buffer */
- if(buf_size>0) {
- h5dims[0] = buf_size;
- h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
- } /* end if */
- else {
- h5mem_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5mem_space_id >= 0), "H5Screate");
- } /* end else */
- } /* end if */
- /* 2D dataspace */
- else {
- if(nbytes>0) {
- /* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = (hsize_t)snbytes;
- h5dims[1] = (hsize_t)snbytes;
- h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
-
- /* Set up the file dset space id to select the pattern to access */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5start[0] = (hsize_t)bytes_begin[0];
- h5start[1] = (hsize_t)bytes_begin[1];
- h5stride[0] = 1;
- h5stride[1] = h5block[0] = h5block[1] = blk_size;
- h5count[0] = 1;
- h5count[1] = buf_size/blk_size;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5start[0] = (hsize_t)bytes_begin[0];
- h5start[1] = (hsize_t)bytes_begin[1];
- h5stride[0] = blk_size;
- h5stride[1] = blk_size*(size_t)pio_mpi_nprocs_g;
- h5block[0] = h5block[1] = blk_size;
- h5count[0] = buf_size/blk_size;
- h5count[1] = 1;
- } /* end else */
- hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
- h5start, h5stride, h5count, h5block);
- VRFY((hrc >= 0), "H5Sselect_hyperslab");
- } /* end if */
- else {
- h5dset_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5dset_space_id >= 0), "H5Screate");
- } /* end else */
-
- /* Create the memory dataspace that corresponds to the xfer buffer */
- if(buf_size>0) {
- if (!parms->interleaved){
- h5dims[0] = blk_size;
- h5dims[1] = buf_size;
- }else{
- h5dims[0] = buf_size;
- h5dims[1] = blk_size;
- }
- h5mem_space_id = H5Screate_simple(2, h5dims, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
- } /* end if */
- else {
- h5mem_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5mem_space_id >= 0), "H5Screate");
- } /* end else */
- } /* end else */
-
- /* Create the dataset transfer property list */
- h5dxpl = H5Pcreate(H5P_DATASET_XFER);
- if (h5dxpl < 0) {
- HDfprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
-
- /* Change to collective I/O, if asked */
- if(parms->collective) {
- hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
- } /* end if */
- break;
-
- default:
- break;
- } /* end switch */
-
- for (ndset = 1; ndset <= ndsets; ++ndset) {
-
- /* Calculate dataset offset within a file */
-
- /* create dataset */
- switch (parms->io_type) {
- case POSIXIO:
- case MPIO:
- /* both posix and mpi io just need dataset offset in file*/
- dset_offset = (ndset - 1) * nbytes;
- break;
-
- case PHDF5:
- HDsprintf(dname, "Dataset_%ld", ndset);
- h5ds_id = H5DOPEN(fd->h5fd, dname);
- if (h5ds_id < 0) {
- HDfprintf(stderr, "HDF5 Dataset open failed\n");
- GOTOERROR(FAIL);
- }
- break;
-
- default:
- break;
- }
-
- /* The task is to transfer bytes_count bytes, starting at
- * bytes_begin position, using transfer buffer of buf_size bytes.
- * If interleaved, select buf_size at a time, in round robin
- * fashion, according to number of process. Otherwise, select
- * all bytes_count in contiguous.
- */
- nbytes_xfer = 0 ;
-
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Set base file offset for all I/O patterns and POSIX access */
- posix_file_offset = dset_offset + bytes_begin[0];
-
- /* Set base file offset for all I/O patterns and MPI access */
- mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]);
- } /* end if */
- else {
- /* Set base file offset for all I/O patterns and POSIX access */
- posix_file_offset=dset_offset + bytes_begin[0]*snbytes+
- bytes_begin[1];
-
- /* Set base file offset for all I/O patterns and MPI access */
- mpi_file_offset=(MPI_Offset)(dset_offset + bytes_begin[0]*snbytes+
- bytes_begin[1]);
- } /* end else */
-
- /* Start "raw data" read timer */
- io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
-
- while (nbytes_xfer < bytes_count){
- /* Read */
- /* Calculate offset of read within a dataset/file */
- switch (parms->io_type) {
- case POSIXIO:
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Contiguous pattern */
- if (!parms->interleaved) {
- /* Compute file offset */
- file_offset = posix_file_offset + (off_t)nbytes_xfer;
-
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
-
- /* check if all bytes are read */
- rc = ((ssize_t)buf_size ==
- POSIXREAD(fd->posixfd, buffer, buf_size));
- VRFY((rc != 0), "POSIXREAD");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(off_t)buf_size;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Set the base of user's buffer */
- buf_p=(unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size;
-
- /* Loop over the buffers to read */
- while(nbytes_toxfer>0) {
- /* Skip offset over blocks of other processes */
- file_offset = posix_file_offset +
- (off_t)(nbytes_xfer*pio_mpi_nprocs_g);
-
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
-
- /* check if all bytes are read */
- rc = ((ssize_t)blk_size ==
- POSIXREAD(fd->posixfd, buf_p, blk_size));
- VRFY((rc != 0), "POSIXREAD");
-
- /* Advance location in buffer */
- buf_p+=blk_size;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(off_t)blk_size;
-
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=blk_size;
- } /* end while */
- } /* end else */
- } /* end if */
- /* 2D dataspace */
- else {
- /* Contiguous storage */
- if (!parms->h5_use_chunks) {
- /* Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/blk_size)
- /(size_t)snbytes)*(blk_size*(size_t)snbytes)+(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes));
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = buf_size;
-
- /* Global offset advance after each I/O operation */
- file_offset_advance = (off_t)snbytes;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)(((((size_t)nbytes_xfer/buf_size)
- *(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)*(buf_size*(size_t)snbytes)
- +(((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes);
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size;
-
- /* Global offset advance after each I/O operation */
- file_offset_advance = (off_t)snbytes;
- } /* end else */
- } /* end if */
- /* Chunked storage */
- else {
- /*Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)nbytes_xfer;
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * buf_size;
-
- /* Global offset advance after each I/O operation */
- file_offset_advance = 0;
- } /* end if */
- /*Interleaved access pattern */
- else {
- /* Compute file offset */
- /* Before simplification */
- /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size
- *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
- *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
-
- file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/(buf_size/blk_size)
- *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes)+(((size_t)nbytes_xfer/(buf_size/blk_size))
- *(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size));
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * blk_size;
-
- /* Global offset advance after each I/O operation */
- /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
- file_offset_advance = (off_t)((size_t)snbytes*blk_size);
- } /* end else */
- } /* end else */
-
- /* Common code for file access */
-
- /* Set the base of user's buffer */
- buf_p = (unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size*blk_size;
-
- /* Loop over portions of the buffer to read */
- while(nbytes_toxfer>0){
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
-
- /* check if all bytes are read */
- rc = ((ssize_t)nbytes_xfer_advance ==
- POSIXREAD(fd->posixfd, buf_p, nbytes_xfer_advance));
- VRFY((rc != 0), "POSIXREAD");
-
- /* Advance location in buffer */
- buf_p+=nbytes_xfer_advance;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(off_t)nbytes_xfer_advance;
-
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=nbytes_xfer_advance;
-
- /* Partially advance file offset */
- file_offset+=file_offset_advance;
- } /* end while */
-
- } /* end else */
- break;
-
- case MPIO:
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Independent file access */
- if(!parms->collective) {
- /* Contiguous pattern */
- if (!parms->interleaved){
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- nbytes_xfer;
-
- /* Perform independent read */
- mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buffer,
- (int)(buf_size/blk_size), mpi_blk_type,
- &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(off_t)buf_size;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Set the base of user's buffer */
- buf_p=(unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size;
-
- /* Loop over the buffers to read */
- while(nbytes_toxfer>0) {
- /* Skip offset over blocks of other processes */
- mpi_offset = mpi_file_offset +
- (nbytes_xfer*pio_mpi_nprocs_g);
-
- /* Perform independent read */
- mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p,
- (int)1, mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
-
- /* Advance location in buffer */
- buf_p+=blk_size;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(off_t)blk_size;
-
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=blk_size;
- } /* end while */
- } /* end else */
- } /* end if */
- /* Collective file access */
- else {
- /* Contiguous access pattern */
- if (!parms->interleaved){
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- nbytes_xfer;
-
- /* Perform collective read */
- mrc = MPI_File_read_at_all(fd->mpifd, mpi_offset, buffer,
- (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(off_t)buf_size;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- (nbytes_xfer*pio_mpi_nprocs_g);
-
- /* Set the file view */
- mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type,
- mpi_file_type, (char*)"native", h5_io_info_g);
- VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
-
- /* Perform collective read */
- mrc = MPI_File_read_at_all(fd->mpifd, 0, buffer,
- (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(off_t)buf_size;
- } /* end else */
- } /* end else */
- } /* end if */
- /* 2D dataspace */
- else {
- /* Contiguous storage */
- if (!parms->h5_use_chunks) {
- /* Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/blk_size)/(size_t)snbytes)*
- (blk_size*(size_t)snbytes))+(MPI_Offset)(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes);
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = buf_size;
-
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = snbytes;
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_cont_type;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+(MPI_Offset)(((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)*
- (buf_size*(size_t)snbytes))+(MPI_Offset)((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes);
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size;
-
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = snbytes;
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_inter_type;
- } /* end else */
- } /* end if */
- /* Chunked storage */
- else {
- /*Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+nbytes_xfer;
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * buf_size;
-
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = 0;
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_full_buffer;
- } /* end if */
- /*Interleaved access pattern */
- else {
- /* Compute offset in file */
- /* Before simplification */
- /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*
- (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
- ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
- /blk_size*(blk_size*blk_size)); */
- mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size)
- *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes))
- +(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size))*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size));
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * blk_size;
-
- /* Global offset advance after each I/O operation */
- /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
- mpi_offset_advance = (MPI_Offset)((size_t)snbytes*blk_size);
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_chunk_inter_type;
- } /* end else */
- } /* end else */
-
- /* Common code for independent file access */
- if (!parms->collective) {
- /* Set the base of user's buffer */
- buf_p = (unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size * blk_size;
-
- /* Loop over portions of the buffer to read */
- while(nbytes_toxfer>0){
- /* Perform independent read */
- mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p,
- (int)nbytes_xfer_advance, MPI_BYTE, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
-
- /* Advance location in buffer */
- buf_p+=nbytes_xfer_advance;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(off_t)nbytes_xfer_advance;
-
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=nbytes_xfer_advance;
-
- /* Partially advance global offset in dataset */
- mpi_offset+=mpi_offset_advance;
- } /* end while */
- } /* end if */
-
- /* Common code for collective file access */
- else {
- /* Set the file view */
- mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE,
- mpi_collective_type, (char *)"native", h5_io_info_g);
- VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
-
- /* Perform read */
- MPI_File_read_at_all(fd->mpifd, 0, buffer,(int)(buf_size*blk_size),
- MPI_BYTE, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=(off_t)buf_size*(off_t)blk_size;
- } /* end else */
-
- } /* end else */
- break;
-
- case PHDF5:
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Set up the file dset space id to move the selection to process */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5offset[0] = nbytes_xfer;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5offset[0] = (nbytes_xfer*pio_mpi_nprocs_g);
- } /* end else */
- hrc = H5Soffset_simple(h5dset_space_id, h5offset);
- VRFY((hrc >= 0), "H5Soffset_simple");
-
- /* Read the buffer in */
- hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
- h5dset_space_id, h5dxpl, buffer);
- VRFY((hrc >= 0), "H5Dread");
-
- /* Increment number of bytes transferred */
- nbytes_xfer += (off_t)buf_size;
- } /* end if */
- /* 2D dataspace */
- else {
- /* Set up the file dset space id to move the selection to process */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5offset[0] = (hssize_t)(((size_t)nbytes_xfer/((size_t)snbytes*blk_size))*blk_size);
- h5offset[1] = (hssize_t)(((size_t)nbytes_xfer%((size_t)snbytes*blk_size))/blk_size);
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5offset[0] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*buf_size))*buf_size);
- h5offset[1] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*buf_size))/buf_size);
-
- } /* end else */
- hrc = H5Soffset_simple(h5dset_space_id, h5offset);
- VRFY((hrc >= 0), "H5Soffset_simple");
-
- /* Write the buffer out */
- hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
- h5dset_space_id, h5dxpl, buffer);
- VRFY((hrc >= 0), "H5Dread");
-
- /* Increment number of bytes transferred */
- nbytes_xfer += (off_t)buf_size*(off_t)blk_size;
-
- } /* end else */
- break;
-
- default:
- break;
- } /* switch (parms->io_type) */
-
- /* Verify raw data, if asked */
- if (parms->verify) {
- /* Verify data read */
- unsigned char *ucharptr = (unsigned char *)buffer;
- size_t i;
- int nerror=0;
-
- for (i = 0; i < bsize; ++i){
- if (*ucharptr++ != pio_mpi_rank_g+1) {
- if (++nerror < 20){
- /* report at most 20 errors */
- HDprint_rank(output);
- HDfprintf(output, "read data error, expected (%d), "
- "got (%d)\n",
- pio_mpi_rank_g+1,
- (int)*(ucharptr-1));
- } /* end if */
- } /* end if */
- } /* end for */
- if (nerror >= 20) {
- HDprint_rank(output);
- HDfprintf(output, "...");
- HDfprintf(output, "total read data errors=%d\n",
- nerror);
- } /* end if */
- } /* if (parms->verify) */
-
- } /* end while */
-
- /* Stop "raw data" read timer */
- io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
-
- /* Calculate read time */
-
- /* Close dataset. Only HDF5 needs to do an explicit close. */
- if (parms->io_type == PHDF5) {
- hrc = H5Dclose(h5ds_id);
-
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Dataset Close failed\n");
- GOTOERROR(FAIL);
- }
-
- h5ds_id = H5I_INVALID_HID;
- } /* end if */
- } /* end for */
-
-done:
- /* release MPI-I/O objects */
- if (parms->io_type == MPIO) {
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Free file type */
- mrc = MPI_Type_free( &mpi_file_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free buffer type */
- mrc = MPI_Type_free( &mpi_blk_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
- } /* end if */
- /* 2D dataspace */
- else {
- /* Free partial buffer type for contiguous access */
- mrc = MPI_Type_free( &mpi_partial_buffer_cont );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free contiguous file type */
- mrc = MPI_Type_free( &mpi_cont_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free partial buffer type for interleaved access */
- mrc = MPI_Type_free( &mpi_partial_buffer_inter );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free interleaved file type */
- mrc = MPI_Type_free( &mpi_inter_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free full buffer type */
- mrc = MPI_Type_free(&mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free full chunk type */
- mrc = MPI_Type_free(&mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
-
- /* Free chunk interleaved file type */
- mrc = MPI_Type_free(&mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
- } /* end else */
- } /* end if */
-
- /* release HDF5 objects */
- if (h5dset_space_id != -1) {
- hrc = H5Sclose(h5dset_space_id);
- if (hrc < 0){
- HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5dset_space_id = H5I_INVALID_HID;
- }
- }
-
- if (h5mem_space_id != -1) {
- hrc = H5Sclose(h5mem_space_id);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5mem_space_id = H5I_INVALID_HID;
- }
- }
-
- if (h5dxpl != -1) {
- hrc = H5Pclose(h5dxpl);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
- ret_code = FAIL;
- } else {
- h5dxpl = H5I_INVALID_HID;
- }
- }
-
- return ret_code;
-}
-
-/*
- * Function: do_fopen
- * Purpose: Open the specified file.
- * Return: SUCCESS or FAIL
- * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
- * Modifications:
- */
- static herr_t
-do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
-{
- int ret_code = SUCCESS, mrc;
- hid_t acc_tpl = H5I_INVALID_HID; /* file access templates */
-
- switch (param->io_type) {
- case POSIXIO:
- if (flags & (PIO_CREATE | PIO_WRITE))
- fd->posixfd = POSIXCREATE(fname);
- else
- fd->posixfd = POSIXOPEN(fname, O_RDONLY);
-
- if (fd->posixfd < 0 ) {
- HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname);
- GOTOERROR(FAIL);
- }
-
-
- /* The perils of POSIX I/O in a parallel environment. The problem is:
- *
- * - Process n opens a file with truncation and then starts
- * writing to the file.
- * - Process m also opens the file with truncation, but after
- * process n has already started to write to the file. Thus,
- * all of the stuff process n wrote is now lost.
- */
- MPI_Barrier(pio_comm_g);
-
- break;
-
- case MPIO:
- if (flags & (PIO_CREATE | PIO_WRITE)) {
- MPI_File_delete(fname, h5_io_info_g);
- mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_CREATE | MPI_MODE_RDWR,
- h5_io_info_g, &fd->mpifd);
-
- if (mrc != MPI_SUCCESS) {
- HDfprintf(stderr, "MPI File Open failed(%s)\n", fname);
- GOTOERROR(FAIL);
- }
-
- /*since MPI_File_open with MPI_MODE_CREATE does not truncate */
- /*filesize , set size to 0 explicitedly. */
- mrc = MPI_File_set_size(fd->mpifd, (MPI_Offset)0);
- if (mrc != MPI_SUCCESS) {
- HDfprintf(stderr, "MPI_File_set_size failed\n");
- GOTOERROR(FAIL);
- }
- } else {
- mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_RDONLY, h5_io_info_g, &fd->mpifd);
- if (mrc != MPI_SUCCESS) {
- HDfprintf(stderr, "MPI File Open failed(%s)\n", fname);
- GOTOERROR(FAIL);
- }
- }
-
- break;
-
- case PHDF5:
- if ((acc_tpl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- HDfprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
-
- /* Set the file driver to the MPI-IO driver */
- if (H5Pset_fapl_mpio(acc_tpl, pio_comm_g, h5_io_info_g) < 0) {
- HDfprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- }
-
- /* Set the alignment of objects in HDF5 file */
- if (H5Pset_alignment(acc_tpl, param->h5_thresh, param->h5_align) < 0) {
- HDfprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- }
-
- /* create the parallel file */
- if (flags & (PIO_CREATE | PIO_WRITE))
- fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
- else
- fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, acc_tpl);
- if (fd->h5fd < 0) {
- HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname);
- GOTOERROR(FAIL);
- }
-
- /* verifying the close of the acc_tpl */
- if (H5Pclose(acc_tpl) < 0) {
- HDfprintf(stderr, "HDF5 Property List Close failed\n");
- GOTOERROR(FAIL);
- }
-
- break;
-
- default:
- break;
- }
-
-done:
- return ret_code;
-}
-
-/*
- * Function: do_fclose
- * Purpose: Close the specified file descriptor.
- * Return: SUCCESS or FAIL
- * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
- * Modifications:
- */
- static herr_t
-do_fclose(iotype iot, file_descr *fd /*out*/)
-{
- herr_t ret_code = SUCCESS, hrc;
- int mrc = 0, rc = 0;
-
- switch (iot) {
- case POSIXIO:
- rc = POSIXCLOSE(fd->posixfd);
-
- if (rc != 0){
- HDfprintf(stderr, "POSIX File Close failed\n");
- GOTOERROR(FAIL);
- }
-
- fd->posixfd = -1;
- break;
-
- case MPIO:
- mrc = MPI_File_close(&fd->mpifd);
-
- if (mrc != MPI_SUCCESS){
- HDfprintf(stderr, "MPI File close failed\n");
- GOTOERROR(FAIL);
- }
-
- fd->mpifd = MPI_FILE_NULL;
- break;
-
- case PHDF5:
- hrc = H5Fclose(fd->h5fd);
-
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 File Close failed\n");
- GOTOERROR(FAIL);
- }
-
- fd->h5fd = -1;
- break;
-
- default:
- break;
- }
-
-done:
- return ret_code;
-}
-
-
-/*
- * Function: do_fclose
- * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set.
- * Only Proc 0 of the PIO communicator will do the cleanup.
- * Other processes just return.
- * Return: void
- * Programmer: Albert Cheng 2001/12/12
- * Modifications:
- */
- static void
-do_cleanupfile(iotype iot, char *fname)
-{
- if (pio_mpi_rank_g != 0)
- return;
-
- if (clean_file_g == -1)
- clean_file_g = (getenv("HDF5_NOCLEANUP")==NULL) ? 1 : 0;
-
- if (clean_file_g){
- switch (iot){
- case POSIXIO:
- HDremove(fname);
- break;
- case MPIO:
- case PHDF5:
- MPI_File_delete(fname, h5_io_info_g);
- break;
- default:
- break;
- }
- }
-}
-
-#ifdef TIME_MPI
-/* instrument the MPI_File_wrirte_xxx and read_xxx calls to measure
- * pure time spent in MPI_File code.
- */
-int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status)
-{
- int err;
- io_time_set(timer_g, HDF5_MPI_READ, TSTART);
- err=PMPI_File_read_at(fh, offset, buf, count, datatype, status);
- io_time_set(timer_g, HDF5_MPI_READ, TSTOP);
- return err;
-}
-
-
-int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status)
-{
- int err;
- io_time_set(timer_g, HDF5_MPI_READ, TSTART);
- err=PMPI_File_read_at_all(fh, offset, buf, count, datatype, status);
- io_time_set(timer_g, HDF5_MPI_READ, TSTOP);
- return err;
-}
-
-int MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status)
-{
- int err;
- io_time_set(timer_g, HDF5_MPI_WRITE, TSTART);
- err=PMPI_File_write_at(fh, offset, buf, count, datatype, status);
- io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP);
- return err;
-}
-
-int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status)
-{
- int err;
- io_time_set(timer_g, HDF5_MPI_WRITE, TSTART);
- err=PMPI_File_write_at_all(fh, offset, buf, count, datatype, status);
- io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP);
- return err;
-}
-
-#endif /* TIME_MPI */
-#endif /* H5_HAVE_PARALLEL */
-
-
-
-
-
diff --git a/tools/test/perform/pio_perf.h b/tools/test/perform/pio_perf.h
deleted file mode 100644
index 55d721e..0000000
--- a/tools/test/perform/pio_perf.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#ifndef PIO_PERF_H__
-#define PIO_PERF_H__
-
-#ifndef STANDALONE
-#include "io_timer.h"
-#include "h5test.h"
-#include "h5tools.h"
-#include "h5tools_utils.h"
-#else
-#include "io_timer.h"
-#include "pio_standalone.h"
-#endif
-
-/* setup the dataset no fill option if this is v1.5 or more */
-#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4
-#define H5_HAVE_NOFILL 1
-#endif
-
-typedef enum iotype_ {
- POSIXIO,
- MPIO,
- PHDF5
- /*NUM_TYPES*/
-} iotype;
-
-typedef struct parameters_ {
- iotype io_type; /* The type of IO test to perform */
- int num_procs; /* Maximum number of processes to use */
- long num_files; /* Number of files to create */
- long num_dsets; /* Number of datasets to create */
- off_t num_bytes; /* Number of bytes in each dset */
- int num_iters; /* Number of times to loop doing the IO */
- size_t buf_size; /* Buffer size */
- size_t blk_size; /* Block size */
- unsigned interleaved; /* Interleaved vs. contiguous blocks */
- unsigned collective; /* Collective vs. independent I/O */
- unsigned dim2d; /* 1D vs. 2D */
- hsize_t h5_align; /* HDF5 object alignment */
- hsize_t h5_thresh; /* HDF5 object alignment threshold */
- int h5_use_chunks; /* Make HDF5 dataset chunked */
- int h5_write_only; /* Perform the write tests only */
- int verify; /* Verify data correctness */
-} parameters;
-
-typedef struct results_ {
- herr_t ret_code;
- io_time_t *timers;
-} results;
-
-#ifndef SUCCESS
-#define SUCCESS 0
-#endif /* !SUCCESS */
-
-#ifndef FAIL
-#define FAIL -1
-#endif /* !FAIL */
-
-extern FILE *output; /* output file */
-extern io_time_t *timer_g; /* timer: global for stub functions */
-extern int comm_world_rank_g; /* my rank in MPI_COMM_RANK */
-extern int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */
-extern MPI_Comm pio_comm_g; /* Communicator to run the PIO */
-extern int pio_mpi_rank_g; /* MPI rank of pio_comm_g */
-extern int pio_mpi_nprocs_g; /* number of processes of pio_comm_g */
-extern int pio_debug_level; /* The debug level:
- * 0 - Off
- * 1 - Minimal
- * 2 - Some more
- * 3 - Maximal
- * 4 - Even More Debugging (timer stuff)
- */
-
-#define HDprint_rank(f) /* print rank in MPI_COMM_WORLD */ \
- HDfprintf(f, "%d: ", comm_world_rank_g);
-#define HDprint_size(f) /* print size of MPI_COMM_WORLD */ \
- HDfprintf(f, "%d", comm_world_nprocs_g);
-#define HDprint_rank_size(f) /* print rank/size of MPI_COMM_WORLD */ \
- HDfprintf(f, "%d/%d: ", comm_world_rank_g, comm_world_nprocs_g);
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-extern results do_pio(parameters param);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* PIO_PERF_H__ */
diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c
index 8cdca85..032bfba 100644
--- a/tools/test/perform/pio_standalone.c
+++ b/tools/test/perform/pio_standalone.c
@@ -5,12 +5,11 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
/* This file contains the definition of functions required to build h5perf in
* STANDALONE mode.
* Created: Christian Chilan, 2005/5/18.
@@ -18,41 +17,32 @@
#include "pio_perf.h"
-#ifdef STANDALONE
-MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
-#endif
-
/** From h5tools_utils.c **/
/* global variables */
-int nCols = 80;
-
-/* ``get_option'' variables */
-int opt_err = 1; /*get_option prints errors if this is on */
-int opt_ind = 1; /*token pointer */
-const char *opt_arg; /*flag argument (or value) */
-
+int nCols = 80;
int
-get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts)
+get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts)
{
- static int sp = 1; /* character index in current token */
- int opt_opt = '?'; /* option character passed back to user */
+ static int sp = 1; /* character index in current token */
+ int opt_opt = '?'; /* option character passed back to user */
if (sp == 1) {
/* check for more flag-like tokens */
- if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') {
+ if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') {
return EOF;
- } else if (HDstrcmp(argv[opt_ind], "--") == 0) {
- opt_ind++;
+ }
+ else if (HDstrcmp(argv[H5_optind], "--") == 0) {
+ H5_optind++;
return EOF;
}
}
- if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') {
+ if (sp == 1 && argv[H5_optind][0] == '-' && argv[H5_optind][1] == '-') {
/* long command line option */
- const char *arg = &argv[opt_ind][2];
- int i;
+ const char *arg = &argv[H5_optind][2];
+ int i;
for (i = 0; l_opts && l_opts[i].name; i++) {
size_t len = HDstrlen(l_opts[i].name);
@@ -63,28 +53,27 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (l_opts[i].has_arg != no_arg) {
if (arg[len] == '=') {
- opt_arg = &arg[len + 1];
- } else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-') {
- opt_arg = argv[++opt_ind];
- } else if (l_opts[i].has_arg == require_arg) {
- if (opt_err)
- HDfprintf(stderr,
- "%s: option required for \"--%s\" flag\n",
- argv[0], arg);
+ H5_optarg = &arg[len + 1];
+ }
+ else if (H5_optind < (argc - 1) && argv[H5_optind + 1][0] != '-') {
+ H5_optarg = argv[++H5_optind];
+ }
+ else if (l_opts[i].has_arg == require_arg) {
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg);
opt_opt = '?';
}
- } else {
+ }
+ else {
if (arg[len] == '=') {
- if (opt_err)
- HDfprintf(stderr,
- "%s: no option required for \"%s\" flag\n",
- argv[0], arg);
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg);
opt_opt = '?';
}
- opt_arg = NULL;
+ H5_optarg = NULL;
}
break;
@@ -93,29 +82,29 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (l_opts[i].name == NULL) {
/* exhausted all of the l_opts we have and still didn't match */
- if (opt_err)
+ if (H5_opterr)
HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
opt_opt = '?';
}
- opt_ind++;
+ H5_optind++;
sp = 1;
- } else {
- register char *cp; /* pointer into current token */
+ }
+ else {
+ register char *cp; /* pointer into current token */
/* short command line option */
- opt_opt = argv[opt_ind][sp];
+ opt_opt = argv[H5_optind][sp];
if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) {
- if (opt_err)
- HDfprintf(stderr, "%s: unknown option \"%c\"\n",
- argv[0], opt_opt);
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], opt_opt);
/* if no chars left in this token, move to next token */
- if (argv[opt_ind][++sp] == '\0') {
- opt_ind++;
+ if (argv[H5_optind][++sp] == '\0') {
+ H5_optind++;
sp = 1;
}
@@ -124,31 +113,32 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (*++cp == ':') {
/* if a value is expected, get it */
- if (argv[opt_ind][sp + 1] != '\0') {
+ if (argv[H5_optind][sp + 1] != '\0') {
/* flag value is rest of current token */
- opt_arg = &argv[opt_ind++][sp + 1];
- } else if (++opt_ind >= argc) {
- if (opt_err)
- HDfprintf(stderr,
- "%s: value expected for option \"%c\"\n",
- argv[0], opt_opt);
+ H5_optarg = &argv[H5_optind++][sp + 1];
+ }
+ else if (++H5_optind >= argc) {
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], opt_opt);
opt_opt = '?';
- } else {
+ }
+ else {
/* flag value is next token */
- opt_arg = argv[opt_ind++];
+ H5_optarg = argv[H5_optind++];
}
sp = 1;
- } else {
+ }
+ else {
/* set up to look at next char in token, next time */
- if (argv[opt_ind][++sp] == '\0') {
+ if (argv[H5_optind][++sp] == '\0') {
/* no more in current token, so setup next token */
- opt_ind++;
+ H5_optind++;
sp = 1;
}
- opt_arg = NULL;
+ H5_optarg = NULL;
}
}
@@ -156,143 +146,9 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
return opt_opt;
}
-
void
print_version(const char *progname)
{
- printf("%s: Version %u.%u.%u%s%s\n",
- progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
+ printf("%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE);
}
-
-#ifdef STANDALONE
-/*
- * Function: h5_set_info_object
- * Purpose: Process environment variables setting to set up MPI Info
- * object.
- * Return: 0 if all is fine; otherwise non-zero.
- * Programmer: Albert Cheng, 2002/05/21.
- * Modifications:
- * Bill Wendling, 2002/05/31
- * Modified so that the HDF5_MPI_INFO environment variable can
- * be a semicolon separated list of "key=value" pairings. Most
- * of the code is to remove any whitespaces which might be
- * surrounding the "key=value" pairs.
- */
-int
-h5_set_info_object(void)
-{
- char *envp; /* environment pointer */
- int ret_value=0;
-
- /* handle any MPI INFO hints via $HDF5_MPI_INFO */
- if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){
- char *next, *valp;
-
- valp = envp = next = HDstrdup(envp);
-
- if (!valp) return 0;
-
- /* create an INFO object if not created yet */
- if (h5_io_info_g == MPI_INFO_NULL)
- MPI_Info_create(&h5_io_info_g);
-
- do {
- size_t len;
- char *key_val, *endp, *namep;
-
- if (*valp == ';')
- valp++;
-
- /* copy key/value pair into temporary buffer */
- len = strcspn(valp, ";");
- next = &valp[len];
- key_val = (char *)HDcalloc(1, len + 1);
-
- /* increment the next pointer past the terminating semicolon */
- if (*next == ';')
- ++next;
-
- namep = HDstrncpy(key_val, valp, len);
-
- /* pass up any beginning whitespaces */
- while (*namep && (*namep == ' ' || *namep == '\t'))
- namep++;
-
- if (!*namep) continue; /* was all white space, so move to next k/v pair */
-
- /* eat up any ending white spaces */
- endp = &namep[HDstrlen(namep) - 1];
-
- while (endp && (*endp == ' ' || *endp == '\t'))
- *endp-- = '\0';
-
- /* find the '=' */
- valp = HDstrchr(namep, '=');
-
- if (valp != NULL) { /* it's a valid key/value pairing */
- char *tmp_val = valp + 1;
-
- /* change '=' to \0, move valp down one */
- *valp-- = '\0';
-
- /* eat up ending whitespace on the "key" part */
- while (*valp == ' ' || *valp == '\t')
- *valp-- = '\0';
-
- valp = tmp_val;
-
- /* eat up beginning whitespace on the "value" part */
- while (*valp == ' ' || *valp == '\t')
- *valp++ = '\0';
-
- /* actually set the darned thing */
- if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) {
- HDprintf("MPI_Info_set failed\n");
- ret_value = -1;
- }
- }
-
- valp = next;
- HDfree(key_val);
- } while (next && *next);
-
- HDfree(envp);
- }
-
- return ret_value;
-}
-
-
-/*
- * Function: h5_dump_info_object
- * Purpose: Display content of an MPI Info object
- * Return: void
- * Programmer: Albert Cheng 2002/05/21
- * Modifications:
- */
-void
-h5_dump_info_object(MPI_Info info)
-{
- char key[MPI_MAX_INFO_KEY+1];
- char value[MPI_MAX_INFO_VAL+1];
- int flag;
- int i, nkeys;
-
- HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL);
- if (info==MPI_INFO_NULL){
- HDprintf("object is MPI_INFO_NULL\n");
- }
- else {
- MPI_Info_get_nkeys(info, &nkeys);
- HDprintf("object has %d items\n", nkeys);
- for (i=0; i<nkeys; i++){
- MPI_Info_get_nthkey(info, i, key);
- MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
- HDprintf("%s=%s\n", key, value);
- }
-
- }
-}
-#endif /* STANDALONE */
-
diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h
index f2cda4f..23cd0e8 100644
--- a/tools/test/perform/pio_standalone.h
+++ b/tools/test/perform/pio_standalone.h
@@ -5,13 +5,13 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef PIO_STANDALONE_H__
-#define PIO_PERF_H__
+#ifndef PIO_STANDALONE_H
+#define PIO_STANDALONE_H
/* Header file for building h5perf by standalone mode.
* Created: Christian Chilan, 2005/5/18.
@@ -19,450 +19,437 @@
/** From H5private.h **/
-#include "H5public.h" /* Include Public Definitions */
-
+#include "H5public.h" /* Include Public Definitions */
/*
* Include ANSI-C header files.
*/
#ifdef H5_STDC_HEADERS
-# include <assert.h>
-# include <ctype.h>
-# include <errno.h>
-# include <fcntl.h>
-# include <float.h>
-# include <limits.h>
-# include <math.h>
-# include <signal.h>
-# include <stdarg.h>
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#endif
/*
* Redefine all the POSIX functions. We should never see a POSIX
* function (or any other non-HDF5 function) in the source!
*/
-#define HDabort() abort()
-#define HDabs(X) abs(X)
+#define HDabort() abort()
+#define HDabs(X) abs(X)
#ifdef H5_HAVE_WIN32_API
-#define HDaccess(F,M) _access(F, M)
-#define R_OK 4 /* Test for read permission. */
-#define W_OK 2 /* Test for write permission. */
-#define X_OK 1 /* Test for execute permission. */
-#define F_OK 0 /* Test for existence. */
-#else /* H5_HAVE_WIN32_API */
-#define HDaccess(F,M) access(F, M)
+#define HDaccess(F, M) _access(F, M)
+#define R_OK 4 /* Test for read permission. */
+#define W_OK 2 /* Test for write permission. */
+#define X_OK 1 /* Test for execute permission. */
+#define F_OK 0 /* Test for existence. */
+#else /* H5_HAVE_WIN32_API */
+#define HDaccess(F, M) access(F, M)
#ifndef F_OK
-#define F_OK 00
+#define F_OK 00
#define W_OK 02
#define R_OK 04
#endif
#endif /* H5_HAVE_WIN32_API */
-#define HDacos(X) acos(X)
+#define HDacos(X) acos(X)
#ifdef H5_HAVE_ALARM
-#define HDalarm(N) alarm(N)
+#define HDalarm(N) alarm(N)
#else /* H5_HAVE_ALARM */
-#define HDalarm(N) (0)
+#define HDalarm(N) (0)
#endif /* H5_HAVE_ALARM */
-#define HDasctime(T) asctime(T)
-#define HDasin(X) asin(X)
-#define HDasprintf asprintf /*varargs*/
-#define HDassert(X) assert(X)
-#define HDatan(X) atan(X)
-#define HDatan2(X,Y) atan2(X,Y)
-#define HDatexit(F) atexit(F)
-#define HDatof(S) atof(S)
-#define HDatoi(S) atoi(S)
-#define HDatol(S) atol(S)
-#define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F)
-#define HDcalloc(N,Z) calloc(N,Z)
-#define HDceil(X) ceil(X)
-#define HDcfgetispeed(T) cfgetispeed(T)
-#define HDcfgetospeed(T) cfgetospeed(T)
-#define HDcfsetispeed(T,S) cfsetispeed(T,S)
-#define HDcfsetospeed(T,S) cfsetospeed(T,S)
-#define HDchdir(S) chdir(S)
-#define HDchmod(S,M) chmod(S,M)
-#define HDchown(S,O,G) chown(S,O,G)
-#define HDclearerr(F) clearerr(F)
-#define HDclock() clock()
-#define HDclose(F) close(F)
-#define HDclosedir(D) closedir(D)
-#define HDcos(X) cos(X)
-#define HDcosh(X) cosh(X)
-#define HDcreat(S,M) creat(S,M)
-#define HDctermid(S) ctermid(S)
-#define HDctime(T) ctime(T)
-#define HDcuserid(S) cuserid(S)
+#define HDasctime(T) asctime(T)
+#define HDasin(X) asin(X)
+#define HDasprintf asprintf /*varargs*/
+#define HDassert(X) assert(X)
+#define HDatan(X) atan(X)
+#define HDatan2(X, Y) atan2(X, Y)
+#define HDatexit(F) atexit(F)
+#define HDatof(S) atof(S)
+#define HDatoi(S) atoi(S)
+#define HDatol(S) atol(S)
+#define HDbsearch(K, B, N, Z, F) bsearch(K, B, N, Z, F)
+#define HDcalloc(N, Z) calloc(N, Z)
+#define HDceil(X) ceil(X)
+#define HDcfgetispeed(T) cfgetispeed(T)
+#define HDcfgetospeed(T) cfgetospeed(T)
+#define HDcfsetispeed(T, S) cfsetispeed(T, S)
+#define HDcfsetospeed(T, S) cfsetospeed(T, S)
+#define HDchdir(S) chdir(S)
+#define HDchmod(S, M) chmod(S, M)
+#define HDchown(S, O, G) chown(S, O, G)
+#define HDclearerr(F) clearerr(F)
+#define HDclock() clock()
+#define HDclose(F) close(F)
+#define HDclosedir(D) closedir(D)
+#define HDcos(X) cos(X)
+#define HDcosh(X) cosh(X)
+#define HDcreat(S, M) creat(S, M)
+#define HDctermid(S) ctermid(S)
+#define HDctime(T) ctime(T)
+#define HDcuserid(S) cuserid(S)
#ifdef H5_HAVE_DIFFTIME
-#define HDdifftime(X,Y) difftime(X,Y)
+#define HDdifftime(X, Y) difftime(X, Y)
#else
-#define HDdifftime(X,Y) ((double)(X)-(double)(Y))
+#define HDdifftime(X, Y) ((double)(X) - (double)(Y))
#endif
-#define HDdiv(X,Y) div(X,Y)
-#define HDdup(F) dup(F)
-#define HDdup2(F,I) dup2(F,I)
+#define HDdiv(X, Y) div(X, Y)
+#define HDdup(F) dup(F)
+#define HDdup2(F, I) dup2(F, I)
/* execl() variable arguments */
/* execle() variable arguments */
/* execlp() variable arguments */
-#define HDexecv(S,AV) execv(S,AV)
-#define HDexecve(S,AV,E) execve(S,AV,E)
-#define HDexecvp(S,AV) execvp(S,AV)
-#define HDexit(N) exit(N)
-#define HD_exit(N) _exit(N)
-#define HDexp(X) exp(X)
-#define HDfabs(X) fabs(X)
+#define HDexecv(S, AV) execv(S, AV)
+#define HDexecve(S, AV, E) execve(S, AV, E)
+#define HDexecvp(S, AV) execvp(S, AV)
+#define HDexit(N) exit(N)
+#define HD_exit(N) _exit(N)
+#define HDexp(X) exp(X)
+#define HDfabs(X) fabs(X)
/* use ABS() because fabsf() fabsl() are not common yet. */
-#define HDfabsf(X) ABS(X)
-#define HDfabsl(X) ABS(X)
-#define HDfclose(F) fclose(F)
+#define HDfabsf(X) ABS(X)
+#define HDfabsl(X) ABS(X)
+#define HDfclose(F) fclose(F)
/* fcntl() variable arguments */
-#define HDfdopen(N,S) fdopen(N,S)
-#define HDfeof(F) feof(F)
-#define HDferror(F) ferror(F)
-#define HDfflush(F) fflush(F)
-#define HDfgetc(F) fgetc(F)
-#define HDfgetpos(F,P) fgetpos(F,P)
-#define HDfgets(S,N,F) fgets(S,N,F)
+#define HDfdopen(N, S) fdopen(N, S)
+#define HDfeof(F) feof(F)
+#define HDferror(F) ferror(F)
+#define HDfflush(F) fflush(F)
+#define HDfgetc(F) fgetc(F)
+#define HDfgetpos(F, P) fgetpos(F, P)
+#define HDfgets(S, N, F) fgets(S, N, F)
#ifdef H5_HAVE_WIN32_API
-#define HDfileno(F) _fileno(F)
+#define HDfileno(F) _fileno(F)
#else /* H5_HAVE_WIN32_API */
-#define HDfileno(F) fileno(F)
+#define HDfileno(F) fileno(F)
#endif /* H5_HAVE_WIN32_API */
-#define HDfloor(X) floor(X)
-#define HDfmod(X,Y) fmod(X,Y)
-#define HDfopen(S,M) fopen(S,M)
-#define HDfork() fork()
-#define HDfpathconf(F,N) fpathconf(F,N)
-H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
-#define HDfputc(C,F) fputc(C,F)
-#define HDfputs(S,F) fputs(S,F)
-#define HDfread(M,Z,N,F) fread(M,Z,N,F)
-#define HDfree(M) free(M)
-#define HDfreopen(S,M,F) freopen(S,M,F)
-#define HDfrexp(X,N) frexp(X,N)
+#define HDfloor(X) floor(X)
+#define HDfmod(X, Y) fmod(X, Y)
+#define HDfopen(S, M) fopen(S, M)
+#define HDfork() fork()
+#define HDfpathconf(F, N) fpathconf(F, N)
+#define HDfprintf fprintf
+#define HDfputc(C, F) fputc(C, F)
+#define HDfputs(S, F) fputs(S, F)
+#define HDfread(M, Z, N, F) fread(M, Z, N, F)
+#define HDfree(M) free(M)
+#define HDfreopen(S, M, F) freopen(S, M, F)
+#define HDfrexp(X, N) frexp(X, N)
/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */
#ifdef H5_HAVE_FREXPF
-#define HDfrexpf(X,N) frexpf(X,N)
+#define HDfrexpf(X, N) frexpf(X, N)
#else /* H5_HAVE_FREXPF */
-#define HDfrexpf(X,N) frexp(X,N)
+#define HDfrexpf(X, N) frexp(X, N)
#endif /* H5_HAVE_FREXPF */
#ifdef H5_HAVE_FREXPL
-#define HDfrexpl(X,N) frexpl(X,N)
+#define HDfrexpl(X, N) frexpl(X, N)
#else /* H5_HAVE_FREXPL */
-#define HDfrexpl(X,N) frexp(X,N)
+#define HDfrexpl(X, N) frexp(X, N)
#endif /* H5_HAVE_FREXPL */
/* fscanf() variable arguments */
#ifdef H5_HAVE_FSEEKO
- #define HDfseek(F,O,W) fseeko(F,O,W)
+#define HDfseek(F, O, W) fseeko(F, O, W)
#else
- #define HDfseek(F,O,W) fseek(F,O,W)
+#define HDfseek(F, O, W) fseek(F, O, W)
#endif
-#define HDfsetpos(F,P) fsetpos(F,P)
+#define HDfsetpos(F, P) fsetpos(F, P)
/* definitions related to the file stat utilities.
* Windows have its own function names.
* For Unix, if off_t is not 64bit big, try use the pseudo-standard
* xxx64 versions if available.
*/
#ifdef H5_HAVE_WIN32_API
- #define HDfstat(F,B) _fstati64(F,B)
- #define HDlstat(S,B) _lstati64(S,B)
- #define HDstat(S,B) _stati64(S,B)
- typedef struct _stati64 h5_stat_t;
- typedef __int64 h5_stat_size_t;
- #define HDoff_t __int64
-#elif H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64)
- #define HDfstat(F,B) fstat64(F,B)
- #define HDlstat(S,B) lstat64(S,B)
- #define HDstat(S,B) stat64(S,B)
- typedef struct stat64 h5_stat_t;
- typedef off64_t h5_stat_size_t;
- #define HDoff_t off64_t
+#define HDfstat(F, B) _fstati64(F, B)
+#define HDlstat(S, B) _lstati64(S, B)
+#define HDstat(S, B) _stati64(S, B)
+typedef struct _stati64 h5_stat_t;
+typedef __int64 h5_stat_size_t;
+#define HDoff_t __int64
+#elif H5_SIZEOF_OFF_T != 8 && H5_SIZEOF_OFF64_T == 8 && defined(H5_HAVE_STAT64)
+#define HDfstat(F, B) fstat64(F, B)
+#define HDlstat(S, B) lstat64(S, B)
+#define HDstat(S, B) stat64(S, B)
+typedef struct stat64 h5_stat_t;
+typedef off64_t h5_stat_size_t;
+#define HDoff_t off64_t
#else
- #define HDfstat(F,B) fstat(F,B)
- #define HDlstat(S,B) lstat(S,B)
- #define HDstat(S,B) stat(S,B)
- typedef struct stat h5_stat_t;
- typedef off_t h5_stat_size_t;
- #define HDoff_t off_t
+#define HDfstat(F, B) fstat(F, B)
+#define HDlstat(S, B) lstat(S, B)
+#define HDstat(S, B) stat(S, B)
+typedef struct stat h5_stat_t;
+typedef off_t h5_stat_size_t;
+#define HDoff_t off_t
#endif
-#define HDftell(F) ftell(F)
-#define HDftruncate(F,L) ftruncate(F,L)
-#define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
-#define HDgetc(F) getc(F)
-#define HDgetchar() getchar()
-#define HDgetcwd(S,Z) getcwd(S,Z)
-#define HDgetegid() getegid()
-#define HDgetenv(S) getenv(S)
-#define HDgeteuid() geteuid()
-#define HDgetgid() getgid()
-#define HDgetgrgid(G) getgrgid(G)
-#define HDgetgrnam(S) getgrnam(S)
-#define HDgetgroups(Z,G) getgroups(Z,G)
+#define HDftell(F) ftell(F)
+#define HDftruncate(F, L) ftruncate(F, L)
+#define HDfwrite(M, Z, N, F) fwrite(M, Z, N, F)
+#define HDgetc(F) getc(F)
+#define HDgetchar() getchar()
+#define HDgetcwd(S, Z) getcwd(S, Z)
+#define HDgetegid() getegid()
+#define HDgetenv(S) getenv(S)
+#define HDgeteuid() geteuid()
+#define HDgetgid() getgid()
+#define HDgetgrgid(G) getgrgid(G)
+#define HDgetgrnam(S) getgrnam(S)
+#define HDgetgroups(Z, G) getgroups(Z, G)
#ifdef H5_HAVE_WIN32_API
-#define HDgetlogin() Wgetlogin()
+#define HDgetlogin() Wgetlogin()
#else /* H5_HAVE_WIN32_API */
-#define HDgetlogin() getlogin()
+#define HDgetlogin() getlogin()
#endif /* H5_HAVE_WIN32_API */
-#define HDgetpgrp() getpgrp()
-#define HDgetpid() getpid()
-#define HDgetppid() getppid()
-#define HDgetpwnam(S) getpwnam(S)
-#define HDgetpwuid(U) getpwuid(U)
-#define HDgetrusage(X,S) getrusage(X,S)
+#define HDgetpgrp() getpgrp()
+#define HDgetpid() getpid()
+#define HDgetppid() getppid()
+#define HDgetpwnam(S) getpwnam(S)
+#define HDgetpwuid(U) getpwuid(U)
+#define HDgetrusage(X, S) getrusage(X, S)
/* Don't define a macro for gets() - it was removed in C11 */
#ifdef H5_HAVE_WIN32_API
- H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
-#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)
+H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
+#define HDgettimeofday(V, Z) Wgettimeofday(V, Z)
#else /* H5_HAVE_WIN32_API */
-#define HDgettimeofday(S,P) gettimeofday(S,P)
+#define HDgettimeofday(S, P) gettimeofday(S, P)
#endif /* H5_HAVE_WIN32_API */
-#define HDgetuid() getuid()
-#define HDgmtime(T) gmtime(T)
-#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
-#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/
-#define HDisatty(F) isatty(F)
-#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/
-#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/
-#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/
-#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/
-#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/
-#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/
-#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/
-#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/
-#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/
-#define HDkill(P,S) kill(P,S)
-#define HDlabs(X) labs(X)
-#define HDldexp(X,N) ldexp(X,N)
-#define HDldiv(X,Y) ldiv(X,Y)
-#define HDlink(OLD,NEW) link(OLD,NEW)
-#define HDlocaleconv() localeconv()
-#define HDlocaltime(T) localtime(T)
-#define HDlog(X) log(X)
-#define HDlog10(X) log10(X)
-#define HDlongjmp(J,N) longjmp(J,N)
+#define HDgetuid() getuid()
+#define HDgmtime(T) gmtime(T)
+#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
+#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/
+#define HDisatty(F) isatty(F)
+#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/
+#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/
+#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/
+#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/
+#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/
+#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/
+#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/
+#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/
+#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/
+#define HDkill(P, S) kill(P, S)
+#define HDlabs(X) labs(X)
+#define HDldexp(X, N) ldexp(X, N)
+#define HDldiv(X, Y) ldiv(X, Y)
+#define HDlink(OLD, NEW) link(OLD, NEW)
+#define HDlocaleconv() localeconv()
+#define HDlocaltime(T) localtime(T)
+#define HDlog(X) log(X)
+#define HDlog10(X) log10(X)
+#define HDlongjmp(J, N) longjmp(J, N)
#ifdef H5_HAVE_WIN32_API
- #define HDlseek(F,O,W) _lseeki64(F,O,W)
+#define HDlseek(F, O, W) _lseeki64(F, O, W)
+#else
+#ifdef H5_HAVE_LSEEK64
+#define HDlseek(F, O, W) lseek64(F, O, W)
#else
- #ifdef H5_HAVE_LSEEK64
- #define HDlseek(F,O,W) lseek64(F,O,W)
- #else
- #define HDlseek(F,O,W) lseek(F,O,W)
- #endif
+#define HDlseek(F, O, W) lseek(F, O, W)
#endif
-#define HDmalloc(Z) malloc(Z)
-#define HDposix_memalign(P,A,Z) posix_memalign(P,A,Z)
-#define HDmblen(S,N) mblen(S,N)
-#define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z)
-#define HDmbtowc(P,S,Z) mbtowc(P,S,Z)
-#define HDmemchr(S,C,Z) memchr(S,C,Z)
-#define HDmemcmp(X,Y,Z) memcmp(X,Y,Z)
+#endif
+#define HDmalloc(Z) malloc(Z)
+#define HDposix_memalign(P, A, Z) posix_memalign(P, A, Z)
+#define HDmblen(S, N) mblen(S, N)
+#define HDmbstowcs(P, S, Z) mbstowcs(P, S, Z)
+#define HDmbtowc(P, S, Z) mbtowc(P, S, Z)
+#define HDmemchr(S, C, Z) memchr(S, C, Z)
+#define HDmemcmp(X, Y, Z) memcmp(X, Y, Z)
/*
* The (char*) casts are required for the DEC when optimizations are turned
* on and the source and/or destination are not aligned.
*/
-#define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z)
-#define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
+#define HDmemcpy(X, Y, Z) memcpy((char *)(X), (const char *)(Y), Z)
+#define HDmemmove(X, Y, Z) memmove((char *)(X), (const char *)(Y), Z)
/*
* The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO
*/
#ifdef H5_HAVE_VISUAL_STUDIO
-#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
+#define HDmemset(X, C, Z) memset((void *)(X), C, Z)
#else /* H5_HAVE_VISUAL_STUDIO */
-#define HDmemset(X,C,Z) memset(X,C,Z)
+#define HDmemset(X, C, Z) memset(X, C, Z)
#endif /* H5_HAVE_VISUAL_STUDIO */
#ifdef H5_HAVE_WIN32_API
-#define HDmkdir(S,M) _mkdir(S)
+#define HDmkdir(S, M) _mkdir(S)
#else /* H5_HAVE_WIN32_API */
-#define HDmkdir(S,M) mkdir(S,M)
+#define HDmkdir(S, M) mkdir(S, M)
#endif /* H5_HAVE_WIN32_API */
-#define HDmkfifo(S,M) mkfifo(S,M)
-#define HDmktime(T) mktime(T)
-#define HDmodf(X,Y) modf(X,Y)
+#define HDmkfifo(S, M) mkfifo(S, M)
+#define HDmktime(T) mktime(T)
+#define HDmodf(X, Y) modf(X, Y)
#ifdef _O_BINARY
-#define HDopen(S,F,M) open(S,F|_O_BINARY,M)
+#define HDopen(S, F, M) open(S, F | _O_BINARY, M)
#else
-#define HDopen(S,F,M) open(S,F,M)
+#define HDopen(S, F, M) open(S, F, M)
#endif
-#define HDopendir(S) opendir(S)
-#define HDpathconf(S,N) pathconf(S,N)
-#define HDpause() pause()
-#define HDperror(S) perror(S)
-#define HDpipe(F) pipe(F)
-#define HDpow(X,Y) pow(X,Y)
+#define HDopendir(S) opendir(S)
+#define HDpathconf(S, N) pathconf(S, N)
+#define HDpause() pause()
+#define HDperror(S) perror(S)
+#define HDpipe(F) pipe(F)
+#define HDpow(X, Y) pow(X, Y)
/* printf() variable arguments */
-#define HDprintf(...) HDfprintf(stdout, __VA_ARGS__)
-#define HDputc(C,F) putc(C,F)
-#define HDputchar(C) putchar(C)
-#define HDputs(S) puts(S)
-#define HDqsort(M,N,Z,F) qsort(M,N,Z,F)
-#define HDraise(N) raise(N)
+#define HDprintf(...) HDfprintf(stdout, __VA_ARGS__)
+#define HDputc(C, F) putc(C, F)
+#define HDputchar(C) putchar(C)
+#define HDputs(S) puts(S)
+#define HDqsort(M, N, Z, F) qsort(M, N, Z, F)
+#define HDraise(N) raise(N)
#ifdef H5_HAVE_RAND_R
-#define HDrandom() HDrand()
+#define HDrandom() HDrand()
H5_DLL int HDrand(void);
#elif H5_HAVE_RANDOM
-#define HDrand() random()
-#define HDrandom() random()
+#define HDrand() random()
+#define HDrandom() random()
#else
-#define HDrand() rand()
-#define HDrandom() rand()
+#define HDrand() rand()
+#define HDrandom() rand()
#endif
-#define HDread(F,M,Z) read(F,M,Z)
-#define HDreaddir(D) readdir(D)
-#define HDrealloc(M,Z) realloc(M,Z)
-#define HDremove(S) remove(S)
-#define HDrename(OLD,NEW) rename(OLD,NEW)
-#define HDrewind(F) rewind(F)
-#define HDrewinddir(D) rewinddir(D)
-#define HDrmdir(S) rmdir(S)
+#define HDread(F, M, Z) read(F, M, Z)
+#define HDreaddir(D) readdir(D)
+#define HDrealloc(M, Z) realloc(M, Z)
+#define HDremove(S) remove(S)
+#define HDrename(OLD, NEW) rename(OLD, NEW)
+#define HDrewind(F) rewind(F)
+#define HDrewinddir(D) rewinddir(D)
+#define HDrmdir(S) rmdir(S)
/* scanf() variable arguments */
-#define HDsetbuf(F,S) setbuf(F,S)
-#define HDsetgid(G) setgid(G)
-#define HDsetjmp(J) setjmp(J)
-#define HDsetlocale(N,S) setlocale(N,S)
-#define HDsetpgid(P,PG) setpgid(P,PG)
-#define HDsetsid() setsid()
-#define HDsetuid(U) setuid(U)
+#define HDsetbuf(F, S) setbuf(F, S)
+#define HDsetgid(G) setgid(G)
+#define HDsetjmp(J) setjmp(J)
+#define HDsetlocale(N, S) setlocale(N, S)
+#define HDsetpgid(P, PG) setpgid(P, PG)
+#define HDsetsid() setsid()
+#define HDsetuid(U) setuid(U)
/* Windows does not permit setting the buffer size to values
less than 2. */
#ifndef H5_HAVE_WIN32_API
-#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z)
-#else
-#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2))
-#endif
-#define HDsigaddset(S,N) sigaddset(S,N)
-#define HDsigdelset(S,N) sigdelset(S,N)
-#define HDsigemptyset(S) sigemptyset(S)
-#define HDsigfillset(S) sigfillset(S)
-#define HDsigismember(S,N) sigismember(S,N)
-#define HDsiglongjmp(J,N) siglongjmp(J,N)
-#define HDsignal(N,F) signal(N,F)
-#define HDsigpending(S) sigpending(S)
-#define HDsigprocmask(H,S,O) sigprocmask(H,S,O)
-#define HDsigsetjmp(J,N) sigsetjmp(J,N)
-#define HDsigsuspend(S) sigsuspend(S)
-#define HDsin(X) sin(X)
-#define HDsinh(X) sinh(X)
-#define HDsleep(N) sleep(N)
-#ifdef H5_HAVE_WIN32_API
-H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...);
-#define HDsnprintf c99_snprintf /*varargs*/
+#define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, Z)
#else
-#define HDsnprintf snprintf /*varargs*/
+#define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, (Z > 1 ? Z : 2))
#endif
-/* sprintf() variable arguments */
-#define HDsprintf sprintf /*varargs*/
-#define HDsqrt(X) sqrt(X)
+#define HDsigaddset(S, N) sigaddset(S, N)
+#define HDsigdelset(S, N) sigdelset(S, N)
+#define HDsigemptyset(S) sigemptyset(S)
+#define HDsigfillset(S) sigfillset(S)
+#define HDsigismember(S, N) sigismember(S, N)
+#define HDsiglongjmp(J, N) siglongjmp(J, N)
+#define HDsignal(N, F) signal(N, F)
+#define HDsigpending(S) sigpending(S)
+#define HDsigprocmask(H, S, O) sigprocmask(H, S, O)
+#define HDsigsetjmp(J, N) sigsetjmp(J, N)
+#define HDsigsuspend(S) sigsuspend(S)
+#define HDsin(X) sin(X)
+#define HDsinh(X) sinh(X)
+#define HDsleep(N) sleep(N)
+#define HDsnprintf snprintf /*varargs*/
+#define HDsprintf sprintf /*varargs*/
+#define HDsqrt(X) sqrt(X)
#ifdef H5_HAVE_RAND_R
H5_DLL void HDsrand(unsigned int seed);
-#define HDsrandom(S) HDsrand(S)
+#define HDsrandom(S) HDsrand(S)
#elif H5_HAVE_RANDOM
-#define HDsrand(S) srandom(S)
-#define HDsrandom(S) srandom(S)
+#define HDsrand(S) srandom(S)
+#define HDsrandom(S) srandom(S)
#else
-#define HDsrand(S) srand(S)
-#define HDsrandom(S) srand(S)
+#define HDsrand(S) srand(S)
+#define HDsrandom(S) srand(S)
#endif
-/* sscanf() variable arguments */
#ifdef H5_HAVE_WIN32_API
-#define HDstrcasecmp(A,B) _stricmp(A,B)
-#else
-#define HDstrcasecmp(X,Y) strcasecmp(X,Y)
-#endif
-#define HDstrcat(X,Y) strcat(X,Y)
-#define HDstrchr(S,C) strchr(S,C)
-#define HDstrcmp(X,Y) strcmp(X,Y)
-#define HDstrcoll(X,Y) strcoll(X,Y)
-#define HDstrcpy(X,Y) strcpy(X,Y)
-#define HDstrcspn(X,Y) strcspn(X,Y)
-#define HDstrerror(N) strerror(N)
-#define HDstrftime(S,Z,F,T) strftime(S,Z,F,T)
-#define HDstrlen(S) strlen(S)
-#define HDstrncat(X,Y,Z) strncat(X,Y,Z)
-#define HDstrncmp(X,Y,Z) strncmp(X,Y,Z)
-#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z)
-#define HDstrpbrk(X,Y) strpbrk(X,Y)
-#define HDstrrchr(S,C) strrchr(S,C)
-#define HDstrspn(X,Y) strspn(X,Y)
-#define HDstrstr(X,Y) strstr(X,Y)
-#define HDstrtod(S,R) strtod(S,R)
-#define HDstrtok(X,Y) strtok(X,Y)
-#define HDstrtol(S,R,N) strtol(S,R,N)
-H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
-#define HDstrtoul(S,R,N) strtoul(S,R,N)
-#ifdef H5_HAVE_WIN32_API
-#define HDstrtoull(S,R,N) _strtoui64(S,R,N)
+#define HDstrcasecmp(A, B) _stricmp(A, B)
#else
-#define HDstrtoull(S,R,N) strtoull(S,R,N)
+#define HDstrcasecmp(X, Y) strcasecmp(X, Y)
#endif
-#define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z)
-#define HDsysconf(N) sysconf(N)
-#define HDsystem(S) system(S)
-#define HDtan(X) tan(X)
-#define HDtanh(X) tanh(X)
-#define HDtcdrain(F) tcdrain(F)
-#define HDtcflow(F,A) tcflow(F,A)
-#define HDtcflush(F,N) tcflush(F,N)
-#define HDtcgetattr(F,T) tcgetattr(F,T)
-#define HDtcgetpgrp(F) tcgetpgrp(F)
-#define HDtcsendbreak(F,N) tcsendbreak(F,N)
-#define HDtcsetattr(F,O,T) tcsetattr(F,O,T)
-#define HDtcsetpgrp(F,N) tcsetpgrp(F,N)
-#define HDtime(T) time(T)
-#define HDtimes(T) times(T)
-#define HDtmpfile() tmpfile()
-#define HDtmpnam(S) tmpnam(S)
-#define HDtolower(C) tolower(C)
-#define HDtoupper(C) toupper(C)
-#define HDttyname(F) ttyname(F)
-#define HDtzset() tzset()
-#define HDumask(N) umask(N)
-#define HDuname(S) uname(S)
-#define HDungetc(C,F) ungetc(C,F)
+#define HDstrcat(X, Y) strcat(X, Y)
+#define HDstrchr(S, C) strchr(S, C)
+#define HDstrcmp(X, Y) strcmp(X, Y)
+#define HDstrcoll(X, Y) strcoll(X, Y)
+#define HDstrcpy(X, Y) strcpy(X, Y)
+#define HDstrcspn(X, Y) strcspn(X, Y)
+#define HDstrerror(N) strerror(N)
+#define HDstrftime(S, Z, F, T) strftime(S, Z, F, T)
+#define HDstrlen(S) strlen(S)
+#define HDstrncat(X, Y, Z) strncat(X, Y, Z)
+#define HDstrncmp(X, Y, Z) strncmp(X, Y, Z)
+#define HDstrncpy(X, Y, Z) strncpy(X, Y, Z)
+#define HDstrpbrk(X, Y) strpbrk(X, Y)
+#define HDstrrchr(S, C) strrchr(S, C)
+#define HDstrspn(X, Y) strspn(X, Y)
+#define HDstrstr(X, Y) strstr(X, Y)
+#define HDstrtod(S, R) strtod(S, R)
+#define HDstrtok(X, Y) strtok(X, Y)
+#define HDstrtol(S, R, N) strtol(S, R, N)
+H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base);
+#define HDstrtoul(S, R, N) strtoul(S, R, N)
#ifdef H5_HAVE_WIN32_API
-#define HDunlink(S) _unlink(S)
+#define HDstrtoull(S, R, N) _strtoui64(S, R, N)
#else
-#define HDunlink(S) unlink(S)
+#define HDstrtoull(S, R, N) strtoull(S, R, N)
#endif
-#define HDutime(S,T) utime(S,T)
-#define HDva_arg(A,T) va_arg(A,T)
-#define HDva_end(A) va_end(A)
-#define HDva_start(A,P) va_start(A,P)
-#define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A)
-#define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A)
-#define HDvprintf(FMT,A) vprintf(FMT,A)
-#define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A)
+#define HDstrxfrm(X, Y, Z) strxfrm(X, Y, Z)
+#define HDsysconf(N) sysconf(N)
+#define HDsystem(S) system(S)
+#define HDtan(X) tan(X)
+#define HDtanh(X) tanh(X)
+#define HDtcdrain(F) tcdrain(F)
+#define HDtcflow(F, A) tcflow(F, A)
+#define HDtcflush(F, N) tcflush(F, N)
+#define HDtcgetattr(F, T) tcgetattr(F, T)
+#define HDtcgetpgrp(F) tcgetpgrp(F)
+#define HDtcsendbreak(F, N) tcsendbreak(F, N)
+#define HDtcsetattr(F, O, T) tcsetattr(F, O, T)
+#define HDtcsetpgrp(F, N) tcsetpgrp(F, N)
+#define HDtime(T) time(T)
+#define HDtimes(T) times(T)
+#define HDtmpfile() tmpfile()
+#define HDtmpnam(S) tmpnam(S)
+#define HDtolower(C) tolower(C)
+#define HDtoupper(C) toupper(C)
+#define HDttyname(F) ttyname(F)
+#define HDtzset() tzset()
+#define HDumask(N) umask(N)
+#define HDuname(S) uname(S)
+#define HDungetc(C, F) ungetc(C, F)
#ifdef H5_HAVE_WIN32_API
-H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap);
-#define HDvsnprintf c99_vsnprintf
+#define HDunlink(S) _unlink(S)
#else
-# define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A)
+#define HDunlink(S) unlink(S)
#endif
-#define HDwait(W) wait(W)
-#define HDwaitpid(P,W,O) waitpid(P,W,O)
-#define HDwcstombs(S,P,Z) wcstombs(S,P,Z)
-#define HDwctomb(S,C) wctomb(S,C)
-#define HDwrite(F,M,Z) write(F,M,Z)
+#define HDutime(S, T) utime(S, T)
+#define HDva_arg(A, T) va_arg(A, T)
+#define HDva_end(A) va_end(A)
+#define HDva_start(A, P) va_start(A, P)
+#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A)
+#define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A)
+#define HDvprintf(FMT, A) vprintf(FMT, A)
+#define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A)
+#define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A)
+#define HDwait(W) wait(W)
+#define HDwaitpid(P, W, O) waitpid(P, W, O)
+#define HDwcstombs(S, P, Z) wcstombs(S, P, Z)
+#define HDwctomb(S, C) wctomb(S, C)
+#define HDwrite(F, M, Z) write(F, M, Z)
/*
* And now for a couple non-Posix functions... Watch out for systems that
* define these in terms of macros.
*/
#ifdef H5_HAVE_WIN32_API
-#define HDstrdup(S) _strdup(S)
+#define HDstrdup(S) _strdup(S)
#else /* H5_HAVE_WIN32_API */
#if !defined strdup && !defined H5_HAVE_STRDUP
-extern char *strdup(const char *s);
+extern char * strdup(const char *s);
#endif
-#define HDstrdup(S) strdup(S)
+#define HDstrdup(S) strdup(S)
#endif /* H5_HAVE_WIN32_API */
@@ -470,52 +457,37 @@ extern char *strdup(const char *s);
* HDF Boolean type.
*/
#ifndef FALSE
-# define FALSE false
+#define FALSE false
#endif
#ifndef TRUE
-# define TRUE true
+#define TRUE true
#endif
-/** From h5test.h **/
-
-#ifdef H5_HAVE_PARALLEL
-extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
-#endif
-
-#ifdef H5_HAVE_PARALLEL
-int h5_set_info_object(void);
-void h5_dump_info_object(MPI_Info info);
-#endif
-
-
-
/** From h5tools_utils.h **/
-extern int opt_err; /* getoption prints errors if this is on */
-extern int opt_ind; /* token pointer */
-extern const char *opt_arg; /* flag argument (or value) */
-
+H5_DLLVAR int H5_opterr; /* getoption prints errors if this is on */
+H5_DLLVAR int H5_optind; /* token pointer */
+H5_DLLVAR const char *H5_optarg; /* flag argument (or value) */
-enum {
- no_arg = 0, /* doesn't take an argument */
- require_arg, /* requires an argument */
- optional_arg /* argument is optional */
+enum h5_arg_level {
+ no_arg = 0, /* doesn't take an argument */
+ require_arg, /* requires an argument */
+ optional_arg /* argument is optional */
};
+struct h5_long_options {
+ const char * name; /* Name of the long option */
+ enum h5_arg_level has_arg; /* Whether we should look for an arg */
+ char shortval; /* The shortname equivalent of long arg
+ * this gets returned from get_option
+ */
+};
-typedef struct long_options {
- const char *name; /* name of the long option */
- int has_arg; /* whether we should look for an arg */
- char shortval; /* the shortname equivalent of long arg
- * this gets returned from get_option */
-} long_options;
-
-extern int get_option(int argc, const char **argv, const char *opt,
- const struct long_options *l_opt);
+extern int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt);
-extern int nCols; /*max number of columns for outputting */
+extern int nCols; /*max number of columns for outputting */
/* Definitions of useful routines */
-extern void print_version(const char *progname);
+extern void print_version(const char *progname);
#endif
diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c
deleted file mode 100644
index aa3a316..0000000
--- a/tools/test/perform/sio_engine.c
+++ /dev/null
@@ -1,1334 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Author: Christian Chilan, April 2008
- */
-
-#include "hdf5.h"
-
-#ifdef H5_STDC_HEADERS
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#endif
-
-#ifdef H5_HAVE_UNISTD_H
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#ifdef H5_HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#include "sio_perf.h"
-
-/* Macro definitions */
-
-/* sizes of various items. these sizes won't change during program execution */
-#define ELMT_H5_TYPE H5T_NATIVE_UCHAR
-
-#define GOTOERROR(errcode) { ret_code = errcode; goto done; }
-#define ERRMSG(mesg) { \
- HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
-}
-
-/* verify: if val is false (0), print mesg. */
-#define VRFY(val, mesg) do { \
- if (!val) { \
- ERRMSG(mesg); \
- GOTOERROR(FAIL); \
- } \
-} while(0)
-
-/* POSIX I/O macros */
-#ifdef H5_HAVE_WIN32_API
-/* Can't link against the library, so this test will use the older, non-Unicode
- * _open() call on Windows.
- */
-#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__)
-#endif /* H5_HAVE_WIN32_API */
-#define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
-#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
-#define POSIXCLOSE(F) HDclose(F)
-#define POSIXSEEK(F,L) HDlseek(F, L, SEEK_SET)
-#define POSIXWRITE(F,B,S) HDwrite(F,B,S)
-#define POSIXREAD(F,B,S) HDread(F,B,S)
-
-enum {
- SIO_CREATE = 1,
- SIO_WRITE = 2,
- SIO_READ = 4
-};
-
-/* Global variables */
-static int clean_file_g = -1; /*whether to cleanup temporary test */
-/*files. -1 is not defined; */
-/*0 is no cleanup; 1 is do cleanup */
-
-/* the different types of file descriptors we can expect */
-typedef union _file_descr {
- int posixfd; /* POSIX file handle*/
- hid_t h5fd; /* HDF5 file */
-} file_descr;
-
-/* local functions */
-static char *sio_create_filename(iotype iot, const char *base_name,
- char *fullname, size_t size, parameters *param);
-static herr_t do_write(results *res, file_descr *fd, parameters *parms, void *buffer);
-static herr_t do_read(results *res, file_descr *fd, parameters *parms, void *buffer);
-static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer);
-static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer);
-static herr_t dset_read(int localrank, file_descr *fd, parameters *parms, void *buffer, const char *buffer2);
-static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer);
-static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/,
- int flags);
-hid_t set_vfd(parameters *param);
-static herr_t do_fclose(iotype iot, file_descr *fd);
-static void do_cleanupfile(iotype iot, char *fname);
-
-/* global variables */
-static HDoff_t offset[MAX_DIMS]; /* dataset size in bytes */
-static size_t buf_offset[MAX_DIMS]; /* dataset size in bytes */
-static int order[MAX_DIMS]; /* dimension access order */
-static size_t linear_buf_size; /* linear buffer size */
-static int cont_dim; /* lowest dimension for contiguous POSIX
- access */
-static size_t cont_size; /* size of contiguous POSIX access */
-static hid_t fapl; /* file access list */
-static unsigned char *buf_p; /* buffer pointer */
-static const char *multi_letters = "msbrglo"; /* string for multi driver */
-
-/* HDF5 global variables */
-static hsize_t h5count[MAX_DIMS]; /*selection count */
-static hssize_t h5offset[MAX_DIMS]; /* Selection offset within dataspace */
-static hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
-static hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
-static hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
-static hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */
-static hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
-
-/*
- * Function: do_sio
- * Purpose: SIO Engine where IO are executed.
- * Return: results
- * Programmer: Christian Chilan, April, 2008
- * Modifications:
- */
-void
-do_sio(parameters param, results *res)
-{
- char *buffer = NULL; /*data buffer pointer */
- size_t buf_size[MAX_DIMS]; /* general buffer size in bytes */
- file_descr fd; /* file handles */
- iotype iot; /* API type */
- char base_name[256]; /* test file base name */
- /* return codes */
- herr_t ret_code = 0; /*return code */
-
- char fname[FILENAME_MAX]; /* test file name */
- int i;
- /* HDF5 variables */
- herr_t hrc; /*HDF5 return code */
-
- /* Sanity check parameters */
-
- /* IO type */
- iot = param.io_type;
-
- switch (iot) {
- case POSIXIO:
- fd.posixfd = -1;
- res->timers = io_time_new(SYS_CLOCK);
- break;
- case HDF5:
- fd.h5fd = -1;
- res->timers = io_time_new(SYS_CLOCK);
- break;
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
- GOTOERROR(FAIL);
- }
-
- linear_buf_size = 1;
-
- for (i=0; i<param.rank; i++){
- buf_size[i] = param.buf_size[i];
- order[i] = param.order[i];
- linear_buf_size *= buf_size[i];
- buf_offset[i] = 0;
- offset[i] = 0;
-
- /* Validate transfer buffer size */
- if (param.buf_size[i]<=0) {
- HDfprintf(stderr,
- "Transfer buffer size[%d] (%zu) must be > 0\n", i,buf_size[i]);
- GOTOERROR(FAIL);
- }
-
- if ((param.dset_size[i]%param.buf_size[i])!=0) {
- HDfprintf(stderr,
- "Dataset size[%d] (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
- "trasfer buffer size[%d] (%zu)\n",param.rank,
- (long long)param.dset_size[i], param.rank, param.buf_size[i]);
- GOTOERROR(FAIL);
- }
-
- }
-
- /* Allocate transfer buffer */
- if ((buffer = (char *)malloc(linear_buf_size)) == NULL){
- HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", linear_buf_size);
- GOTOERROR(FAIL);
- }
-
- if (sio_debug_level >= 4)
-
- /* output all of the times for all iterations */
- HDfprintf(output, "Timer details:\n");
-
- /*
- * Write performance measurement
- */
- /* Open file for write */
-
- HDstrcpy(base_name, "#sio_tmp");
- sio_create_filename(iot, base_name, fname, sizeof(fname), &param);
-
- if (sio_debug_level > 0)
- HDfprintf(output, "data filename=%s\n",
- fname);
-
- io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
- hrc = do_fopen(&param, fname, &fd, SIO_CREATE | SIO_WRITE);
- VRFY((hrc == SUCCESS), "do_fopen failed");
-
- io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
- hrc = do_write(res, &fd, &param, buffer);
- io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_write failed");
-
- /* Close file for write */
- hrc = do_fclose(iot, &fd);
- io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_fclose failed");
-
- if (!param.h5_write_only) {
- /*
- * Read performance measurement
- */
-
- /* Open file for read */
- io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
- hrc = do_fopen(&param, fname, &fd, SIO_READ);
- VRFY((hrc == SUCCESS), "do_fopen failed");
-
- io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
- hrc = do_read(res, &fd, &param, buffer);
- io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_read failed");
-
- /* Close file for read */
- hrc = do_fclose(iot, &fd);
-
- io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_fclose failed");
- }
-
- do_cleanupfile(iot, fname);
-
-done:
- /* clean up */
- /* release HDF5 objects */
-
- /* close any opened files */
- /* no remove(fname) because that should have happened normally. */
- switch (iot) {
- case POSIXIO:
- if (fd.posixfd != -1)
- hrc = do_fclose(iot, &fd);
- break;
- case HDF5:
- if (fd.h5fd != -1)
- hrc = do_fclose(iot, &fd);
- break;
- default:
- /* unknown request */
- HDassert(0 && "Unknown IO type");
- break;
- }
-
- /* release generic resources */
- if (buffer)
- free(buffer);
-
- res->ret_code = ret_code;
-}
-
-/*
- * Function: sio_create_filename
- * Purpose: Create a new filename to write to. Determine the correct
- * suffix to append to the filename by the type of I/O we're
- * doing. Also, place in the /tmp/{$USER,$LOGIN} directory if
- * USER or LOGIN are specified in the environment.
- * Return: Pointer to filename or NULL
- * Programmer: Bill Wendling, 21. November 2001
- * Modifications: Support for file drivers. Christian Chilan, April, 2008
- */
- static char *
-sio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size, parameters *param)
-{
- const char *prefix, *suffix="";
- char *ptr, last = '\0';
- size_t i, j;
- vfdtype vfd;
- vfd = param->vfd;
-
- if (!base_name || !fullname || size < 1)
- return NULL;
-
- memset(fullname, 0, size);
-
- switch (iot) {
- case POSIXIO:
- suffix = ".posix";
- break;
- case HDF5:
- suffix = ".h5";
- if (vfd == family)
- suffix = "%05d.h5";
- else if (vfd == multi)
- suffix = NULL;
- break;
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
- HDassert(0 && "Unknown IO type");
- break;
- }
-
- /* First use the environment variable and then try the constant */
- prefix = HDgetenv("HDF5_PREFIX");
-
-#ifdef HDF5_PREFIX
- if (!prefix)
- prefix = HDF5_PREFIX;
-#endif /* HDF5_PREFIX */
-
- /* Prepend the prefix value to the base name */
- if (prefix && *prefix) {
- /* If the prefix specifies the HDF5_PREFIX directory, then
- * default to using the "/tmp/$USER" or "/tmp/$LOGIN"
- * directory instead. */
- register char *user, *login, *subdir;
-
- user = HDgetenv("USER");
- login = HDgetenv("LOGIN");
- subdir = (user ? user : login);
-
- if (subdir) {
- for (i = 0; i < size-1 && prefix[i]; i++)
- fullname[i] = prefix[i];
-
- fullname[i++] = '/';
-
- for (j = 0; i < size && subdir[j]; i++, j++)
- fullname[i] = subdir[j];
- } else {
- /* We didn't append the prefix yet */
- HDstrncpy(fullname, prefix, size);
- fullname[size - 1] = '\0';
- }
-
- if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) {
- /* Append the base_name with a slash first. Multiple slashes are
- * handled below. */
- h5_stat_t buf;
-
- if (HDstat(fullname, &buf) < 0)
- /* The directory doesn't exist just yet */
- if (HDmkdir(fullname, 0755) < 0 && errno != EEXIST) {
- /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory.
- * Default to PREFIX's original prefix value. */
- HDstrcpy(fullname, prefix);
- }
-
- HDstrcat(fullname, "/");
- HDstrcat(fullname, base_name);
- } else {
- /* Buffer is too small */
- return NULL;
- }
- } else if (strlen(base_name) >= size) {
- /* Buffer is too small */
- return NULL;
- } else {
- HDstrcpy(fullname, base_name);
- }
-
- /* Append a suffix */
- if (suffix) {
- if (HDstrlen(fullname) + HDstrlen(suffix) >= size)
- return NULL;
-
- HDstrcat(fullname, suffix);
- }
-
- /* Remove any double slashes in the filename */
- for (ptr = fullname, i = j = 0; ptr && (i < size); i++, ptr++) {
- if (*ptr != '/' || last != '/')
- fullname[j++] = *ptr;
-
- last = *ptr;
- }
-
- return fullname;
-}
-
-/*
- * Function: do_write
- * Purpose: Write the required amount of data to the file.
- * Return: SUCCESS or FAIL
- * Programmer: Christian Chilan, April, 2008
- * Modifications:
- */
-static herr_t
-do_write(results *res, file_descr *fd, parameters *parms, void *buffer)
-{
- int ret_code = SUCCESS;
- char dname[64];
- int i;
- size_t u;
- /* HDF5 variables */
- herr_t hrc; /*HDF5 return code */
- hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */
- hsize_t h5chunk[MAX_DIMS]; /*dataset dim sizes */
- hsize_t h5block[MAX_DIMS]; /*dataspace selection */
- hsize_t h5stride[MAX_DIMS]; /*selection stride */
- hsize_t h5start[MAX_DIMS]; /*selection start */
- hsize_t h5maxdims[MAX_DIMS];
- int rank; /*rank of dataset */
-
- /* Prepare buffer for verifying data */
-/* if (parms->verify)
- memset(buffer,1,linear_buf_size); */
-
- buf_p=(unsigned char *)buffer;
-
- for(u = 0; u < linear_buf_size; u++)
- buf_p[u] = u % 128;
-
- rank = parms->rank;
-
- for(i = 0; i < rank; i++)
- h5offset[i] = offset[i] = 0;
-
- /* I/O Access specific setup */
- switch (parms->io_type) {
- case POSIXIO:
-
- /* determine lowest dimension for contiguous POSIX access */
- cont_dim = rank;
-
- for (i=rank-1; i>=0; i--) {
- if (parms->buf_size[i]==parms->dset_size[i])
- cont_dim = i;
- else
- break;
- }
-
- /* determine size of the contiguous POSIX access */
- cont_size = (!cont_dim)? 1 : parms->buf_size[cont_dim-1];
- for (i=cont_dim; i<rank; i++)
- cont_size *= parms->buf_size[i];
-
- break;
-
- case HDF5: /* HDF5 setup */
-
- for (i=0; i < rank; i++){
- h5dims[i] = parms->dset_size[i];
- h5start[i] = 0;
- h5stride[i] = 1;
- h5block[i] = 1;
- h5count[i] = parms->buf_size[i];
- h5chunk[i] = parms->chk_size[i];
- h5maxdims[i] = H5S_UNLIMITED;
-
- }
-
- if (parms->h5_use_chunks && parms->h5_extendable) {
- h5dset_space_id = H5Screate_simple(rank, h5count, h5maxdims);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
- }
- else {
- h5dset_space_id = H5Screate_simple(rank, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
- }
-
- hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
- h5start, h5stride, h5count, h5block);
- VRFY((hrc >= 0), "H5Sselect_hyperslab");
-
- /* Create the memory dataspace that corresponds to the xfer buffer */
- h5mem_space_id = H5Screate_simple(rank, h5count, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
-
- /* Create the dataset transfer property list */
- h5dxpl = H5Pcreate(H5P_DATASET_XFER);
- if (h5dxpl < 0) {
- HDfprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
-
- break;
-
- default:
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
- GOTOERROR(FAIL);
- break;
- } /* end switch */
-
-
- /* create dataset */
- switch (parms->io_type) {
- case POSIXIO:
- break;
-
- case HDF5:
- h5dcpl = H5Pcreate(H5P_DATASET_CREATE);
-
- if (h5dcpl < 0) {
- HDfprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
-
- if(parms->h5_use_chunks) {
- /* Set the chunk size to be the same as the buffer size */
- hrc = H5Pset_chunk(h5dcpl, rank, h5chunk);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
- } /* end if */
-
- HDsprintf(dname, "Dataset_%ld", (unsigned long)parms->num_bytes);
- h5ds_id = H5Dcreate2(fd->h5fd, dname, ELMT_H5_TYPE,
- h5dset_space_id, H5P_DEFAULT, h5dcpl, H5P_DEFAULT);
-
- if (h5ds_id < 0) {
- HDfprintf(stderr, "HDF5 Dataset Create failed\n");
- GOTOERROR(FAIL);
- }
-
- hrc = H5Pclose(h5dcpl);
- /* verifying the close of the dcpl */
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Property List Close failed\n");
- GOTOERROR(FAIL);
- }
- break;
-
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
- GOTOERROR(FAIL);
- break;
- }
-
- /* Start "raw data" write timer */
- io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
-
- /* Perform write */
- hrc = dset_write(rank-1, fd, parms, buffer);
-
- if (hrc < 0) {
- HDfprintf(stderr, "Error in dataset write\n");
- GOTOERROR(FAIL);
- }
-
-
- /* Stop "raw data" write timer */
- io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
-
- /* Calculate write time */
-
- /* Close dataset. Only HDF5 needs to do an explicit close. */
- if (parms->io_type == HDF5) {
- hrc = H5Dclose(h5ds_id);
-
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Dataset Close failed\n");
- GOTOERROR(FAIL);
- }
-
- h5ds_id = H5I_INVALID_HID;
- } /* end if */
-
-done:
-
- /* release HDF5 objects */
- if (h5dset_space_id != -1) {
- hrc = H5Sclose(h5dset_space_id);
- if (hrc < 0){
- HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5dset_space_id = H5I_INVALID_HID;
- }
- }
-
- if (h5mem_space_id != -1) {
- hrc = H5Sclose(h5mem_space_id);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5mem_space_id = H5I_INVALID_HID;
- }
- }
-
- if (h5dxpl != -1) {
- hrc = H5Pclose(h5dxpl);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
- ret_code = FAIL;
- } else {
- h5dxpl = H5I_INVALID_HID;
- }
- }
-
- return ret_code;
-}
-
-/*
- * Function: dset_write
- * Purpose: Write buffer into the dataset.
- * Return: SUCCESS or FAIL
- * Programmer: Christian Chilan, April, 2008
- * Modifications:
- */
-static herr_t
-dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
-{
- int cur_dim = order[local_dim]-1;
- int ret_code = SUCCESS;
- int k;
- hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS];
- hsize_t i;
- int j;
- herr_t hrc;
-
- /* iterates according to the dimensions in order array */
- for (i=0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]){
-
- h5offset[cur_dim] = (hssize_t)i;
- offset[cur_dim] = (HDoff_t)i;
-
- if (local_dim > 0){
-
- dset_write(local_dim-1, fd, parms, buffer);
-
- }else{
-
- switch (parms->io_type) {
-
- case POSIXIO:
- /* initialize POSIX offset in the buffer */
- for(j = 0; j < parms->rank; j++)
- buf_offset[j] = 0;
- buf_p = (unsigned char *)buffer;
- /* write POSIX buffer */
- posix_buffer_write(0, fd, parms, buffer);
- break;
-
- case HDF5:
- /* if dimensions are extendable, extend them as needed during access */
- if (parms->h5_use_chunks && parms->h5_extendable) {
-
- hrc=H5Sget_simple_extent_dims(h5dset_space_id,dims,maxdims);
- VRFY((hrc >= 0), "H5Sget_simple_extent_dims");
-
- for (k=0; k < parms->rank; k++){
-
- HDassert(h5offset[k] >= 0);
- if (dims[k] <= (hsize_t)h5offset[k]) {
- dims[k] = dims[k]+h5count[k];
- hrc=H5Sset_extent_simple(h5dset_space_id,parms->rank,dims,maxdims);
- VRFY((hrc >= 0), "H5Sset_extent_simple");
- hrc=H5Dset_extent(h5ds_id,dims);
- VRFY((hrc >= 0), "H5Dextend");
- }
- }
- }
- /* applies offset */
- hrc = H5Soffset_simple(h5dset_space_id, h5offset);
- VRFY((hrc >= 0), "H5Soffset_simple");
-
- /* Write the buffer out */
- hrc=H5Sget_simple_extent_dims(h5dset_space_id,dims,maxdims);
- hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
- h5dset_space_id, h5dxpl, buffer);
- VRFY((hrc >= 0), "H5Dwrite");
-
- break;
-
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
- HDassert(0 && "Unknown IO type");
- break;
- } /* switch (parms->io_type) */
- }
- }
-done:
- return ret_code;
-}
-
-/*
- * Function: posix_buffer_write
- * Purpose: Write buffer into the POSIX file considering contiguity.
- * Return: SUCCESS or FAIL
- * Programmer: Christian Chilan, April, 2008
- * Modifications:
- */
-
-static herr_t
-posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
-{
- int ret_code = SUCCESS;
-
- /* if dimension is not contiguous, call recursively */
- if (local_dim < parms->rank-1 && local_dim != cont_dim) {
- size_t u;
-
- for(u = 0; u < parms->buf_size[local_dim]; u ++) {
- buf_offset[local_dim] = u;
- posix_buffer_write(local_dim+1, fd, parms, buffer);
-
- /* if next dimension is cont_dim, it will fill out the buffer
- traversing the entire dimension local_dim without the need
- of performing iteration */
- if (local_dim+1==cont_dim)
- break;
- }
- /* otherwise, perform contiguous POSIX access */
- } else {
- HDoff_t d_offset;
- HDoff_t linear_dset_offset = 0;
- int i, j, rc;
-
- buf_offset[local_dim] = 0;
-
- /* determine offset in the buffer */
- for(i = 0; i < parms->rank; i++) {
- d_offset = 1;
-
- for(j = i + 1; j < parms->rank; j++)
- d_offset *= (HDoff_t)parms->dset_size[j];
-
- linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset;
- }
-
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, linear_dset_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
- /* check if all bytes are written */
- rc = ((ssize_t)cont_size ==
- POSIXWRITE(fd->posixfd, buf_p, cont_size));
- VRFY((rc != 0), "POSIXWRITE");
-
- /* Advance location in buffer */
- buf_p += cont_size;
-
- }
-
-done:
- return ret_code;
-}
-
-/*
- * Function: do_read
- * Purpose: Read the required amount of data to the file.
- * Return: SUCCESS or FAIL
- * Programmer: Christian Chilan, April, 2008
- * Modifications:
- */
-static herr_t
-do_read(results *res, file_descr *fd, parameters *parms, void *buffer)
-{
- char *buffer2 = NULL; /* Buffer for data verification */
- int ret_code = SUCCESS;
- char dname[64];
- int i;
- size_t u;
- /* HDF5 variables */
- herr_t hrc; /*HDF5 return code */
- hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */
- hsize_t h5block[MAX_DIMS]; /*dataspace selection */
- hsize_t h5stride[MAX_DIMS]; /*selection stride */
- hsize_t h5start[MAX_DIMS]; /*selection start */
- int rank;
-
- /* Allocate data verification buffer */
- if(NULL == (buffer2 = (char *)malloc(linear_buf_size))) {
- HDfprintf(stderr, "malloc for data verification buffer size (%Zu) failed\n", linear_buf_size);
- GOTOERROR(FAIL);
- } /* end if */
-
- /* Prepare buffer for verifying data */
- for(u = 0; u < linear_buf_size; u++)
- buffer2[u] = (char)(u % 128);
-
- rank = parms->rank;
- for(i = 0; i < rank; i++)
- h5offset[i] = offset[i] = 0;
-
- /* I/O Access specific setup */
- switch (parms->io_type) {
- case POSIXIO:
- cont_dim = rank;
-
- for (i=rank-1; i>=0; i--) {
- if (parms->buf_size[i]==parms->dset_size[i])
- cont_dim = i;
- else
- break;
- }
- cont_size = (!cont_dim)? 1 : parms->buf_size[cont_dim-1];
- for (i=cont_dim; i<rank; i++)
- cont_size *= parms->buf_size[i];
-
- break;
-
- case HDF5: /* HDF5 setup */
- for (i=0; i < rank; i++){
- h5dims[i] = parms->dset_size[i];
- h5start[i] = 0;
- h5stride[i] = 1;
- h5block[i] = 1;
- h5count[i] = parms->buf_size[i];
- }
-
- h5dset_space_id = H5Screate_simple(rank, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
-
- hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
- h5start, h5stride, h5count, h5block);
- VRFY((hrc >= 0), "H5Sselect_hyperslab");
-
- /* Create the memory dataspace that corresponds to the xfer buffer */
- h5mem_space_id = H5Screate_simple(rank, h5count, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
-
- /* Create the dataset transfer property list */
- h5dxpl = H5Pcreate(H5P_DATASET_XFER);
- if (h5dxpl < 0) {
- HDfprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
- break;
-
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
- GOTOERROR(FAIL);
- break;
- } /* end switch */
-
-
- /* create dataset */
- switch (parms->io_type) {
- case POSIXIO:
- break;
-
- case HDF5:
- HDsprintf(dname, "Dataset_%ld", (long)parms->num_bytes);
- h5ds_id = H5Dopen2(fd->h5fd, dname, H5P_DEFAULT);
- if (h5ds_id < 0) {
- HDfprintf(stderr, "HDF5 Dataset open failed\n");
- GOTOERROR(FAIL);
- }
- break;
-
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
- GOTOERROR(FAIL);
- break;
- } /* end switch */
-
- /* Start "raw data" read timer */
- io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
- hrc = dset_read(rank-1, fd, parms, buffer, buffer2);
-
- if (hrc < 0) {
- HDfprintf(stderr, "Error in dataset read\n");
- GOTOERROR(FAIL);
- }
-
- /* Stop "raw data" read timer */
- io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
-
- /* Calculate read time */
-
- /* Close dataset. Only HDF5 needs to do an explicit close. */
- if (parms->io_type == HDF5) {
- hrc = H5Dclose(h5ds_id);
-
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Dataset Close failed\n");
- GOTOERROR(FAIL);
- }
-
- h5ds_id = H5I_INVALID_HID;
- } /* end if */
-
-done:
-
- /* release HDF5 objects */
- if (h5dset_space_id != -1) {
- hrc = H5Sclose(h5dset_space_id);
- if (hrc < 0){
- HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5dset_space_id = H5I_INVALID_HID;
- }
- }
-
- if (h5mem_space_id != -1) {
- hrc = H5Sclose(h5mem_space_id);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5mem_space_id = H5I_INVALID_HID;
- }
- }
-
- if (h5dxpl != -1) {
- hrc = H5Pclose(h5dxpl);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
- ret_code = FAIL;
- } else {
- h5dxpl = H5I_INVALID_HID;
- }
- }
-
- /* release generic resources */
- if(buffer2)
- free(buffer2);
-
- return ret_code;
-}
-
-/*
- * Function: dset_read
- * Purpose: Read buffer into the dataset.
- * Return: SUCCESS or FAIL
- * Programmer: Christian Chilan, April, 2008
- * Modifications:
- */
-
-static herr_t
-dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer,
- const char *buffer2)
-{
- int cur_dim = order[local_dim]-1;
- hsize_t i;
- int j;
- herr_t hrc;
- int ret_code = SUCCESS;
-
- /* iterate on the current dimension */
- for (i=0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]){
-
- h5offset[cur_dim] = (hssize_t)i;
- offset[cur_dim] = (HDoff_t)i;
-
- /* if traverse in order array is incomplete, recurse */
- if (local_dim > 0){
-
- ret_code = dset_read(local_dim-1, fd, parms, buffer, buffer2);
-
- /* otherwise, write buffer into dataset */
- }else{
-
- switch (parms->io_type) {
-
- case POSIXIO:
- for (j=0; j<parms->rank; j++) {
- buf_offset[j] = 0;
- }
- buf_p = (unsigned char*)buffer;
- posix_buffer_read(0, fd, parms, buffer);
- break;
-
- case HDF5:
- hrc = H5Soffset_simple(h5dset_space_id, h5offset);
- VRFY((hrc >= 0), "H5Soffset_simple");
- /* Read the buffer out */
- hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
- h5dset_space_id, h5dxpl, buffer);
- VRFY((hrc >= 0), "H5Dread");
- break;
-
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
- HDassert(0 && "Unknown IO type");
- break;
- } /* switch (parms->io_type) */
- }
- }
-done:
- return ret_code;
-}
-
-/*
- * Function: posix_buffer_read
- * Purpose: Read buffer into the POSIX file considering contiguity.
- * Return: SUCCESS or FAIL
- * Programmer: Christian Chilan, April, 2008
- * Modifications:
- */
-
-static herr_t
-posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer)
-{
- int ret_code = SUCCESS;
-
- /* if local dimension is not contiguous, recurse */
- if (local_dim < parms->rank-1 && local_dim != cont_dim) {
- size_t u;
-
- for(u = 0; u < parms->buf_size[local_dim]; u++) {
- buf_offset[local_dim] = u;
- ret_code = posix_buffer_read(local_dim+1, fd, parms, buffer);
- if (local_dim+1==cont_dim)
- break;
- }
- /* otherwise, perform contiguous POSIX access */
- } else {
- HDoff_t d_offset;
- HDoff_t linear_dset_offset = 0;
- int i, j, rc;
-
- buf_offset[local_dim] = 0;
- /* determine offset in buffer */
- for (i=0; i<parms->rank; i++){
- d_offset=1;
-
- for (j=i+1; j<parms->rank; j++)
- d_offset *= (HDoff_t)parms->dset_size[j];
-
- linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset;
- }
-
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, linear_dset_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
- /* check if all bytes are read */
- rc = ((ssize_t)cont_size ==
- POSIXREAD(fd->posixfd, buf_p, cont_size));
- VRFY((rc != 0), "POSIXREAD");
-
- /* Advance location in buffer */
- buf_p += cont_size;
-
- }
-done:
- return ret_code;
-}
-
-
-/*
- * Function: do_fopen
- * Purpose: Open the specified file.
- * Return: SUCCESS or FAIL
- * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
- * Modifications: Support for file drivers, Christian Chilan, April, 2008
- */
- static herr_t
-do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
-{
- int ret_code = SUCCESS;
- hid_t fcpl;
-
- switch (param->io_type) {
- case POSIXIO:
- if (flags & (SIO_CREATE | SIO_WRITE))
- fd->posixfd = POSIXCREATE(fname);
- else
- fd->posixfd = POSIXOPEN(fname, O_RDONLY);
-
- if (fd->posixfd < 0 ) {
- HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname);
- GOTOERROR(FAIL);
- }
-
- break;
-
- case HDF5:
-
- fapl = set_vfd(param);
-
- if (fapl < 0) {
- HDfprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
-
- fcpl = H5Pcreate(H5P_FILE_CREATE);
- if(param->page_size) {
- H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1);
- H5Pset_file_space_page_size(fcpl, param->page_size);
- if(param->page_buffer_size)
- H5Pset_page_buffer_size(fapl, param->page_buffer_size, 0, 0);
- }
-
- /* create the parallel file */
- if (flags & (SIO_CREATE | SIO_WRITE)) {
- fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl);
- } else {
- fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, fapl);
- }
-
-
- if (fd->h5fd < 0) {
- HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname);
- GOTOERROR(FAIL);
- }
- break;
-
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)param->io_type);
- GOTOERROR(FAIL);
- break;
- }
-
-done:
- return ret_code;
-}
-
-/*
- * Function: set_vfd
- * Purpose: Sets file driver.
- * Return: SUCCESS or FAIL
- * Programmer: Christian Chilan, April, 2008
- * Modifications:
- */
-
-hid_t
-set_vfd(parameters *param)
-{
- hid_t my_fapl = H5I_INVALID_HID;
- vfdtype vfd;
-
- vfd = param->vfd;
-
- if ((my_fapl=H5Pcreate(H5P_FILE_ACCESS))<0) return -1;
-
- if (vfd == sec2) {
- /* Unix read() and write() system calls */
- if (H5Pset_fapl_sec2(my_fapl)<0) return -1;
- } else if (vfd == stdio) {
- /* Standard C fread() and fwrite() system calls */
- if (H5Pset_fapl_stdio(my_fapl)<0) return -1;
- } else if (vfd == core) {
- /* In-core temporary file with 1MB increment */
- if (H5Pset_fapl_core(my_fapl, (size_t)1024*1024, TRUE)<0) return -1;
- } else if (vfd == split) {
- /* Split meta data and raw data each using default driver */
- if (H5Pset_fapl_split(my_fapl,
- "-m.h5", H5P_DEFAULT,
- "-r.h5", H5P_DEFAULT)<0)
- return -1;
- } else if (vfd == multi) {
- /* Multi-file driver, general case of the split driver */
- H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl[H5FD_MEM_NTYPES];
- const char *memb_name[H5FD_MEM_NTYPES];
- char sv[H5FD_MEM_NTYPES][1024];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
- H5FD_mem_t mt;
-
- HDmemset(memb_map, 0, sizeof memb_map);
- HDmemset(memb_fapl, 0, sizeof memb_fapl);
- HDmemset(memb_name, 0, sizeof memb_name);
- HDmemset(memb_addr, 0, sizeof memb_addr);
-
- HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt++) {
- memb_fapl[mt] = H5P_DEFAULT;
- HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
- memb_name[mt] = sv[mt];
- memb_addr[mt] = (haddr_t)MAX(mt - 1,0) * (HADDR_MAX / 10);
- }
-
- if (H5Pset_fapl_multi(my_fapl, memb_map, memb_fapl, memb_name,
- memb_addr, FALSE)<0) {
- return -1;
- }
- } else if (vfd == family) {
- hsize_t fam_size = 1*1024*1024; /*100 MB*/
-
- /* Family of files, each 1MB and using the default driver */
- /* if ((val=HDstrtok(NULL, " \t\n\r")))
- fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); */
- if (H5Pset_fapl_family(my_fapl, fam_size, H5P_DEFAULT)<0)
- return -1;
- } else if (vfd == direct) {
-#ifdef H5_HAVE_DIRECT
- /* Linux direct read() and write() system calls. Set memory boundary, file block size,
- * and copy buffer size to the default values. */
- if (H5Pset_fapl_direct(my_fapl, 1024, 4096, 8*4096)<0) return -1;
-#endif
- } else {
- /* Unknown driver */
- return -1;
- }
-
- return my_fapl;
-}
-
-/*
- * Function: do_fclose
- * Purpose: Close the specified file descriptor.
- * Return: SUCCESS or FAIL
- * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
- * Modifications:
- */
- static herr_t
-do_fclose(iotype iot, file_descr *fd /*out*/)
-{
- herr_t ret_code = SUCCESS, hrc;
- int rc = 0;
-
- switch (iot) {
- case POSIXIO:
- rc = POSIXCLOSE(fd->posixfd);
-
- if (rc != 0){
- HDfprintf(stderr, "POSIX File Close failed\n");
- GOTOERROR(FAIL);
- }
-
- fd->posixfd = -1;
- break;
-
- case HDF5:
- hrc = H5Fclose(fd->h5fd);
-
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 File Close failed\n");
- GOTOERROR(FAIL);
- }
-
- fd->h5fd = -1;
- break;
-
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
- GOTOERROR(FAIL);
- break;
- }
-
-done:
- return ret_code;
-}
-
-
-/*
- * Function: do_cleanupfile
- * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set.
- * Return: void
- * Programmer: Albert Cheng 2001/12/12
- * Modifications: Support for file drivers. Christian Chilan, April, 2008
- */
-/* Disable warning for "format not a string literal" here -QAK */
-/*
- * This pragma only needs to surround the snprintf() calls with
- * 'temp' in the code below, but early (4.4.7, at least) gcc only
- * allows diagnostic pragmas to be toggled outside of functions.
- */
-H5_GCC_DIAG_OFF(format-nonliteral)
-static void
-do_cleanupfile(iotype iot, char *filename)
-{
- char temp[2048];
- int j;
- hid_t driver;
-
- if (clean_file_g == -1)
- clean_file_g = (HDgetenv("HDF5_NOCLEANUP")==NULL) ? 1 : 0;
-
- if (clean_file_g){
-
- switch (iot) {
- case POSIXIO:
- HDremove(filename);
- break;
-
- case HDF5:
- driver = H5Pget_driver(fapl);
-
- if (driver == H5FD_FAMILY) {
- for (j = 0; /*void*/; j++) {
- HDsnprintf(temp, sizeof temp, filename, j);
-
- if (HDaccess(temp, F_OK) < 0)
- break;
-
- HDremove(temp);
- }
- } else if (driver == H5FD_CORE) {
- hbool_t backing; /* Whether the core file has backing store */
-
- H5Pget_fapl_core(fapl,NULL,&backing);
-
- /* If the file was stored to disk with bacing store, remove it */
- if(backing)
- HDremove(filename);
-
- } else if (driver == H5FD_MULTI) {
- H5FD_mem_t mt;
- assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
-
- for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
- HDsnprintf(temp, sizeof temp, "%s-%c.h5",
- filename, multi_letters[mt]);
- HDremove(temp); /*don't care if it fails*/
- }
- } else {
- HDremove(filename);
- }
- H5Pclose(fapl);
- break;
-
- default:
- /* unknown request */
- HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
- HDassert(0 && "Unknown IO type");
- break;
- }
- }
-}
-H5_GCC_DIAG_ON(format-nonliteral)
-
diff --git a/tools/test/perform/sio_perf.h b/tools/test/perform/sio_perf.h
deleted file mode 100644
index d26c78b..0000000
--- a/tools/test/perform/sio_perf.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#ifndef SIO_PERF_H__
-#define SIO_PERF_H__
-
-#ifndef STANDALONE
-#include "io_timer.h"
-#include "h5test.h"
-#include "h5tools.h"
-#include "h5tools_utils.h"
-#else
-#include "io_timer.h"
-#include "sio_standalone.h"
-#endif
-
-/* setup the dataset no fill option if this is v1.5 or more */
-#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4
-#define H5_HAVE_NOFILL 1
-#endif
-
-#define MAX_DIMS 32
-
-typedef enum iotype_ {
- POSIXIO,
- HDF5
- /*NUM_TYPES*/
-} iotype;
-
-typedef enum vfdtype_ {
- sec2,
- stdio,
- core,
- split,
- multi,
- family,
- direct
- /*NUM_TYPES*/
-} vfdtype;
-
-typedef struct parameters_ {
- iotype io_type; /* The type of IO test to perform */
- vfdtype vfd;
- long num_files; /* Number of files to create */
- long num_dsets; /* Number of datasets to create */
- hsize_t num_bytes; /* Number of bytes in each dset */
- int num_iters; /* Number of times to loop doing the IO */
- int rank; /* Rank of dataset */
- hsize_t dset_size[MAX_DIMS]; /* Dataset size */
- size_t buf_size[MAX_DIMS]; /* Buffer size */
- size_t chk_size[MAX_DIMS]; /* Chunk size */
- int order[MAX_DIMS]; /* Buffer size */
- hsize_t h5_align; /* HDF5 object alignment */
- hsize_t h5_thresh; /* HDF5 object alignment threshold */
- int h5_use_chunks; /* Make HDF5 dataset chunked */
- int h5_extendable; /* Make HDF5 dataset chunked */
- int h5_write_only; /* Perform the write tests only */
- int verify; /* Verify data correctness */
- size_t page_size;
- size_t page_buffer_size;
-} parameters;
-
-typedef struct results_ {
- herr_t ret_code;
- io_time_t *timers;
-} results;
-
-#ifndef SUCCESS
-#define SUCCESS 0
-#endif /* !SUCCESS */
-
-#ifndef FAIL
-#define FAIL -1
-#endif /* !FAIL */
-
-extern FILE *output; /* output file */
-extern io_time_t *timer_g; /* timer: global for stub functions */
-extern int sio_debug_level; /* The debug level:
- * 0 - Off
- * 1 - Minimal
- * 2 - Some more
- * 3 - Maximal
- * 4 - Even More Debugging (timer stuff)
- */
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-extern void do_sio(parameters param, results *res);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* PIO_PERF_H__ */
diff --git a/tools/test/perform/sio_standalone.c b/tools/test/perform/sio_standalone.c
index ac191e5..7c22b53 100644
--- a/tools/test/perform/sio_standalone.c
+++ b/tools/test/perform/sio_standalone.c
@@ -5,12 +5,11 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
/* This file contains the definition of functions required to build h5perf in
* STANDALONE mode.
* Created: Christian Chilan, 2005/5/18.
@@ -18,38 +17,32 @@
#include "sio_perf.h"
-
/** From h5tools_utils.c **/
/* global variables */
-int nCols = 80;
-
-/* ``get_option'' variables */
-int opt_err = 1; /*get_option prints errors if this is on */
-int opt_ind = 1; /*token pointer */
-const char *opt_arg; /*flag argument (or value) */
-
+int nCols = 80;
int
-get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts)
+get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts)
{
- static int sp = 1; /* character index in current token */
- int opt_opt = '?'; /* option character passed back to user */
+ static int sp = 1; /* character index in current token */
+ int opt_opt = '?'; /* option character passed back to user */
if (sp == 1) {
/* check for more flag-like tokens */
- if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') {
+ if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') {
return EOF;
- } else if (HDstrcmp(argv[opt_ind], "--") == 0) {
- opt_ind++;
+ }
+ else if (HDstrcmp(argv[H5_optind], "--") == 0) {
+ H5_optind++;
return EOF;
}
}
- if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') {
+ if (sp == 1 && argv[H5_optind][0] == '-' && argv[H5_optind][1] == '-') {
/* long command line option */
- const char *arg = &argv[opt_ind][2];
- int i;
+ const char *arg = &argv[H5_optind][2];
+ int i;
for (i = 0; l_opts && l_opts[i].name; i++) {
size_t len = HDstrlen(l_opts[i].name);
@@ -60,28 +53,27 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (l_opts[i].has_arg != no_arg) {
if (arg[len] == '=') {
- opt_arg = &arg[len + 1];
- } else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-') {
- opt_arg = argv[++opt_ind];
- } else if (l_opts[i].has_arg == require_arg) {
- if (opt_err)
- HDfprintf(stderr,
- "%s: option required for \"--%s\" flag\n",
- argv[0], arg);
+ H5_optarg = &arg[len + 1];
+ }
+ else if (H5_optind < (argc - 1) && argv[H5_optind + 1][0] != '-') {
+ H5_optarg = argv[++H5_optind];
+ }
+ else if (l_opts[i].has_arg == require_arg) {
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg);
opt_opt = '?';
}
- } else {
+ }
+ else {
if (arg[len] == '=') {
- if (opt_err)
- HDfprintf(stderr,
- "%s: no option required for \"%s\" flag\n",
- argv[0], arg);
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg);
opt_opt = '?';
}
- opt_arg = NULL;
+ H5_optarg = NULL;
}
break;
@@ -90,29 +82,29 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (l_opts[i].name == NULL) {
/* exhausted all of the l_opts we have and still didn't match */
- if (opt_err)
+ if (H5_opterr)
HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
opt_opt = '?';
}
- opt_ind++;
+ H5_optind++;
sp = 1;
- } else {
- register char *cp; /* pointer into current token */
+ }
+ else {
+ register char *cp; /* pointer into current token */
/* short command line option */
- opt_opt = argv[opt_ind][sp];
+ opt_opt = argv[H5_optind][sp];
if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) {
- if (opt_err)
- HDfprintf(stderr, "%s: unknown option \"%c\"\n",
- argv[0], opt_opt);
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], opt_opt);
/* if no chars left in this token, move to next token */
- if (argv[opt_ind][++sp] == '\0') {
- opt_ind++;
+ if (argv[H5_optind][++sp] == '\0') {
+ H5_optind++;
sp = 1;
}
@@ -121,31 +113,32 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (*++cp == ':') {
/* if a value is expected, get it */
- if (argv[opt_ind][sp + 1] != '\0') {
+ if (argv[H5_optind][sp + 1] != '\0') {
/* flag value is rest of current token */
- opt_arg = &argv[opt_ind++][sp + 1];
- } else if (++opt_ind >= argc) {
- if (opt_err)
- HDfprintf(stderr,
- "%s: value expected for option \"%c\"\n",
- argv[0], opt_opt);
+ H5_optarg = &argv[H5_optind++][sp + 1];
+ }
+ else if (++H5_optind >= argc) {
+ if (H5_opterr)
+ HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], opt_opt);
opt_opt = '?';
- } else {
+ }
+ else {
/* flag value is next token */
- opt_arg = argv[opt_ind++];
+ H5_optarg = argv[H5_optind++];
}
sp = 1;
- } else {
+ }
+ else {
/* set up to look at next char in token, next time */
- if (argv[opt_ind][++sp] == '\0') {
+ if (argv[H5_optind][++sp] == '\0') {
/* no more in current token, so setup next token */
- opt_ind++;
+ H5_optind++;
sp = 1;
}
- opt_arg = NULL;
+ H5_optarg = NULL;
}
}
@@ -153,12 +146,9 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
return opt_opt;
}
-
void
print_version(const char *progname)
{
- printf("%s: Version %u.%u.%u%s%s\n",
- progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
+ printf("%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE);
}
-
diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h
index 99e13bc..bf925f1 100644
--- a/tools/test/perform/sio_standalone.h
+++ b/tools/test/perform/sio_standalone.h
@@ -5,13 +5,13 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef SIO_STANDALONE_H__
-#define SIO_PERF_H__
+#ifndef SIO_STANDALONE_H
+#define SIO_STANDALONE_H
/* Header file for building h5perf by standalone mode.
* Created: Christian Chilan, 2005/5/18.
@@ -19,465 +19,452 @@
/** From H5private.h **/
-#include "H5public.h" /* Include Public Definitions */
-
+#include "H5public.h" /* Include Public Definitions */
/*
* Include ANSI-C header files.
*/
#ifdef H5_STDC_HEADERS
-# include <assert.h>
-# include <ctype.h>
-# include <errno.h>
-# include <fcntl.h>
-# include <float.h>
-# include <limits.h>
-# include <math.h>
-# include <signal.h>
-# include <stdarg.h>
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#endif
/* maximum of two, three, or four values */
#undef MAX
-#define MAX(a,b) (((a)>(b)) ? (a) : (b))
-#define MAX2(a,b) MAX(a,b)
-#define MAX3(a,b,c) MAX(a,MAX(b,c))
-#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#define MAX2(a, b) MAX(a, b)
+#define MAX3(a, b, c) MAX(a, MAX(b, c))
+#define MAX4(a, b, c, d) MAX(MAX(a, b), MAX(c, d))
-#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf((X)-(Y)) < FLT_EPSILON)
-#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs ((X)-(Y)) < DBL_EPSILON)
-#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl((X)-(Y)) < LDBL_EPSILON)
+#define H5_FLT_ABS_EQUAL(X, Y) (HDfabsf((X) - (Y)) < FLT_EPSILON)
+#define H5_DBL_ABS_EQUAL(X, Y) (HDfabs((X) - (Y)) < DBL_EPSILON)
+#define H5_LDBL_ABS_EQUAL(X, Y) (HDfabsl((X) - (Y)) < LDBL_EPSILON)
-#define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf(((Y)-(X)) / (X)) < (M))
-#define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs (((Y)-(X)) / (X)) < (M))
-#define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl(((Y)-(X)) / (X)) < (M))
+#define H5_FLT_REL_EQUAL(X, Y, M) (HDfabsf(((Y) - (X)) / (X)) < (M))
+#define H5_DBL_REL_EQUAL(X, Y, M) (HDfabs(((Y) - (X)) / (X)) < (M))
+#define H5_LDBL_REL_EQUAL(X, Y, M) (HDfabsl(((Y) - (X)) / (X)) < (M))
/*
* Redefine all the POSIX functions. We should never see a POSIX
* function (or any other non-HDF5 function) in the source!
*/
-#define HDabort() abort()
-#define HDabs(X) abs(X)
+#define HDabort() abort()
+#define HDabs(X) abs(X)
#ifdef H5_HAVE_WIN32_API
-#define HDaccess(F,M) _access(F, M)
-#define R_OK 4 /* Test for read permission. */
-#define W_OK 2 /* Test for write permission. */
-#define X_OK 1 /* Test for execute permission. */
-#define F_OK 0 /* Test for existence. */
-#else /* H5_HAVE_WIN32_API */
-#define HDaccess(F,M) access(F, M)
+#define HDaccess(F, M) _access(F, M)
+#define R_OK 4 /* Test for read permission. */
+#define W_OK 2 /* Test for write permission. */
+#define X_OK 1 /* Test for execute permission. */
+#define F_OK 0 /* Test for existence. */
+#else /* H5_HAVE_WIN32_API */
+#define HDaccess(F, M) access(F, M)
#ifndef F_OK
-#define F_OK 00
+#define F_OK 00
#define W_OK 02
#define R_OK 04
#endif
#endif /* H5_HAVE_WIN32_API */
-#define HDacos(X) acos(X)
+#define HDacos(X) acos(X)
#ifdef H5_HAVE_ALARM
-#define HDalarm(N) alarm(N)
+#define HDalarm(N) alarm(N)
#else /* H5_HAVE_ALARM */
-#define HDalarm(N) (0)
+#define HDalarm(N) (0)
#endif /* H5_HAVE_ALARM */
-#define HDasctime(T) asctime(T)
-#define HDasin(X) asin(X)
-#define HDasprintf asprintf /*varargs*/
-#define HDassert(X) assert(X)
-#define HDatan(X) atan(X)
-#define HDatan2(X,Y) atan2(X,Y)
-#define HDatexit(F) atexit(F)
-#define HDatof(S) atof(S)
-#define HDatoi(S) atoi(S)
-#define HDatol(S) atol(S)
-#define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F)
-#define HDcalloc(N,Z) calloc(N,Z)
-#define HDceil(X) ceil(X)
-#define HDcfgetispeed(T) cfgetispeed(T)
-#define HDcfgetospeed(T) cfgetospeed(T)
-#define HDcfsetispeed(T,S) cfsetispeed(T,S)
-#define HDcfsetospeed(T,S) cfsetospeed(T,S)
-#define HDchdir(S) chdir(S)
-#define HDchmod(S,M) chmod(S,M)
-#define HDchown(S,O,G) chown(S,O,G)
-#define HDclearerr(F) clearerr(F)
-#define HDclock() clock()
-#define HDclose(F) close(F)
-#define HDclosedir(D) closedir(D)
-#define HDcos(X) cos(X)
-#define HDcosh(X) cosh(X)
-#define HDcreat(S,M) creat(S,M)
-#define HDctermid(S) ctermid(S)
-#define HDctime(T) ctime(T)
-#define HDcuserid(S) cuserid(S)
+#define HDasctime(T) asctime(T)
+#define HDasin(X) asin(X)
+#define HDasprintf asprintf /*varargs*/
+#define HDassert(X) assert(X)
+#define HDatan(X) atan(X)
+#define HDatan2(X, Y) atan2(X, Y)
+#define HDatexit(F) atexit(F)
+#define HDatof(S) atof(S)
+#define HDatoi(S) atoi(S)
+#define HDatol(S) atol(S)
+#define HDbsearch(K, B, N, Z, F) bsearch(K, B, N, Z, F)
+#define HDcalloc(N, Z) calloc(N, Z)
+#define HDceil(X) ceil(X)
+#define HDcfgetispeed(T) cfgetispeed(T)
+#define HDcfgetospeed(T) cfgetospeed(T)
+#define HDcfsetispeed(T, S) cfsetispeed(T, S)
+#define HDcfsetospeed(T, S) cfsetospeed(T, S)
+#define HDchdir(S) chdir(S)
+#define HDchmod(S, M) chmod(S, M)
+#define HDchown(S, O, G) chown(S, O, G)
+#define HDclearerr(F) clearerr(F)
+#define HDclock() clock()
+#define HDclose(F) close(F)
+#define HDclosedir(D) closedir(D)
+#define HDcos(X) cos(X)
+#define HDcosh(X) cosh(X)
+#define HDcreat(S, M) creat(S, M)
+#define HDctermid(S) ctermid(S)
+#define HDctime(T) ctime(T)
+#define HDcuserid(S) cuserid(S)
#ifdef H5_HAVE_DIFFTIME
-#define HDdifftime(X,Y) difftime(X,Y)
+#define HDdifftime(X, Y) difftime(X, Y)
#else
-#define HDdifftime(X,Y) ((double)(X)-(double)(Y))
+#define HDdifftime(X, Y) ((double)(X) - (double)(Y))
#endif
-#define HDdiv(X,Y) div(X,Y)
-#define HDdup(F) dup(F)
-#define HDdup2(F,I) dup2(F,I)
+#define HDdiv(X, Y) div(X, Y)
+#define HDdup(F) dup(F)
+#define HDdup2(F, I) dup2(F, I)
/* execl() variable arguments */
/* execle() variable arguments */
/* execlp() variable arguments */
-#define HDexecv(S,AV) execv(S,AV)
-#define HDexecve(S,AV,E) execve(S,AV,E)
-#define HDexecvp(S,AV) execvp(S,AV)
-#define HDexit(N) exit(N)
-#define HD_exit(N) _exit(N)
-#define HDexp(X) exp(X)
-#define HDfabs(X) fabs(X)
+#define HDexecv(S, AV) execv(S, AV)
+#define HDexecve(S, AV, E) execve(S, AV, E)
+#define HDexecvp(S, AV) execvp(S, AV)
+#define HDexit(N) exit(N)
+#define HD_exit(N) _exit(N)
+#define HDexp(X) exp(X)
+#define HDfabs(X) fabs(X)
/* use ABS() because fabsf() fabsl() are not common yet. */
-#define HDfabsf(X) ABS(X)
-#define HDfabsl(X) ABS(X)
-#define HDfclose(F) fclose(F)
+#define HDfabsf(X) ABS(X)
+#define HDfabsl(X) ABS(X)
+#define HDfclose(F) fclose(F)
/* fcntl() variable arguments */
-#define HDfdopen(N,S) fdopen(N,S)
-#define HDfeof(F) feof(F)
-#define HDferror(F) ferror(F)
-#define HDfflush(F) fflush(F)
-#define HDfgetc(F) fgetc(F)
-#define HDfgetpos(F,P) fgetpos(F,P)
-#define HDfgets(S,N,F) fgets(S,N,F)
+#define HDfdopen(N, S) fdopen(N, S)
+#define HDfeof(F) feof(F)
+#define HDferror(F) ferror(F)
+#define HDfflush(F) fflush(F)
+#define HDfgetc(F) fgetc(F)
+#define HDfgetpos(F, P) fgetpos(F, P)
+#define HDfgets(S, N, F) fgets(S, N, F)
#ifdef H5_HAVE_WIN32_API
-#define HDfileno(F) _fileno(F)
+#define HDfileno(F) _fileno(F)
#else /* H5_HAVE_WIN32_API */
-#define HDfileno(F) fileno(F)
+#define HDfileno(F) fileno(F)
#endif /* H5_HAVE_WIN32_API */
-#define HDfloor(X) floor(X)
-#define HDfmod(X,Y) fmod(X,Y)
-#define HDfopen(S,M) fopen(S,M)
-#define HDfork() fork()
-#define HDfpathconf(F,N) fpathconf(F,N)
-H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
-#define HDfputc(C,F) fputc(C,F)
-#define HDfputs(S,F) fputs(S,F)
-#define HDfread(M,Z,N,F) fread(M,Z,N,F)
-#define HDfree(M) free(M)
-#define HDfreopen(S,M,F) freopen(S,M,F)
-#define HDfrexp(X,N) frexp(X,N)
+#define HDfloor(X) floor(X)
+#define HDfmod(X, Y) fmod(X, Y)
+#define HDfopen(S, M) fopen(S, M)
+#define HDfork() fork()
+#define HDfpathconf(F, N) fpathconf(F, N)
+#define HDfprintf fprintf
+#define HDfputc(C, F) fputc(C, F)
+#define HDfputs(S, F) fputs(S, F)
+#define HDfread(M, Z, N, F) fread(M, Z, N, F)
+#define HDfree(M) free(M)
+#define HDfreopen(S, M, F) freopen(S, M, F)
+#define HDfrexp(X, N) frexp(X, N)
/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */
#ifdef H5_HAVE_FREXPF
-#define HDfrexpf(X,N) frexpf(X,N)
+#define HDfrexpf(X, N) frexpf(X, N)
#else /* H5_HAVE_FREXPF */
-#define HDfrexpf(X,N) frexp(X,N)
+#define HDfrexpf(X, N) frexp(X, N)
#endif /* H5_HAVE_FREXPF */
#ifdef H5_HAVE_FREXPL
-#define HDfrexpl(X,N) frexpl(X,N)
+#define HDfrexpl(X, N) frexpl(X, N)
#else /* H5_HAVE_FREXPL */
-#define HDfrexpl(X,N) frexp(X,N)
+#define HDfrexpl(X, N) frexp(X, N)
#endif /* H5_HAVE_FREXPL */
/* fscanf() variable arguments */
#ifdef H5_HAVE_FSEEKO
- #define HDfseek(F,O,W) fseeko(F,O,W)
+#define HDfseek(F, O, W) fseeko(F, O, W)
#else
- #define HDfseek(F,O,W) fseek(F,O,W)
+#define HDfseek(F, O, W) fseek(F, O, W)
#endif
-#define HDfsetpos(F,P) fsetpos(F,P)
+#define HDfsetpos(F, P) fsetpos(F, P)
/* definitions related to the file stat utilities.
* Windows have its own function names.
* For Unix, if off_t is not 64bit big, try use the pseudo-standard
* xxx64 versions if available.
*/
#ifdef H5_HAVE_WIN32_API
- #define HDfstat(F,B) _fstati64(F,B)
- #define HDlstat(S,B) _lstati64(S,B)
- #define HDstat(S,B) _stati64(S,B)
- typedef struct _stati64 h5_stat_t;
- typedef __int64 h5_stat_size_t;
- #define HDoff_t __int64
-#elif H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64)
- #define HDfstat(F,B) fstat64(F,B)
- #define HDlstat(S,B) lstat64(S,B)
- #define HDstat(S,B) stat64(S,B)
- typedef struct stat64 h5_stat_t;
- typedef off64_t h5_stat_size_t;
- #define HDoff_t off64_t
+#define HDfstat(F, B) _fstati64(F, B)
+#define HDlstat(S, B) _lstati64(S, B)
+#define HDstat(S, B) _stati64(S, B)
+typedef struct _stati64 h5_stat_t;
+typedef __int64 h5_stat_size_t;
+#define HDoff_t __int64
+#elif H5_SIZEOF_OFF_T != 8 && H5_SIZEOF_OFF64_T == 8 && defined(H5_HAVE_STAT64)
+#define HDfstat(F, B) fstat64(F, B)
+#define HDlstat(S, B) lstat64(S, B)
+#define HDstat(S, B) stat64(S, B)
+typedef struct stat64 h5_stat_t;
+typedef off64_t h5_stat_size_t;
+#define HDoff_t off64_t
#else
- #define HDfstat(F,B) fstat(F,B)
- #define HDlstat(S,B) lstat(S,B)
- #define HDstat(S,B) stat(S,B)
- typedef struct stat h5_stat_t;
- typedef off_t h5_stat_size_t;
- #define HDoff_t off_t
+#define HDfstat(F, B) fstat(F, B)
+#define HDlstat(S, B) lstat(S, B)
+#define HDstat(S, B) stat(S, B)
+typedef struct stat h5_stat_t;
+typedef off_t h5_stat_size_t;
+#define HDoff_t off_t
#endif
-#define HDftell(F) ftell(F)
-#define HDftruncate(F,L) ftruncate(F,L)
-#define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
-#define HDgetc(F) getc(F)
-#define HDgetchar() getchar()
-#define HDgetcwd(S,Z) getcwd(S,Z)
-#define HDgetegid() getegid()
-#define HDgetenv(S) getenv(S)
-#define HDgeteuid() geteuid()
-#define HDgetgid() getgid()
-#define HDgetgrgid(G) getgrgid(G)
-#define HDgetgrnam(S) getgrnam(S)
-#define HDgetgroups(Z,G) getgroups(Z,G)
+#define HDftell(F) ftell(F)
+#define HDftruncate(F, L) ftruncate(F, L)
+#define HDfwrite(M, Z, N, F) fwrite(M, Z, N, F)
+#define HDgetc(F) getc(F)
+#define HDgetchar() getchar()
+#define HDgetcwd(S, Z) getcwd(S, Z)
+#define HDgetegid() getegid()
+#define HDgetenv(S) getenv(S)
+#define HDgeteuid() geteuid()
+#define HDgetgid() getgid()
+#define HDgetgrgid(G) getgrgid(G)
+#define HDgetgrnam(S) getgrnam(S)
+#define HDgetgroups(Z, G) getgroups(Z, G)
#ifdef H5_HAVE_WIN32_API
-#define HDgetlogin() Wgetlogin()
+#define HDgetlogin() Wgetlogin()
#else /* H5_HAVE_WIN32_API */
-#define HDgetlogin() getlogin()
+#define HDgetlogin() getlogin()
#endif /* H5_HAVE_WIN32_API */
-#define HDgetpgrp() getpgrp()
-#define HDgetpid() getpid()
-#define HDgetppid() getppid()
-#define HDgetpwnam(S) getpwnam(S)
-#define HDgetpwuid(U) getpwuid(U)
-#define HDgetrusage(X,S) getrusage(X,S)
+#define HDgetpgrp() getpgrp()
+#define HDgetpid() getpid()
+#define HDgetppid() getppid()
+#define HDgetpwnam(S) getpwnam(S)
+#define HDgetpwuid(U) getpwuid(U)
+#define HDgetrusage(X, S) getrusage(X, S)
/* Don't define a macro for gets() - it was removed in C11 */
#ifdef H5_HAVE_WIN32_API
- H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
-#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)
+H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
+#define HDgettimeofday(V, Z) Wgettimeofday(V, Z)
#else /* H5_HAVE_WIN32_API */
-#define HDgettimeofday(S,P) gettimeofday(S,P)
+#define HDgettimeofday(S, P) gettimeofday(S, P)
#endif /* H5_HAVE_WIN32_API */
-#define HDgetuid() getuid()
-#define HDgmtime(T) gmtime(T)
-#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
-#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/
-#define HDisatty(F) isatty(F)
-#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/
-#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/
-#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/
-#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/
-#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/
-#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/
-#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/
-#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/
-#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/
-#define HDkill(P,S) kill(P,S)
-#define HDlabs(X) labs(X)
-#define HDldexp(X,N) ldexp(X,N)
-#define HDldiv(X,Y) ldiv(X,Y)
-#define HDlink(OLD,NEW) link(OLD,NEW)
-#define HDlocaleconv() localeconv()
-#define HDlocaltime(T) localtime(T)
-#define HDlog(X) log(X)
-#define HDlog10(X) log10(X)
-#define HDlongjmp(J,N) longjmp(J,N)
+#define HDgetuid() getuid()
+#define HDgmtime(T) gmtime(T)
+#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
+#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/
+#define HDisatty(F) isatty(F)
+#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/
+#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/
+#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/
+#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/
+#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/
+#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/
+#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/
+#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/
+#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/
+#define HDkill(P, S) kill(P, S)
+#define HDlabs(X) labs(X)
+#define HDldexp(X, N) ldexp(X, N)
+#define HDldiv(X, Y) ldiv(X, Y)
+#define HDlink(OLD, NEW) link(OLD, NEW)
+#define HDlocaleconv() localeconv()
+#define HDlocaltime(T) localtime(T)
+#define HDlog(X) log(X)
+#define HDlog10(X) log10(X)
+#define HDlongjmp(J, N) longjmp(J, N)
#ifdef H5_HAVE_WIN32_API
- #define HDlseek(F,O,W) _lseeki64(F,O,W)
+#define HDlseek(F, O, W) _lseeki64(F, O, W)
+#else
+#ifdef H5_HAVE_LSEEK64
+#define HDlseek(F, O, W) lseek64(F, O, W)
#else
- #ifdef H5_HAVE_LSEEK64
- #define HDlseek(F,O,W) lseek64(F,O,W)
- #else
- #define HDlseek(F,O,W) lseek(F,O,W)
- #endif
+#define HDlseek(F, O, W) lseek(F, O, W)
#endif
-#define HDmalloc(Z) malloc(Z)
-#define HDposix_memalign(P,A,Z) posix_memalign(P,A,Z)
-#define HDmblen(S,N) mblen(S,N)
-#define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z)
-#define HDmbtowc(P,S,Z) mbtowc(P,S,Z)
-#define HDmemchr(S,C,Z) memchr(S,C,Z)
-#define HDmemcmp(X,Y,Z) memcmp(X,Y,Z)
+#endif
+#define HDmalloc(Z) malloc(Z)
+#define HDposix_memalign(P, A, Z) posix_memalign(P, A, Z)
+#define HDmblen(S, N) mblen(S, N)
+#define HDmbstowcs(P, S, Z) mbstowcs(P, S, Z)
+#define HDmbtowc(P, S, Z) mbtowc(P, S, Z)
+#define HDmemchr(S, C, Z) memchr(S, C, Z)
+#define HDmemcmp(X, Y, Z) memcmp(X, Y, Z)
/*
* The (char*) casts are required for the DEC when optimizations are turned
* on and the source and/or destination are not aligned.
*/
-#define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z)
-#define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
+#define HDmemcpy(X, Y, Z) memcpy((char *)(X), (const char *)(Y), Z)
+#define HDmemmove(X, Y, Z) memmove((char *)(X), (const char *)(Y), Z)
/*
* The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO
*/
#ifdef H5_HAVE_VISUAL_STUDIO
-#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
+#define HDmemset(X, C, Z) memset((void *)(X), C, Z)
#else /* H5_HAVE_VISUAL_STUDIO */
-#define HDmemset(X,C,Z) memset(X,C,Z)
+#define HDmemset(X, C, Z) memset(X, C, Z)
#endif /* H5_HAVE_VISUAL_STUDIO */
#ifdef H5_HAVE_WIN32_API
-#define HDmkdir(S,M) _mkdir(S)
+#define HDmkdir(S, M) _mkdir(S)
#else /* H5_HAVE_WIN32_API */
-#define HDmkdir(S,M) mkdir(S,M)
+#define HDmkdir(S, M) mkdir(S, M)
#endif /* H5_HAVE_WIN32_API */
-#define HDmkfifo(S,M) mkfifo(S,M)
-#define HDmktime(T) mktime(T)
-#define HDmodf(X,Y) modf(X,Y)
+#define HDmkfifo(S, M) mkfifo(S, M)
+#define HDmktime(T) mktime(T)
+#define HDmodf(X, Y) modf(X, Y)
#ifdef _O_BINARY
-#define HDopen(S,F,M) open(S,F|_O_BINARY,M)
+#define HDopen(S, F, M) open(S, F | _O_BINARY, M)
#else
-#define HDopen(S,F,M) open(S,F,M)
+#define HDopen(S, F, M) open(S, F, M)
#endif
-#define HDopendir(S) opendir(S)
-#define HDpathconf(S,N) pathconf(S,N)
-#define HDpause() pause()
-#define HDperror(S) perror(S)
-#define HDpipe(F) pipe(F)
-#define HDpow(X,Y) pow(X,Y)
+#define HDopendir(S) opendir(S)
+#define HDpathconf(S, N) pathconf(S, N)
+#define HDpause() pause()
+#define HDperror(S) perror(S)
+#define HDpipe(F) pipe(F)
+#define HDpow(X, Y) pow(X, Y)
/* printf() variable arguments */
-#define HDprintf(...) HDfprintf(stdout, __VA_ARGS__)
-#define HDputc(C,F) putc(C,F)
-#define HDputchar(C) putchar(C)
-#define HDputs(S) puts(S)
-#define HDqsort(M,N,Z,F) qsort(M,N,Z,F)
-#define HDraise(N) raise(N)
+#define HDprintf(...) HDfprintf(stdout, __VA_ARGS__)
+#define HDputc(C, F) putc(C, F)
+#define HDputchar(C) putchar(C)
+#define HDputs(S) puts(S)
+#define HDqsort(M, N, Z, F) qsort(M, N, Z, F)
+#define HDraise(N) raise(N)
#ifdef H5_HAVE_RAND_R
-#define HDrandom() HDrand()
+#define HDrandom() HDrand()
H5_DLL int HDrand(void);
#elif H5_HAVE_RANDOM
-#define HDrand() random()
-#define HDrandom() random()
+#define HDrand() random()
+#define HDrandom() random()
#else
-#define HDrand() rand()
-#define HDrandom() rand()
+#define HDrand() rand()
+#define HDrandom() rand()
#endif
-#define HDread(F,M,Z) read(F,M,Z)
-#define HDreaddir(D) readdir(D)
-#define HDrealloc(M,Z) realloc(M,Z)
-#define HDremove(S) remove(S)
-#define HDrename(OLD,NEW) rename(OLD,NEW)
-#define HDrewind(F) rewind(F)
-#define HDrewinddir(D) rewinddir(D)
-#define HDrmdir(S) rmdir(S)
+#define HDread(F, M, Z) read(F, M, Z)
+#define HDreaddir(D) readdir(D)
+#define HDrealloc(M, Z) realloc(M, Z)
+#define HDremove(S) remove(S)
+#define HDrename(OLD, NEW) rename(OLD, NEW)
+#define HDrewind(F) rewind(F)
+#define HDrewinddir(D) rewinddir(D)
+#define HDrmdir(S) rmdir(S)
/* scanf() variable arguments */
-#define HDsetbuf(F,S) setbuf(F,S)
-#define HDsetgid(G) setgid(G)
-#define HDsetjmp(J) setjmp(J)
-#define HDsetlocale(N,S) setlocale(N,S)
-#define HDsetpgid(P,PG) setpgid(P,PG)
-#define HDsetsid() setsid()
-#define HDsetuid(U) setuid(U)
+#define HDsetbuf(F, S) setbuf(F, S)
+#define HDsetgid(G) setgid(G)
+#define HDsetjmp(J) setjmp(J)
+#define HDsetlocale(N, S) setlocale(N, S)
+#define HDsetpgid(P, PG) setpgid(P, PG)
+#define HDsetsid() setsid()
+#define HDsetuid(U) setuid(U)
/* Windows does not permit setting the buffer size to values
less than 2. */
#ifndef H5_HAVE_WIN32_API
-#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z)
-#else
-#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2))
-#endif
-#define HDsigaddset(S,N) sigaddset(S,N)
-#define HDsigdelset(S,N) sigdelset(S,N)
-#define HDsigemptyset(S) sigemptyset(S)
-#define HDsigfillset(S) sigfillset(S)
-#define HDsigismember(S,N) sigismember(S,N)
-#define HDsiglongjmp(J,N) siglongjmp(J,N)
-#define HDsignal(N,F) signal(N,F)
-#define HDsigpending(S) sigpending(S)
-#define HDsigprocmask(H,S,O) sigprocmask(H,S,O)
-#define HDsigsetjmp(J,N) sigsetjmp(J,N)
-#define HDsigsuspend(S) sigsuspend(S)
-#define HDsin(X) sin(X)
-#define HDsinh(X) sinh(X)
-#define HDsleep(N) sleep(N)
-#ifdef H5_HAVE_WIN32_API
-H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...);
-#define HDsnprintf c99_snprintf /*varargs*/
+#define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, Z)
#else
-#define HDsnprintf snprintf /*varargs*/
+#define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, (Z > 1 ? Z : 2))
#endif
-/* sprintf() variable arguments */
-#define HDsprintf sprintf /*varargs*/
-#define HDsqrt(X) sqrt(X)
+#define HDsigaddset(S, N) sigaddset(S, N)
+#define HDsigdelset(S, N) sigdelset(S, N)
+#define HDsigemptyset(S) sigemptyset(S)
+#define HDsigfillset(S) sigfillset(S)
+#define HDsigismember(S, N) sigismember(S, N)
+#define HDsiglongjmp(J, N) siglongjmp(J, N)
+#define HDsignal(N, F) signal(N, F)
+#define HDsigpending(S) sigpending(S)
+#define HDsigprocmask(H, S, O) sigprocmask(H, S, O)
+#define HDsigsetjmp(J, N) sigsetjmp(J, N)
+#define HDsigsuspend(S) sigsuspend(S)
+#define HDsin(X) sin(X)
+#define HDsinh(X) sinh(X)
+#define HDsleep(N) sleep(N)
+#define HDsnprintf snprintf /*varargs*/
+#define HDsprintf sprintf /*varargs*/
+#define HDsqrt(X) sqrt(X)
#ifdef H5_HAVE_RAND_R
H5_DLL void HDsrand(unsigned int seed);
-#define HDsrandom(S) HDsrand(S)
+#define HDsrandom(S) HDsrand(S)
#elif H5_HAVE_RANDOM
-#define HDsrand(S) srandom(S)
-#define HDsrandom(S) srandom(S)
+#define HDsrand(S) srandom(S)
+#define HDsrandom(S) srandom(S)
#else
-#define HDsrand(S) srand(S)
-#define HDsrandom(S) srand(S)
+#define HDsrand(S) srand(S)
+#define HDsrandom(S) srand(S)
#endif
-/* sscanf() variable arguments */
#ifdef H5_HAVE_WIN32_API
-#define HDstrcasecmp(A,B) _stricmp(A,B)
-#else
-#define HDstrcasecmp(X,Y) strcasecmp(X,Y)
-#endif
-#define HDstrcat(X,Y) strcat(X,Y)
-#define HDstrchr(S,C) strchr(S,C)
-#define HDstrcmp(X,Y) strcmp(X,Y)
-#define HDstrcoll(X,Y) strcoll(X,Y)
-#define HDstrcpy(X,Y) strcpy(X,Y)
-#define HDstrcspn(X,Y) strcspn(X,Y)
-#define HDstrerror(N) strerror(N)
-#define HDstrftime(S,Z,F,T) strftime(S,Z,F,T)
-#define HDstrlen(S) strlen(S)
-#define HDstrncat(X,Y,Z) strncat(X,Y,Z)
-#define HDstrncmp(X,Y,Z) strncmp(X,Y,Z)
-#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z)
-#define HDstrpbrk(X,Y) strpbrk(X,Y)
-#define HDstrrchr(S,C) strrchr(S,C)
-#define HDstrspn(X,Y) strspn(X,Y)
-#define HDstrstr(X,Y) strstr(X,Y)
-#define HDstrtod(S,R) strtod(S,R)
-#define HDstrtok(X,Y) strtok(X,Y)
-#define HDstrtol(S,R,N) strtol(S,R,N)
-H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
-#define HDstrtoul(S,R,N) strtoul(S,R,N)
-#ifdef H5_HAVE_WIN32_API
-#define HDstrtoull(S,R,N) _strtoui64(S,R,N)
+#define HDstrcasecmp(A, B) _stricmp(A, B)
#else
-#define HDstrtoull(S,R,N) strtoull(S,R,N)
+#define HDstrcasecmp(X, Y) strcasecmp(X, Y)
#endif
-#define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z)
-#define HDsysconf(N) sysconf(N)
-#define HDsystem(S) system(S)
-#define HDtan(X) tan(X)
-#define HDtanh(X) tanh(X)
-#define HDtcdrain(F) tcdrain(F)
-#define HDtcflow(F,A) tcflow(F,A)
-#define HDtcflush(F,N) tcflush(F,N)
-#define HDtcgetattr(F,T) tcgetattr(F,T)
-#define HDtcgetpgrp(F) tcgetpgrp(F)
-#define HDtcsendbreak(F,N) tcsendbreak(F,N)
-#define HDtcsetattr(F,O,T) tcsetattr(F,O,T)
-#define HDtcsetpgrp(F,N) tcsetpgrp(F,N)
-#define HDtime(T) time(T)
-#define HDtimes(T) times(T)
-#define HDtmpfile() tmpfile()
-#define HDtmpnam(S) tmpnam(S)
-#define HDtolower(C) tolower(C)
-#define HDtoupper(C) toupper(C)
-#define HDttyname(F) ttyname(F)
-#define HDtzset() tzset()
-#define HDumask(N) umask(N)
-#define HDuname(S) uname(S)
-#define HDungetc(C,F) ungetc(C,F)
+#define HDstrcat(X, Y) strcat(X, Y)
+#define HDstrchr(S, C) strchr(S, C)
+#define HDstrcmp(X, Y) strcmp(X, Y)
+#define HDstrcoll(X, Y) strcoll(X, Y)
+#define HDstrcpy(X, Y) strcpy(X, Y)
+#define HDstrcspn(X, Y) strcspn(X, Y)
+#define HDstrerror(N) strerror(N)
+#define HDstrftime(S, Z, F, T) strftime(S, Z, F, T)
+#define HDstrlen(S) strlen(S)
+#define HDstrncat(X, Y, Z) strncat(X, Y, Z)
+#define HDstrncmp(X, Y, Z) strncmp(X, Y, Z)
+#define HDstrncpy(X, Y, Z) strncpy(X, Y, Z)
+#define HDstrpbrk(X, Y) strpbrk(X, Y)
+#define HDstrrchr(S, C) strrchr(S, C)
+#define HDstrspn(X, Y) strspn(X, Y)
+#define HDstrstr(X, Y) strstr(X, Y)
+#define HDstrtod(S, R) strtod(S, R)
+#define HDstrtok(X, Y) strtok(X, Y)
+#define HDstrtol(S, R, N) strtol(S, R, N)
+H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base);
+#define HDstrtoul(S, R, N) strtoul(S, R, N)
#ifdef H5_HAVE_WIN32_API
-#define HDunlink(S) _unlink(S)
+#define HDstrtoull(S, R, N) _strtoui64(S, R, N)
#else
-#define HDunlink(S) unlink(S)
+#define HDstrtoull(S, R, N) strtoull(S, R, N)
#endif
-#define HDutime(S,T) utime(S,T)
-#define HDva_arg(A,T) va_arg(A,T)
-#define HDva_end(A) va_end(A)
-#define HDva_start(A,P) va_start(A,P)
-#define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A)
-#define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A)
-#define HDvprintf(FMT,A) vprintf(FMT,A)
-#define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A)
+#define HDstrxfrm(X, Y, Z) strxfrm(X, Y, Z)
+#define HDsysconf(N) sysconf(N)
+#define HDsystem(S) system(S)
+#define HDtan(X) tan(X)
+#define HDtanh(X) tanh(X)
+#define HDtcdrain(F) tcdrain(F)
+#define HDtcflow(F, A) tcflow(F, A)
+#define HDtcflush(F, N) tcflush(F, N)
+#define HDtcgetattr(F, T) tcgetattr(F, T)
+#define HDtcgetpgrp(F) tcgetpgrp(F)
+#define HDtcsendbreak(F, N) tcsendbreak(F, N)
+#define HDtcsetattr(F, O, T) tcsetattr(F, O, T)
+#define HDtcsetpgrp(F, N) tcsetpgrp(F, N)
+#define HDtime(T) time(T)
+#define HDtimes(T) times(T)
+#define HDtmpfile() tmpfile()
+#define HDtmpnam(S) tmpnam(S)
+#define HDtolower(C) tolower(C)
+#define HDtoupper(C) toupper(C)
+#define HDttyname(F) ttyname(F)
+#define HDtzset() tzset()
+#define HDumask(N) umask(N)
+#define HDuname(S) uname(S)
+#define HDungetc(C, F) ungetc(C, F)
#ifdef H5_HAVE_WIN32_API
-H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap);
-#define HDvsnprintf c99_vsnprintf
+#define HDunlink(S) _unlink(S)
#else
-# define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A)
+#define HDunlink(S) unlink(S)
#endif
-#define HDwait(W) wait(W)
-#define HDwaitpid(P,W,O) waitpid(P,W,O)
-#define HDwcstombs(S,P,Z) wcstombs(S,P,Z)
-#define HDwctomb(S,C) wctomb(S,C)
-#define HDwrite(F,M,Z) write(F,M,Z)
+#define HDutime(S, T) utime(S, T)
+#define HDva_arg(A, T) va_arg(A, T)
+#define HDva_end(A) va_end(A)
+#define HDva_start(A, P) va_start(A, P)
+#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A)
+#define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A)
+#define HDvprintf(FMT, A) vprintf(FMT, A)
+#define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A)
+#define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A)
+#define HDwait(W) wait(W)
+#define HDwaitpid(P, W, O) waitpid(P, W, O)
+#define HDwcstombs(S, P, Z) wcstombs(S, P, Z)
+#define HDwctomb(S, C) wctomb(S, C)
+#define HDwrite(F, M, Z) write(F, M, Z)
/*
* And now for a couple non-Posix functions... Watch out for systems that
* define these in terms of macros.
*/
#ifdef H5_HAVE_WIN32_API
-#define HDstrdup(S) _strdup(S)
+#define HDstrdup(S) _strdup(S)
#else /* H5_HAVE_WIN32_API */
#if !defined strdup && !defined H5_HAVE_STRDUP
-extern char *strdup(const char *s);
+extern char * strdup(const char *s);
#endif
-#define HDstrdup(S) strdup(S)
+#define HDstrdup(S) strdup(S)
#endif /* H5_HAVE_WIN32_API */
@@ -485,52 +472,37 @@ extern char *strdup(const char *s);
* HDF Boolean type.
*/
#ifndef FALSE
-# define FALSE false
+#define FALSE false
#endif
#ifndef TRUE
-# define TRUE true
+#define TRUE true
#endif
-/** From h5test.h **/
-
-#ifdef H5_HAVE_PARALLEL
-extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
-#endif
-
-#ifdef H5_HAVE_PARALLEL
-int h5_set_info_object(void);
-void h5_dump_info_object(MPI_Info info);
-#endif
-
-
-
/** From h5tools_utils.h **/
-extern int opt_err; /* getoption prints errors if this is on */
-extern int opt_ind; /* token pointer */
-extern const char *opt_arg; /* flag argument (or value) */
-
+H5_DLLVAR int H5_opterr; /* getoption prints errors if this is on */
+H5_DLLVAR int H5_optind; /* token pointer */
+H5_DLLVAR const char *H5_optarg; /* flag argument (or value) */
-enum {
- no_arg = 0, /* doesn't take an argument */
- require_arg, /* requires an argument */
- optional_arg /* argument is optional */
+enum h5_arg_level {
+ no_arg = 0, /* doesn't take an argument */
+ require_arg, /* requires an argument */
+ optional_arg /* argument is optional */
};
+struct h5_long_options {
+ const char * name; /* Name of the long option */
+ enum h5_arg_level has_arg; /* Whether we should look for an arg */
+ char shortval; /* The shortname equivalent of long arg
+ * this gets returned from get_option
+ */
+};
-typedef struct long_options {
- const char *name; /* name of the long option */
- int has_arg; /* whether we should look for an arg */
- char shortval; /* the shortname equivalent of long arg
- * this gets returned from get_option */
-} long_options;
-
-extern int get_option(int argc, const char **argv, const char *opt,
- const struct long_options *l_opt);
+extern int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt);
-extern int nCols; /*max number of columns for outputting */
+extern int nCols; /*max number of columns for outputting */
/* Definitions of useful routines */
-extern void print_version(const char *progname);
+extern void print_version(const char *progname);
#endif
diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c
index 8f1f584..d8cd3a1 100644
--- a/tools/test/perform/zip_perf.c
+++ b/tools/test/perform/zip_perf.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -28,105 +28,51 @@
#include <zlib.h>
-#define ONE_KB 1024
-#define ONE_MB (ONE_KB * ONE_KB)
-#define ONE_GB (ONE_MB * ONE_KB)
+#define ONE_KB 1024
+#define ONE_MB (ONE_KB * ONE_KB)
+#define ONE_GB (ONE_MB * ONE_KB)
-#define MICROSECOND 1000000.0F
+#define MICROSECOND 1000000.0
/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) ((fabs(t) < (double)0.0000000001F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t)))
+#define MB_PER_SEC(bytes, t) ((fabs(t) < 0.0000000001) ? 0.0 : ((((double)(bytes)) / (double)ONE_MB) / (t)))
#ifndef TRUE
-#define TRUE 1
-#endif /* TRUE */
+#define TRUE 1
+#endif /* TRUE */
#ifndef FALSE
-#define FALSE (!TRUE)
-#endif /* FALSE */
+#define FALSE (!TRUE)
+#endif /* FALSE */
#ifndef S_IRWXU
-#define S_IRWXU (_S_IREAD|_S_IWRITE)
+#define S_IRWXU (_S_IREAD | _S_IWRITE)
#endif
/* internal variables */
-static const char *prog=NULL;
-static const char *option_prefix=NULL;
-static char *filename=NULL;
-static int compress_percent = 0;
-static int compress_level = Z_DEFAULT_COMPRESSION;
-static int output, random_test = FALSE;
-static int report_once_flag;
-static double compression_time;
+static const char *prog = NULL;
+static const char *option_prefix = NULL;
+static char * filename = NULL;
+static int compress_percent = 0;
+static int compress_level = Z_DEFAULT_COMPRESSION;
+static int output, random_test = FALSE;
+static int report_once_flag;
+static double compression_time;
/* internal functions */
static void error(const char *fmt, ...);
-static void compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source,
- uLong sourceLen);
+static void compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
/* commandline options : long and short form */
-static const char *s_opts = "hB:b:c:p:rs:0123456789";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "compressability", require_arg, 'c' },
- { "compressabilit", require_arg, 'c' },
- { "compressabili", require_arg, 'c' },
- { "compressabil", require_arg, 'c' },
- { "compressabi", require_arg, 'c' },
- { "compressab", require_arg, 'c' },
- { "compressa", require_arg, 'c' },
- { "compress", require_arg, 'c' },
- { "compres", require_arg, 'c' },
- { "compre", require_arg, 'c' },
- { "compr", require_arg, 'c' },
- { "comp", require_arg, 'c' },
- { "com", require_arg, 'c' },
- { "co", require_arg, 'c' },
- { "file-size", require_arg, 's' },
- { "file-siz", require_arg, 's' },
- { "file-si", require_arg, 's' },
- { "file-s", require_arg, 's' },
- { "file", require_arg, 's' },
- { "fil", require_arg, 's' },
- { "fi", require_arg, 's' },
- { "max-buffer-size", require_arg, 'B' },
- { "max-buffer-siz", require_arg, 'B' },
- { "max-buffer-si", require_arg, 'B' },
- { "max-buffer-s", require_arg, 'B' },
- { "max-buffer", require_arg, 'B' },
- { "max-buffe", require_arg, 'B' },
- { "max-buff", require_arg, 'B' },
- { "max-buf", require_arg, 'B' },
- { "max-bu", require_arg, 'B' },
- { "max-b", require_arg, 'B' },
- { "max", require_arg, 'B' },
- { "min-buffer-size", require_arg, 'b' },
- { "min-buffer-siz", require_arg, 'b' },
- { "min-buffer-si", require_arg, 'b' },
- { "min-buffer-s", require_arg, 'b' },
- { "min-buffer", require_arg, 'b' },
- { "min-buffe", require_arg, 'b' },
- { "min-buff", require_arg, 'b' },
- { "min-buf", require_arg, 'b' },
- { "min-bu", require_arg, 'b' },
- { "min-b", require_arg, 'b' },
- { "min", require_arg, 'b' },
- { "prefix", require_arg, 'p' },
- { "prefi", require_arg, 'p' },
- { "pref", require_arg, 'p' },
- { "pre", require_arg, 'p' },
- { "pr", require_arg, 'p' },
- { "random-test", no_arg, 'r' },
- { "random-tes", no_arg, 'r' },
- { "random-te", no_arg, 'r' },
- { "random-t", no_arg, 'r' },
- { "random", no_arg, 'r' },
- { "rando", no_arg, 'r' },
- { "rand", no_arg, 'r' },
- { "ran", no_arg, 'r' },
- { "ra", no_arg, 'r' },
- { NULL, 0, '\0' }
-};
+static const char * s_opts = "hB:b:c:p:rs:0123456789";
+static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"compressability", require_arg, 'c'},
+ {"file-size", require_arg, 's'},
+ {"max-buffer-size", require_arg, 'B'},
+ {"min-buffer-size", require_arg, 'b'},
+ {"prefix", require_arg, 'p'},
+ {"random-test", no_arg, 'r'},
+ {NULL, 0, '\0'}};
/*
* Function: error
@@ -165,14 +111,14 @@ cleanup(void)
static void
write_file(Bytef *source, uLongf sourceLen)
{
- Bytef *d_ptr, *dest;
- uLongf d_len, destLen;
+ Bytef * d_ptr, *dest;
+ uLongf d_len, destLen;
struct timeval timer_start, timer_stop;
/* destination buffer needs to be at least 0.1% larger than sourceLen
* plus 12 bytes */
- destLen = (uLongf)((double)sourceLen + ((double)sourceLen * (double)0.1F)) + 12;
- dest = (Bytef *)HDmalloc(destLen);
+ destLen = (uLongf)((double)sourceLen + ((double)sourceLen * 0.1)) + 12;
+ dest = (Bytef *)HDmalloc(destLen);
if (!dest)
error("out of memory");
@@ -181,10 +127,8 @@ write_file(Bytef *source, uLongf sourceLen)
compress_buffer(dest, &destLen, source, sourceLen);
HDgettimeofday(&timer_stop, NULL);
- compression_time += ((double)timer_stop.tv_sec +
- ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
- ((double)timer_start.tv_sec +
- ((double)timer_start.tv_usec) / (double)MICROSECOND);
+ compression_time += ((double)timer_stop.tv_sec + ((double)timer_stop.tv_usec) / MICROSECOND) -
+ ((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / MICROSECOND);
if (report_once_flag) {
HDfprintf(stdout, "\tCompression Ratio: %g\n", ((double)destLen) / (double)sourceLen);
@@ -222,8 +166,7 @@ write_file(Bytef *source, uLongf sourceLen)
* Modifications:
*/
static void
-compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source,
- uLong sourceLen)
+compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
{
int rc = compress2(dest, destLen, source, sourceLen, compress_level);
@@ -232,18 +175,18 @@ compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source,
cleanup();
switch (rc) {
- case Z_MEM_ERROR:
- error("not enough memory");
- break;
- case Z_BUF_ERROR:
- error("not enough room in the output buffer");
- break;
- case Z_STREAM_ERROR:
- error("level parameter (%d) is invalid", compress_level);
- break;
- default:
- error("unknown compression error");
- break;
+ case Z_MEM_ERROR:
+ error("not enough memory");
+ break;
+ case Z_BUF_ERROR:
+ error("not enough room in the output buffer");
+ break;
+ case Z_STREAM_ERROR:
+ error("level parameter (%d) is invalid", compress_level);
+ break;
+ default:
+ error("unknown compression error");
+ break;
}
}
}
@@ -260,8 +203,7 @@ compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source,
* Modifications:
*/
static int
-uncompress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source,
- uLong sourceLen)
+uncompress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
{
int rc = uncompress(dest, destLen, source, sourceLen);
@@ -282,7 +224,7 @@ static void
get_unique_name(void)
{
const char *prefix = NULL;
- const char *env = HDgetenv("HDF5_PREFIX");
+ const char *env = HDgetenv("HDF5_PREFIX");
if (env)
prefix = env;
@@ -292,15 +234,15 @@ get_unique_name(void)
if (prefix)
/* 2 = 1 for '/' + 1 for null terminator */
- filename = (char *) HDmalloc(HDstrlen(prefix) + HDstrlen(ZIP_PERF_FILE) + 2);
+ filename = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(ZIP_PERF_FILE) + 2);
else
- filename = (char *) HDmalloc(HDstrlen(ZIP_PERF_FILE) + 1);
+ filename = (char *)HDmalloc(HDstrlen(ZIP_PERF_FILE) + 1);
if (!filename)
error("out of memory");
filename[0] = 0;
- if (prefix){
+ if (prefix) {
HDstrcpy(filename, prefix);
HDstrcat(filename, "/");
}
@@ -361,7 +303,7 @@ static unsigned long
parse_size_directive(const char *size)
{
unsigned long s;
- char *endptr;
+ char * endptr;
s = HDstrtoul(size, &endptr, 10);
@@ -395,12 +337,12 @@ static void
fill_with_random_data(Bytef *src, uLongf src_len)
{
register unsigned u;
- h5_stat_t stat_buf;
+ h5_stat_t stat_buf;
if (HDstat("/dev/urandom", &stat_buf) == 0) {
uLongf len = src_len;
Bytef *buf = src;
- int fd = HDopen("/dev/urandom", O_RDONLY, 0);
+ int fd = HDopen("/dev/urandom", O_RDONLY, 0);
HDfprintf(stdout, "Using /dev/urandom for random data\n");
@@ -436,19 +378,18 @@ fill_with_random_data(Bytef *src, uLongf src_len)
}
static void
-do_write_test(unsigned long file_size, unsigned long min_buf_size,
- unsigned long max_buf_size)
+do_write_test(unsigned long file_size, unsigned long min_buf_size, unsigned long max_buf_size)
{
- uLongf src_len, total_len;
+ uLongf src_len, total_len;
struct timeval timer_start, timer_stop;
- double total_time;
- Bytef *src;
+ double total_time;
+ Bytef * src;
for (src_len = min_buf_size; src_len <= max_buf_size; src_len <<= 1) {
register unsigned long i, iters;
iters = file_size / src_len;
- src = (Bytef *)HDcalloc(1, sizeof(Bytef) * src_len);
+ src = (Bytef *)HDcalloc(1, sizeof(Bytef) * src_len);
if (!src) {
cleanup();
@@ -465,10 +406,12 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
if (src_len >= ONE_KB && (src_len % ONE_KB) == 0) {
if (src_len >= ONE_MB && (src_len % ONE_MB) == 0) {
HDfprintf(stdout, "%ldMB", src_len / ONE_MB);
- } else {
+ }
+ else {
HDfprintf(stdout, "%ldKB", src_len / ONE_KB);
}
- } else {
+ }
+ else {
HDfprintf(stdout, "%ld", src_len);
}
@@ -483,7 +426,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
for (i = 0; i <= iters; ++i) {
Bytef *s_ptr = src;
- uLong s_len = src_len;
+ uLong s_len = src_len;
/* loop to make sure we write everything out that we want to write */
for (;;) {
@@ -503,14 +446,11 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
HDclose(output);
HDgettimeofday(&timer_stop, NULL);
- total_time = ((double)timer_stop.tv_sec +
- ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
- ((double)timer_start.tv_sec +
- ((double)timer_start.tv_usec) / (double)MICROSECOND);
+ total_time = ((double)timer_stop.tv_sec + ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
+ ((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / (double)MICROSECOND);
HDfprintf(stdout, "\tUncompressed Write Time: %.2fs\n", total_time);
- HDfprintf(stdout, "\tUncompressed Write Throughput: %.2fMB/s\n",
- MB_PER_SEC(file_size, total_time));
+ HDfprintf(stdout, "\tUncompressed Write Throughput: %.2fMB/s\n", MB_PER_SEC(file_size, total_time));
HDunlink(filename);
@@ -529,14 +469,11 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
HDclose(output);
HDgettimeofday(&timer_stop, NULL);
- total_time = ((double)timer_stop.tv_sec +
- ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
- ((double)timer_start.tv_sec +
- ((double)timer_start.tv_usec) / (double)MICROSECOND);
+ total_time = ((double)timer_stop.tv_sec + ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
+ ((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / (double)MICROSECOND);
HDfprintf(stdout, "\tCompressed Write Time: %.2fs\n", total_time);
- HDfprintf(stdout, "\tCompressed Write Throughput: %.2fMB/s\n",
- MB_PER_SEC(file_size, total_time));
+ HDfprintf(stdout, "\tCompressed Write Throughput: %.2fMB/s\n", MB_PER_SEC(file_size, total_time));
HDfprintf(stdout, "\tCompression Time: %gs\n", compression_time);
HDunlink(filename);
@@ -556,60 +493,65 @@ main(int argc, const char *argv[])
{
unsigned long min_buf_size = 128 * ONE_KB, max_buf_size = ONE_MB;
unsigned long file_size = 64 * ONE_MB;
- int opt;
+ int opt;
prog = argv[0];
/* Initialize h5tools lib */
h5tools_init();
- while ((opt = get_option(argc, argv, s_opts, l_opts)) > 0) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) > 0) {
switch ((char)opt) {
- case '0': case '1': case '2':
- case '3': case '4': case '5':
- case '6': case '7': case '8':
- case '9':
- compress_level = opt - '0';
- break;
- case 'B':
- max_buf_size = parse_size_directive(opt_arg);
- break;
- case 'b':
- min_buf_size = parse_size_directive(opt_arg);
- break;
- case 'c':
- compress_percent = (int)HDstrtol(opt_arg, NULL, 10);
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ compress_level = opt - '0';
+ break;
+ case 'B':
+ max_buf_size = parse_size_directive(H5_optarg);
+ break;
+ case 'b':
+ min_buf_size = parse_size_directive(H5_optarg);
+ break;
+ case 'c':
+ compress_percent = (int)HDstrtol(H5_optarg, NULL, 10);
- if (compress_percent < 0)
- compress_percent = 0;
- else if (compress_percent > 100)
- compress_percent = 100;
+ if (compress_percent < 0)
+ compress_percent = 0;
+ else if (compress_percent > 100)
+ compress_percent = 100;
- break;
- case 'p':
- option_prefix = opt_arg;
- break;
- case 'r':
- random_test = TRUE;
- break;
- case 's':
- file_size = parse_size_directive(opt_arg);
- break;
- case '?':
- usage();
- exit(EXIT_FAILURE);
- break;
- case 'h':
- default:
- usage();
- exit(EXIT_SUCCESS);
- break;
+ break;
+ case 'p':
+ option_prefix = H5_optarg;
+ break;
+ case 'r':
+ random_test = TRUE;
+ break;
+ case 's':
+ file_size = parse_size_directive(H5_optarg);
+ break;
+ case '?':
+ usage();
+ exit(EXIT_FAILURE);
+ break;
+ case 'h':
+ default:
+ usage();
+ exit(EXIT_SUCCESS);
+ break;
}
}
if (min_buf_size > max_buf_size)
- error("minmum buffer size (%d) exceeds maximum buffer size (%d)",
- min_buf_size, max_buf_size);
+ error("minmum buffer size (%d) exceeds maximum buffer size (%d)", min_buf_size, max_buf_size);
HDfprintf(stdout, "Filesize: %ld\n", file_size);
@@ -641,4 +583,4 @@ main(void)
return EXIT_SUCCESS;
}
-#endif /* !H5_HAVE_FILTER_DEFLATE */
+#endif /* !H5_HAVE_FILTER_DEFLATE */
diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt
index 95dfc3b..89160a3 100644
--- a/tools/testfiles/h5dump-help.txt
+++ b/tools/testfiles/h5dump-help.txt
@@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files
--s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
<cred> :: "(<aws-region>,<access-id>,<access-key>)"
If absent or <cred> -> "(,,)", no authentication.
- Has no effect is filedriver is not `ros3'.
+ Has no effect if filedriver is not "ros3".
--hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
For use with "--filedriver=hdfs"
<attrs> :: (<namenode name>,<namenode port>,
@@ -67,7 +67,7 @@ usage: h5dump [OPTIONS] files
-D U, --xml-dtd=U Use the DTD or schema at U
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
- E.g., to dump a file called `-f', use h5dump -- -f
+ E.g., to dump a file called "-f", use h5dump -- -f
--------------- Subsetting Options ---------------
Subsetting is available by using the following options with a dataset
diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl
index 95dfc3b..89160a3 100644
--- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl
+++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl
@@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files
--s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
<cred> :: "(<aws-region>,<access-id>,<access-key>)"
If absent or <cred> -> "(,,)", no authentication.
- Has no effect is filedriver is not `ros3'.
+ Has no effect if filedriver is not "ros3".
--hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
For use with "--filedriver=hdfs"
<attrs> :: (<namenode name>,<namenode port>,
@@ -67,7 +67,7 @@ usage: h5dump [OPTIONS] files
-D U, --xml-dtd=U Use the DTD or schema at U
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
- E.g., to dump a file called `-f', use h5dump -- -f
+ E.g., to dump a file called "-f", use h5dump -- -f
--------------- Subsetting Options ---------------
Subsetting is available by using the following options with a dataset
diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl
index 95dfc3b..89160a3 100644
--- a/tools/testfiles/pbits/tpbitsIncomplete.ddl
+++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl
@@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files
--s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
<cred> :: "(<aws-region>,<access-id>,<access-key>)"
If absent or <cred> -> "(,,)", no authentication.
- Has no effect is filedriver is not `ros3'.
+ Has no effect if filedriver is not "ros3".
--hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
For use with "--filedriver=hdfs"
<attrs> :: (<namenode name>,<namenode port>,
@@ -67,7 +67,7 @@ usage: h5dump [OPTIONS] files
-D U, --xml-dtd=U Use the DTD or schema at U
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
- E.g., to dump a file called `-f', use h5dump -- -f
+ E.g., to dump a file called "-f", use h5dump -- -f
--------------- Subsetting Options ---------------
Subsetting is available by using the following options with a dataset
diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl
index 95dfc3b..89160a3 100644
--- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl
@@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files
--s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
<cred> :: "(<aws-region>,<access-id>,<access-key>)"
If absent or <cred> -> "(,,)", no authentication.
- Has no effect is filedriver is not `ros3'.
+ Has no effect if filedriver is not "ros3".
--hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
For use with "--filedriver=hdfs"
<attrs> :: (<namenode name>,<namenode port>,
@@ -67,7 +67,7 @@ usage: h5dump [OPTIONS] files
-D U, --xml-dtd=U Use the DTD or schema at U
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
- E.g., to dump a file called `-f', use h5dump -- -f
+ E.g., to dump a file called "-f", use h5dump -- -f
--------------- Subsetting Options ---------------
Subsetting is available by using the following options with a dataset
diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl
index 95dfc3b..89160a3 100644
--- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl
+++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl
@@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files
--s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
<cred> :: "(<aws-region>,<access-id>,<access-key>)"
If absent or <cred> -> "(,,)", no authentication.
- Has no effect is filedriver is not `ros3'.
+ Has no effect if filedriver is not "ros3".
--hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
For use with "--filedriver=hdfs"
<attrs> :: (<namenode name>,<namenode port>,
@@ -67,7 +67,7 @@ usage: h5dump [OPTIONS] files
-D U, --xml-dtd=U Use the DTD or schema at U
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
- E.g., to dump a file called `-f', use h5dump -- -f
+ E.g., to dump a file called "-f", use h5dump -- -f
--------------- Subsetting Options ---------------
Subsetting is available by using the following options with a dataset
diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl
index 95dfc3b..89160a3 100644
--- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl
@@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files
--s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
<cred> :: "(<aws-region>,<access-id>,<access-key>)"
If absent or <cred> -> "(,,)", no authentication.
- Has no effect is filedriver is not `ros3'.
+ Has no effect if filedriver is not "ros3".
--hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
For use with "--filedriver=hdfs"
<attrs> :: (<namenode name>,<namenode port>,
@@ -67,7 +67,7 @@ usage: h5dump [OPTIONS] files
-D U, --xml-dtd=U Use the DTD or schema at U
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
- E.g., to dump a file called `-f', use h5dump -- -f
+ E.g., to dump a file called "-f", use h5dump -- -f
--------------- Subsetting Options ---------------
Subsetting is available by using the following options with a dataset
diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl
index 95dfc3b..89160a3 100644
--- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl
@@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files
--s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
<cred> :: "(<aws-region>,<access-id>,<access-key>)"
If absent or <cred> -> "(,,)", no authentication.
- Has no effect is filedriver is not `ros3'.
+ Has no effect if filedriver is not "ros3".
--hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
For use with "--filedriver=hdfs"
<attrs> :: (<namenode name>,<namenode port>,
@@ -67,7 +67,7 @@ usage: h5dump [OPTIONS] files
-D U, --xml-dtd=U Use the DTD or schema at U
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
- E.g., to dump a file called `-f', use h5dump -- -f
+ E.g., to dump a file called "-f", use h5dump -- -f
--------------- Subsetting Options ---------------
Subsetting is available by using the following options with a dataset
diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl
index 95dfc3b..89160a3 100644
--- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl
+++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl
@@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files
--s3-cred=<cred> Supply S3 authentication information to "ros3" vfd.
<cred> :: "(<aws-region>,<access-id>,<access-key>)"
If absent or <cred> -> "(,,)", no authentication.
- Has no effect is filedriver is not `ros3'.
+ Has no effect if filedriver is not "ros3".
--hdfs-attrs=<attrs> Supply configuration information for HDFS file access.
For use with "--filedriver=hdfs"
<attrs> :: (<namenode name>,<namenode port>,
@@ -67,7 +67,7 @@ usage: h5dump [OPTIONS] files
-D U, --xml-dtd=U Use the DTD or schema at U
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
- E.g., to dump a file called `-f', use h5dump -- -f
+ E.g., to dump a file called "-f", use h5dump -- -f
--------------- Subsetting Options ---------------
Subsetting is available by using the following options with a dataset
diff --git a/tools/testfiles/tCVE_2018_11206_fill_new.h5 b/tools/testfiles/tCVE_2018_11206_fill_new.h5
new file mode 100644
index 0000000..643591c
--- /dev/null
+++ b/tools/testfiles/tCVE_2018_11206_fill_new.h5
Binary files differ
diff --git a/tools/testfiles/tCVE_2018_11206_fill_old.h5 b/tools/testfiles/tCVE_2018_11206_fill_old.h5
new file mode 100644
index 0000000..7f5b41a
--- /dev/null
+++ b/tools/testfiles/tCVE_2018_11206_fill_old.h5
Binary files differ
diff --git a/tools/testfiles/tfloatsattrs.ddl b/tools/testfiles/tfloatsattrs.ddl
new file mode 100644
index 0000000..11c65b8
--- /dev/null
+++ b/tools/testfiles/tfloatsattrs.ddl
@@ -0,0 +1,621 @@
+HDF5 "tfloatsattrs.h5" {
+GROUP "/" {
+ DATASET "DS128BITS" {
+ DATATYPE 128-bit little-endian floating-point 80-bit precision
+ DATASPACE SIMPLE { ( 8, 128 ) / ( 8, 128 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 16384
+ OFFSET 14416
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ DATA {
+ (0,0): 128, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5,
+ (0,9): 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1.0625,
+ (0,18): 1.125, 1.1875, 1.25, 1.3125, 1.375, 1.4375, 1.5, 1.5625, 1.625,
+ (0,27): 1.6875, 1.75, 1.8125, 1.875, 1.9375, 2, 2.0625, 2.125, 2.1875,
+ (0,36): 2.25, 2.3125, 2.375, 2.4375, 2.5, 2.5625, 2.625, 2.6875, 2.75,
+ (0,45): 2.8125, 2.875, 2.9375, 3, 3.0625, 3.125, 3.1875, 3.25, 3.3125,
+ (0,54): 3.375, 3.4375, 3.5, 3.5625, 3.625, 3.6875, 3.75, 3.8125, 3.875,
+ (0,63): 3.9375, 4, 4.0625, 4.125, 4.1875, 4.25, 4.3125, 4.375, 4.4375,
+ (0,72): 4.5, 4.5625, 4.625, 4.6875, 4.75, 4.8125, 4.875, 4.9375, 5,
+ (0,81): 5.0625, 5.125, 5.1875, 5.25, 5.3125, 5.375, 5.4375, 5.5,
+ (0,89): 5.5625, 5.625, 5.6875, 5.75, 5.8125, 5.875, 5.9375, 6, 6.0625,
+ (0,98): 6.125, 6.1875, 6.25, 6.3125, 6.375, 6.4375, 6.5, 6.5625, 6.625,
+ (0,107): 6.6875, 6.75, 6.8125, 6.875, 6.9375, 7, 7.0625, 7.125, 7.1875,
+ (0,116): 7.25, 7.3125, 7.375, 7.4375, 7.5, 7.5625, 7.625, 7.6875, 7.75,
+ (0,125): 7.8125, 7.875, 7.9375,
+ (1,0): 127, 0.0703125, 0.132812, 0.195312, 0.257812, 0.320312,
+ (1,6): 0.382812, 0.445312, 0.507812, 0.570312, 0.632812, 0.695312,
+ (1,12): 0.757812, 0.820312, 0.882812, 0.945312, 1.00781, 1.07031,
+ (1,18): 1.13281, 1.19531, 1.25781, 1.32031, 1.38281, 1.44531, 1.50781,
+ (1,25): 1.57031, 1.63281, 1.69531, 1.75781, 1.82031, 1.88281, 1.94531,
+ (1,32): 2.00781, 2.07031, 2.13281, 2.19531, 2.25781, 2.32031, 2.38281,
+ (1,39): 2.44531, 2.50781, 2.57031, 2.63281, 2.69531, 2.75781, 2.82031,
+ (1,46): 2.88281, 2.94531, 3.00781, 3.07031, 3.13281, 3.19531, 3.25781,
+ (1,53): 3.32031, 3.38281, 3.44531, 3.50781, 3.57031, 3.63281, 3.69531,
+ (1,60): 3.75781, 3.82031, 3.88281, 3.94531, 4.00781, 4.07031, 4.13281,
+ (1,67): 4.19531, 4.25781, 4.32031, 4.38281, 4.44531, 4.50781, 4.57031,
+ (1,74): 4.63281, 4.69531, 4.75781, 4.82031, 4.88281, 4.94531, 5.00781,
+ (1,81): 5.07031, 5.13281, 5.19531, 5.25781, 5.32031, 5.38281, 5.44531,
+ (1,88): 5.50781, 5.57031, 5.63281, 5.69531, 5.75781, 5.82031, 5.88281,
+ (1,95): 5.94531, 6.00781, 6.07031, 6.13281, 6.19531, 6.25781, 6.32031,
+ (1,102): 6.38281, 6.44531, 6.50781, 6.57031, 6.63281, 6.69531, 6.75781,
+ (1,109): 6.82031, 6.88281, 6.94531, 7.00781, 7.07031, 7.13281, 7.19531,
+ (1,116): 7.25781, 7.32031, 7.38281, 7.44531, 7.50781, 7.57031, 7.63281,
+ (1,123): 7.69531, 7.75781, 7.82031, 7.88281, 7.94531,
+ (2,0): 126, 0.078125, 0.140625, 0.203125, 0.265625, 0.328125, 0.390625,
+ (2,7): 0.453125, 0.515625, 0.578125, 0.640625, 0.703125, 0.765625,
+ (2,13): 0.828125, 0.890625, 0.953125, 1.01562, 1.07812, 1.14062,
+ (2,19): 1.20312, 1.26562, 1.32812, 1.39062, 1.45312, 1.51562, 1.57812,
+ (2,26): 1.64062, 1.70312, 1.76562, 1.82812, 1.89062, 1.95312, 2.01562,
+ (2,33): 2.07812, 2.14062, 2.20312, 2.26562, 2.32812, 2.39062, 2.45312,
+ (2,40): 2.51562, 2.57812, 2.64062, 2.70312, 2.76562, 2.82812, 2.89062,
+ (2,47): 2.95312, 3.01562, 3.07812, 3.14062, 3.20312, 3.26562, 3.32812,
+ (2,54): 3.39062, 3.45312, 3.51562, 3.57812, 3.64062, 3.70312, 3.76562,
+ (2,61): 3.82812, 3.89062, 3.95312, 4.01562, 4.07812, 4.14062, 4.20312,
+ (2,68): 4.26562, 4.32812, 4.39062, 4.45312, 4.51562, 4.57812, 4.64062,
+ (2,75): 4.70312, 4.76562, 4.82812, 4.89062, 4.95312, 5.01562, 5.07812,
+ (2,82): 5.14062, 5.20312, 5.26562, 5.32812, 5.39062, 5.45312, 5.51562,
+ (2,89): 5.57812, 5.64062, 5.70312, 5.76562, 5.82812, 5.89062, 5.95312,
+ (2,96): 6.01562, 6.07812, 6.14062, 6.20312, 6.26562, 6.32812, 6.39062,
+ (2,103): 6.45312, 6.51562, 6.57812, 6.64062, 6.70312, 6.76562, 6.82812,
+ (2,110): 6.89062, 6.95312, 7.01562, 7.07812, 7.14062, 7.20312, 7.26562,
+ (2,117): 7.32812, 7.39062, 7.45312, 7.51562, 7.57812, 7.64062, 7.70312,
+ (2,124): 7.76562, 7.82812, 7.89062, 7.95312,
+ (3,0): 125, 0.0859375, 0.148438, 0.210938, 0.273438, 0.335938,
+ (3,6): 0.398438, 0.460938, 0.523438, 0.585938, 0.648438, 0.710938,
+ (3,12): 0.773438, 0.835938, 0.898438, 0.960938, 1.02344, 1.08594,
+ (3,18): 1.14844, 1.21094, 1.27344, 1.33594, 1.39844, 1.46094, 1.52344,
+ (3,25): 1.58594, 1.64844, 1.71094, 1.77344, 1.83594, 1.89844, 1.96094,
+ (3,32): 2.02344, 2.08594, 2.14844, 2.21094, 2.27344, 2.33594, 2.39844,
+ (3,39): 2.46094, 2.52344, 2.58594, 2.64844, 2.71094, 2.77344, 2.83594,
+ (3,46): 2.89844, 2.96094, 3.02344, 3.08594, 3.14844, 3.21094, 3.27344,
+ (3,53): 3.33594, 3.39844, 3.46094, 3.52344, 3.58594, 3.64844, 3.71094,
+ (3,60): 3.77344, 3.83594, 3.89844, 3.96094, 4.02344, 4.08594, 4.14844,
+ (3,67): 4.21094, 4.27344, 4.33594, 4.39844, 4.46094, 4.52344, 4.58594,
+ (3,74): 4.64844, 4.71094, 4.77344, 4.83594, 4.89844, 4.96094, 5.02344,
+ (3,81): 5.08594, 5.14844, 5.21094, 5.27344, 5.33594, 5.39844, 5.46094,
+ (3,88): 5.52344, 5.58594, 5.64844, 5.71094, 5.77344, 5.83594, 5.89844,
+ (3,95): 5.96094, 6.02344, 6.08594, 6.14844, 6.21094, 6.27344, 6.33594,
+ (3,102): 6.39844, 6.46094, 6.52344, 6.58594, 6.64844, 6.71094, 6.77344,
+ (3,109): 6.83594, 6.89844, 6.96094, 7.02344, 7.08594, 7.14844, 7.21094,
+ (3,116): 7.27344, 7.33594, 7.39844, 7.46094, 7.52344, 7.58594, 7.64844,
+ (3,123): 7.71094, 7.77344, 7.83594, 7.89844, 7.96094,
+ (4,0): 124, 0.09375, 0.15625, 0.21875, 0.28125, 0.34375, 0.40625,
+ (4,7): 0.46875, 0.53125, 0.59375, 0.65625, 0.71875, 0.78125, 0.84375,
+ (4,14): 0.90625, 0.96875, 1.03125, 1.09375, 1.15625, 1.21875, 1.28125,
+ (4,21): 1.34375, 1.40625, 1.46875, 1.53125, 1.59375, 1.65625, 1.71875,
+ (4,28): 1.78125, 1.84375, 1.90625, 1.96875, 2.03125, 2.09375, 2.15625,
+ (4,35): 2.21875, 2.28125, 2.34375, 2.40625, 2.46875, 2.53125, 2.59375,
+ (4,42): 2.65625, 2.71875, 2.78125, 2.84375, 2.90625, 2.96875, 3.03125,
+ (4,49): 3.09375, 3.15625, 3.21875, 3.28125, 3.34375, 3.40625, 3.46875,
+ (4,56): 3.53125, 3.59375, 3.65625, 3.71875, 3.78125, 3.84375, 3.90625,
+ (4,63): 3.96875, 4.03125, 4.09375, 4.15625, 4.21875, 4.28125, 4.34375,
+ (4,70): 4.40625, 4.46875, 4.53125, 4.59375, 4.65625, 4.71875, 4.78125,
+ (4,77): 4.84375, 4.90625, 4.96875, 5.03125, 5.09375, 5.15625, 5.21875,
+ (4,84): 5.28125, 5.34375, 5.40625, 5.46875, 5.53125, 5.59375, 5.65625,
+ (4,91): 5.71875, 5.78125, 5.84375, 5.90625, 5.96875, 6.03125, 6.09375,
+ (4,98): 6.15625, 6.21875, 6.28125, 6.34375, 6.40625, 6.46875, 6.53125,
+ (4,105): 6.59375, 6.65625, 6.71875, 6.78125, 6.84375, 6.90625, 6.96875,
+ (4,112): 7.03125, 7.09375, 7.15625, 7.21875, 7.28125, 7.34375, 7.40625,
+ (4,119): 7.46875, 7.53125, 7.59375, 7.65625, 7.71875, 7.78125, 7.84375,
+ (4,126): 7.90625, 7.96875,
+ (5,0): 123, 0.101562, 0.164062, 0.226562, 0.289062, 0.351562, 0.414062,
+ (5,7): 0.476562, 0.539062, 0.601562, 0.664062, 0.726562, 0.789062,
+ (5,13): 0.851562, 0.914062, 0.976562, 1.03906, 1.10156, 1.16406,
+ (5,19): 1.22656, 1.28906, 1.35156, 1.41406, 1.47656, 1.53906, 1.60156,
+ (5,26): 1.66406, 1.72656, 1.78906, 1.85156, 1.91406, 1.97656, 2.03906,
+ (5,33): 2.10156, 2.16406, 2.22656, 2.28906, 2.35156, 2.41406, 2.47656,
+ (5,40): 2.53906, 2.60156, 2.66406, 2.72656, 2.78906, 2.85156, 2.91406,
+ (5,47): 2.97656, 3.03906, 3.10156, 3.16406, 3.22656, 3.28906, 3.35156,
+ (5,54): 3.41406, 3.47656, 3.53906, 3.60156, 3.66406, 3.72656, 3.78906,
+ (5,61): 3.85156, 3.91406, 3.97656, 4.03906, 4.10156, 4.16406, 4.22656,
+ (5,68): 4.28906, 4.35156, 4.41406, 4.47656, 4.53906, 4.60156, 4.66406,
+ (5,75): 4.72656, 4.78906, 4.85156, 4.91406, 4.97656, 5.03906, 5.10156,
+ (5,82): 5.16406, 5.22656, 5.28906, 5.35156, 5.41406, 5.47656, 5.53906,
+ (5,89): 5.60156, 5.66406, 5.72656, 5.78906, 5.85156, 5.91406, 5.97656,
+ (5,96): 6.03906, 6.10156, 6.16406, 6.22656, 6.28906, 6.35156, 6.41406,
+ (5,103): 6.47656, 6.53906, 6.60156, 6.66406, 6.72656, 6.78906, 6.85156,
+ (5,110): 6.91406, 6.97656, 7.03906, 7.10156, 7.16406, 7.22656, 7.28906,
+ (5,117): 7.35156, 7.41406, 7.47656, 7.53906, 7.60156, 7.66406, 7.72656,
+ (5,124): 7.78906, 7.85156, 7.91406, 7.97656,
+ (6,0): 122, 0.109375, 0.171875, 0.234375, 0.296875, 0.359375, 0.421875,
+ (6,7): 0.484375, 0.546875, 0.609375, 0.671875, 0.734375, 0.796875,
+ (6,13): 0.859375, 0.921875, 0.984375, 1.04688, 1.10938, 1.17188,
+ (6,19): 1.23438, 1.29688, 1.35938, 1.42188, 1.48438, 1.54688, 1.60938,
+ (6,26): 1.67188, 1.73438, 1.79688, 1.85938, 1.92188, 1.98438, 2.04688,
+ (6,33): 2.10938, 2.17188, 2.23438, 2.29688, 2.35938, 2.42188, 2.48438,
+ (6,40): 2.54688, 2.60938, 2.67188, 2.73438, 2.79688, 2.85938, 2.92188,
+ (6,47): 2.98438, 3.04688, 3.10938, 3.17188, 3.23438, 3.29688, 3.35938,
+ (6,54): 3.42188, 3.48438, 3.54688, 3.60938, 3.67188, 3.73438, 3.79688,
+ (6,61): 3.85938, 3.92188, 3.98438, 4.04688, 4.10938, 4.17188, 4.23438,
+ (6,68): 4.29688, 4.35938, 4.42188, 4.48438, 4.54688, 4.60938, 4.67188,
+ (6,75): 4.73438, 4.79688, 4.85938, 4.92188, 4.98438, 5.04688, 5.10938,
+ (6,82): 5.17188, 5.23438, 5.29688, 5.35938, 5.42188, 5.48438, 5.54688,
+ (6,89): 5.60938, 5.67188, 5.73438, 5.79688, 5.85938, 5.92188, 5.98438,
+ (6,96): 6.04688, 6.10938, 6.17188, 6.23438, 6.29688, 6.35938, 6.42188,
+ (6,103): 6.48438, 6.54688, 6.60938, 6.67188, 6.73438, 6.79688, 6.85938,
+ (6,110): 6.92188, 6.98438, 7.04688, 7.10938, 7.17188, 7.23438, 7.29688,
+ (6,117): 7.35938, 7.42188, 7.48438, 7.54688, 7.60938, 7.67188, 7.73438,
+ (6,124): 7.79688, 7.85938, 7.92188, 7.98438,
+ (7,0): 121, 0.117188, 0.179688, 0.242188, 0.304688, 0.367188, 0.429688,
+ (7,7): 0.492188, 0.554688, 0.617188, 0.679688, 0.742188, 0.804688,
+ (7,13): 0.867188, 0.929688, 0.992188, 1.05469, 1.11719, 1.17969,
+ (7,19): 1.24219, 1.30469, 1.36719, 1.42969, 1.49219, 1.55469, 1.61719,
+ (7,26): 1.67969, 1.74219, 1.80469, 1.86719, 1.92969, 1.99219, 2.05469,
+ (7,33): 2.11719, 2.17969, 2.24219, 2.30469, 2.36719, 2.42969, 2.49219,
+ (7,40): 2.55469, 2.61719, 2.67969, 2.74219, 2.80469, 2.86719, 2.92969,
+ (7,47): 2.99219, 3.05469, 3.11719, 3.17969, 3.24219, 3.30469, 3.36719,
+ (7,54): 3.42969, 3.49219, 3.55469, 3.61719, 3.67969, 3.74219, 3.80469,
+ (7,61): 3.86719, 3.92969, 3.99219, 4.05469, 4.11719, 4.17969, 4.24219,
+ (7,68): 4.30469, 4.36719, 4.42969, 4.49219, 4.55469, 4.61719, 4.67969,
+ (7,75): 4.74219, 4.80469, 4.86719, 4.92969, 4.99219, 5.05469, 5.11719,
+ (7,82): 5.17969, 5.24219, 5.30469, 5.36719, 5.42969, 5.49219, 5.55469,
+ (7,89): 5.61719, 5.67969, 5.74219, 5.80469, 5.86719, 5.92969, 5.99219,
+ (7,96): 6.05469, 6.11719, 6.17969, 6.24219, 6.30469, 6.36719, 6.42969,
+ (7,103): 6.49219, 6.55469, 6.61719, 6.67969, 6.74219, 6.80469, 6.86719,
+ (7,110): 6.92969, 6.99219, 7.05469, 7.11719, 7.17969, 7.24219, 7.30469,
+ (7,117): 7.36719, 7.42969, 7.49219, 7.55469, 7.61719, 7.67969, 7.74219,
+ (7,124): 7.80469, 7.86719, 7.92969, 7.99219
+ }
+ ATTRIBUTE "DS128BITS" {
+ DATATYPE 128-bit little-endian floating-point 80-bit precision
+ DATASPACE SIMPLE { ( 1024 ) / ( 1024 ) }
+ DATA {
+ (0): 128, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5,
+ (9): 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1.0625,
+ (18): 1.125, 1.1875, 1.25, 1.3125, 1.375, 1.4375, 1.5, 1.5625,
+ (26): 1.625, 1.6875, 1.75, 1.8125, 1.875, 1.9375, 2, 2.0625, 2.125,
+ (35): 2.1875, 2.25, 2.3125, 2.375, 2.4375, 2.5, 2.5625, 2.625,
+ (43): 2.6875, 2.75, 2.8125, 2.875, 2.9375, 3, 3.0625, 3.125, 3.1875,
+ (52): 3.25, 3.3125, 3.375, 3.4375, 3.5, 3.5625, 3.625, 3.6875, 3.75,
+ (61): 3.8125, 3.875, 3.9375, 4, 4.0625, 4.125, 4.1875, 4.25, 4.3125,
+ (70): 4.375, 4.4375, 4.5, 4.5625, 4.625, 4.6875, 4.75, 4.8125,
+ (78): 4.875, 4.9375, 5, 5.0625, 5.125, 5.1875, 5.25, 5.3125, 5.375,
+ (87): 5.4375, 5.5, 5.5625, 5.625, 5.6875, 5.75, 5.8125, 5.875,
+ (95): 5.9375, 6, 6.0625, 6.125, 6.1875, 6.25, 6.3125, 6.375, 6.4375,
+ (104): 6.5, 6.5625, 6.625, 6.6875, 6.75, 6.8125, 6.875, 6.9375, 7,
+ (113): 7.0625, 7.125, 7.1875, 7.25, 7.3125, 7.375, 7.4375, 7.5,
+ (121): 7.5625, 7.625, 7.6875, 7.75, 7.8125, 7.875, 7.9375, 127,
+ (129): 0.0703125, 0.132812, 0.195312, 0.257812, 0.320312, 0.382812,
+ (135): 0.445312, 0.507812, 0.570312, 0.632812, 0.695312, 0.757812,
+ (141): 0.820312, 0.882812, 0.945312, 1.00781, 1.07031, 1.13281,
+ (147): 1.19531, 1.25781, 1.32031, 1.38281, 1.44531, 1.50781,
+ (153): 1.57031, 1.63281, 1.69531, 1.75781, 1.82031, 1.88281,
+ (159): 1.94531, 2.00781, 2.07031, 2.13281, 2.19531, 2.25781,
+ (165): 2.32031, 2.38281, 2.44531, 2.50781, 2.57031, 2.63281,
+ (171): 2.69531, 2.75781, 2.82031, 2.88281, 2.94531, 3.00781,
+ (177): 3.07031, 3.13281, 3.19531, 3.25781, 3.32031, 3.38281,
+ (183): 3.44531, 3.50781, 3.57031, 3.63281, 3.69531, 3.75781,
+ (189): 3.82031, 3.88281, 3.94531, 4.00781, 4.07031, 4.13281,
+ (195): 4.19531, 4.25781, 4.32031, 4.38281, 4.44531, 4.50781,
+ (201): 4.57031, 4.63281, 4.69531, 4.75781, 4.82031, 4.88281,
+ (207): 4.94531, 5.00781, 5.07031, 5.13281, 5.19531, 5.25781,
+ (213): 5.32031, 5.38281, 5.44531, 5.50781, 5.57031, 5.63281,
+ (219): 5.69531, 5.75781, 5.82031, 5.88281, 5.94531, 6.00781,
+ (225): 6.07031, 6.13281, 6.19531, 6.25781, 6.32031, 6.38281,
+ (231): 6.44531, 6.50781, 6.57031, 6.63281, 6.69531, 6.75781,
+ (237): 6.82031, 6.88281, 6.94531, 7.00781, 7.07031, 7.13281,
+ (243): 7.19531, 7.25781, 7.32031, 7.38281, 7.44531, 7.50781,
+ (249): 7.57031, 7.63281, 7.69531, 7.75781, 7.82031, 7.88281,
+ (255): 7.94531, 126, 0.078125, 0.140625, 0.203125, 0.265625,
+ (261): 0.328125, 0.390625, 0.453125, 0.515625, 0.578125, 0.640625,
+ (267): 0.703125, 0.765625, 0.828125, 0.890625, 0.953125, 1.01562,
+ (273): 1.07812, 1.14062, 1.20312, 1.26562, 1.32812, 1.39062,
+ (279): 1.45312, 1.51562, 1.57812, 1.64062, 1.70312, 1.76562,
+ (285): 1.82812, 1.89062, 1.95312, 2.01562, 2.07812, 2.14062,
+ (291): 2.20312, 2.26562, 2.32812, 2.39062, 2.45312, 2.51562,
+ (297): 2.57812, 2.64062, 2.70312, 2.76562, 2.82812, 2.89062,
+ (303): 2.95312, 3.01562, 3.07812, 3.14062, 3.20312, 3.26562,
+ (309): 3.32812, 3.39062, 3.45312, 3.51562, 3.57812, 3.64062,
+ (315): 3.70312, 3.76562, 3.82812, 3.89062, 3.95312, 4.01562,
+ (321): 4.07812, 4.14062, 4.20312, 4.26562, 4.32812, 4.39062,
+ (327): 4.45312, 4.51562, 4.57812, 4.64062, 4.70312, 4.76562,
+ (333): 4.82812, 4.89062, 4.95312, 5.01562, 5.07812, 5.14062,
+ (339): 5.20312, 5.26562, 5.32812, 5.39062, 5.45312, 5.51562,
+ (345): 5.57812, 5.64062, 5.70312, 5.76562, 5.82812, 5.89062,
+ (351): 5.95312, 6.01562, 6.07812, 6.14062, 6.20312, 6.26562,
+ (357): 6.32812, 6.39062, 6.45312, 6.51562, 6.57812, 6.64062,
+ (363): 6.70312, 6.76562, 6.82812, 6.89062, 6.95312, 7.01562,
+ (369): 7.07812, 7.14062, 7.20312, 7.26562, 7.32812, 7.39062,
+ (375): 7.45312, 7.51562, 7.57812, 7.64062, 7.70312, 7.76562,
+ (381): 7.82812, 7.89062, 7.95312, 125, 0.0859375, 0.148438,
+ (387): 0.210938, 0.273438, 0.335938, 0.398438, 0.460938, 0.523438,
+ (393): 0.585938, 0.648438, 0.710938, 0.773438, 0.835938, 0.898438,
+ (399): 0.960938, 1.02344, 1.08594, 1.14844, 1.21094, 1.27344,
+ (405): 1.33594, 1.39844, 1.46094, 1.52344, 1.58594, 1.64844,
+ (411): 1.71094, 1.77344, 1.83594, 1.89844, 1.96094, 2.02344,
+ (417): 2.08594, 2.14844, 2.21094, 2.27344, 2.33594, 2.39844,
+ (423): 2.46094, 2.52344, 2.58594, 2.64844, 2.71094, 2.77344,
+ (429): 2.83594, 2.89844, 2.96094, 3.02344, 3.08594, 3.14844,
+ (435): 3.21094, 3.27344, 3.33594, 3.39844, 3.46094, 3.52344,
+ (441): 3.58594, 3.64844, 3.71094, 3.77344, 3.83594, 3.89844,
+ (447): 3.96094, 4.02344, 4.08594, 4.14844, 4.21094, 4.27344,
+ (453): 4.33594, 4.39844, 4.46094, 4.52344, 4.58594, 4.64844,
+ (459): 4.71094, 4.77344, 4.83594, 4.89844, 4.96094, 5.02344,
+ (465): 5.08594, 5.14844, 5.21094, 5.27344, 5.33594, 5.39844,
+ (471): 5.46094, 5.52344, 5.58594, 5.64844, 5.71094, 5.77344,
+ (477): 5.83594, 5.89844, 5.96094, 6.02344, 6.08594, 6.14844,
+ (483): 6.21094, 6.27344, 6.33594, 6.39844, 6.46094, 6.52344,
+ (489): 6.58594, 6.64844, 6.71094, 6.77344, 6.83594, 6.89844,
+ (495): 6.96094, 7.02344, 7.08594, 7.14844, 7.21094, 7.27344,
+ (501): 7.33594, 7.39844, 7.46094, 7.52344, 7.58594, 7.64844,
+ (507): 7.71094, 7.77344, 7.83594, 7.89844, 7.96094, 124, 0.09375,
+ (514): 0.15625, 0.21875, 0.28125, 0.34375, 0.40625, 0.46875,
+ (520): 0.53125, 0.59375, 0.65625, 0.71875, 0.78125, 0.84375,
+ (526): 0.90625, 0.96875, 1.03125, 1.09375, 1.15625, 1.21875,
+ (532): 1.28125, 1.34375, 1.40625, 1.46875, 1.53125, 1.59375,
+ (538): 1.65625, 1.71875, 1.78125, 1.84375, 1.90625, 1.96875,
+ (544): 2.03125, 2.09375, 2.15625, 2.21875, 2.28125, 2.34375,
+ (550): 2.40625, 2.46875, 2.53125, 2.59375, 2.65625, 2.71875,
+ (556): 2.78125, 2.84375, 2.90625, 2.96875, 3.03125, 3.09375,
+ (562): 3.15625, 3.21875, 3.28125, 3.34375, 3.40625, 3.46875,
+ (568): 3.53125, 3.59375, 3.65625, 3.71875, 3.78125, 3.84375,
+ (574): 3.90625, 3.96875, 4.03125, 4.09375, 4.15625, 4.21875,
+ (580): 4.28125, 4.34375, 4.40625, 4.46875, 4.53125, 4.59375,
+ (586): 4.65625, 4.71875, 4.78125, 4.84375, 4.90625, 4.96875,
+ (592): 5.03125, 5.09375, 5.15625, 5.21875, 5.28125, 5.34375,
+ (598): 5.40625, 5.46875, 5.53125, 5.59375, 5.65625, 5.71875,
+ (604): 5.78125, 5.84375, 5.90625, 5.96875, 6.03125, 6.09375,
+ (610): 6.15625, 6.21875, 6.28125, 6.34375, 6.40625, 6.46875,
+ (616): 6.53125, 6.59375, 6.65625, 6.71875, 6.78125, 6.84375,
+ (622): 6.90625, 6.96875, 7.03125, 7.09375, 7.15625, 7.21875,
+ (628): 7.28125, 7.34375, 7.40625, 7.46875, 7.53125, 7.59375,
+ (634): 7.65625, 7.71875, 7.78125, 7.84375, 7.90625, 7.96875, 123,
+ (641): 0.101562, 0.164062, 0.226562, 0.289062, 0.351562, 0.414062,
+ (647): 0.476562, 0.539062, 0.601562, 0.664062, 0.726562, 0.789062,
+ (653): 0.851562, 0.914062, 0.976562, 1.03906, 1.10156, 1.16406,
+ (659): 1.22656, 1.28906, 1.35156, 1.41406, 1.47656, 1.53906,
+ (665): 1.60156, 1.66406, 1.72656, 1.78906, 1.85156, 1.91406,
+ (671): 1.97656, 2.03906, 2.10156, 2.16406, 2.22656, 2.28906,
+ (677): 2.35156, 2.41406, 2.47656, 2.53906, 2.60156, 2.66406,
+ (683): 2.72656, 2.78906, 2.85156, 2.91406, 2.97656, 3.03906,
+ (689): 3.10156, 3.16406, 3.22656, 3.28906, 3.35156, 3.41406,
+ (695): 3.47656, 3.53906, 3.60156, 3.66406, 3.72656, 3.78906,
+ (701): 3.85156, 3.91406, 3.97656, 4.03906, 4.10156, 4.16406,
+ (707): 4.22656, 4.28906, 4.35156, 4.41406, 4.47656, 4.53906,
+ (713): 4.60156, 4.66406, 4.72656, 4.78906, 4.85156, 4.91406,
+ (719): 4.97656, 5.03906, 5.10156, 5.16406, 5.22656, 5.28906,
+ (725): 5.35156, 5.41406, 5.47656, 5.53906, 5.60156, 5.66406,
+ (731): 5.72656, 5.78906, 5.85156, 5.91406, 5.97656, 6.03906,
+ (737): 6.10156, 6.16406, 6.22656, 6.28906, 6.35156, 6.41406,
+ (743): 6.47656, 6.53906, 6.60156, 6.66406, 6.72656, 6.78906,
+ (749): 6.85156, 6.91406, 6.97656, 7.03906, 7.10156, 7.16406,
+ (755): 7.22656, 7.28906, 7.35156, 7.41406, 7.47656, 7.53906,
+ (761): 7.60156, 7.66406, 7.72656, 7.78906, 7.85156, 7.91406,
+ (767): 7.97656, 122, 0.109375, 0.171875, 0.234375, 0.296875,
+ (773): 0.359375, 0.421875, 0.484375, 0.546875, 0.609375, 0.671875,
+ (779): 0.734375, 0.796875, 0.859375, 0.921875, 0.984375, 1.04688,
+ (785): 1.10938, 1.17188, 1.23438, 1.29688, 1.35938, 1.42188,
+ (791): 1.48438, 1.54688, 1.60938, 1.67188, 1.73438, 1.79688,
+ (797): 1.85938, 1.92188, 1.98438, 2.04688, 2.10938, 2.17188,
+ (803): 2.23438, 2.29688, 2.35938, 2.42188, 2.48438, 2.54688,
+ (809): 2.60938, 2.67188, 2.73438, 2.79688, 2.85938, 2.92188,
+ (815): 2.98438, 3.04688, 3.10938, 3.17188, 3.23438, 3.29688,
+ (821): 3.35938, 3.42188, 3.48438, 3.54688, 3.60938, 3.67188,
+ (827): 3.73438, 3.79688, 3.85938, 3.92188, 3.98438, 4.04688,
+ (833): 4.10938, 4.17188, 4.23438, 4.29688, 4.35938, 4.42188,
+ (839): 4.48438, 4.54688, 4.60938, 4.67188, 4.73438, 4.79688,
+ (845): 4.85938, 4.92188, 4.98438, 5.04688, 5.10938, 5.17188,
+ (851): 5.23438, 5.29688, 5.35938, 5.42188, 5.48438, 5.54688,
+ (857): 5.60938, 5.67188, 5.73438, 5.79688, 5.85938, 5.92188,
+ (863): 5.98438, 6.04688, 6.10938, 6.17188, 6.23438, 6.29688,
+ (869): 6.35938, 6.42188, 6.48438, 6.54688, 6.60938, 6.67188,
+ (875): 6.73438, 6.79688, 6.85938, 6.92188, 6.98438, 7.04688,
+ (881): 7.10938, 7.17188, 7.23438, 7.29688, 7.35938, 7.42188,
+ (887): 7.48438, 7.54688, 7.60938, 7.67188, 7.73438, 7.79688,
+ (893): 7.85938, 7.92188, 7.98438, 121, 0.117188, 0.179688, 0.242188,
+ (900): 0.304688, 0.367188, 0.429688, 0.492188, 0.554688, 0.617188,
+ (906): 0.679688, 0.742188, 0.804688, 0.867188, 0.929688, 0.992188,
+ (912): 1.05469, 1.11719, 1.17969, 1.24219, 1.30469, 1.36719,
+ (918): 1.42969, 1.49219, 1.55469, 1.61719, 1.67969, 1.74219,
+ (924): 1.80469, 1.86719, 1.92969, 1.99219, 2.05469, 2.11719,
+ (930): 2.17969, 2.24219, 2.30469, 2.36719, 2.42969, 2.49219,
+ (936): 2.55469, 2.61719, 2.67969, 2.74219, 2.80469, 2.86719,
+ (942): 2.92969, 2.99219, 3.05469, 3.11719, 3.17969, 3.24219,
+ (948): 3.30469, 3.36719, 3.42969, 3.49219, 3.55469, 3.61719,
+ (954): 3.67969, 3.74219, 3.80469, 3.86719, 3.92969, 3.99219,
+ (960): 4.05469, 4.11719, 4.17969, 4.24219, 4.30469, 4.36719,
+ (966): 4.42969, 4.49219, 4.55469, 4.61719, 4.67969, 4.74219,
+ (972): 4.80469, 4.86719, 4.92969, 4.99219, 5.05469, 5.11719,
+ (978): 5.17969, 5.24219, 5.30469, 5.36719, 5.42969, 5.49219,
+ (984): 5.55469, 5.61719, 5.67969, 5.74219, 5.80469, 5.86719,
+ (990): 5.92969, 5.99219, 6.05469, 6.11719, 6.17969, 6.24219,
+ (996): 6.30469, 6.36719, 6.42969, 6.49219, 6.55469, 6.61719,
+ (1002): 6.67969, 6.74219, 6.80469, 6.86719, 6.92969, 6.99219,
+ (1008): 7.05469, 7.11719, 7.17969, 7.24219, 7.30469, 7.36719,
+ (1014): 7.42969, 7.49219, 7.55469, 7.61719, 7.67969, 7.74219,
+ (1020): 7.80469, 7.86719, 7.92969, 7.99219
+ }
+ }
+ }
+ DATASET "DS32BITS" {
+ DATATYPE H5T_IEEE_F32LE
+ DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 1024
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ DATA {
+ (0,0): 32, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3,
+ (0,13): 3.25, 3.5, 3.75, 4, 4.25, 4.5, 4.75, 5, 5.25, 5.5, 5.75, 6,
+ (0,25): 6.25, 6.5, 6.75, 7, 7.25, 7.5, 7.75,
+ (1,0): 31, 0.28125, 0.53125, 0.78125, 1.03125, 1.28125, 1.53125,
+ (1,7): 1.78125, 2.03125, 2.28125, 2.53125, 2.78125, 3.03125, 3.28125,
+ (1,14): 3.53125, 3.78125, 4.03125, 4.28125, 4.53125, 4.78125, 5.03125,
+ (1,21): 5.28125, 5.53125, 5.78125, 6.03125, 6.28125, 6.53125, 6.78125,
+ (1,28): 7.03125, 7.28125, 7.53125, 7.78125,
+ (2,0): 30, 0.3125, 0.5625, 0.8125, 1.0625, 1.3125, 1.5625, 1.8125,
+ (2,8): 2.0625, 2.3125, 2.5625, 2.8125, 3.0625, 3.3125, 3.5625, 3.8125,
+ (2,16): 4.0625, 4.3125, 4.5625, 4.8125, 5.0625, 5.3125, 5.5625, 5.8125,
+ (2,24): 6.0625, 6.3125, 6.5625, 6.8125, 7.0625, 7.3125, 7.5625, 7.8125,
+ (3,0): 29, 0.34375, 0.59375, 0.84375, 1.09375, 1.34375, 1.59375,
+ (3,7): 1.84375, 2.09375, 2.34375, 2.59375, 2.84375, 3.09375, 3.34375,
+ (3,14): 3.59375, 3.84375, 4.09375, 4.34375, 4.59375, 4.84375, 5.09375,
+ (3,21): 5.34375, 5.59375, 5.84375, 6.09375, 6.34375, 6.59375, 6.84375,
+ (3,28): 7.09375, 7.34375, 7.59375, 7.84375,
+ (4,0): 28, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875, 2.125,
+ (4,9): 2.375, 2.625, 2.875, 3.125, 3.375, 3.625, 3.875, 4.125, 4.375,
+ (4,18): 4.625, 4.875, 5.125, 5.375, 5.625, 5.875, 6.125, 6.375, 6.625,
+ (4,27): 6.875, 7.125, 7.375, 7.625, 7.875,
+ (5,0): 27, 0.40625, 0.65625, 0.90625, 1.15625, 1.40625, 1.65625,
+ (5,7): 1.90625, 2.15625, 2.40625, 2.65625, 2.90625, 3.15625, 3.40625,
+ (5,14): 3.65625, 3.90625, 4.15625, 4.40625, 4.65625, 4.90625, 5.15625,
+ (5,21): 5.40625, 5.65625, 5.90625, 6.15625, 6.40625, 6.65625, 6.90625,
+ (5,28): 7.15625, 7.40625, 7.65625, 7.90625,
+ (6,0): 26, 0.4375, 0.6875, 0.9375, 1.1875, 1.4375, 1.6875, 1.9375,
+ (6,8): 2.1875, 2.4375, 2.6875, 2.9375, 3.1875, 3.4375, 3.6875, 3.9375,
+ (6,16): 4.1875, 4.4375, 4.6875, 4.9375, 5.1875, 5.4375, 5.6875, 5.9375,
+ (6,24): 6.1875, 6.4375, 6.6875, 6.9375, 7.1875, 7.4375, 7.6875, 7.9375,
+ (7,0): 25, 0.46875, 0.71875, 0.96875, 1.21875, 1.46875, 1.71875,
+ (7,7): 1.96875, 2.21875, 2.46875, 2.71875, 2.96875, 3.21875, 3.46875,
+ (7,14): 3.71875, 3.96875, 4.21875, 4.46875, 4.71875, 4.96875, 5.21875,
+ (7,21): 5.46875, 5.71875, 5.96875, 6.21875, 6.46875, 6.71875, 6.96875,
+ (7,28): 7.21875, 7.46875, 7.71875, 7.96875
+ }
+ ATTRIBUTE "DS32BITS" {
+ DATATYPE H5T_IEEE_F32LE
+ DATASPACE SIMPLE { ( 256 ) / ( 256 ) }
+ DATA {
+ (0): 32, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3,
+ (13): 3.25, 3.5, 3.75, 4, 4.25, 4.5, 4.75, 5, 5.25, 5.5, 5.75, 6,
+ (25): 6.25, 6.5, 6.75, 7, 7.25, 7.5, 7.75, 31, 0.28125, 0.53125,
+ (35): 0.78125, 1.03125, 1.28125, 1.53125, 1.78125, 2.03125, 2.28125,
+ (42): 2.53125, 2.78125, 3.03125, 3.28125, 3.53125, 3.78125, 4.03125,
+ (49): 4.28125, 4.53125, 4.78125, 5.03125, 5.28125, 5.53125, 5.78125,
+ (56): 6.03125, 6.28125, 6.53125, 6.78125, 7.03125, 7.28125, 7.53125,
+ (63): 7.78125, 30, 0.3125, 0.5625, 0.8125, 1.0625, 1.3125, 1.5625,
+ (71): 1.8125, 2.0625, 2.3125, 2.5625, 2.8125, 3.0625, 3.3125,
+ (78): 3.5625, 3.8125, 4.0625, 4.3125, 4.5625, 4.8125, 5.0625,
+ (85): 5.3125, 5.5625, 5.8125, 6.0625, 6.3125, 6.5625, 6.8125,
+ (92): 7.0625, 7.3125, 7.5625, 7.8125, 29, 0.34375, 0.59375, 0.84375,
+ (100): 1.09375, 1.34375, 1.59375, 1.84375, 2.09375, 2.34375,
+ (106): 2.59375, 2.84375, 3.09375, 3.34375, 3.59375, 3.84375,
+ (112): 4.09375, 4.34375, 4.59375, 4.84375, 5.09375, 5.34375,
+ (118): 5.59375, 5.84375, 6.09375, 6.34375, 6.59375, 6.84375,
+ (124): 7.09375, 7.34375, 7.59375, 7.84375, 28, 0.375, 0.625, 0.875,
+ (132): 1.125, 1.375, 1.625, 1.875, 2.125, 2.375, 2.625, 2.875,
+ (140): 3.125, 3.375, 3.625, 3.875, 4.125, 4.375, 4.625, 4.875,
+ (148): 5.125, 5.375, 5.625, 5.875, 6.125, 6.375, 6.625, 6.875,
+ (156): 7.125, 7.375, 7.625, 7.875, 27, 0.40625, 0.65625, 0.90625,
+ (164): 1.15625, 1.40625, 1.65625, 1.90625, 2.15625, 2.40625,
+ (170): 2.65625, 2.90625, 3.15625, 3.40625, 3.65625, 3.90625,
+ (176): 4.15625, 4.40625, 4.65625, 4.90625, 5.15625, 5.40625,
+ (182): 5.65625, 5.90625, 6.15625, 6.40625, 6.65625, 6.90625,
+ (188): 7.15625, 7.40625, 7.65625, 7.90625, 26, 0.4375, 0.6875,
+ (195): 0.9375, 1.1875, 1.4375, 1.6875, 1.9375, 2.1875, 2.4375,
+ (202): 2.6875, 2.9375, 3.1875, 3.4375, 3.6875, 3.9375, 4.1875,
+ (209): 4.4375, 4.6875, 4.9375, 5.1875, 5.4375, 5.6875, 5.9375,
+ (216): 6.1875, 6.4375, 6.6875, 6.9375, 7.1875, 7.4375, 7.6875,
+ (223): 7.9375, 25, 0.46875, 0.71875, 0.96875, 1.21875, 1.46875,
+ (230): 1.71875, 1.96875, 2.21875, 2.46875, 2.71875, 2.96875,
+ (236): 3.21875, 3.46875, 3.71875, 3.96875, 4.21875, 4.46875,
+ (242): 4.71875, 4.96875, 5.21875, 5.46875, 5.71875, 5.96875,
+ (248): 6.21875, 6.46875, 6.71875, 6.96875, 7.21875, 7.46875,
+ (254): 7.71875, 7.96875
+ }
+ }
+ }
+ DATASET "DS64BITS" {
+ DATATYPE H5T_IEEE_F64LE
+ DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 4096
+ OFFSET 6144
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ DATA {
+ (0,0): 64, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125, 1.25,
+ (0,11): 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375, 2.5,
+ (0,21): 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625, 3.75,
+ (0,31): 3.875, 4, 4.125, 4.25, 4.375, 4.5, 4.625, 4.75, 4.875, 5,
+ (0,41): 5.125, 5.25, 5.375, 5.5, 5.625, 5.75, 5.875, 6, 6.125, 6.25,
+ (0,51): 6.375, 6.5, 6.625, 6.75, 6.875, 7, 7.125, 7.25, 7.375, 7.5,
+ (0,61): 7.625, 7.75, 7.875,
+ (1,0): 63, 0.140625, 0.265625, 0.390625, 0.515625, 0.640625, 0.765625,
+ (1,7): 0.890625, 1.01562, 1.14062, 1.26562, 1.39062, 1.51562, 1.64062,
+ (1,14): 1.76562, 1.89062, 2.01562, 2.14062, 2.26562, 2.39062, 2.51562,
+ (1,21): 2.64062, 2.76562, 2.89062, 3.01562, 3.14062, 3.26562, 3.39062,
+ (1,28): 3.51562, 3.64062, 3.76562, 3.89062, 4.01562, 4.14062, 4.26562,
+ (1,35): 4.39062, 4.51562, 4.64062, 4.76562, 4.89062, 5.01562, 5.14062,
+ (1,42): 5.26562, 5.39062, 5.51562, 5.64062, 5.76562, 5.89062, 6.01562,
+ (1,49): 6.14062, 6.26562, 6.39062, 6.51562, 6.64062, 6.76562, 6.89062,
+ (1,56): 7.01562, 7.14062, 7.26562, 7.39062, 7.51562, 7.64062, 7.76562,
+ (1,63): 7.89062,
+ (2,0): 62, 0.15625, 0.28125, 0.40625, 0.53125, 0.65625, 0.78125,
+ (2,7): 0.90625, 1.03125, 1.15625, 1.28125, 1.40625, 1.53125, 1.65625,
+ (2,14): 1.78125, 1.90625, 2.03125, 2.15625, 2.28125, 2.40625, 2.53125,
+ (2,21): 2.65625, 2.78125, 2.90625, 3.03125, 3.15625, 3.28125, 3.40625,
+ (2,28): 3.53125, 3.65625, 3.78125, 3.90625, 4.03125, 4.15625, 4.28125,
+ (2,35): 4.40625, 4.53125, 4.65625, 4.78125, 4.90625, 5.03125, 5.15625,
+ (2,42): 5.28125, 5.40625, 5.53125, 5.65625, 5.78125, 5.90625, 6.03125,
+ (2,49): 6.15625, 6.28125, 6.40625, 6.53125, 6.65625, 6.78125, 6.90625,
+ (2,56): 7.03125, 7.15625, 7.28125, 7.40625, 7.53125, 7.65625, 7.78125,
+ (2,63): 7.90625,
+ (3,0): 61, 0.171875, 0.296875, 0.421875, 0.546875, 0.671875, 0.796875,
+ (3,7): 0.921875, 1.04688, 1.17188, 1.29688, 1.42188, 1.54688, 1.67188,
+ (3,14): 1.79688, 1.92188, 2.04688, 2.17188, 2.29688, 2.42188, 2.54688,
+ (3,21): 2.67188, 2.79688, 2.92188, 3.04688, 3.17188, 3.29688, 3.42188,
+ (3,28): 3.54688, 3.67188, 3.79688, 3.92188, 4.04688, 4.17188, 4.29688,
+ (3,35): 4.42188, 4.54688, 4.67188, 4.79688, 4.92188, 5.04688, 5.17188,
+ (3,42): 5.29688, 5.42188, 5.54688, 5.67188, 5.79688, 5.92188, 6.04688,
+ (3,49): 6.17188, 6.29688, 6.42188, 6.54688, 6.67188, 6.79688, 6.92188,
+ (3,56): 7.04688, 7.17188, 7.29688, 7.42188, 7.54688, 7.67188, 7.79688,
+ (3,63): 7.92188,
+ (4,0): 60, 0.1875, 0.3125, 0.4375, 0.5625, 0.6875, 0.8125, 0.9375,
+ (4,8): 1.0625, 1.1875, 1.3125, 1.4375, 1.5625, 1.6875, 1.8125, 1.9375,
+ (4,16): 2.0625, 2.1875, 2.3125, 2.4375, 2.5625, 2.6875, 2.8125, 2.9375,
+ (4,24): 3.0625, 3.1875, 3.3125, 3.4375, 3.5625, 3.6875, 3.8125, 3.9375,
+ (4,32): 4.0625, 4.1875, 4.3125, 4.4375, 4.5625, 4.6875, 4.8125, 4.9375,
+ (4,40): 5.0625, 5.1875, 5.3125, 5.4375, 5.5625, 5.6875, 5.8125, 5.9375,
+ (4,48): 6.0625, 6.1875, 6.3125, 6.4375, 6.5625, 6.6875, 6.8125, 6.9375,
+ (4,56): 7.0625, 7.1875, 7.3125, 7.4375, 7.5625, 7.6875, 7.8125, 7.9375,
+ (5,0): 59, 0.203125, 0.328125, 0.453125, 0.578125, 0.703125, 0.828125,
+ (5,7): 0.953125, 1.07812, 1.20312, 1.32812, 1.45312, 1.57812, 1.70312,
+ (5,14): 1.82812, 1.95312, 2.07812, 2.20312, 2.32812, 2.45312, 2.57812,
+ (5,21): 2.70312, 2.82812, 2.95312, 3.07812, 3.20312, 3.32812, 3.45312,
+ (5,28): 3.57812, 3.70312, 3.82812, 3.95312, 4.07812, 4.20312, 4.32812,
+ (5,35): 4.45312, 4.57812, 4.70312, 4.82812, 4.95312, 5.07812, 5.20312,
+ (5,42): 5.32812, 5.45312, 5.57812, 5.70312, 5.82812, 5.95312, 6.07812,
+ (5,49): 6.20312, 6.32812, 6.45312, 6.57812, 6.70312, 6.82812, 6.95312,
+ (5,56): 7.07812, 7.20312, 7.32812, 7.45312, 7.57812, 7.70312, 7.82812,
+ (5,63): 7.95312,
+ (6,0): 58, 0.21875, 0.34375, 0.46875, 0.59375, 0.71875, 0.84375,
+ (6,7): 0.96875, 1.09375, 1.21875, 1.34375, 1.46875, 1.59375, 1.71875,
+ (6,14): 1.84375, 1.96875, 2.09375, 2.21875, 2.34375, 2.46875, 2.59375,
+ (6,21): 2.71875, 2.84375, 2.96875, 3.09375, 3.21875, 3.34375, 3.46875,
+ (6,28): 3.59375, 3.71875, 3.84375, 3.96875, 4.09375, 4.21875, 4.34375,
+ (6,35): 4.46875, 4.59375, 4.71875, 4.84375, 4.96875, 5.09375, 5.21875,
+ (6,42): 5.34375, 5.46875, 5.59375, 5.71875, 5.84375, 5.96875, 6.09375,
+ (6,49): 6.21875, 6.34375, 6.46875, 6.59375, 6.71875, 6.84375, 6.96875,
+ (6,56): 7.09375, 7.21875, 7.34375, 7.46875, 7.59375, 7.71875, 7.84375,
+ (6,63): 7.96875,
+ (7,0): 57, 0.234375, 0.359375, 0.484375, 0.609375, 0.734375, 0.859375,
+ (7,7): 0.984375, 1.10938, 1.23438, 1.35938, 1.48438, 1.60938, 1.73438,
+ (7,14): 1.85938, 1.98438, 2.10938, 2.23438, 2.35938, 2.48438, 2.60938,
+ (7,21): 2.73438, 2.85938, 2.98438, 3.10938, 3.23438, 3.35938, 3.48438,
+ (7,28): 3.60938, 3.73438, 3.85938, 3.98438, 4.10938, 4.23438, 4.35938,
+ (7,35): 4.48438, 4.60938, 4.73438, 4.85938, 4.98438, 5.10938, 5.23438,
+ (7,42): 5.35938, 5.48438, 5.60938, 5.73438, 5.85938, 5.98438, 6.10938,
+ (7,49): 6.23438, 6.35938, 6.48438, 6.60938, 6.73438, 6.85938, 6.98438,
+ (7,56): 7.10938, 7.23438, 7.35938, 7.48438, 7.60938, 7.73438, 7.85938,
+ (7,63): 7.98438
+ }
+ ATTRIBUTE "DS64BITS" {
+ DATATYPE H5T_IEEE_F64LE
+ DATASPACE SIMPLE { ( 512 ) / ( 512 ) }
+ DATA {
+ (0): 64, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125,
+ (10): 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375,
+ (20): 2.5, 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625,
+ (30): 3.75, 3.875, 4, 4.125, 4.25, 4.375, 4.5, 4.625, 4.75, 4.875,
+ (40): 5, 5.125, 5.25, 5.375, 5.5, 5.625, 5.75, 5.875, 6, 6.125,
+ (50): 6.25, 6.375, 6.5, 6.625, 6.75, 6.875, 7, 7.125, 7.25, 7.375,
+ (60): 7.5, 7.625, 7.75, 7.875, 63, 0.140625, 0.265625, 0.390625,
+ (68): 0.515625, 0.640625, 0.765625, 0.890625, 1.01562, 1.14062,
+ (74): 1.26562, 1.39062, 1.51562, 1.64062, 1.76562, 1.89062, 2.01562,
+ (81): 2.14062, 2.26562, 2.39062, 2.51562, 2.64062, 2.76562, 2.89062,
+ (88): 3.01562, 3.14062, 3.26562, 3.39062, 3.51562, 3.64062, 3.76562,
+ (95): 3.89062, 4.01562, 4.14062, 4.26562, 4.39062, 4.51562, 4.64062,
+ (102): 4.76562, 4.89062, 5.01562, 5.14062, 5.26562, 5.39062,
+ (108): 5.51562, 5.64062, 5.76562, 5.89062, 6.01562, 6.14062,
+ (114): 6.26562, 6.39062, 6.51562, 6.64062, 6.76562, 6.89062,
+ (120): 7.01562, 7.14062, 7.26562, 7.39062, 7.51562, 7.64062,
+ (126): 7.76562, 7.89062, 62, 0.15625, 0.28125, 0.40625, 0.53125,
+ (133): 0.65625, 0.78125, 0.90625, 1.03125, 1.15625, 1.28125,
+ (139): 1.40625, 1.53125, 1.65625, 1.78125, 1.90625, 2.03125,
+ (145): 2.15625, 2.28125, 2.40625, 2.53125, 2.65625, 2.78125,
+ (151): 2.90625, 3.03125, 3.15625, 3.28125, 3.40625, 3.53125,
+ (157): 3.65625, 3.78125, 3.90625, 4.03125, 4.15625, 4.28125,
+ (163): 4.40625, 4.53125, 4.65625, 4.78125, 4.90625, 5.03125,
+ (169): 5.15625, 5.28125, 5.40625, 5.53125, 5.65625, 5.78125,
+ (175): 5.90625, 6.03125, 6.15625, 6.28125, 6.40625, 6.53125,
+ (181): 6.65625, 6.78125, 6.90625, 7.03125, 7.15625, 7.28125,
+ (187): 7.40625, 7.53125, 7.65625, 7.78125, 7.90625, 61, 0.171875,
+ (194): 0.296875, 0.421875, 0.546875, 0.671875, 0.796875, 0.921875,
+ (200): 1.04688, 1.17188, 1.29688, 1.42188, 1.54688, 1.67188,
+ (206): 1.79688, 1.92188, 2.04688, 2.17188, 2.29688, 2.42188,
+ (212): 2.54688, 2.67188, 2.79688, 2.92188, 3.04688, 3.17188,
+ (218): 3.29688, 3.42188, 3.54688, 3.67188, 3.79688, 3.92188,
+ (224): 4.04688, 4.17188, 4.29688, 4.42188, 4.54688, 4.67188,
+ (230): 4.79688, 4.92188, 5.04688, 5.17188, 5.29688, 5.42188,
+ (236): 5.54688, 5.67188, 5.79688, 5.92188, 6.04688, 6.17188,
+ (242): 6.29688, 6.42188, 6.54688, 6.67188, 6.79688, 6.92188,
+ (248): 7.04688, 7.17188, 7.29688, 7.42188, 7.54688, 7.67188,
+ (254): 7.79688, 7.92188, 60, 0.1875, 0.3125, 0.4375, 0.5625, 0.6875,
+ (262): 0.8125, 0.9375, 1.0625, 1.1875, 1.3125, 1.4375, 1.5625,
+ (269): 1.6875, 1.8125, 1.9375, 2.0625, 2.1875, 2.3125, 2.4375,
+ (276): 2.5625, 2.6875, 2.8125, 2.9375, 3.0625, 3.1875, 3.3125,
+ (283): 3.4375, 3.5625, 3.6875, 3.8125, 3.9375, 4.0625, 4.1875,
+ (290): 4.3125, 4.4375, 4.5625, 4.6875, 4.8125, 4.9375, 5.0625,
+ (297): 5.1875, 5.3125, 5.4375, 5.5625, 5.6875, 5.8125, 5.9375,
+ (304): 6.0625, 6.1875, 6.3125, 6.4375, 6.5625, 6.6875, 6.8125,
+ (311): 6.9375, 7.0625, 7.1875, 7.3125, 7.4375, 7.5625, 7.6875,
+ (318): 7.8125, 7.9375, 59, 0.203125, 0.328125, 0.453125, 0.578125,
+ (325): 0.703125, 0.828125, 0.953125, 1.07812, 1.20312, 1.32812,
+ (331): 1.45312, 1.57812, 1.70312, 1.82812, 1.95312, 2.07812,
+ (337): 2.20312, 2.32812, 2.45312, 2.57812, 2.70312, 2.82812,
+ (343): 2.95312, 3.07812, 3.20312, 3.32812, 3.45312, 3.57812,
+ (349): 3.70312, 3.82812, 3.95312, 4.07812, 4.20312, 4.32812,
+ (355): 4.45312, 4.57812, 4.70312, 4.82812, 4.95312, 5.07812,
+ (361): 5.20312, 5.32812, 5.45312, 5.57812, 5.70312, 5.82812,
+ (367): 5.95312, 6.07812, 6.20312, 6.32812, 6.45312, 6.57812,
+ (373): 6.70312, 6.82812, 6.95312, 7.07812, 7.20312, 7.32812,
+ (379): 7.45312, 7.57812, 7.70312, 7.82812, 7.95312, 58, 0.21875,
+ (386): 0.34375, 0.46875, 0.59375, 0.71875, 0.84375, 0.96875,
+ (392): 1.09375, 1.21875, 1.34375, 1.46875, 1.59375, 1.71875,
+ (398): 1.84375, 1.96875, 2.09375, 2.21875, 2.34375, 2.46875,
+ (404): 2.59375, 2.71875, 2.84375, 2.96875, 3.09375, 3.21875,
+ (410): 3.34375, 3.46875, 3.59375, 3.71875, 3.84375, 3.96875,
+ (416): 4.09375, 4.21875, 4.34375, 4.46875, 4.59375, 4.71875,
+ (422): 4.84375, 4.96875, 5.09375, 5.21875, 5.34375, 5.46875,
+ (428): 5.59375, 5.71875, 5.84375, 5.96875, 6.09375, 6.21875,
+ (434): 6.34375, 6.46875, 6.59375, 6.71875, 6.84375, 6.96875,
+ (440): 7.09375, 7.21875, 7.34375, 7.46875, 7.59375, 7.71875,
+ (446): 7.84375, 7.96875, 57, 0.234375, 0.359375, 0.484375, 0.609375,
+ (453): 0.734375, 0.859375, 0.984375, 1.10938, 1.23438, 1.35938,
+ (459): 1.48438, 1.60938, 1.73438, 1.85938, 1.98438, 2.10938,
+ (465): 2.23438, 2.35938, 2.48438, 2.60938, 2.73438, 2.85938,
+ (471): 2.98438, 3.10938, 3.23438, 3.35938, 3.48438, 3.60938,
+ (477): 3.73438, 3.85938, 3.98438, 4.10938, 4.23438, 4.35938,
+ (483): 4.48438, 4.60938, 4.73438, 4.85938, 4.98438, 5.10938,
+ (489): 5.23438, 5.35938, 5.48438, 5.60938, 5.73438, 5.85938,
+ (495): 5.98438, 6.10938, 6.23438, 6.35938, 6.48438, 6.60938,
+ (501): 6.73438, 6.85938, 6.98438, 7.10938, 7.23438, 7.35938,
+ (507): 7.48438, 7.60938, 7.73438, 7.85938, 7.98438
+ }
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tfloatsattrs.h5 b/tools/testfiles/tfloatsattrs.h5
new file mode 100644
index 0000000..9e73542
--- /dev/null
+++ b/tools/testfiles/tfloatsattrs.h5
Binary files differ
diff --git a/tools/testfiles/tfloatsattrs.wddl b/tools/testfiles/tfloatsattrs.wddl
new file mode 100644
index 0000000..38b735f
--- /dev/null
+++ b/tools/testfiles/tfloatsattrs.wddl
@@ -0,0 +1,621 @@
+HDF5 "tfloatsattrs.h5" {
+GROUP "/" {
+ DATASET "DS128BITS" {
+ DATATYPE 128-bit little-endian floating-point 80-bit precision
+ DATASPACE SIMPLE { ( 8, 128 ) / ( 8, 128 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 16384
+ OFFSET 14416
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ DATA {
+ (0,0): 128, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5,
+ (0,9): 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1.0625,
+ (0,18): 1.125, 1.1875, 1.25, 1.3125, 1.375, 1.4375, 1.5, 1.5625, 1.625,
+ (0,27): 1.6875, 1.75, 1.8125, 1.875, 1.9375, 2, 2.0625, 2.125, 2.1875,
+ (0,36): 2.25, 2.3125, 2.375, 2.4375, 2.5, 2.5625, 2.625, 2.6875, 2.75,
+ (0,45): 2.8125, 2.875, 2.9375, 3, 3.0625, 3.125, 3.1875, 3.25, 3.3125,
+ (0,54): 3.375, 3.4375, 3.5, 3.5625, 3.625, 3.6875, 3.75, 3.8125, 3.875,
+ (0,63): 3.9375, 4, 4.0625, 4.125, 4.1875, 4.25, 4.3125, 4.375, 4.4375,
+ (0,72): 4.5, 4.5625, 4.625, 4.6875, 4.75, 4.8125, 4.875, 4.9375, 5,
+ (0,81): 5.0625, 5.125, 5.1875, 5.25, 5.3125, 5.375, 5.4375, 5.5,
+ (0,89): 5.5625, 5.625, 5.6875, 5.75, 5.8125, 5.875, 5.9375, 6, 6.0625,
+ (0,98): 6.125, 6.1875, 6.25, 6.3125, 6.375, 6.4375, 6.5, 6.5625, 6.625,
+ (0,107): 6.6875, 6.75, 6.8125, 6.875, 6.9375, 7, 7.0625, 7.125, 7.1875,
+ (0,116): 7.25, 7.3125, 7.375, 7.4375, 7.5, 7.5625, 7.625, 7.6875, 7.75,
+ (0,125): 7.8125, 7.875, 7.9375,
+ (1,0): 127, 0.0703125, 0.132813, 0.195313, 0.257813, 0.320313,
+ (1,6): 0.382813, 0.445313, 0.507813, 0.570313, 0.632813, 0.695313,
+ (1,12): 0.757813, 0.820313, 0.882813, 0.945313, 1.00781, 1.07031,
+ (1,18): 1.13281, 1.19531, 1.25781, 1.32031, 1.38281, 1.44531, 1.50781,
+ (1,25): 1.57031, 1.63281, 1.69531, 1.75781, 1.82031, 1.88281, 1.94531,
+ (1,32): 2.00781, 2.07031, 2.13281, 2.19531, 2.25781, 2.32031, 2.38281,
+ (1,39): 2.44531, 2.50781, 2.57031, 2.63281, 2.69531, 2.75781, 2.82031,
+ (1,46): 2.88281, 2.94531, 3.00781, 3.07031, 3.13281, 3.19531, 3.25781,
+ (1,53): 3.32031, 3.38281, 3.44531, 3.50781, 3.57031, 3.63281, 3.69531,
+ (1,60): 3.75781, 3.82031, 3.88281, 3.94531, 4.00781, 4.07031, 4.13281,
+ (1,67): 4.19531, 4.25781, 4.32031, 4.38281, 4.44531, 4.50781, 4.57031,
+ (1,74): 4.63281, 4.69531, 4.75781, 4.82031, 4.88281, 4.94531, 5.00781,
+ (1,81): 5.07031, 5.13281, 5.19531, 5.25781, 5.32031, 5.38281, 5.44531,
+ (1,88): 5.50781, 5.57031, 5.63281, 5.69531, 5.75781, 5.82031, 5.88281,
+ (1,95): 5.94531, 6.00781, 6.07031, 6.13281, 6.19531, 6.25781, 6.32031,
+ (1,102): 6.38281, 6.44531, 6.50781, 6.57031, 6.63281, 6.69531, 6.75781,
+ (1,109): 6.82031, 6.88281, 6.94531, 7.00781, 7.07031, 7.13281, 7.19531,
+ (1,116): 7.25781, 7.32031, 7.38281, 7.44531, 7.50781, 7.57031, 7.63281,
+ (1,123): 7.69531, 7.75781, 7.82031, 7.88281, 7.94531,
+ (2,0): 126, 0.078125, 0.140625, 0.203125, 0.265625, 0.328125, 0.390625,
+ (2,7): 0.453125, 0.515625, 0.578125, 0.640625, 0.703125, 0.765625,
+ (2,13): 0.828125, 0.890625, 0.953125, 1.01563, 1.07813, 1.14063,
+ (2,19): 1.20313, 1.26563, 1.32813, 1.39063, 1.45313, 1.51563, 1.57813,
+ (2,26): 1.64063, 1.70313, 1.76563, 1.82813, 1.89063, 1.95313, 2.01563,
+ (2,33): 2.07813, 2.14063, 2.20313, 2.26563, 2.32813, 2.39063, 2.45313,
+ (2,40): 2.51563, 2.57813, 2.64063, 2.70313, 2.76563, 2.82813, 2.89063,
+ (2,47): 2.95313, 3.01563, 3.07813, 3.14063, 3.20313, 3.26563, 3.32813,
+ (2,54): 3.39063, 3.45313, 3.51563, 3.57813, 3.64063, 3.70313, 3.76563,
+ (2,61): 3.82813, 3.89063, 3.95313, 4.01563, 4.07813, 4.14063, 4.20313,
+ (2,68): 4.26563, 4.32813, 4.39063, 4.45313, 4.51563, 4.57813, 4.64063,
+ (2,75): 4.70313, 4.76563, 4.82813, 4.89063, 4.95313, 5.01563, 5.07813,
+ (2,82): 5.14063, 5.20313, 5.26563, 5.32813, 5.39063, 5.45313, 5.51563,
+ (2,89): 5.57813, 5.64063, 5.70313, 5.76563, 5.82813, 5.89063, 5.95313,
+ (2,96): 6.01563, 6.07813, 6.14063, 6.20313, 6.26563, 6.32813, 6.39063,
+ (2,103): 6.45313, 6.51563, 6.57813, 6.64063, 6.70313, 6.76563, 6.82813,
+ (2,110): 6.89063, 6.95313, 7.01563, 7.07813, 7.14063, 7.20313, 7.26563,
+ (2,117): 7.32813, 7.39063, 7.45313, 7.51563, 7.57813, 7.64063, 7.70313,
+ (2,124): 7.76563, 7.82813, 7.89063, 7.95313,
+ (3,0): 125, 0.0859375, 0.148438, 0.210938, 0.273438, 0.335938,
+ (3,6): 0.398438, 0.460938, 0.523438, 0.585938, 0.648438, 0.710938,
+ (3,12): 0.773438, 0.835938, 0.898438, 0.960938, 1.02344, 1.08594,
+ (3,18): 1.14844, 1.21094, 1.27344, 1.33594, 1.39844, 1.46094, 1.52344,
+ (3,25): 1.58594, 1.64844, 1.71094, 1.77344, 1.83594, 1.89844, 1.96094,
+ (3,32): 2.02344, 2.08594, 2.14844, 2.21094, 2.27344, 2.33594, 2.39844,
+ (3,39): 2.46094, 2.52344, 2.58594, 2.64844, 2.71094, 2.77344, 2.83594,
+ (3,46): 2.89844, 2.96094, 3.02344, 3.08594, 3.14844, 3.21094, 3.27344,
+ (3,53): 3.33594, 3.39844, 3.46094, 3.52344, 3.58594, 3.64844, 3.71094,
+ (3,60): 3.77344, 3.83594, 3.89844, 3.96094, 4.02344, 4.08594, 4.14844,
+ (3,67): 4.21094, 4.27344, 4.33594, 4.39844, 4.46094, 4.52344, 4.58594,
+ (3,74): 4.64844, 4.71094, 4.77344, 4.83594, 4.89844, 4.96094, 5.02344,
+ (3,81): 5.08594, 5.14844, 5.21094, 5.27344, 5.33594, 5.39844, 5.46094,
+ (3,88): 5.52344, 5.58594, 5.64844, 5.71094, 5.77344, 5.83594, 5.89844,
+ (3,95): 5.96094, 6.02344, 6.08594, 6.14844, 6.21094, 6.27344, 6.33594,
+ (3,102): 6.39844, 6.46094, 6.52344, 6.58594, 6.64844, 6.71094, 6.77344,
+ (3,109): 6.83594, 6.89844, 6.96094, 7.02344, 7.08594, 7.14844, 7.21094,
+ (3,116): 7.27344, 7.33594, 7.39844, 7.46094, 7.52344, 7.58594, 7.64844,
+ (3,123): 7.71094, 7.77344, 7.83594, 7.89844, 7.96094,
+ (4,0): 124, 0.09375, 0.15625, 0.21875, 0.28125, 0.34375, 0.40625,
+ (4,7): 0.46875, 0.53125, 0.59375, 0.65625, 0.71875, 0.78125, 0.84375,
+ (4,14): 0.90625, 0.96875, 1.03125, 1.09375, 1.15625, 1.21875, 1.28125,
+ (4,21): 1.34375, 1.40625, 1.46875, 1.53125, 1.59375, 1.65625, 1.71875,
+ (4,28): 1.78125, 1.84375, 1.90625, 1.96875, 2.03125, 2.09375, 2.15625,
+ (4,35): 2.21875, 2.28125, 2.34375, 2.40625, 2.46875, 2.53125, 2.59375,
+ (4,42): 2.65625, 2.71875, 2.78125, 2.84375, 2.90625, 2.96875, 3.03125,
+ (4,49): 3.09375, 3.15625, 3.21875, 3.28125, 3.34375, 3.40625, 3.46875,
+ (4,56): 3.53125, 3.59375, 3.65625, 3.71875, 3.78125, 3.84375, 3.90625,
+ (4,63): 3.96875, 4.03125, 4.09375, 4.15625, 4.21875, 4.28125, 4.34375,
+ (4,70): 4.40625, 4.46875, 4.53125, 4.59375, 4.65625, 4.71875, 4.78125,
+ (4,77): 4.84375, 4.90625, 4.96875, 5.03125, 5.09375, 5.15625, 5.21875,
+ (4,84): 5.28125, 5.34375, 5.40625, 5.46875, 5.53125, 5.59375, 5.65625,
+ (4,91): 5.71875, 5.78125, 5.84375, 5.90625, 5.96875, 6.03125, 6.09375,
+ (4,98): 6.15625, 6.21875, 6.28125, 6.34375, 6.40625, 6.46875, 6.53125,
+ (4,105): 6.59375, 6.65625, 6.71875, 6.78125, 6.84375, 6.90625, 6.96875,
+ (4,112): 7.03125, 7.09375, 7.15625, 7.21875, 7.28125, 7.34375, 7.40625,
+ (4,119): 7.46875, 7.53125, 7.59375, 7.65625, 7.71875, 7.78125, 7.84375,
+ (4,126): 7.90625, 7.96875,
+ (5,0): 123, 0.101563, 0.164063, 0.226563, 0.289063, 0.351563, 0.414063,
+ (5,7): 0.476563, 0.539063, 0.601563, 0.664063, 0.726563, 0.789063,
+ (5,13): 0.851563, 0.914063, 0.976563, 1.03906, 1.10156, 1.16406,
+ (5,19): 1.22656, 1.28906, 1.35156, 1.41406, 1.47656, 1.53906, 1.60156,
+ (5,26): 1.66406, 1.72656, 1.78906, 1.85156, 1.91406, 1.97656, 2.03906,
+ (5,33): 2.10156, 2.16406, 2.22656, 2.28906, 2.35156, 2.41406, 2.47656,
+ (5,40): 2.53906, 2.60156, 2.66406, 2.72656, 2.78906, 2.85156, 2.91406,
+ (5,47): 2.97656, 3.03906, 3.10156, 3.16406, 3.22656, 3.28906, 3.35156,
+ (5,54): 3.41406, 3.47656, 3.53906, 3.60156, 3.66406, 3.72656, 3.78906,
+ (5,61): 3.85156, 3.91406, 3.97656, 4.03906, 4.10156, 4.16406, 4.22656,
+ (5,68): 4.28906, 4.35156, 4.41406, 4.47656, 4.53906, 4.60156, 4.66406,
+ (5,75): 4.72656, 4.78906, 4.85156, 4.91406, 4.97656, 5.03906, 5.10156,
+ (5,82): 5.16406, 5.22656, 5.28906, 5.35156, 5.41406, 5.47656, 5.53906,
+ (5,89): 5.60156, 5.66406, 5.72656, 5.78906, 5.85156, 5.91406, 5.97656,
+ (5,96): 6.03906, 6.10156, 6.16406, 6.22656, 6.28906, 6.35156, 6.41406,
+ (5,103): 6.47656, 6.53906, 6.60156, 6.66406, 6.72656, 6.78906, 6.85156,
+ (5,110): 6.91406, 6.97656, 7.03906, 7.10156, 7.16406, 7.22656, 7.28906,
+ (5,117): 7.35156, 7.41406, 7.47656, 7.53906, 7.60156, 7.66406, 7.72656,
+ (5,124): 7.78906, 7.85156, 7.91406, 7.97656,
+ (6,0): 122, 0.109375, 0.171875, 0.234375, 0.296875, 0.359375, 0.421875,
+ (6,7): 0.484375, 0.546875, 0.609375, 0.671875, 0.734375, 0.796875,
+ (6,13): 0.859375, 0.921875, 0.984375, 1.04688, 1.10938, 1.17188,
+ (6,19): 1.23438, 1.29688, 1.35938, 1.42188, 1.48438, 1.54688, 1.60938,
+ (6,26): 1.67188, 1.73438, 1.79688, 1.85938, 1.92188, 1.98438, 2.04688,
+ (6,33): 2.10938, 2.17188, 2.23438, 2.29688, 2.35938, 2.42188, 2.48438,
+ (6,40): 2.54688, 2.60938, 2.67188, 2.73438, 2.79688, 2.85938, 2.92188,
+ (6,47): 2.98438, 3.04688, 3.10938, 3.17188, 3.23438, 3.29688, 3.35938,
+ (6,54): 3.42188, 3.48438, 3.54688, 3.60938, 3.67188, 3.73438, 3.79688,
+ (6,61): 3.85938, 3.92188, 3.98438, 4.04688, 4.10938, 4.17188, 4.23438,
+ (6,68): 4.29688, 4.35938, 4.42188, 4.48438, 4.54688, 4.60938, 4.67188,
+ (6,75): 4.73438, 4.79688, 4.85938, 4.92188, 4.98438, 5.04688, 5.10938,
+ (6,82): 5.17188, 5.23438, 5.29688, 5.35938, 5.42188, 5.48438, 5.54688,
+ (6,89): 5.60938, 5.67188, 5.73438, 5.79688, 5.85938, 5.92188, 5.98438,
+ (6,96): 6.04688, 6.10938, 6.17188, 6.23438, 6.29688, 6.35938, 6.42188,
+ (6,103): 6.48438, 6.54688, 6.60938, 6.67188, 6.73438, 6.79688, 6.85938,
+ (6,110): 6.92188, 6.98438, 7.04688, 7.10938, 7.17188, 7.23438, 7.29688,
+ (6,117): 7.35938, 7.42188, 7.48438, 7.54688, 7.60938, 7.67188, 7.73438,
+ (6,124): 7.79688, 7.85938, 7.92188, 7.98438,
+ (7,0): 121, 0.117188, 0.179688, 0.242188, 0.304688, 0.367188, 0.429688,
+ (7,7): 0.492188, 0.554688, 0.617188, 0.679688, 0.742188, 0.804688,
+ (7,13): 0.867188, 0.929688, 0.992188, 1.05469, 1.11719, 1.17969,
+ (7,19): 1.24219, 1.30469, 1.36719, 1.42969, 1.49219, 1.55469, 1.61719,
+ (7,26): 1.67969, 1.74219, 1.80469, 1.86719, 1.92969, 1.99219, 2.05469,
+ (7,33): 2.11719, 2.17969, 2.24219, 2.30469, 2.36719, 2.42969, 2.49219,
+ (7,40): 2.55469, 2.61719, 2.67969, 2.74219, 2.80469, 2.86719, 2.92969,
+ (7,47): 2.99219, 3.05469, 3.11719, 3.17969, 3.24219, 3.30469, 3.36719,
+ (7,54): 3.42969, 3.49219, 3.55469, 3.61719, 3.67969, 3.74219, 3.80469,
+ (7,61): 3.86719, 3.92969, 3.99219, 4.05469, 4.11719, 4.17969, 4.24219,
+ (7,68): 4.30469, 4.36719, 4.42969, 4.49219, 4.55469, 4.61719, 4.67969,
+ (7,75): 4.74219, 4.80469, 4.86719, 4.92969, 4.99219, 5.05469, 5.11719,
+ (7,82): 5.17969, 5.24219, 5.30469, 5.36719, 5.42969, 5.49219, 5.55469,
+ (7,89): 5.61719, 5.67969, 5.74219, 5.80469, 5.86719, 5.92969, 5.99219,
+ (7,96): 6.05469, 6.11719, 6.17969, 6.24219, 6.30469, 6.36719, 6.42969,
+ (7,103): 6.49219, 6.55469, 6.61719, 6.67969, 6.74219, 6.80469, 6.86719,
+ (7,110): 6.92969, 6.99219, 7.05469, 7.11719, 7.17969, 7.24219, 7.30469,
+ (7,117): 7.36719, 7.42969, 7.49219, 7.55469, 7.61719, 7.67969, 7.74219,
+ (7,124): 7.80469, 7.86719, 7.92969, 7.99219
+ }
+ ATTRIBUTE "DS128BITS" {
+ DATATYPE 128-bit little-endian floating-point 80-bit precision
+ DATASPACE SIMPLE { ( 1024 ) / ( 1024 ) }
+ DATA {
+ (0): 128, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5,
+ (9): 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1.0625,
+ (18): 1.125, 1.1875, 1.25, 1.3125, 1.375, 1.4375, 1.5, 1.5625,
+ (26): 1.625, 1.6875, 1.75, 1.8125, 1.875, 1.9375, 2, 2.0625, 2.125,
+ (35): 2.1875, 2.25, 2.3125, 2.375, 2.4375, 2.5, 2.5625, 2.625,
+ (43): 2.6875, 2.75, 2.8125, 2.875, 2.9375, 3, 3.0625, 3.125, 3.1875,
+ (52): 3.25, 3.3125, 3.375, 3.4375, 3.5, 3.5625, 3.625, 3.6875, 3.75,
+ (61): 3.8125, 3.875, 3.9375, 4, 4.0625, 4.125, 4.1875, 4.25, 4.3125,
+ (70): 4.375, 4.4375, 4.5, 4.5625, 4.625, 4.6875, 4.75, 4.8125,
+ (78): 4.875, 4.9375, 5, 5.0625, 5.125, 5.1875, 5.25, 5.3125, 5.375,
+ (87): 5.4375, 5.5, 5.5625, 5.625, 5.6875, 5.75, 5.8125, 5.875,
+ (95): 5.9375, 6, 6.0625, 6.125, 6.1875, 6.25, 6.3125, 6.375, 6.4375,
+ (104): 6.5, 6.5625, 6.625, 6.6875, 6.75, 6.8125, 6.875, 6.9375, 7,
+ (113): 7.0625, 7.125, 7.1875, 7.25, 7.3125, 7.375, 7.4375, 7.5,
+ (121): 7.5625, 7.625, 7.6875, 7.75, 7.8125, 7.875, 7.9375, 127,
+ (129): 0.0703125, 0.132813, 0.195313, 0.257813, 0.320313, 0.382813,
+ (135): 0.445313, 0.507813, 0.570313, 0.632813, 0.695313, 0.757813,
+ (141): 0.820313, 0.882813, 0.945313, 1.00781, 1.07031, 1.13281,
+ (147): 1.19531, 1.25781, 1.32031, 1.38281, 1.44531, 1.50781,
+ (153): 1.57031, 1.63281, 1.69531, 1.75781, 1.82031, 1.88281,
+ (159): 1.94531, 2.00781, 2.07031, 2.13281, 2.19531, 2.25781,
+ (165): 2.32031, 2.38281, 2.44531, 2.50781, 2.57031, 2.63281,
+ (171): 2.69531, 2.75781, 2.82031, 2.88281, 2.94531, 3.00781,
+ (177): 3.07031, 3.13281, 3.19531, 3.25781, 3.32031, 3.38281,
+ (183): 3.44531, 3.50781, 3.57031, 3.63281, 3.69531, 3.75781,
+ (189): 3.82031, 3.88281, 3.94531, 4.00781, 4.07031, 4.13281,
+ (195): 4.19531, 4.25781, 4.32031, 4.38281, 4.44531, 4.50781,
+ (201): 4.57031, 4.63281, 4.69531, 4.75781, 4.82031, 4.88281,
+ (207): 4.94531, 5.00781, 5.07031, 5.13281, 5.19531, 5.25781,
+ (213): 5.32031, 5.38281, 5.44531, 5.50781, 5.57031, 5.63281,
+ (219): 5.69531, 5.75781, 5.82031, 5.88281, 5.94531, 6.00781,
+ (225): 6.07031, 6.13281, 6.19531, 6.25781, 6.32031, 6.38281,
+ (231): 6.44531, 6.50781, 6.57031, 6.63281, 6.69531, 6.75781,
+ (237): 6.82031, 6.88281, 6.94531, 7.00781, 7.07031, 7.13281,
+ (243): 7.19531, 7.25781, 7.32031, 7.38281, 7.44531, 7.50781,
+ (249): 7.57031, 7.63281, 7.69531, 7.75781, 7.82031, 7.88281,
+ (255): 7.94531, 126, 0.078125, 0.140625, 0.203125, 0.265625,
+ (261): 0.328125, 0.390625, 0.453125, 0.515625, 0.578125, 0.640625,
+ (267): 0.703125, 0.765625, 0.828125, 0.890625, 0.953125, 1.01563,
+ (273): 1.07813, 1.14063, 1.20313, 1.26563, 1.32813, 1.39063,
+ (279): 1.45313, 1.51563, 1.57813, 1.64063, 1.70313, 1.76563,
+ (285): 1.82813, 1.89063, 1.95313, 2.01563, 2.07813, 2.14063,
+ (291): 2.20313, 2.26563, 2.32813, 2.39063, 2.45313, 2.51563,
+ (297): 2.57813, 2.64063, 2.70313, 2.76563, 2.82813, 2.89063,
+ (303): 2.95313, 3.01563, 3.07813, 3.14063, 3.20313, 3.26563,
+ (309): 3.32813, 3.39063, 3.45313, 3.51563, 3.57813, 3.64063,
+ (315): 3.70313, 3.76563, 3.82813, 3.89063, 3.95313, 4.01563,
+ (321): 4.07813, 4.14063, 4.20313, 4.26563, 4.32813, 4.39063,
+ (327): 4.45313, 4.51563, 4.57813, 4.64063, 4.70313, 4.76563,
+ (333): 4.82813, 4.89063, 4.95313, 5.01563, 5.07813, 5.14063,
+ (339): 5.20313, 5.26563, 5.32813, 5.39063, 5.45313, 5.51563,
+ (345): 5.57813, 5.64063, 5.70313, 5.76563, 5.82813, 5.89063,
+ (351): 5.95313, 6.01563, 6.07813, 6.14063, 6.20313, 6.26563,
+ (357): 6.32813, 6.39063, 6.45313, 6.51563, 6.57813, 6.64063,
+ (363): 6.70313, 6.76563, 6.82813, 6.89063, 6.95313, 7.01563,
+ (369): 7.07813, 7.14063, 7.20313, 7.26563, 7.32813, 7.39063,
+ (375): 7.45313, 7.51563, 7.57813, 7.64063, 7.70313, 7.76563,
+ (381): 7.82813, 7.89063, 7.95313, 125, 0.0859375, 0.148438,
+ (387): 0.210938, 0.273438, 0.335938, 0.398438, 0.460938, 0.523438,
+ (393): 0.585938, 0.648438, 0.710938, 0.773438, 0.835938, 0.898438,
+ (399): 0.960938, 1.02344, 1.08594, 1.14844, 1.21094, 1.27344,
+ (405): 1.33594, 1.39844, 1.46094, 1.52344, 1.58594, 1.64844,
+ (411): 1.71094, 1.77344, 1.83594, 1.89844, 1.96094, 2.02344,
+ (417): 2.08594, 2.14844, 2.21094, 2.27344, 2.33594, 2.39844,
+ (423): 2.46094, 2.52344, 2.58594, 2.64844, 2.71094, 2.77344,
+ (429): 2.83594, 2.89844, 2.96094, 3.02344, 3.08594, 3.14844,
+ (435): 3.21094, 3.27344, 3.33594, 3.39844, 3.46094, 3.52344,
+ (441): 3.58594, 3.64844, 3.71094, 3.77344, 3.83594, 3.89844,
+ (447): 3.96094, 4.02344, 4.08594, 4.14844, 4.21094, 4.27344,
+ (453): 4.33594, 4.39844, 4.46094, 4.52344, 4.58594, 4.64844,
+ (459): 4.71094, 4.77344, 4.83594, 4.89844, 4.96094, 5.02344,
+ (465): 5.08594, 5.14844, 5.21094, 5.27344, 5.33594, 5.39844,
+ (471): 5.46094, 5.52344, 5.58594, 5.64844, 5.71094, 5.77344,
+ (477): 5.83594, 5.89844, 5.96094, 6.02344, 6.08594, 6.14844,
+ (483): 6.21094, 6.27344, 6.33594, 6.39844, 6.46094, 6.52344,
+ (489): 6.58594, 6.64844, 6.71094, 6.77344, 6.83594, 6.89844,
+ (495): 6.96094, 7.02344, 7.08594, 7.14844, 7.21094, 7.27344,
+ (501): 7.33594, 7.39844, 7.46094, 7.52344, 7.58594, 7.64844,
+ (507): 7.71094, 7.77344, 7.83594, 7.89844, 7.96094, 124, 0.09375,
+ (514): 0.15625, 0.21875, 0.28125, 0.34375, 0.40625, 0.46875,
+ (520): 0.53125, 0.59375, 0.65625, 0.71875, 0.78125, 0.84375,
+ (526): 0.90625, 0.96875, 1.03125, 1.09375, 1.15625, 1.21875,
+ (532): 1.28125, 1.34375, 1.40625, 1.46875, 1.53125, 1.59375,
+ (538): 1.65625, 1.71875, 1.78125, 1.84375, 1.90625, 1.96875,
+ (544): 2.03125, 2.09375, 2.15625, 2.21875, 2.28125, 2.34375,
+ (550): 2.40625, 2.46875, 2.53125, 2.59375, 2.65625, 2.71875,
+ (556): 2.78125, 2.84375, 2.90625, 2.96875, 3.03125, 3.09375,
+ (562): 3.15625, 3.21875, 3.28125, 3.34375, 3.40625, 3.46875,
+ (568): 3.53125, 3.59375, 3.65625, 3.71875, 3.78125, 3.84375,
+ (574): 3.90625, 3.96875, 4.03125, 4.09375, 4.15625, 4.21875,
+ (580): 4.28125, 4.34375, 4.40625, 4.46875, 4.53125, 4.59375,
+ (586): 4.65625, 4.71875, 4.78125, 4.84375, 4.90625, 4.96875,
+ (592): 5.03125, 5.09375, 5.15625, 5.21875, 5.28125, 5.34375,
+ (598): 5.40625, 5.46875, 5.53125, 5.59375, 5.65625, 5.71875,
+ (604): 5.78125, 5.84375, 5.90625, 5.96875, 6.03125, 6.09375,
+ (610): 6.15625, 6.21875, 6.28125, 6.34375, 6.40625, 6.46875,
+ (616): 6.53125, 6.59375, 6.65625, 6.71875, 6.78125, 6.84375,
+ (622): 6.90625, 6.96875, 7.03125, 7.09375, 7.15625, 7.21875,
+ (628): 7.28125, 7.34375, 7.40625, 7.46875, 7.53125, 7.59375,
+ (634): 7.65625, 7.71875, 7.78125, 7.84375, 7.90625, 7.96875, 123,
+ (641): 0.101563, 0.164063, 0.226563, 0.289063, 0.351563, 0.414063,
+ (647): 0.476563, 0.539063, 0.601563, 0.664063, 0.726563, 0.789063,
+ (653): 0.851563, 0.914063, 0.976563, 1.03906, 1.10156, 1.16406,
+ (659): 1.22656, 1.28906, 1.35156, 1.41406, 1.47656, 1.53906,
+ (665): 1.60156, 1.66406, 1.72656, 1.78906, 1.85156, 1.91406,
+ (671): 1.97656, 2.03906, 2.10156, 2.16406, 2.22656, 2.28906,
+ (677): 2.35156, 2.41406, 2.47656, 2.53906, 2.60156, 2.66406,
+ (683): 2.72656, 2.78906, 2.85156, 2.91406, 2.97656, 3.03906,
+ (689): 3.10156, 3.16406, 3.22656, 3.28906, 3.35156, 3.41406,
+ (695): 3.47656, 3.53906, 3.60156, 3.66406, 3.72656, 3.78906,
+ (701): 3.85156, 3.91406, 3.97656, 4.03906, 4.10156, 4.16406,
+ (707): 4.22656, 4.28906, 4.35156, 4.41406, 4.47656, 4.53906,
+ (713): 4.60156, 4.66406, 4.72656, 4.78906, 4.85156, 4.91406,
+ (719): 4.97656, 5.03906, 5.10156, 5.16406, 5.22656, 5.28906,
+ (725): 5.35156, 5.41406, 5.47656, 5.53906, 5.60156, 5.66406,
+ (731): 5.72656, 5.78906, 5.85156, 5.91406, 5.97656, 6.03906,
+ (737): 6.10156, 6.16406, 6.22656, 6.28906, 6.35156, 6.41406,
+ (743): 6.47656, 6.53906, 6.60156, 6.66406, 6.72656, 6.78906,
+ (749): 6.85156, 6.91406, 6.97656, 7.03906, 7.10156, 7.16406,
+ (755): 7.22656, 7.28906, 7.35156, 7.41406, 7.47656, 7.53906,
+ (761): 7.60156, 7.66406, 7.72656, 7.78906, 7.85156, 7.91406,
+ (767): 7.97656, 122, 0.109375, 0.171875, 0.234375, 0.296875,
+ (773): 0.359375, 0.421875, 0.484375, 0.546875, 0.609375, 0.671875,
+ (779): 0.734375, 0.796875, 0.859375, 0.921875, 0.984375, 1.04688,
+ (785): 1.10938, 1.17188, 1.23438, 1.29688, 1.35938, 1.42188,
+ (791): 1.48438, 1.54688, 1.60938, 1.67188, 1.73438, 1.79688,
+ (797): 1.85938, 1.92188, 1.98438, 2.04688, 2.10938, 2.17188,
+ (803): 2.23438, 2.29688, 2.35938, 2.42188, 2.48438, 2.54688,
+ (809): 2.60938, 2.67188, 2.73438, 2.79688, 2.85938, 2.92188,
+ (815): 2.98438, 3.04688, 3.10938, 3.17188, 3.23438, 3.29688,
+ (821): 3.35938, 3.42188, 3.48438, 3.54688, 3.60938, 3.67188,
+ (827): 3.73438, 3.79688, 3.85938, 3.92188, 3.98438, 4.04688,
+ (833): 4.10938, 4.17188, 4.23438, 4.29688, 4.35938, 4.42188,
+ (839): 4.48438, 4.54688, 4.60938, 4.67188, 4.73438, 4.79688,
+ (845): 4.85938, 4.92188, 4.98438, 5.04688, 5.10938, 5.17188,
+ (851): 5.23438, 5.29688, 5.35938, 5.42188, 5.48438, 5.54688,
+ (857): 5.60938, 5.67188, 5.73438, 5.79688, 5.85938, 5.92188,
+ (863): 5.98438, 6.04688, 6.10938, 6.17188, 6.23438, 6.29688,
+ (869): 6.35938, 6.42188, 6.48438, 6.54688, 6.60938, 6.67188,
+ (875): 6.73438, 6.79688, 6.85938, 6.92188, 6.98438, 7.04688,
+ (881): 7.10938, 7.17188, 7.23438, 7.29688, 7.35938, 7.42188,
+ (887): 7.48438, 7.54688, 7.60938, 7.67188, 7.73438, 7.79688,
+ (893): 7.85938, 7.92188, 7.98438, 121, 0.117188, 0.179688, 0.242188,
+ (900): 0.304688, 0.367188, 0.429688, 0.492188, 0.554688, 0.617188,
+ (906): 0.679688, 0.742188, 0.804688, 0.867188, 0.929688, 0.992188,
+ (912): 1.05469, 1.11719, 1.17969, 1.24219, 1.30469, 1.36719,
+ (918): 1.42969, 1.49219, 1.55469, 1.61719, 1.67969, 1.74219,
+ (924): 1.80469, 1.86719, 1.92969, 1.99219, 2.05469, 2.11719,
+ (930): 2.17969, 2.24219, 2.30469, 2.36719, 2.42969, 2.49219,
+ (936): 2.55469, 2.61719, 2.67969, 2.74219, 2.80469, 2.86719,
+ (942): 2.92969, 2.99219, 3.05469, 3.11719, 3.17969, 3.24219,
+ (948): 3.30469, 3.36719, 3.42969, 3.49219, 3.55469, 3.61719,
+ (954): 3.67969, 3.74219, 3.80469, 3.86719, 3.92969, 3.99219,
+ (960): 4.05469, 4.11719, 4.17969, 4.24219, 4.30469, 4.36719,
+ (966): 4.42969, 4.49219, 4.55469, 4.61719, 4.67969, 4.74219,
+ (972): 4.80469, 4.86719, 4.92969, 4.99219, 5.05469, 5.11719,
+ (978): 5.17969, 5.24219, 5.30469, 5.36719, 5.42969, 5.49219,
+ (984): 5.55469, 5.61719, 5.67969, 5.74219, 5.80469, 5.86719,
+ (990): 5.92969, 5.99219, 6.05469, 6.11719, 6.17969, 6.24219,
+ (996): 6.30469, 6.36719, 6.42969, 6.49219, 6.55469, 6.61719,
+ (1002): 6.67969, 6.74219, 6.80469, 6.86719, 6.92969, 6.99219,
+ (1008): 7.05469, 7.11719, 7.17969, 7.24219, 7.30469, 7.36719,
+ (1014): 7.42969, 7.49219, 7.55469, 7.61719, 7.67969, 7.74219,
+ (1020): 7.80469, 7.86719, 7.92969, 7.99219
+ }
+ }
+ }
+ DATASET "DS32BITS" {
+ DATATYPE H5T_IEEE_F32LE
+ DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 1024
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ DATA {
+ (0,0): 32, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3,
+ (0,13): 3.25, 3.5, 3.75, 4, 4.25, 4.5, 4.75, 5, 5.25, 5.5, 5.75, 6,
+ (0,25): 6.25, 6.5, 6.75, 7, 7.25, 7.5, 7.75,
+ (1,0): 31, 0.28125, 0.53125, 0.78125, 1.03125, 1.28125, 1.53125,
+ (1,7): 1.78125, 2.03125, 2.28125, 2.53125, 2.78125, 3.03125, 3.28125,
+ (1,14): 3.53125, 3.78125, 4.03125, 4.28125, 4.53125, 4.78125, 5.03125,
+ (1,21): 5.28125, 5.53125, 5.78125, 6.03125, 6.28125, 6.53125, 6.78125,
+ (1,28): 7.03125, 7.28125, 7.53125, 7.78125,
+ (2,0): 30, 0.3125, 0.5625, 0.8125, 1.0625, 1.3125, 1.5625, 1.8125,
+ (2,8): 2.0625, 2.3125, 2.5625, 2.8125, 3.0625, 3.3125, 3.5625, 3.8125,
+ (2,16): 4.0625, 4.3125, 4.5625, 4.8125, 5.0625, 5.3125, 5.5625, 5.8125,
+ (2,24): 6.0625, 6.3125, 6.5625, 6.8125, 7.0625, 7.3125, 7.5625, 7.8125,
+ (3,0): 29, 0.34375, 0.59375, 0.84375, 1.09375, 1.34375, 1.59375,
+ (3,7): 1.84375, 2.09375, 2.34375, 2.59375, 2.84375, 3.09375, 3.34375,
+ (3,14): 3.59375, 3.84375, 4.09375, 4.34375, 4.59375, 4.84375, 5.09375,
+ (3,21): 5.34375, 5.59375, 5.84375, 6.09375, 6.34375, 6.59375, 6.84375,
+ (3,28): 7.09375, 7.34375, 7.59375, 7.84375,
+ (4,0): 28, 0.375, 0.625, 0.875, 1.125, 1.375, 1.625, 1.875, 2.125,
+ (4,9): 2.375, 2.625, 2.875, 3.125, 3.375, 3.625, 3.875, 4.125, 4.375,
+ (4,18): 4.625, 4.875, 5.125, 5.375, 5.625, 5.875, 6.125, 6.375, 6.625,
+ (4,27): 6.875, 7.125, 7.375, 7.625, 7.875,
+ (5,0): 27, 0.40625, 0.65625, 0.90625, 1.15625, 1.40625, 1.65625,
+ (5,7): 1.90625, 2.15625, 2.40625, 2.65625, 2.90625, 3.15625, 3.40625,
+ (5,14): 3.65625, 3.90625, 4.15625, 4.40625, 4.65625, 4.90625, 5.15625,
+ (5,21): 5.40625, 5.65625, 5.90625, 6.15625, 6.40625, 6.65625, 6.90625,
+ (5,28): 7.15625, 7.40625, 7.65625, 7.90625,
+ (6,0): 26, 0.4375, 0.6875, 0.9375, 1.1875, 1.4375, 1.6875, 1.9375,
+ (6,8): 2.1875, 2.4375, 2.6875, 2.9375, 3.1875, 3.4375, 3.6875, 3.9375,
+ (6,16): 4.1875, 4.4375, 4.6875, 4.9375, 5.1875, 5.4375, 5.6875, 5.9375,
+ (6,24): 6.1875, 6.4375, 6.6875, 6.9375, 7.1875, 7.4375, 7.6875, 7.9375,
+ (7,0): 25, 0.46875, 0.71875, 0.96875, 1.21875, 1.46875, 1.71875,
+ (7,7): 1.96875, 2.21875, 2.46875, 2.71875, 2.96875, 3.21875, 3.46875,
+ (7,14): 3.71875, 3.96875, 4.21875, 4.46875, 4.71875, 4.96875, 5.21875,
+ (7,21): 5.46875, 5.71875, 5.96875, 6.21875, 6.46875, 6.71875, 6.96875,
+ (7,28): 7.21875, 7.46875, 7.71875, 7.96875
+ }
+ ATTRIBUTE "DS32BITS" {
+ DATATYPE H5T_IEEE_F32LE
+ DATASPACE SIMPLE { ( 256 ) / ( 256 ) }
+ DATA {
+ (0): 32, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3,
+ (13): 3.25, 3.5, 3.75, 4, 4.25, 4.5, 4.75, 5, 5.25, 5.5, 5.75, 6,
+ (25): 6.25, 6.5, 6.75, 7, 7.25, 7.5, 7.75, 31, 0.28125, 0.53125,
+ (35): 0.78125, 1.03125, 1.28125, 1.53125, 1.78125, 2.03125, 2.28125,
+ (42): 2.53125, 2.78125, 3.03125, 3.28125, 3.53125, 3.78125, 4.03125,
+ (49): 4.28125, 4.53125, 4.78125, 5.03125, 5.28125, 5.53125, 5.78125,
+ (56): 6.03125, 6.28125, 6.53125, 6.78125, 7.03125, 7.28125, 7.53125,
+ (63): 7.78125, 30, 0.3125, 0.5625, 0.8125, 1.0625, 1.3125, 1.5625,
+ (71): 1.8125, 2.0625, 2.3125, 2.5625, 2.8125, 3.0625, 3.3125,
+ (78): 3.5625, 3.8125, 4.0625, 4.3125, 4.5625, 4.8125, 5.0625,
+ (85): 5.3125, 5.5625, 5.8125, 6.0625, 6.3125, 6.5625, 6.8125,
+ (92): 7.0625, 7.3125, 7.5625, 7.8125, 29, 0.34375, 0.59375, 0.84375,
+ (100): 1.09375, 1.34375, 1.59375, 1.84375, 2.09375, 2.34375,
+ (106): 2.59375, 2.84375, 3.09375, 3.34375, 3.59375, 3.84375,
+ (112): 4.09375, 4.34375, 4.59375, 4.84375, 5.09375, 5.34375,
+ (118): 5.59375, 5.84375, 6.09375, 6.34375, 6.59375, 6.84375,
+ (124): 7.09375, 7.34375, 7.59375, 7.84375, 28, 0.375, 0.625, 0.875,
+ (132): 1.125, 1.375, 1.625, 1.875, 2.125, 2.375, 2.625, 2.875,
+ (140): 3.125, 3.375, 3.625, 3.875, 4.125, 4.375, 4.625, 4.875,
+ (148): 5.125, 5.375, 5.625, 5.875, 6.125, 6.375, 6.625, 6.875,
+ (156): 7.125, 7.375, 7.625, 7.875, 27, 0.40625, 0.65625, 0.90625,
+ (164): 1.15625, 1.40625, 1.65625, 1.90625, 2.15625, 2.40625,
+ (170): 2.65625, 2.90625, 3.15625, 3.40625, 3.65625, 3.90625,
+ (176): 4.15625, 4.40625, 4.65625, 4.90625, 5.15625, 5.40625,
+ (182): 5.65625, 5.90625, 6.15625, 6.40625, 6.65625, 6.90625,
+ (188): 7.15625, 7.40625, 7.65625, 7.90625, 26, 0.4375, 0.6875,
+ (195): 0.9375, 1.1875, 1.4375, 1.6875, 1.9375, 2.1875, 2.4375,
+ (202): 2.6875, 2.9375, 3.1875, 3.4375, 3.6875, 3.9375, 4.1875,
+ (209): 4.4375, 4.6875, 4.9375, 5.1875, 5.4375, 5.6875, 5.9375,
+ (216): 6.1875, 6.4375, 6.6875, 6.9375, 7.1875, 7.4375, 7.6875,
+ (223): 7.9375, 25, 0.46875, 0.71875, 0.96875, 1.21875, 1.46875,
+ (230): 1.71875, 1.96875, 2.21875, 2.46875, 2.71875, 2.96875,
+ (236): 3.21875, 3.46875, 3.71875, 3.96875, 4.21875, 4.46875,
+ (242): 4.71875, 4.96875, 5.21875, 5.46875, 5.71875, 5.96875,
+ (248): 6.21875, 6.46875, 6.71875, 6.96875, 7.21875, 7.46875,
+ (254): 7.71875, 7.96875
+ }
+ }
+ }
+ DATASET "DS64BITS" {
+ DATATYPE H5T_IEEE_F64LE
+ DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 4096
+ OFFSET 6144
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ DATA {
+ (0,0): 64, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125, 1.25,
+ (0,11): 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375, 2.5,
+ (0,21): 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625, 3.75,
+ (0,31): 3.875, 4, 4.125, 4.25, 4.375, 4.5, 4.625, 4.75, 4.875, 5,
+ (0,41): 5.125, 5.25, 5.375, 5.5, 5.625, 5.75, 5.875, 6, 6.125, 6.25,
+ (0,51): 6.375, 6.5, 6.625, 6.75, 6.875, 7, 7.125, 7.25, 7.375, 7.5,
+ (0,61): 7.625, 7.75, 7.875,
+ (1,0): 63, 0.140625, 0.265625, 0.390625, 0.515625, 0.640625, 0.765625,
+ (1,7): 0.890625, 1.01563, 1.14063, 1.26563, 1.39063, 1.51563, 1.64063,
+ (1,14): 1.76563, 1.89063, 2.01563, 2.14063, 2.26563, 2.39063, 2.51563,
+ (1,21): 2.64063, 2.76563, 2.89063, 3.01563, 3.14063, 3.26563, 3.39063,
+ (1,28): 3.51563, 3.64063, 3.76563, 3.89063, 4.01563, 4.14063, 4.26563,
+ (1,35): 4.39063, 4.51563, 4.64063, 4.76563, 4.89063, 5.01563, 5.14063,
+ (1,42): 5.26563, 5.39063, 5.51563, 5.64063, 5.76563, 5.89063, 6.01563,
+ (1,49): 6.14063, 6.26563, 6.39063, 6.51563, 6.64063, 6.76563, 6.89063,
+ (1,56): 7.01563, 7.14063, 7.26563, 7.39063, 7.51563, 7.64063, 7.76563,
+ (1,63): 7.89063,
+ (2,0): 62, 0.15625, 0.28125, 0.40625, 0.53125, 0.65625, 0.78125,
+ (2,7): 0.90625, 1.03125, 1.15625, 1.28125, 1.40625, 1.53125, 1.65625,
+ (2,14): 1.78125, 1.90625, 2.03125, 2.15625, 2.28125, 2.40625, 2.53125,
+ (2,21): 2.65625, 2.78125, 2.90625, 3.03125, 3.15625, 3.28125, 3.40625,
+ (2,28): 3.53125, 3.65625, 3.78125, 3.90625, 4.03125, 4.15625, 4.28125,
+ (2,35): 4.40625, 4.53125, 4.65625, 4.78125, 4.90625, 5.03125, 5.15625,
+ (2,42): 5.28125, 5.40625, 5.53125, 5.65625, 5.78125, 5.90625, 6.03125,
+ (2,49): 6.15625, 6.28125, 6.40625, 6.53125, 6.65625, 6.78125, 6.90625,
+ (2,56): 7.03125, 7.15625, 7.28125, 7.40625, 7.53125, 7.65625, 7.78125,
+ (2,63): 7.90625,
+ (3,0): 61, 0.171875, 0.296875, 0.421875, 0.546875, 0.671875, 0.796875,
+ (3,7): 0.921875, 1.04688, 1.17188, 1.29688, 1.42188, 1.54688, 1.67188,
+ (3,14): 1.79688, 1.92188, 2.04688, 2.17188, 2.29688, 2.42188, 2.54688,
+ (3,21): 2.67188, 2.79688, 2.92188, 3.04688, 3.17188, 3.29688, 3.42188,
+ (3,28): 3.54688, 3.67188, 3.79688, 3.92188, 4.04688, 4.17188, 4.29688,
+ (3,35): 4.42188, 4.54688, 4.67188, 4.79688, 4.92188, 5.04688, 5.17188,
+ (3,42): 5.29688, 5.42188, 5.54688, 5.67188, 5.79688, 5.92188, 6.04688,
+ (3,49): 6.17188, 6.29688, 6.42188, 6.54688, 6.67188, 6.79688, 6.92188,
+ (3,56): 7.04688, 7.17188, 7.29688, 7.42188, 7.54688, 7.67188, 7.79688,
+ (3,63): 7.92188,
+ (4,0): 60, 0.1875, 0.3125, 0.4375, 0.5625, 0.6875, 0.8125, 0.9375,
+ (4,8): 1.0625, 1.1875, 1.3125, 1.4375, 1.5625, 1.6875, 1.8125, 1.9375,
+ (4,16): 2.0625, 2.1875, 2.3125, 2.4375, 2.5625, 2.6875, 2.8125, 2.9375,
+ (4,24): 3.0625, 3.1875, 3.3125, 3.4375, 3.5625, 3.6875, 3.8125, 3.9375,
+ (4,32): 4.0625, 4.1875, 4.3125, 4.4375, 4.5625, 4.6875, 4.8125, 4.9375,
+ (4,40): 5.0625, 5.1875, 5.3125, 5.4375, 5.5625, 5.6875, 5.8125, 5.9375,
+ (4,48): 6.0625, 6.1875, 6.3125, 6.4375, 6.5625, 6.6875, 6.8125, 6.9375,
+ (4,56): 7.0625, 7.1875, 7.3125, 7.4375, 7.5625, 7.6875, 7.8125, 7.9375,
+ (5,0): 59, 0.203125, 0.328125, 0.453125, 0.578125, 0.703125, 0.828125,
+ (5,7): 0.953125, 1.07813, 1.20313, 1.32813, 1.45313, 1.57813, 1.70313,
+ (5,14): 1.82813, 1.95313, 2.07813, 2.20313, 2.32813, 2.45313, 2.57813,
+ (5,21): 2.70313, 2.82813, 2.95313, 3.07813, 3.20313, 3.32813, 3.45313,
+ (5,28): 3.57813, 3.70313, 3.82813, 3.95313, 4.07813, 4.20313, 4.32813,
+ (5,35): 4.45313, 4.57813, 4.70313, 4.82813, 4.95313, 5.07813, 5.20313,
+ (5,42): 5.32813, 5.45313, 5.57813, 5.70313, 5.82813, 5.95313, 6.07813,
+ (5,49): 6.20313, 6.32813, 6.45313, 6.57813, 6.70313, 6.82813, 6.95313,
+ (5,56): 7.07813, 7.20313, 7.32813, 7.45313, 7.57813, 7.70313, 7.82813,
+ (5,63): 7.95313,
+ (6,0): 58, 0.21875, 0.34375, 0.46875, 0.59375, 0.71875, 0.84375,
+ (6,7): 0.96875, 1.09375, 1.21875, 1.34375, 1.46875, 1.59375, 1.71875,
+ (6,14): 1.84375, 1.96875, 2.09375, 2.21875, 2.34375, 2.46875, 2.59375,
+ (6,21): 2.71875, 2.84375, 2.96875, 3.09375, 3.21875, 3.34375, 3.46875,
+ (6,28): 3.59375, 3.71875, 3.84375, 3.96875, 4.09375, 4.21875, 4.34375,
+ (6,35): 4.46875, 4.59375, 4.71875, 4.84375, 4.96875, 5.09375, 5.21875,
+ (6,42): 5.34375, 5.46875, 5.59375, 5.71875, 5.84375, 5.96875, 6.09375,
+ (6,49): 6.21875, 6.34375, 6.46875, 6.59375, 6.71875, 6.84375, 6.96875,
+ (6,56): 7.09375, 7.21875, 7.34375, 7.46875, 7.59375, 7.71875, 7.84375,
+ (6,63): 7.96875,
+ (7,0): 57, 0.234375, 0.359375, 0.484375, 0.609375, 0.734375, 0.859375,
+ (7,7): 0.984375, 1.10938, 1.23438, 1.35938, 1.48438, 1.60938, 1.73438,
+ (7,14): 1.85938, 1.98438, 2.10938, 2.23438, 2.35938, 2.48438, 2.60938,
+ (7,21): 2.73438, 2.85938, 2.98438, 3.10938, 3.23438, 3.35938, 3.48438,
+ (7,28): 3.60938, 3.73438, 3.85938, 3.98438, 4.10938, 4.23438, 4.35938,
+ (7,35): 4.48438, 4.60938, 4.73438, 4.85938, 4.98438, 5.10938, 5.23438,
+ (7,42): 5.35938, 5.48438, 5.60938, 5.73438, 5.85938, 5.98438, 6.10938,
+ (7,49): 6.23438, 6.35938, 6.48438, 6.60938, 6.73438, 6.85938, 6.98438,
+ (7,56): 7.10938, 7.23438, 7.35938, 7.48438, 7.60938, 7.73438, 7.85938,
+ (7,63): 7.98438
+ }
+ ATTRIBUTE "DS64BITS" {
+ DATATYPE H5T_IEEE_F64LE
+ DATASPACE SIMPLE { ( 512 ) / ( 512 ) }
+ DATA {
+ (0): 64, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1, 1.125,
+ (10): 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375,
+ (20): 2.5, 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625,
+ (30): 3.75, 3.875, 4, 4.125, 4.25, 4.375, 4.5, 4.625, 4.75, 4.875,
+ (40): 5, 5.125, 5.25, 5.375, 5.5, 5.625, 5.75, 5.875, 6, 6.125,
+ (50): 6.25, 6.375, 6.5, 6.625, 6.75, 6.875, 7, 7.125, 7.25, 7.375,
+ (60): 7.5, 7.625, 7.75, 7.875, 63, 0.140625, 0.265625, 0.390625,
+ (68): 0.515625, 0.640625, 0.765625, 0.890625, 1.01563, 1.14063,
+ (74): 1.26563, 1.39063, 1.51563, 1.64063, 1.76563, 1.89063, 2.01563,
+ (81): 2.14063, 2.26563, 2.39063, 2.51563, 2.64063, 2.76563, 2.89063,
+ (88): 3.01563, 3.14063, 3.26563, 3.39063, 3.51563, 3.64063, 3.76563,
+ (95): 3.89063, 4.01563, 4.14063, 4.26563, 4.39063, 4.51563, 4.64063,
+ (102): 4.76563, 4.89063, 5.01563, 5.14063, 5.26563, 5.39063,
+ (108): 5.51563, 5.64063, 5.76563, 5.89063, 6.01563, 6.14063,
+ (114): 6.26563, 6.39063, 6.51563, 6.64063, 6.76563, 6.89063,
+ (120): 7.01563, 7.14063, 7.26563, 7.39063, 7.51563, 7.64063,
+ (126): 7.76563, 7.89063, 62, 0.15625, 0.28125, 0.40625, 0.53125,
+ (133): 0.65625, 0.78125, 0.90625, 1.03125, 1.15625, 1.28125,
+ (139): 1.40625, 1.53125, 1.65625, 1.78125, 1.90625, 2.03125,
+ (145): 2.15625, 2.28125, 2.40625, 2.53125, 2.65625, 2.78125,
+ (151): 2.90625, 3.03125, 3.15625, 3.28125, 3.40625, 3.53125,
+ (157): 3.65625, 3.78125, 3.90625, 4.03125, 4.15625, 4.28125,
+ (163): 4.40625, 4.53125, 4.65625, 4.78125, 4.90625, 5.03125,
+ (169): 5.15625, 5.28125, 5.40625, 5.53125, 5.65625, 5.78125,
+ (175): 5.90625, 6.03125, 6.15625, 6.28125, 6.40625, 6.53125,
+ (181): 6.65625, 6.78125, 6.90625, 7.03125, 7.15625, 7.28125,
+ (187): 7.40625, 7.53125, 7.65625, 7.78125, 7.90625, 61, 0.171875,
+ (194): 0.296875, 0.421875, 0.546875, 0.671875, 0.796875, 0.921875,
+ (200): 1.04688, 1.17188, 1.29688, 1.42188, 1.54688, 1.67188,
+ (206): 1.79688, 1.92188, 2.04688, 2.17188, 2.29688, 2.42188,
+ (212): 2.54688, 2.67188, 2.79688, 2.92188, 3.04688, 3.17188,
+ (218): 3.29688, 3.42188, 3.54688, 3.67188, 3.79688, 3.92188,
+ (224): 4.04688, 4.17188, 4.29688, 4.42188, 4.54688, 4.67188,
+ (230): 4.79688, 4.92188, 5.04688, 5.17188, 5.29688, 5.42188,
+ (236): 5.54688, 5.67188, 5.79688, 5.92188, 6.04688, 6.17188,
+ (242): 6.29688, 6.42188, 6.54688, 6.67188, 6.79688, 6.92188,
+ (248): 7.04688, 7.17188, 7.29688, 7.42188, 7.54688, 7.67188,
+ (254): 7.79688, 7.92188, 60, 0.1875, 0.3125, 0.4375, 0.5625, 0.6875,
+ (262): 0.8125, 0.9375, 1.0625, 1.1875, 1.3125, 1.4375, 1.5625,
+ (269): 1.6875, 1.8125, 1.9375, 2.0625, 2.1875, 2.3125, 2.4375,
+ (276): 2.5625, 2.6875, 2.8125, 2.9375, 3.0625, 3.1875, 3.3125,
+ (283): 3.4375, 3.5625, 3.6875, 3.8125, 3.9375, 4.0625, 4.1875,
+ (290): 4.3125, 4.4375, 4.5625, 4.6875, 4.8125, 4.9375, 5.0625,
+ (297): 5.1875, 5.3125, 5.4375, 5.5625, 5.6875, 5.8125, 5.9375,
+ (304): 6.0625, 6.1875, 6.3125, 6.4375, 6.5625, 6.6875, 6.8125,
+ (311): 6.9375, 7.0625, 7.1875, 7.3125, 7.4375, 7.5625, 7.6875,
+ (318): 7.8125, 7.9375, 59, 0.203125, 0.328125, 0.453125, 0.578125,
+ (325): 0.703125, 0.828125, 0.953125, 1.07813, 1.20313, 1.32813,
+ (331): 1.45313, 1.57813, 1.70313, 1.82813, 1.95313, 2.07813,
+ (337): 2.20313, 2.32813, 2.45313, 2.57813, 2.70313, 2.82813,
+ (343): 2.95313, 3.07813, 3.20313, 3.32813, 3.45313, 3.57813,
+ (349): 3.70313, 3.82813, 3.95313, 4.07813, 4.20313, 4.32813,
+ (355): 4.45313, 4.57813, 4.70313, 4.82813, 4.95313, 5.07813,
+ (361): 5.20313, 5.32813, 5.45313, 5.57813, 5.70313, 5.82813,
+ (367): 5.95313, 6.07813, 6.20313, 6.32813, 6.45313, 6.57813,
+ (373): 6.70313, 6.82813, 6.95313, 7.07813, 7.20313, 7.32813,
+ (379): 7.45313, 7.57813, 7.70313, 7.82813, 7.95313, 58, 0.21875,
+ (386): 0.34375, 0.46875, 0.59375, 0.71875, 0.84375, 0.96875,
+ (392): 1.09375, 1.21875, 1.34375, 1.46875, 1.59375, 1.71875,
+ (398): 1.84375, 1.96875, 2.09375, 2.21875, 2.34375, 2.46875,
+ (404): 2.59375, 2.71875, 2.84375, 2.96875, 3.09375, 3.21875,
+ (410): 3.34375, 3.46875, 3.59375, 3.71875, 3.84375, 3.96875,
+ (416): 4.09375, 4.21875, 4.34375, 4.46875, 4.59375, 4.71875,
+ (422): 4.84375, 4.96875, 5.09375, 5.21875, 5.34375, 5.46875,
+ (428): 5.59375, 5.71875, 5.84375, 5.96875, 6.09375, 6.21875,
+ (434): 6.34375, 6.46875, 6.59375, 6.71875, 6.84375, 6.96875,
+ (440): 7.09375, 7.21875, 7.34375, 7.46875, 7.59375, 7.71875,
+ (446): 7.84375, 7.96875, 57, 0.234375, 0.359375, 0.484375, 0.609375,
+ (453): 0.734375, 0.859375, 0.984375, 1.10938, 1.23438, 1.35938,
+ (459): 1.48438, 1.60938, 1.73438, 1.85938, 1.98438, 2.10938,
+ (465): 2.23438, 2.35938, 2.48438, 2.60938, 2.73438, 2.85938,
+ (471): 2.98438, 3.10938, 3.23438, 3.35938, 3.48438, 3.60938,
+ (477): 3.73438, 3.85938, 3.98438, 4.10938, 4.23438, 4.35938,
+ (483): 4.48438, 4.60938, 4.73438, 4.85938, 4.98438, 5.10938,
+ (489): 5.23438, 5.35938, 5.48438, 5.60938, 5.73438, 5.85938,
+ (495): 5.98438, 6.10938, 6.23438, 6.35938, 6.48438, 6.60938,
+ (501): 6.73438, 6.85938, 6.98438, 7.10938, 7.23438, 7.35938,
+ (507): 7.48438, 7.60938, 7.73438, 7.85938, 7.98438
+ }
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tldouble.ddl b/tools/testfiles/tldouble.ddl
new file mode 100644
index 0000000..2fed523
--- /dev/null
+++ b/tools/testfiles/tldouble.ddl
@@ -0,0 +1,11 @@
+HDF5 "tldouble.h5" {
+GROUP "/" {
+ DATASET "dset" {
+ DATATYPE 128-bit little-endian floating-point 80-bit precision
+ DATASPACE SIMPLE { ( 3 ) / ( 3 ) }
+ DATA {
+ (0): 1, 2, 3
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tldouble_scalar.ddl b/tools/testfiles/tldouble_scalar.ddl
new file mode 100755
index 0000000..596d8db
--- /dev/null
+++ b/tools/testfiles/tldouble_scalar.ddl
@@ -0,0 +1,26 @@
+HDF5 "tldouble_scalar.h5" {
+GROUP "/" {
+ DATASET "dset" {
+ DATATYPE H5T_ARRAY { [6] 128-bit little-endian floating-point 80-bit precision }
+ DATASPACE SCALAR
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 96
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ DATA {
+ (0): [ 0, 1, 2, 3, 4, 5 ]
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tldouble_scalar.h5 b/tools/testfiles/tldouble_scalar.h5
new file mode 100644
index 0000000..0344ea0
--- /dev/null
+++ b/tools/testfiles/tldouble_scalar.h5
Binary files differ
diff --git a/tools/testfiles/tnbit.ddl b/tools/testfiles/tnbit.ddl
index fd5d1cf..cf2ac1f 100644
--- a/tools/testfiles/tnbit.ddl
+++ b/tools/testfiles/tnbit.ddl
@@ -1,6 +1,6 @@
HDF5 "tfilters.h5" {
DATASET "nbit" {
- DATATYPE 32-bit little-endian integer
+ DATATYPE 32-bit little-endian integer 3-bit precision
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
STORAGE_LAYOUT {
CHUNKED ( 10, 5 )
diff --git a/tools/testfiles/treadintfilter.ddl b/tools/testfiles/treadintfilter.ddl
index a2269a6b..fbad3f6 100644
--- a/tools/testfiles/treadintfilter.ddl
+++ b/tools/testfiles/treadintfilter.ddl
@@ -78,7 +78,7 @@ DATASET "fletcher32" {
}
}
DATASET "nbit" {
- DATATYPE 32-bit little-endian integer
+ DATATYPE 32-bit little-endian integer 3-bit precision
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
DATA {
(0,0): 0, 1, 2, 3, -4, -3, -2, -1, 0, 1,