diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-04-01 16:37:19 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-04-01 16:37:19 (GMT) |
commit | ff974d2cb7f566b1242ba331667cd9eb145209de (patch) | |
tree | b8dea2238d69a67adf2d6f8f869b07b24ed30a03 /tools/lib | |
parent | addc39a75cfb3cc2672c196db6df2dea3db7b119 (diff) | |
parent | 72e8017eadf211257caceb43095b2aed76e81632 (diff) | |
download | hdf5-ff974d2cb7f566b1242ba331667cd9eb145209de.zip hdf5-ff974d2cb7f566b1242ba331667cd9eb145209de.tar.gz hdf5-ff974d2cb7f566b1242ba331667cd9eb145209de.tar.bz2 |
[svn-r24942] merge from VOL branch.
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/CMakeLists.txt | 43 | ||||
-rw-r--r-- | tools/lib/Makefile.am | 2 | ||||
-rw-r--r-- | tools/lib/Makefile.in | 500 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 64 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 6 | ||||
-rw-r--r-- | tools/lib/h5tools_filters.c | 289 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 2 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 138 | ||||
-rw-r--r-- | tools/lib/h5trav.h | 12 |
10 files changed, 693 insertions, 365 deletions
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 43ef6ba..c3b8294 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -1,16 +1,16 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) PROJECT (HDF5_TOOLS_LIB) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF5_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- -SET (H5_TOOLS_LIB_SRCS +set (H5_TOOLS_LIB_SRCS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_array.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_attr.c @@ -26,7 +26,7 @@ SET (H5_TOOLS_LIB_SRCS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5trav.c ) -SET (H5_TOOLS_LIB_HDRS +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 @@ -36,18 +36,21 @@ SET (H5_TOOLS_LIB_HDRS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.h ) -ADD_LIBRARY (${HDF5_TOOLS_LIB_TARGET} ${LIB_TYPE} ${H5_TOOLS_LIB_SRCS} ${H5_TOOLS_LIB_HDRS}) +add_library (${HDF5_TOOLS_LIB_TARGET} ${LIB_TYPE} ${H5_TOOLS_LIB_SRCS} ${H5_TOOLS_LIB_HDRS}) TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} " " " ") -TARGET_LINK_LIBRARIES (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") +target_link_libraries (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") H5_SET_LIB_OPTIONS ( ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} ${LIB_TYPE} HDF5_TOOLS_LIB_NAME_RELEASE HDF5_TOOLS_LIB_NAME_DEBUG ) -#SET_TARGET_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS H5DIFF_DEBUG) -SET_TARGET_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tools) +#set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS H5DIFF_DEBUG) +set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES + FOLDER libraries/tools + INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +) ############################################################################## ############################################################################## @@ -58,7 +61,7 @@ SET_TARGET_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tool #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- -INSTALL ( +install ( FILES ${H5_TOOLS_LIB_HDRS} DESTINATION @@ -71,26 +74,26 @@ INSTALL ( # Because tools are installed into bin/tools we need to make sure the hdf5tools # library will be installed into the proper location. #----------------------------------------------------------------------------- -IF (APPLE) - OPTION (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF) - IF (HDF5_BUILD_WITH_INSTALL_NAME) +if (APPLE) + option (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF) + if (HDF5_BUILD_WITH_INSTALL_NAME) SET_TARGET_PROPERTIES(${HDF5_TOOLS_LIB_TARGET} PROPERTIES LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}" INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME} ) - ENDIF (HDF5_BUILD_WITH_INSTALL_NAME) -ENDIF (APPLE) + endif (HDF5_BUILD_WITH_INSTALL_NAME) +endif (APPLE) #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- -IF (HDF5_EXPORTED_TARGETS) - IF (BUILD_SHARED_LIBS) +if (HDF5_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} toolslibraries) - ENDIF (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS) - INSTALL ( + install ( TARGETS ${HDF5_TOOLS_LIB_TARGET} EXPORT @@ -99,4 +102,4 @@ IF (HDF5_EXPORTED_TARGETS) ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT toolslibraries RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolslibraries ) -ENDIF (HDF5_EXPORTED_TARGETS) +endif (HDF5_EXPORTED_TARGETS) diff --git a/tools/lib/Makefile.am b/tools/lib/Makefile.am index e364b47..9050aac 100644 --- a/tools/lib/Makefile.am +++ b/tools/lib/Makefile.am @@ -21,7 +21,7 @@ include $(top_srcdir)/config/commence.am # Include files in /src directory -INCLUDES=-I$(top_srcdir)/src +AM_CPPFLAGS+=-I$(top_srcdir)/src # This is our main target, the h5tools library. noinst_LTLIBRARIES=libh5tools.la diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index dae3924..e830869 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,23 +32,51 @@ # VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +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 \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + 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@ @@ -67,10 +95,10 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \ - $(top_srcdir)/config/commence.am \ - $(top_srcdir)/config/conclude.am +DIST_COMMON = $(top_srcdir)/config/commence.am \ + $(top_srcdir)/config/conclude.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/bin/mkinstalldirs \ + $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/test-driver check_PROGRAMS = $(am__EXEEXT_1) TESTS = $(am__EXEEXT_1) subdir = tools/lib @@ -137,12 +165,225 @@ am__can_run_installinfo = \ 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) +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='[0;31m'; \ + grn='[0;32m'; \ + lgn='[1;32m'; \ + blu='[1;34m'; \ + mgn='[0;35m'; \ + brg='[1m'; \ + std='[m'; \ + 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ @@ -154,7 +395,9 @@ AMTAR = @AMTAR@ # 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@ + +# Include files in /src directory +AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ @@ -215,7 +458,6 @@ FC_VERSION = @FC_VERSION@ FGREP = @FGREP@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ -GPFS = @GPFS@ GREP = @GREP@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ @@ -449,9 +691,6 @@ TRACE = perl $(top_srcdir)/bin/trace # *.clog are from the MPE option. CHECK_CLEANFILES = *.chkexe *.chklog *.clog -# Include files in /src directory -INCLUDES = -I$(top_srcdir)/src - # This is our main target, the h5tools library. noinst_LTLIBRARIES = libh5tools.la libh5tools_la_SOURCES = h5tools.c h5tools_dump.c h5tools_str.c h5tools_utils.c h5diff.c \ @@ -488,7 +727,7 @@ TEST_SCRIPT_PARA_CHKSH = $(TEST_SCRIPT_PARA:=.chkexe_) all: all-am .SUFFIXES: -.SUFFIXES: .c .lo .o .obj +.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 \ @@ -531,6 +770,7 @@ clean-noinstLTLIBRARIES: echo rm -f $${locs}; \ rm -f $${locs}; \ } + libh5tools.la: $(libh5tools_la_OBJECTS) $(libh5tools_la_DEPENDENCIES) $(EXTRA_libh5tools_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libh5tools_la_OBJECTS) $(libh5tools_la_LIBADD) $(LIBS) @@ -568,14 +808,14 @@ distclean-compile: @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -590,26 +830,15 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +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`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -621,15 +850,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +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 @@ -638,9 +863,10 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am -cscopelist: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP)'; \ +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ @@ -656,6 +882,151 @@ cscopelist: $(HEADERS) $(SOURCES) $(LISP) 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; \ + else \ + 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 $(check_PROGRAMS) + @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'`; \ @@ -712,6 +1083,9 @@ install-strip: "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: @@ -795,9 +1169,9 @@ uninstall-am: .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ - clean clean-checkPROGRAMS clean-generic clean-libtool \ - clean-noinstLTLIBRARIES cscopelist ctags distclean \ +.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES 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 \ @@ -807,8 +1181,8 @@ uninstall-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 tags uninstall \ - uninstall-am + mostlyclean-local pdf pdf-am ps ps-am recheck tags tags-am \ + uninstall uninstall-am # List all build rules defined by HDF5 Makefiles as "PHONY" targets here. diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index ab21bfd..884a85d 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1096,7 +1096,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, char * grp2_path = ""; char * obj1_fullpath = NULL; char * obj2_fullpath = NULL; - h5trav_type_t objtype; diff_args_t argdata; size_t idx1 = 0; size_t idx2 = 0; @@ -1163,7 +1162,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, { if( table->objs[i].flags[0] && table->objs[i].flags[1]) { - objtype = table->objs[i].type; /* make full path for obj1 */ obj1_fullpath = (char*)HDcalloc (HDstrlen(grp1_path) + strlen (table->objs[i].name) + 1, sizeof (char)); HDstrcpy(obj1_fullpath, grp1_path); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 1794342..10d150f 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -64,12 +64,8 @@ static const char *drivernames[]={ "family", "split", "multi", -#ifdef H5_HAVE_STREAM - "stream", -#endif /* H5_HAVE_STREAM */ #ifdef H5_HAVE_PARALLEL "mpio", - "mpiposix" #endif /* H5_HAVE_PARALLEL */ }; @@ -80,12 +76,8 @@ typedef enum { ,FAMILY_IDX ,SPLIT_IDX ,MULTI_IDX -#ifdef H5_HAVE_STREAM - ,STREAM_IDX -#endif /* H5_HAVE_STREAM */ #ifdef H5_HAVE_PARALLEL ,MPIO_IDX - ,MPIPOSIX_IDX #endif /* H5_HAVE_PARALLEL */ } driver_idx; #define NUM_DRIVERS (sizeof(drivernames) / sizeof(drivernames[0])) @@ -521,48 +513,23 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) if(drivernum) *drivernum = MULTI_IDX; -#ifdef H5_HAVE_STREAM - } - else if(!HDstrcmp(driver, drivernames[STREAM_IDX])) { - /* STREAM Driver */ - if(H5Pset_fapl_stream(new_fapl, NULL) < 0) - goto error; - - if(drivernum) - *drivernum = STREAM_IDX; -#endif /* H5_HAVE_STREAM */ -#ifdef H5_HAVE_PARALLEL - } - else if(!HDstrcmp(driver, drivernames[MPIO_IDX])) { - /* MPI-I/O Driver */ - /* check if MPI has been initialized. */ - if(!h5tools_mpi_init_g) - MPI_Initialized(&h5tools_mpi_init_g); - if(h5tools_mpi_init_g) { - if(H5Pset_fapl_mpio(new_fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0) - goto error; - - if(drivernum) - *drivernum = MPIO_IDX; - } /* end if */ } - else if (!HDstrcmp(driver, drivernames[MPIPOSIX_IDX])) { +#ifdef H5_HAVE_PARALLEL + else if(!HDstrcmp(driver, drivernames[MPIO_IDX])) { /* MPI-I/O Driver */ /* check if MPI has been initialized. */ if(!h5tools_mpi_init_g) MPI_Initialized(&h5tools_mpi_init_g); if(h5tools_mpi_init_g) { - if(H5Pset_fapl_mpiposix(new_fapl, MPI_COMM_WORLD, TRUE) < 0) + if(H5Pset_fapl_mpio(new_fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0) goto error; - if(drivernum) - *drivernum = MPIPOSIX_IDX; + *drivernum = MPIO_IDX; } /* end if */ -#endif /* H5_HAVE_PARALLEL */ } - else { +#endif /* H5_HAVE_PARALLEL */ + else goto error; - } return(new_fapl); @@ -580,8 +547,7 @@ error: * Loop through the various types of VFL drivers trying to open FNAME. * If the HDF5 library is version 1.2 or less, then we have only the SEC2 * driver to try out. If the HDF5 library is greater than version 1.2, - * then we have the FAMILY, SPLIT, and MULTI drivers to play with (and - * the STREAM driver if H5_HAVE_STREAM is defined, that is). + * then we have the FAMILY, SPLIT, and MULTI drivers to play with. * * If DRIVER is non-NULL, then it will try to open the file with that * driver first. We assume that the user knows what they are doing so, if @@ -956,10 +922,9 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims, ctx->p_max_idx, ctx); /* Write new prefix to output */ - if (ctx->indent_level >= 0) { + if (ctx->indent_level >= 0) indentlevel = ctx->indent_level; - } - else { + else /* * This is because sometimes we don't print out all the header * info for the data (like the tattr-2.ddl example). If that happens @@ -967,25 +932,20 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, * just print out the default indent levels. */ indentlevel = ctx->default_indent_level; - } /* when printing array indices, print the indentation before the prefix the prefix is printed one indentation level before */ - if (info->pindex) { + if (info->pindex) for (i = 0; i < indentlevel - 1; i++) { PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); } - } if (elmtno == 0 && secnum == 0 && info->line_1st) { PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); - } - else if (secnum && info->line_cont) { + } else if (secnum && info->line_cont) { PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); - } - else { + } else PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); - } templength = h5tools_str_len(&prefix); diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index e1fdd4b..3432a8b 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2336,7 +2336,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ 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); - HDfree(ttag); + H5free_memory(ttag); } ctx->indent_level--; @@ -2372,7 +2372,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ } else HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_member_type failed"); - HDfree(mname); + H5free_memory(mname); } ctx->indent_level--; @@ -2688,7 +2688,7 @@ CATCH /* Release resources */ for(i = 0; i < nmembs; i++) if(name[i]) - HDfree(name[i]); + H5free_memory(name[i]); HDfree(name); } /* end if */ diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 2da21ef..3664a29 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -20,10 +20,10 @@ * print a warning message *------------------------------------------------------------------------- */ -static void print_warning(const char *dname, const char *fname) -{ - fprintf(stderr,"warning: dataset <%s> cannot be read, %s filter is not available\n", - dname,fname); +static void print_warning(const char *dname, const char *fname) { + fprintf(stderr, + "warning: dataset <%s> cannot be read, %s filter is not available\n", + dname, fname); } /*------------------------------------------------------------------------- @@ -46,109 +46,111 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr hid_t dcpl_id) /* dataset creation property list */ { - int nfilters; /* number of filters */ - H5Z_filter_t filtn; /* filter identification number */ - int i; /* index */ - - - /* get information about filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) - return -1; - - /* if we do not have filters, we can read the dataset safely */ - if (!nfilters) - return 1; - - /* 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) - return -1; - - switch(filtn) - { -/*------------------------------------------------------------------------- - * user defined filter - *------------------------------------------------------------------------- - */ - default: - if(name) - print_warning(name, "user defined"); - return 0; - -/*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE 1 , deflation like gzip - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_DEFLATE: + int nfilters; /* number of filters */ + H5Z_filter_t filtn; /* filter identification number */ + int i; /* index */ + int udfilter_avail; /* index */ + + /* get information about filters */ + if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) + return -1; + + /* if we do not have filters, we can read the dataset safely */ + if (!nfilters) + return 1; + + /* 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) + return -1; + + switch (filtn) { + /*------------------------------------------------------------------------- + * user defined filter + *------------------------------------------------------------------------- + */ + default: + if ((udfilter_avail = H5Zfilter_avail(filtn)) < 0) + return -1; + else if (udfilter_avail == 0) { + if (name) + print_warning(name, "user defined"); + return 0; + } + break; + + /*------------------------------------------------------------------------- + * H5Z_FILTER_DEFLATE 1 , deflation like gzip + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_DEFLATE: #ifndef H5_HAVE_FILTER_DEFLATE - if (name) - print_warning(name,"deflate"); - return 0; + if (name) + print_warning(name,"deflate"); + return 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_warning(name,"SZIP"); - return 0; + if (name) + print_warning(name,"SZIP"); + return 0; #endif - break; -/*------------------------------------------------------------------------- - * H5Z_FILTER_SHUFFLE 2 , shuffle the data - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_SHUFFLE: + break; + /*------------------------------------------------------------------------- + * H5Z_FILTER_SHUFFLE 2 , shuffle the data + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_SHUFFLE: #ifndef H5_HAVE_FILTER_SHUFFLE - if (name) - print_warning(name,"shuffle"); - return 0; + if (name) + print_warning(name,"shuffle"); + return 0; #endif - break; -/*------------------------------------------------------------------------- - * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_FLETCHER32: + break; + /*------------------------------------------------------------------------- + * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_FLETCHER32: #ifndef H5_HAVE_FILTER_FLETCHER32 - if (name) - print_warning(name,"fletcher32"); - return 0; + if (name) + print_warning(name,"fletcher32"); + return 0; #endif - break; -/*------------------------------------------------------------------------- - * H5Z_FILTER_NBIT - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_NBIT: + break; + /*------------------------------------------------------------------------- + * H5Z_FILTER_NBIT + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_NBIT: #ifndef H5_HAVE_FILTER_NBIT - if (name) - print_warning(name,"nbit"); - return 0; + if (name) + print_warning(name,"nbit"); + return 0; #endif - break; -/*------------------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET - *------------------------------------------------------------------------- - */ - case H5Z_FILTER_SCALEOFFSET: + break; + /*------------------------------------------------------------------------- + * H5Z_FILTER_SCALEOFFSET + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_SCALEOFFSET: #ifndef H5_HAVE_FILTER_SCALEOFFSET - if (name) - print_warning(name,"scaleoffset"); - return 0; + if (name) + print_warning(name,"scaleoffset"); + return 0; #endif - break; - }/*switch*/ - }/*for*/ + break; + }/*switch*/ + }/*for*/ - return 1; + return 1; } - /*------------------------------------------------------------------------- * Function: h5tools_canwritef * @@ -164,71 +166,70 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr * *------------------------------------------------------------------------- */ -int h5tools_can_encode( H5Z_filter_t filtn) -{ - switch (filtn) - { - /* user defined filter */ - default: - return 0; +int h5tools_can_encode(H5Z_filter_t filtn) { + switch (filtn) { + /* user defined filter */ + default: + return 0; - case H5Z_FILTER_DEFLATE: + case H5Z_FILTER_DEFLATE: #ifndef H5_HAVE_FILTER_DEFLATE - return 0; + return 0; #endif - break; - case H5Z_FILTER_SZIP: + break; + case H5Z_FILTER_SZIP: #ifndef H5_HAVE_FILTER_SZIP - return 0; + return 0; #else - { - unsigned int filter_config_flags; - - if(H5Zget_filter_info(filtn, &filter_config_flags)<0) - return -1; - if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { - /* filter present but neither encode nor decode is supported (???) */ - return -1; - } 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 */ - return 0; - } 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 (???) */ - return -1; - } 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)) { - return 1; - } - } + { + unsigned int filter_config_flags; + + if (H5Zget_filter_info(filtn, &filter_config_flags) < 0) + return -1; + if ((filter_config_flags + & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { + /* filter present but neither encode nor decode is supported (???) */ + return -1; + } + 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 */ + return 0; + } + 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 (???) */ + return -1; + } + 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)) { + return 1; + } + } #endif - break; - case H5Z_FILTER_SHUFFLE: + break; + case H5Z_FILTER_SHUFFLE: #ifndef H5_HAVE_FILTER_SHUFFLE - return 0; + return 0; #endif - break; - case H5Z_FILTER_FLETCHER32: + break; + case H5Z_FILTER_FLETCHER32: #ifndef H5_HAVE_FILTER_FLETCHER32 - return 0; + return 0; #endif - break; - case H5Z_FILTER_NBIT: + break; + case H5Z_FILTER_NBIT: #ifndef H5_HAVE_FILTER_NBIT - return 0; + return 0; #endif - break; - case H5Z_FILTER_SCALEOFFSET: + break; + case H5Z_FILTER_SCALEOFFSET: #ifndef H5_HAVE_FILTER_SCALEOFFSET - return 0; + return 0; #endif - break; - }/*switch*/ + break; + }/*switch*/ - return 1; + return 1; } diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 34142d4..3160cfa 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -991,7 +991,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai /* The name */ name = H5Tget_member_name(type, j); h5tools_str_append(str, OPT(info->cmpd_name, ""), name); - HDfree(name); + H5free_memory(name); /* The value */ offset = H5Tget_member_offset(type, j); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index a475ded..d0a4a76 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -21,13 +21,15 @@ * local typedefs *------------------------------------------------------------------------- */ +typedef struct trav_addr_path_t { + haddr_t addr; + char *path; +} trav_addr_path_t; + typedef struct trav_addr_t { size_t nalloc; size_t nused; - struct { - haddr_t addr; - char *path; - } *objs; + trav_addr_path_t *objs; } trav_addr_t; typedef struct { @@ -49,7 +51,9 @@ typedef struct { } trav_print_udata_t; /* format for hsize_t */ +#ifdef H5TRAV_PRINT_SPACE #define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u" +#endif /* H5TRAV_PRINT_SPACE */ /*------------------------------------------------------------------------- * local functions @@ -130,7 +134,7 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path) /* Allocate space if necessary */ if(visited->nused == visited->nalloc) { visited->nalloc = MAX(1, visited->nalloc * 2);; - visited->objs = HDrealloc(visited->objs, visited->nalloc * sizeof(visited->objs[0])); + visited->objs = (trav_addr_path_t *)HDrealloc(visited->objs, visited->nalloc * sizeof(trav_addr_path_t)); } /* end if */ /* Append it */ @@ -192,14 +196,15 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, /* 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 add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1; + size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1; - if(NULL == (new_name = (char*)HDmalloc(base_len + add_slash + HDstrlen(path) + 1))) + if(NULL == (new_name = (char*)HDmalloc(new_name_len))) return(H5_ITER_ERROR); - HDstrcpy(new_name, udata->base_grp_name); - if (add_slash) - new_name[base_len] = '/'; - HDstrcpy(new_name + base_len + add_slash, path); + 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); full_name = new_name; } /* end if */ else @@ -214,7 +219,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, if(new_name) HDfree(new_name); 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 @@ -229,7 +234,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, if(new_name) HDfree(new_name); return(H5_ITER_ERROR); - } + } /* end if */ } /* end if */ else { /* Make 'visit link' callback */ @@ -238,7 +243,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, if(new_name) HDfree(new_name); return(H5_ITER_ERROR); - } + } /* end if */ } /* end else */ if(new_name) @@ -680,11 +685,11 @@ h5trav_getindext(const char *name, const trav_table_t *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(i); + return((int)i); /* Check for object name without leading '/' */ if(HDstrcmp(name, table->objs[i].name + 1) == 0) - return(i); + return((int)i); /* search also in the list of links */ if(table->objs[i].nlinks) { @@ -693,11 +698,11 @@ h5trav_getindext(const char *name, const trav_table_t *table) 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(i); + return((int)i); /* Check for object name without leading '/' */ if(HDstrcmp(name, table->objs[i].links[j].new_name + 1) == 0) - return(i); + return((int)i); } /* end for */ } /* end if */ } /* end for */ @@ -728,7 +733,7 @@ trav_table_add(trav_table_t *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)); + table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t)); } /* end if */ new_obj = table->nobjs++; @@ -772,7 +777,7 @@ trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path) /* allocate space if necessary */ 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 */ @@ -807,7 +812,7 @@ void trav_table_addflags(unsigned *flags, h5trav_type_t type, trav_table_t *table) { - unsigned int new_obj; + size_t new_obj; if(table->nobjs == table->size) { table->size = MAX(1, table->size * 2); @@ -995,6 +1000,8 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, printf(" %-10s %s", "datatype", path); break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: printf(" %-10s %s", "unknown object type", path); break; @@ -1005,7 +1012,7 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, /* Finish printing line about object */ printf("\n"); if(trav_verbosity > 0) - H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order, NULL, trav_attr, path, H5P_DEFAULT); + H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order, NULL, trav_attr, (void *)path, H5P_DEFAULT); } else /* Print the link's original name */ @@ -1040,7 +1047,8 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) char *targbuf = (char*)HDmalloc(linfo->u.val_size + 1); HDassert(targbuf); - H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT); + if(H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0) + targbuf[0] = 0; printf(" %-10s %s -> %s\n", "link", path, targbuf); HDfree(targbuf); } /* end if */ @@ -1051,21 +1059,28 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) case H5L_TYPE_EXTERNAL: if(linfo->u.val_size > 0) { char *targbuf; - const char *filename; - const char *objname; + const char *filename = NULL; + const char *objname = NULL; targbuf = (char*)HDmalloc(linfo->u.val_size + 1); HDassert(targbuf); - H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT); - H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &objname); - printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname); + 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) + printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname); HDfree(targbuf); } /* end if */ else printf(" %-10s %s ->\n", "ext link", path); break; + case H5L_TYPE_HARD: + /* Should be handled elsewhere */ + return(-1); + + case H5L_TYPE_ERROR: + case H5L_TYPE_MAX: default: printf(" %-10s %s -> ???\n", "unknown type of UD link", path); break; @@ -1156,31 +1171,21 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start, * * Date: September 5, 2008 * - * Modified: - * Jonathan Kim - * - Moved from h5ls.c to share among tools. (Sep 16, 2010) - * - Renamed from elink_trav_add to symlink_visit_add for both soft and - * external links. (May 25, 2010) - * - Add type parameter to distingush between soft and external link for - * sure, which prevent from mixing up visited link when the target names - * are same between the soft and external link, as code marks with the - * target name. (May 25,2010) - * *------------------------------------------------------------------------- */ 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 */ - void *tmp_ptr; /* Allocate space if necessary */ - if(visited->nused == visited->nalloc) - { + 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(visited->objs[0])))) + if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t)))) return -1; - visited->objs = tmp_ptr; + visited->objs = (symlink_trav_path_t *)tmp_ptr; } /* end if */ /* Append it */ @@ -1190,22 +1195,19 @@ 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--; return -1; - } - } + } /* 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) + if(visited->objs[idx].file) HDfree (visited->objs[idx].file); return -1; - } + } /* end if */ return 0; } /* end symlink_visit_add() */ @@ -1223,16 +1225,6 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co * * Date: September 5, 2008 * - * Modified: - * Jonathan Kim - * - Moved from h5ls.c to share among tools. (Sep 16, 2010) - * - Renamed from elink_trav_visited to symlink_is_visited for both soft and - * external links. (May 25, 2010) - * - Add type parameter to distingush between soft and external link for - * sure, which prevent from mixing up visited link when the target names - * are same between the soft and external link, as code marks with the - * target name. (May 25,2010) - * *------------------------------------------------------------------------- */ hbool_t @@ -1241,21 +1233,19 @@ symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, c 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 */ + /* Didn't find symlink */ return(FALSE); } /* end symlink_is_visited() */ diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index 3548c6b..352a9e5 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -51,14 +51,16 @@ typedef enum { /* Struct to keep track of symbolic link targets visited. * Functions: symlink_visit_add() and symlink_is_visited() */ +typedef struct symlink_trav_path_t { + H5L_type_t type; + char *file; + char *path; +} symlink_trav_path_t; + typedef struct symlink_trav_t { size_t nalloc; size_t nused; - struct { - H5L_type_t type; - char *file; - char *path; - } *objs; + symlink_trav_path_t *objs; hbool_t dangle_link; } symlink_trav_t; |