From a4294ab3ccd31bb06336cfec0b90b28bc591dbf8 Mon Sep 17 00:00:00 2001 From: HDF Tester Date: Sun, 1 Sep 2013 03:37:42 -0500 Subject: [svn-r24092] Snapshot version 1.9 release 163 --- README.txt | 2 +- c++/src/Makefile.in | 2 +- config/lt_vers.am | 2 +- configure | 22 +++++++++++----------- configure.ac | 2 +- fortran/src/Makefile.in | 2 +- hl/c++/src/Makefile.in | 2 +- hl/fortran/src/Makefile.in | 2 +- hl/src/Makefile.in | 2 +- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- src/Makefile.in | 2 +- vms/src/h5pubconf.h | 6 +++--- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/README.txt b/README.txt index da1a1fa..986a09e 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.163 currently under development +HDF5 version 1.9.164 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 44ecd1f..f601487 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -467,7 +467,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 153 +LT_VERS_REVISION = 154 LT_VERS_AGE = 0 # Include src directory diff --git a/config/lt_vers.am b/config/lt_vers.am index 67cd8b6..8d9927b 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 153 +LT_VERS_REVISION = 154 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index 2c449eb..4963d93 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.163. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.164. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.163' -PACKAGE_STRING='HDF5 1.9.163' +PACKAGE_VERSION='1.9.164' +PACKAGE_STRING='HDF5 1.9.164' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1486,7 +1486,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.163 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.164 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1556,7 +1556,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.163:";; + short | recursive ) echo "Configuration of HDF5 1.9.164:";; esac cat <<\_ACEOF @@ -1752,7 +1752,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.163 +HDF5 configure 1.9.164 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2846,7 +2846,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.163, which was +It was created by HDF5 $as_me 1.9.164, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3678,7 +3678,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.163' + VERSION='1.9.164' cat >>confdefs.h <<_ACEOF @@ -31613,7 +31613,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.163 +HDF5 config.lt 1.9.164 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -33743,7 +33743,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.163, which was +This file was extended by HDF5 $as_me 1.9.164, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33809,7 +33809,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.163 +HDF5 config.status 1.9.164 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 1992c48..386450b 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.163], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.164], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 0410f1c..e826a35 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -518,7 +518,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 153 +LT_VERS_REVISION = 154 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 9209263..102fe39 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -458,7 +458,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 153 +LT_VERS_REVISION = 154 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index e9c55e0..c69b952 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -474,7 +474,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 153 +LT_VERS_REVISION = 154 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 8a30f06..27b278e 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -457,7 +457,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 153 +LT_VERS_REVISION = 154 LT_VERS_AGE = 0 # This library is our main target. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 2e216df..811095f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.163 currently under development +HDF5 version 1.9.164 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index eab72b5..3d77ed7 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 163 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 164 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.163" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.164" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index 609aea5..6e54781 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -522,7 +522,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 153 +LT_VERS_REVISION = 154 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index da0172f..471b2ed 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -511,7 +511,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.163" +#define H5_PACKAGE_STRING "HDF5 1.9.164" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -520,7 +520,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.163" +#define H5_PACKAGE_VERSION "1.9.164" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -683,7 +683,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.163" +#define H5_VERSION "1.9.164" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12 From d50c061d38182a5b6477e63655fbe96fcb2c2726 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Tue, 3 Sep 2013 14:39:34 -0500 Subject: [svn-r24095] Issue 8500 - H5detect.c has trouble to find info for long double with GCC 4.8. A user in the forum found the problem in H5detect.c (uninitialized buffer) and provided the solution. Allen and I verified it. Tested with h5committest and CMake on jam, koala, ostrich, playtus, and Allen's virtual machine. --- config/gnu-flags | 5 ----- src/H5detect.c | 2 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index eef38ad..a79cc72 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -156,11 +156,6 @@ case "$cc_vendor-$cc_version" in gcc-3.*) PROD_CFLAGS="-O3" ;; - gcc-4.8.*) - # temp patch: when GCC 4.8.x is used for Linux, dt_arith fails if -O* - # is used. Remove any -O* flags. (AKC HDFFV-8500) - PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O[0-3]*//'`" - ;; gcc-4.*) PROD_CFLAGS="-O3" ;; diff --git a/src/H5detect.c b/src/H5detect.c index 2bf0d2d..25fe778 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -238,6 +238,7 @@ precision (detected_t *d) unsigned char *_x; \ \ HDmemset(&INFO, 0, sizeof(INFO)); \ + HDmemset(INFO.perm, 0, sizeof(INFO.perm)); \ INFO.varname = #VAR; \ INFO.size = sizeof(TYPE); \ \ @@ -297,6 +298,7 @@ precision (detected_t *d) char *_mesg; \ \ HDmemset(&INFO, 0, sizeof(INFO)); \ + HDmemset(INFO.perm, 0, sizeof(INFO.perm)); \ INFO.varname = #VAR; \ INFO.size = sizeof(TYPE); \ \ -- cgit v0.12 From bf1c137c0c7ff571f1a40e7ae8e28617de70c95c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 4 Sep 2013 14:58:45 -0500 Subject: [svn-r24097] Correct indentation --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2704f0c..f41a5a1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -65,7 +65,7 @@ IF (BUILD_SHARED_LIBS) INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) ADD_LIBRARY (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) - TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} " " " ") + TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} " " " ") TARGET_LINK_LIBRARIES (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} -- cgit v0.12 From a1fe10691cf7ce1737aa420191efb996f7fe5657 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Wed, 4 Sep 2013 17:09:23 -0500 Subject: [svn-r24098] Issue 8500 - H5detect.c has trouble to find info for long double with GCC 4.8. A user in the forum found the problem in H5detect.c (uninitialized buffer) and provided the solution. I checked it in yesterday. But it turned out to be a false fix. So I'm back it out. Tested on jam - reverse of changes. --- config/gnu-flags | 5 +++++ src/H5detect.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index a79cc72..eef38ad 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -156,6 +156,11 @@ case "$cc_vendor-$cc_version" in gcc-3.*) PROD_CFLAGS="-O3" ;; + gcc-4.8.*) + # temp patch: when GCC 4.8.x is used for Linux, dt_arith fails if -O* + # is used. Remove any -O* flags. (AKC HDFFV-8500) + PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O[0-3]*//'`" + ;; gcc-4.*) PROD_CFLAGS="-O3" ;; diff --git a/src/H5detect.c b/src/H5detect.c index 25fe778..2bf0d2d 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -238,7 +238,6 @@ precision (detected_t *d) unsigned char *_x; \ \ HDmemset(&INFO, 0, sizeof(INFO)); \ - HDmemset(INFO.perm, 0, sizeof(INFO.perm)); \ INFO.varname = #VAR; \ INFO.size = sizeof(TYPE); \ \ @@ -298,7 +297,6 @@ precision (detected_t *d) char *_mesg; \ \ HDmemset(&INFO, 0, sizeof(INFO)); \ - HDmemset(INFO.perm, 0, sizeof(INFO.perm)); \ INFO.varname = #VAR; \ INFO.size = sizeof(TYPE); \ \ -- cgit v0.12 From 5b876c929f79003c85585570827452f5d8052d01 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 5 Sep 2013 15:44:14 -0500 Subject: [svn-r24101] Description: Clean up warnings, enable new compiler warning flag(s) and bring back changes from Coverity branch: r20813: Remove the dead code as listed for coverity bug #1722. h5committested. r20814: Issue 69: Check return value and throw error if negative return. Also free datatype id on error r20815: Use HDstrncpy. --gh r20816: Replaced one last HDstrcat call with HDstrncat to resolve coverity issue 832. r20817: Use HDstrncpy and HDstrncat. --gh r20818: Purpose: Fix valgrind issues with h5jam Description: Modified h5jam to free strings strdup'd in parse_command_line before exit. Note that they may still not be freed in case of error, due to the widespread use of exit(). r20819: Issue 80: change loop to use int as loop index. r20820: Maintenance: Fixed the bug found by coverity CID 788 There were two problems with this function: 1) it tried to unnecessary free NULL pointer 2) it tried to allocate c_name buffer that is done by H5Pget_class_name Tested on: Mac OSX 10.8.4 (amazon) w/gcc 4.8.1, C++ & FORTRAN (too minor to require h5committest) --- config/gnu-flags | 3 +- fortran/src/H5Pf.c | 26 +++++++-------- fortran/test/fortranlib_test_1_8.f90 | 10 ++++++ src/H5Pint.c | 26 +++++++-------- src/H5T.c | 13 ++++---- src/H5Tconv.c | 56 +++++++++++++++++++++++++++++++- src/H5Zscaleoffset.c | 52 +++++++++++++++--------------- src/H5private.h | 24 ++++++++++++++ test/dsets.c | 10 +++--- test/dtypes.c | 62 +++++++++++++++++++----------------- tools/h5dump/h5dump_defines.h | 2 +- tools/h5dump/h5dumpgentest.c | 12 +++---- tools/h5jam/h5jam.c | 17 ++++++---- tools/lib/h5diff_array.c | 17 +++++----- tools/lib/h5tools.c | 28 ++++++++++------ 15 files changed, 225 insertions(+), 133 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index eef38ad..57fc23a 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -220,8 +220,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wformat=2" # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) - #H5_CFLAGS="$H5_CFLAGS -Wunreachable-code" + H5_CFLAGS="$H5_CFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case H5_CFLAGS="$H5_CFLAGS -Wendif-labels" diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index dba2aa4..262ce55 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -3370,14 +3370,15 @@ nh5pclose_class_c(hid_t_f *cls) ret_value = 0; return ret_value; } + /****if* H5Pf/h5pget_class_name_c * NAME * h5pget_class_name_c * PURPOSE * Call H5Pget_class_name to get property class name * INPUTS - * cls - identifier of property class - * name - ibuffer to retrieve name in + * cls - identifier of property class + * name - buffer to retrieve name in * name_len - length of the "name" buffer * RETURNS * 0 on success, -1 on failure @@ -3393,30 +3394,25 @@ nh5pget_class_name_c(hid_t_f *cls, _fcd name, int_f *name_len) /******/ { int_f ret_value = -1; - char *c_name = NULL; /* Buffer to hold C string */ - size_t c_size; - c_size = (size_t)*name_len + 1; - - /* - * Allocate buffer to hold name - */ - if(NULL == (c_name = (char *)HDmalloc(c_size))) - goto DONE; + /* Buffer to return name by C function */ + char *c_name; /* - * Call H5Pget_class_name function. + * Call H5Pget_class_name function. c_name is allocated by the library, + * has to be freed by application. */ - c_name = H5Pget_class_name((hid_t)*cls); - if(c_name == NULL) goto DONE; + if(NULL == (c_name = H5Pget_class_name((hid_t)*cls))) + goto DONE; HD5packFstring(c_name, _fcdtocp(name), (size_t)*name_len); ret_value = (int_f)HDstrlen(c_name); + HDfree(c_name); DONE: - HDfree(c_name); return ret_value; } + /****if* H5Pf/h5psetc_c * NAME * h5psetc_c diff --git a/fortran/test/fortranlib_test_1_8.f90 b/fortran/test/fortranlib_test_1_8.f90 index d3ced72..dc45560 100644 --- a/fortran/test/fortranlib_test_1_8.f90 +++ b/fortran/test/fortranlib_test_1_8.f90 @@ -196,6 +196,16 @@ SUBROUTINE test_genprop_basic_class(cleanup, total_error) INTEGER :: size LOGICAL :: flag + !/* Output message about test being performed */ + + !WRITE(*,*) "Testing Basic Generic Property List Class Creation Functionality" + + ! Try some bogus value for class identifier; function should fail gracefully + + cid1 = 456 + CALL H5Pget_class_name_f(cid1, name, size, error) + CALL VERIFY("H5Pget_class_name", error, -1, error) + ! /* Create a new generic class, derived from the root of the class hierarchy */ CALL H5Pcreate_class_f(H5P_ROOT_F, CLASS1_NAME, cid1, error) CALL check("H5Pcreate_class", error, total_error) diff --git a/src/H5Pint.c b/src/H5Pint.c index 13cc3c1..40d0a9c 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -4787,9 +4787,6 @@ done: char * H5P_get_class_path(H5P_genclass_t *pclass) { - char *par_path; /* Parent class's full path */ - size_t par_path_len;/* Parent class's full path's length */ - size_t my_path_len; /* This class's name's length */ char *ret_value; /* return value */ FUNC_ENTER_NOAPI_NOINIT @@ -4797,33 +4794,32 @@ H5P_get_class_path(H5P_genclass_t *pclass) HDassert(pclass); /* Recursively build the full path */ - if(pclass->parent!=NULL) { + if(pclass->parent != NULL) { + char *par_path; /* Parent class's full path */ + /* Get the parent class's path */ - par_path=H5P_get_class_path(pclass->parent); - if(par_path!=NULL) { - /* Get the string lengths we need to allocate space */ - par_path_len=HDstrlen(par_path); - my_path_len=HDstrlen(pclass->name); + par_path = H5P_get_class_path(pclass->parent); + if(par_path != NULL) { + size_t ret_str_len; /* Allocate enough space for the parent class's path, plus the '/' * separator, this class's name and the string terminator */ - if(NULL == (ret_value = (char *)H5MM_malloc(par_path_len + 1 + my_path_len + 1))) + ret_str_len = HDstrlen(par_path) + 1 + HDstrlen(pclass->name) + 1; + if(NULL == (ret_value = (char *)H5MM_malloc(ret_str_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name") /* Build the full path for this class */ - HDstrcpy(ret_value,par_path); - HDstrcat(ret_value,"/"); - HDstrcat(ret_value,pclass->name); + HDsnprintf(ret_value, ret_str_len, "%s/%s", par_path, pclass->name); /* Free the parent class's path */ H5MM_xfree(par_path); } /* end if */ else - ret_value=H5MM_xstrdup(pclass->name); + ret_value = H5MM_xstrdup(pclass->name); } /* end if */ else - ret_value=H5MM_xstrdup(pclass->name); + ret_value = H5MM_xstrdup(pclass->name); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5T.c b/src/H5T.c index 8f44035..f918ee1 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -494,10 +494,10 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0; /* Useful floating-point values for conversion routines */ /* (+/- Inf for all floating-point types) */ -float H5T_NATIVE_FLOAT_POS_INF_g = 0.0; -float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0; -double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0; -double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0; +float H5T_NATIVE_FLOAT_POS_INF_g = 0.0f; +float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0f; +double H5T_NATIVE_DOUBLE_POS_INF_g = (double)0.0f; +double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f; /* Declare the free list for H5T_t's and H5T_shared_t's */ H5FL_DEFINE(H5T_t); @@ -2395,7 +2395,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if(NULL == (new_path = H5FL_CALLOC(H5T_path_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") HDstrncpy(new_path->name, name, (size_t)H5T_NAMELEN); - new_path->name[H5T_NAMELEN-1] = '\0'; + new_path->name[H5T_NAMELEN - 1] = '\0'; if(NULL == (new_path->src = H5T_copy(old_path->src, H5T_COPY_ALL)) || NULL == (new_path->dst=H5T_copy(old_path->dst, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy data types") @@ -4515,7 +4515,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5E_clear_stack(H5E_DEFAULT); /*ignore the error*/ } /* end if */ else { - HDstrcpy(path->name, H5T_g.soft[i].name); + HDstrncpy(path->name, H5T_g.soft[i].name, (size_t)H5T_NAMELEN); + path->name[H5T_NAMELEN - 1] = '\0'; path->func = H5T_g.soft[i].func; path->is_hard = FALSE; } /* end else */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 9ff0f00..bf686b8 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -8039,7 +8039,9 @@ H5T__conv_float_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX); +GCC_DIAG_ON(float-equal) } @@ -8064,7 +8066,9 @@ H5T__conv_float_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX); +GCC_DIAG_ON(float-equal) } @@ -8089,7 +8093,9 @@ H5T__conv_double_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX); +GCC_DIAG_ON(float-equal) } @@ -8114,7 +8120,9 @@ H5T__conv_double_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX); +GCC_DIAG_ON(float-equal) } @@ -8140,7 +8148,9 @@ H5T__conv_ldouble_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8167,7 +8177,9 @@ H5T__conv_ldouble_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8193,7 +8205,9 @@ H5T__conv_float_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8218,7 +8232,9 @@ H5T__conv_float_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8243,7 +8259,9 @@ H5T__conv_double_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8268,7 +8286,9 @@ H5T__conv_double_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8294,7 +8314,9 @@ H5T__conv_ldouble_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX); +GCC_DIAG_ON(float-equal) } #endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/ @@ -8321,7 +8343,9 @@ H5T__conv_ldouble_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8347,7 +8371,9 @@ H5T__conv_float_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8372,7 +8398,9 @@ H5T__conv_float_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8397,7 +8425,9 @@ H5T__conv_double_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8422,7 +8452,9 @@ H5T__conv_double_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8448,7 +8480,9 @@ H5T__conv_ldouble_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8475,7 +8509,9 @@ H5T__conv_ldouble_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_UINT */ @@ -8501,7 +8537,9 @@ H5T__conv_float_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX); +GCC_DIAG_ON(float-equal) } @@ -8526,7 +8564,9 @@ H5T__conv_float_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX); +GCC_DIAG_ON(float-equal) } @@ -8551,7 +8591,9 @@ H5T__conv_double_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX); +GCC_DIAG_ON(float-equal) } @@ -8576,7 +8618,9 @@ H5T__conv_double_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX); +GCC_DIAG_ON(float-equal) } @@ -8602,7 +8646,9 @@ H5T__conv_ldouble_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX); +GCC_DIAG_ON(float-equal) } #endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/ @@ -8629,7 +8675,9 @@ H5T__conv_ldouble_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8656,7 +8704,9 @@ H5T__conv_float_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_FP_LLONG */ @@ -8710,7 +8760,9 @@ H5T__conv_double_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX); +GCC_DIAG_ON(float-equal) } #endif /*H5T_CONV_INTERNAL_FP_LLONG*/ @@ -8764,7 +8816,9 @@ H5T__conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX); +GCC_DIAG_ON(float-equal) } #endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/ @@ -8909,7 +8963,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Allocate enough space for the buffer holding temporary * converted value */ - buf_size = (size_t)HDpow((double)2.0, (double)src.u.f.esize) / 8 + 1; + buf_size = (size_t)HDpow((double)2.0f, (double)src.u.f.esize) / 8 + 1; int_buf = (uint8_t*)H5MM_calloc(buf_size); /* Get the plist structure. Do I need to close it? */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 0aaff11..83864b9 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -347,10 +347,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Find maximum and minimum values of a buffer with fill value defined for floating-point type */ #define H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ { \ - i = 0; while(i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) i++; \ + i = 0; while(i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) i++; \ if(i < d_nelmts) min = max = buf[i]; \ for(; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ continue; /* ignore fill value */ \ if(buf[i] > max) max = buf[i]; \ if(buf[i] < min) min = buf[i]; \ @@ -394,18 +394,18 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ #define H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ { \ if(sizeof(type)==sizeof(int)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)) \ - > HDpow(2.0, (double)(sizeof(int)*8 - 1))) { \ + if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ + > HDpow(2.0f, (double)(sizeof(int)*8 - 1))) { \ *minbits = sizeof(int)*8; goto done; \ } \ } else if(sizeof(type)==sizeof(long)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)) \ - > HDpow(2.0, (double)(sizeof(long)*8 - 1))) { \ + if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ + > HDpow(2.0f, (double)(sizeof(long)*8 - 1))) { \ *minbits = sizeof(long)*8; goto done; \ } \ } else if(sizeof(type)==sizeof(long long)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)) \ - > HDpow(2.0, (double)(sizeof(long long)*8 - 1))) { \ + if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ + > HDpow(2.0f, (double)(sizeof(long long)*8 - 1))) { \ *minbits = sizeof(long long)*8; goto done; \ } \ } else \ @@ -483,27 +483,27 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ *(int *)&buf[i] = (int)(((unsigned int)1 << *minbits) - 1); \ else \ *(int *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ } \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ *(long *)&buf[i] = (long)(((unsigned long)1 << *minbits) - 1); \ else \ *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ } \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ *(long long *)&buf[i] = (long long)(((unsigned long long)1 << *minbits) - 1); \ else \ *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ } \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ @@ -515,15 +515,15 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ *(int *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ } @@ -560,14 +560,14 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ - span = H5Z_scaleoffset_rnd(max * HDpow(10.0, D_val) - min * HDpow(10.0, D_val)) + 1; \ + span = H5Z_scaleoffset_rnd(max * HDpow(10.0f, D_val) - min * HDpow(10.0f, D_val)) + 1; \ *minbits = H5Z_scaleoffset_log2((unsigned long long)(span + 1)); \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_1(i, type, buf, d_nelmts, filval, minbits, min, D_val) \ } else { /* fill value undefined */ \ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ - span = H5Z_scaleoffset_rnd(max * HDpow(10.0, D_val) - min * HDpow(10.0, D_val)) + 1; \ + span = H5Z_scaleoffset_rnd(max * HDpow(10.0f, D_val) - min * HDpow(10.0f, D_val)) + 1; \ *minbits = H5Z_scaleoffset_log2((unsigned long long)span); \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_2(i, type, buf, d_nelmts, min, D_val) \ @@ -628,15 +628,15 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(int *)&buf[i] == (int)(((unsigned int)1 << minbits) - 1)) ? \ - filval : (double)(*(int *)&buf[i]) / HDpow(10.0, D_val) + min); \ + filval : (double)(*(int *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(long *)&buf[i] == (long)(((unsigned long)1 << minbits) - 1)) ? \ - filval : (double)(*(long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + filval : (double)(*(long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(long long *)&buf[i] == (long long)(((unsigned long long)1 << minbits) - 1)) ? \ - filval : (double)(*(long long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + filval : (double)(*(long long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -646,13 +646,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(int *)&buf[i]) / HDpow(10.0, D_val) + min); \ + buf[i] = (type)((double)(*(int *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + buf[i] = (type)((double)(*(long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(long long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + buf[i] = (type)((double)(*(long long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -1047,7 +1047,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value unsigned filavail; /* flag indicating if fill value is defined or not */ H5Z_SO_scale_type_t scale_type = H5Z_SO_FLOAT_DSCALE;/* scale type */ int scale_factor = 0; /* scale factor */ - double D_val = 0.0; /* decimal scale factor */ + double D_val = 0.0f; /* decimal scale factor */ uint32_t minbits = 0; /* minimum number of bits to store values */ unsigned long long minval= 0; /* minimum value of input buffer */ enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */ diff --git a/src/H5private.h b/src/H5private.h index 2701c63..c376789 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2354,6 +2354,30 @@ func_init_failed: \ #define HDcompile_assert(e) do { typedef struct { unsigned int b: (e); } x; } while(0) */ +/* Macros for enabling/disabling particular GCC warnings */ +/* (see the following web-sites for more info: + * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html + * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas + */ +/* These pragmas are only implemented in gcc 4.2+ */ +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 + #define GCC_DIAG_STR(s) #s + #define GCC_DIAG_JOINSTR(x,y) GCC_DIAG_STR(x ## y) + #define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x) + #define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x) + /* These pragmas are only implemented in gcc 4.6+ */ + #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 + #define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) + #define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop) + #else + #define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) + #define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning GCC_DIAG_JOINSTR(-W,x)) + #endif +#else + #define GCC_DIAG_OFF(x) + #define GCC_DIAG_ON(x) +#endif + /* Private functions, not part of the publicly documented API */ H5_DLL herr_t H5_init_library(void); H5_DLL void H5_term_library(void); diff --git a/test/dsets.c b/test/dsets.c index 7abe818..cec8f9a 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1023,10 +1023,10 @@ test_conv_buffer(hid_t fid) cf->a[j][k][l] = 10*(j+1) + l + k; for(j = 0; j < DIM2; j++) - cf->b[j] = (float)(100.*(j+1) + 0.01*j); + cf->b[j] = (float)(100.0f*(j+1) + 0.01f*j); for(j = 0; j < DIM3; j++) - cf->c[j] = 100.*(j+1) + 0.02*j; + cf->c[j] = 100.0f*(j+1) + 0.02f*j; /* Create data space */ @@ -2770,7 +2770,7 @@ test_nbit_int(hid_t file) for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { orig_data[i][j] = (int)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision - 1))) << offset); + (long long)HDpow(2.0f, (double)(precision - 1))) << offset); /* even-numbered values are negtive */ if((i*size[1]+j+1)%2 == 0) @@ -2872,8 +2872,8 @@ test_nbit_float(hid_t file) /* orig_data[] are initialized to be within the range that can be represented by * dataset datatype (no precision loss during datatype conversion) */ - float orig_data[2][5] = {{(float)188384.00, (float)19.103516, (float)-1.0831790e9, (float)-84.242188, - (float)5.2045898}, {(float)-49140.000, (float)2350.2500, (float)-3.2110596e-1, (float)6.4998865e-5, (float)-0.0000000}}; + float orig_data[2][5] = {{(float)188384.00f, (float)19.103516f, (float)-1.0831790e9f, (float)-84.242188f, + (float)5.2045898f}, {(float)-49140.000f, (float)2350.2500f, (float)-3.2110596e-1f, (float)6.4998865e-5f, (float)-0.0000000f}}; float new_data[2][5]; size_t precision, offset; size_t i, j; diff --git a/test/dtypes.c b/test/dtypes.c index 117a21a..de64713 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1859,7 +1859,7 @@ test_compound_10(void) hsize_t dim1[1]; void *t1, *t2; char filename[1024]; - int len; + size_t len; int i; TESTING("array datatype of compound type with VL string"); @@ -1867,12 +1867,12 @@ test_compound_10(void) for(i=0; i=0; --i) { char pattern[3]; - pattern[2] = i; + pattern[2] = (char)i; pattern[0] = pattern[1] = 0; H5Tenum_insert(srctype, mname[i], pattern); } @@ -4549,7 +4549,7 @@ test_conv_enum_2(void) /* Source data */ data = (int*)malloc(NTESTELEM*sizeof(int)); for (i=0; i= 0) HDclose (ufid); - if (h5fid >= 0) HDclose (h5fid); - if (ofid >= 0) HDclose (ofid); + if(ufid >= 0) + HDclose (ufid); + if(h5fid >= 0) + HDclose (h5fid); + if(ofid >= 0) + HDclose (ofid); return h5tools_getstatus(); } diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 96b508d..7dba0e5 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -109,7 +109,7 @@ static hbool_t not_comparable; if(0 == (A) && 0 == (B)) \ both_zero = TRUE; \ if(0 != (A)) \ - per = (double)ABS((double)(B - A) / (double)A); \ + per = (double)ABS((double)((B) - (A)) / (double)(A)); \ else \ not_comparable = TRUE; \ } @@ -119,16 +119,16 @@ static hbool_t not_comparable; per = -1; \ not_comparable = FALSE; \ both_zero = FALSE; \ - if(A == 0 && B == 0) \ + if((A) == 0 && (B) == 0) \ both_zero = TRUE; \ - if(A != 0) \ - per = ABS((double)((TYPE)(B - A)) / (double)A) ; \ + if((A) != 0) \ + per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \ else \ not_comparable = TRUE; \ } -# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b)) +#define PDIFF(a,b) (((b) > (a)) ? ((b) - (a)) : ((a) -(b))) typedef struct mcomp_t { @@ -890,9 +890,8 @@ static hsize_t diff_datum(void *_mem1, /* calculate the number of array elements */ for (u = 0, nelmts = 1; u < (unsigned)ndims; u++) nelmts *= adims[u]; - for (u = 0; u < nelmts; u++) - { - nfound+=diff_datum( + for (u = 0; u < nelmts; u++) { + nfound += diff_datum( mem1 + u * size, mem2 + u * size, /* offset */ memb_type, @@ -907,7 +906,7 @@ static hsize_t diff_datum(void *_mem1, container1_id, container2_id, ph, members); - } + } H5Tclose(memb_type); } break; diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 7b43d2e..d9a1827 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1443,8 +1443,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t offset = H5Tget_member_offset(tid, j); memb = H5Tget_member_type(tid, j); - if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) - return FAIL; + if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) { + H5Tclose(memb); + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed"); + } H5Tclose(memb); } @@ -1473,8 +1475,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t 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) + if (render_bin_output(stream, container, memb, mem, nelmts) < 0) { + H5Tclose(memb); H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + } } H5Tclose(memb); } @@ -1493,8 +1497,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts = ((hvl_t *) mem)->len; /* dump the array element */ - if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) + if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) { + H5Tclose(memb); H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + } } H5Tclose(memb); } @@ -1615,15 +1621,16 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, } if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - render_bin_output(stream, container, type_id, (char*)region_buf, numelem); + if(render_bin_output(stream, container, type_id, (char*)region_buf, numelem) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "render_bin_output of data region failed"); /* Render the region data element end */ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ @@ -1753,9 +1760,10 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); if(H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - render_bin_output(stream, container, type_id, (char*)region_buf, npoints); + if(render_bin_output(stream, container, type_id, (char*)region_buf, npoints) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "render_bin_output of data points failed"); done: HDfree(region_buf); -- cgit v0.12 From ddbc3c841cc71254243e87ede6dd99c403507914 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2013 09:44:55 -0500 Subject: [svn-r24103] Force NO optimization of H5detect.c --- src/Makefile.am | 2 +- src/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 40b5f6b..2d7640e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,7 +27,7 @@ include $(top_srcdir)/config/lt_vers.am # a long time to compile it with any optimization on. H5detect is used # to generate H5Tinit.c once. So, optimization is not critical. noinst_PROGRAMS = H5detect H5make_libsettings -H5detect_CFLAGS = -g $(AM_CFLAGS) +H5detect_CFLAGS = $(AM_CFLAGS) -g -O0 # Our main target, the HDF5 library lib_LTLIBRARIES=libhdf5.la diff --git a/src/Makefile.in b/src/Makefile.in index 6e54781..f215b74 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -524,7 +524,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog LT_VERS_INTERFACE = 6 LT_VERS_REVISION = 154 LT_VERS_AGE = 0 -H5detect_CFLAGS = -g $(AM_CFLAGS) +H5detect_CFLAGS = $(AM_CFLAGS) -g -O0 # Our main target, the HDF5 library lib_LTLIBRARIES = libhdf5.la -- cgit v0.12 From 145f1ce9e35414e40abf00c139114f69c5e1322d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2013 10:15:50 -0500 Subject: [svn-r24104] HDFFV-8345: add User Defined filters to h5repack. Reviewed in H5T-61 Tested: local linux - cmake and autotools --- MANIFEST | 37 +- aclocal.m4 | 3 +- config/cmake/ConfigureChecks.cmake | 8 + config/cmake/H5pubconf.h.in | 3 + configure | 115 ++- configure.ac | 24 +- release_docs/RELEASE.txt | 3 +- src/H5PL.c | 4 +- src/H5config.h.in | 3 + tools/h5dump/testh5dump.sh.in | 36 +- tools/h5repack/CMakeLists.txt | 35 + tools/h5repack/CMakeTests.cmake | 116 ++- tools/h5repack/Makefile.am | 18 +- tools/h5repack/Makefile.in | 153 +++- tools/h5repack/h5repack.c | 7 +- tools/h5repack/h5repack.sh.in | 48 +- tools/h5repack/h5repack_copy.c | 10 +- tools/h5repack/h5repack_filters.c | 17 +- tools/h5repack/h5repack_main.c | 8 + tools/h5repack/h5repack_parse.c | 859 +++++++++++---------- tools/h5repack/h5repack_plugin.sh.in | 238 ++++++ tools/h5repack/h5repack_verify.c | 15 +- .../testfiles/deflate_limit.h5repack_layout.h5.ddl | 130 ++++ tools/h5repack/testfiles/h5repack-help.txt | 122 +++ tools/h5repack/testfiles/h5repack_filters.h5.tst | 13 + .../testfiles/h5repack_layout.h5-plugin_test.ddl | 158 ++++ tools/h5repack/testfiles/h5repack_layout.h5.ddl | 660 +++++++++++++--- .../testfiles/plugin_test.h5repack_layout.h5.tst | 14 + tools/testfiles/h5repack_filters.h5.ddl | 13 - 29 files changed, 2286 insertions(+), 584 deletions(-) create mode 100644 tools/h5repack/h5repack_plugin.sh.in create mode 100644 tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl create mode 100644 tools/h5repack/testfiles/h5repack-help.txt create mode 100644 tools/h5repack/testfiles/h5repack_filters.h5.tst create mode 100644 tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl create mode 100644 tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst delete mode 100644 tools/testfiles/h5repack_filters.h5.ddl diff --git a/MANIFEST b/MANIFEST index e8a4f3a..fededbb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1251,6 +1251,7 @@ ./tools/h5repack/Makefile.am ./tools/h5repack/Makefile.in ./tools/h5repack/h5repack.sh.in +./tools/h5repack/h5repack_plugin.sh.in ./tools/h5repack/h5repack.c ./tools/h5repack/h5repack.h ./tools/h5repack/h5repack_copy.c @@ -1742,7 +1743,6 @@ ./tools/testfiles/tfpformat.h5 # h5dump h5repack validation -./tools/testfiles/h5repack_filters.h5.ddl ./tools/testfiles/zerodim.ddl ./tools/testfiles/zerodim.h5 @@ -2113,30 +2113,35 @@ ./tools/h5diff/testfiles/non_comparables2.h5 #test files for h5repack -./tools/h5repack/testfiles/h5repack_fill.h5 -./tools/h5repack/testfiles/h5repack_objs.h5 ./tools/h5repack/testfiles/h5repack_attr.h5 +./tools/h5repack/testfiles/h5repack_attr_refs.h5 +./tools/h5repack/testfiles/h5repack_deflate.h5 +./tools/h5repack/testfiles/h5repack_early.h5 +./tools/h5repack/testfiles/h5repack_ext.bin +./tools/h5repack/testfiles/h5repack_ext.h5 +./tools/h5repack/testfiles/h5repack_fill.h5 +./tools/h5repack/testfiles/h5repack_filters.h5 +./tools/h5repack/testfiles/h5repack_fletcher.h5 ./tools/h5repack/testfiles/h5repack_hlink.h5 +./tools/h5repack/testfiles/h5repack.info ./tools/h5repack/testfiles/h5repack_layout.h5 -./tools/h5repack/testfiles/h5repack_layout.h5.ddl ./tools/h5repack/testfiles/h5repack_layouto.h5 ./tools/h5repack/testfiles/h5repack_layout2.h5 ./tools/h5repack/testfiles/h5repack_layout3.h5 -./tools/h5repack/testfiles/h5repack_early.h5 -./tools/h5repack/testfiles/h5repack_szip.h5 -./tools/h5repack/testfiles/h5repack_deflate.h5 -./tools/h5repack/testfiles/h5repack_shuffle.h5 -./tools/h5repack/testfiles/h5repack_fletcher.h5 -./tools/h5repack/testfiles/h5repack_filters.h5 +./tools/h5repack/testfiles/h5repack_named_dtypes.h5 ./tools/h5repack/testfiles/h5repack_nbit.h5 +./tools/h5repack/testfiles/h5repack_objs.h5 +./tools/h5repack/testfiles/h5repack_refs.h5 +./tools/h5repack/testfiles/h5repack_shuffle.h5 ./tools/h5repack/testfiles/h5repack_soffset.h5 -./tools/h5repack/testfiles/h5repack.info -./tools/h5repack/testfiles/h5repack_ext.bin -./tools/h5repack/testfiles/h5repack_ext.h5 +./tools/h5repack/testfiles/h5repack_szip.h5 ./tools/h5repack/testfiles/ublock.bin -./tools/h5repack/testfiles/h5repack_named_dtypes.h5 -./tools/h5repack/testfiles/h5repack_refs.h5 -./tools/h5repack/testfiles/h5repack_attr_refs.h5 +./tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl +./tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.ddl +./tools/h5repack/testfiles/h5repack-help.txt +./tools/h5repack/testfiles/h5repack_filters.h5.tst +./tools/h5repack/testfiles/h5repack_layout.h5.ddl +./tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl # jam utility and tests ./tools/h5jam/h5jam.c diff --git a/aclocal.m4 b/aclocal.m4 index e6aae87..4e5a489 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -11,6 +11,7 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, @@ -372,7 +373,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue + test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index b467a15..e495d9b 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -152,6 +152,14 @@ ENDIF (WIN32) # SET (H5_DEFAULT_VFD H5FD_SEC2) +IF (NOT DEFINED "H5_DEFAULT_PLUGIN") + IF (WINDOWS) + SET (H5_DEFAULT_PLUGIN "%ALLUSERSPROFILE%/hdf5/lib/plugin") + ELSE (WINDOWS) + SET (H5_DEFAULT_PLUGIN "/usr/local/hdf5/lib/plugin") + ENDIF (WINDOWS) +ENDIF (NOT DEFINED "H5_DEFAULT_PLUGIN") + IF (WINDOWS) SET (H5_HAVE_WINDOWS 1) # ---------------------------------------------------------------------- diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 2736daf..2160ee8 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -54,6 +54,9 @@ problem converting from unsigned long long to long double */ #cmakedefine H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM @H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM@ +/* Define the default plugins path to compile */ +#cmakedefine H5_DEFAULT_PLUGIN "@H5_DEFAULT_PLUGIN@" + /* Define the default virtual file driver to compile */ #cmakedefine H5_DEFAULT_VFD @H5_DEFAULT_VFD@ diff --git a/configure b/configure index 4963d93..dd8f3ea 100755 --- a/configure +++ b/configure @@ -921,6 +921,7 @@ with_mpe enable_mpi_size enable_filters with_default_vfd +with_default_plugin enable_direct_vfd enable_dconv_exception enable_dconv_accuracy @@ -1667,6 +1668,9 @@ Optional Packages: --with-mpe=DIR Use MPE instrumentation [default=no] --with-default-vfd=driver Specify default file driver [default=sec2] + --with-default-plugin=location + Specify default location for plugins + [default="/usr/local/hdf5/lib/plugin"] --with-default-api-version=(v16|v18|v110) Specify default release version of public symbols [default=v110] @@ -3231,7 +3235,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ## AM_INIT_AUTOMAKE takes a list of options that should be applied to ## every Makefile.am when automake is run. -am__api_version='1.12' +am__api_version='1.13' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -3415,8 +3419,8 @@ if test x"${MISSING+set}" != xset; then esac fi # Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 @@ -3656,6 +3660,45 @@ else fi rmdir .tst 2>/dev/null +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." @@ -3718,12 +3761,17 @@ mkdir_p='$(MKDIR_P)' # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; @@ -12333,6 +12381,10 @@ _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= @@ -14911,10 +14963,14 @@ fi # before this can be enabled. hardcode_into_libs=yes + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -18806,10 +18862,14 @@ fi # before this can be enabled. hardcode_into_libs=yes + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -21682,10 +21742,14 @@ fi # before this can be enabled. hardcode_into_libs=yes + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -23359,7 +23423,7 @@ case "$host_cpu-$host_vendor-$host_os" in ;; esac -## Need to add the AM_ and H5_ into CPFLAGS/CPPFLAGS to make them visible +## Need to add the AM_ and H5_ into CFLAGS/CPPFLAGS to make them visible ## for configure checks. ## Note: Both will be restored by the end of configure. CPPFLAGS="$H5_CPPFLAGS $AM_CPPFLAGS $CPPFLAGS" @@ -29271,6 +29335,36 @@ _ACEOF fi ## ---------------------------------------------------------------------- +## Enable custom plugin default path for library. It requires SHARED support. +## +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Custom Plugin Default Path definition" >&5 +$as_echo_n "checking for Custom Plugin Default Path definition... " >&6; } + +# Check whether --with-default-plugin was given. +if test "${with_default_plugin+set}" = set; then : + withval=$with_default_plugin; +else + withval="/usr/local/hdf5/lib/plugin" +fi + + +if test "X$withval" = "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5 +$as_echo "default" >&6; } + default_plugin="/usr/local/hdf5/lib/plugin" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 +$as_echo "$withval" >&6; } + default_plugin=$withval +fi + + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_PLUGIN "$default_plugin" +_ACEOF + + +## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## @@ -33149,7 +33243,7 @@ else fi -ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/H5srcdir_str.h test/testlibinfo.sh test/testlinks_env.sh test/test_plugin.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumppbits.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5import/h5importtestutil.sh tools/h5diff/Makefile tools/h5diff/testh5diff.sh tools/h5diff/testph5diff.sh tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/h5copy/testh5copy.sh tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5mkgrp.sh tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir_str.h c++/examples/Makefile c++/examples/run-c++-ex.sh c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir_str.h hl/tools/Makefile hl/tools/gif2h5/Makefile hl/tools/gif2h5/h52giftest.sh hl/examples/Makefile hl/examples/run-hlc-ex.sh hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/c++/examples/run-hlc++-ex.sh hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh" +ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/H5srcdir_str.h test/testlibinfo.sh test/testlinks_env.sh test/test_plugin.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumppbits.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5import/h5importtestutil.sh tools/h5diff/Makefile tools/h5diff/testh5diff.sh tools/h5diff/testph5diff.sh tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5repack/h5repack_plugin.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/h5copy/testh5copy.sh tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5mkgrp.sh tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir_str.h c++/examples/Makefile c++/examples/run-c++-ex.sh c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir_str.h hl/tools/Makefile hl/tools/gif2h5/Makefile hl/tools/gif2h5/h52giftest.sh hl/examples/Makefile hl/examples/run-hlc-ex.sh hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/c++/examples/run-hlc++-ex.sh hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh" cat >confcache <<\_ACEOF @@ -34434,6 +34528,7 @@ do "tools/h5jam/testh5jam.sh") CONFIG_FILES="$CONFIG_FILES tools/h5jam/testh5jam.sh" ;; "tools/h5repack/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5repack/Makefile" ;; "tools/h5repack/h5repack.sh") CONFIG_FILES="$CONFIG_FILES tools/h5repack/h5repack.sh" ;; + "tools/h5repack/h5repack_plugin.sh") CONFIG_FILES="$CONFIG_FILES tools/h5repack/h5repack_plugin.sh" ;; "tools/h5ls/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5ls/Makefile" ;; "tools/h5copy/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5copy/Makefile" ;; "tools/h5copy/testh5copy.sh") CONFIG_FILES="$CONFIG_FILES tools/h5copy/testh5copy.sh" ;; @@ -35095,7 +35190,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} rm -f libhdf5.settings.TMP ;; "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files + # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in @@ -35146,7 +35241,7 @@ $as_echo X"$mf" | DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue + test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the diff --git a/configure.ac b/configure.ac index 386450b..0ae405e 100644 --- a/configure.ac +++ b/configure.ac @@ -1467,7 +1467,7 @@ case "$host_cpu-$host_vendor-$host_os" in ;; esac -## Need to add the AM_ and H5_ into CPFLAGS/CPPFLAGS to make them visible +## Need to add the AM_ and H5_ into CFLAGS/CPPFLAGS to make them visible ## for configure checks. ## Note: Both will be restored by the end of configure. CPPFLAGS="$H5_CPPFLAGS $AM_CPPFLAGS $CPPFLAGS" @@ -3052,6 +3052,27 @@ if test "X$default_vfd" = "Xyes"; then fi ## ---------------------------------------------------------------------- +## Enable custom plugin default path for library. It requires SHARED support. +## +AC_MSG_CHECKING([for Custom Plugin Default Path definition]) +AC_ARG_WITH([default-plugin], + [AS_HELP_STRING([--with-default-plugin=location], + [Specify default location for plugins + [default="/usr/local/hdf5/lib/plugin"]])],, + withval="/usr/local/hdf5/lib/plugin") + +if test "X$withval" = "X"; then + AC_MSG_RESULT([default]) + default_plugin="/usr/local/hdf5/lib/plugin" +else + AC_MSG_RESULT([$withval]) + default_plugin=$withval +fi + +AC_DEFINE_UNQUOTED([DEFAULT_PLUGIN], ["$default_plugin"], + [Define the default plugins path to compile]) + +## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## @@ -4516,6 +4537,7 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh + tools/h5repack/h5repack_plugin.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/h5copy/testh5copy.sh diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 811095f..a8f68e1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -41,7 +41,7 @@ New Features Configuration: ------------- - - CMake minimum is now 2.8.10. (ADB 2013/1/14) + - CMake minimum is now 2.8.10. (ADB 2013/01/14) - A new tool, cmakehdf5, which is a build command script similar to buildhdf5 is added and is available in the bin directory. (AKC - 2012/12/12) @@ -279,6 +279,7 @@ New Features Tools: ------ + - h5repack: Added ability to use plugin filters. HDFFV-8345 (ADB - 2013/09/04). - h5dump: Added option -N --any_path, which searches the file for paths that match the search path. HDFFV-7989 (ADB - 2013/08/12). - h5dump: Added optional arg 0 to -A, which excludes attributes from display. diff --git a/src/H5PL.c b/src/H5PL.c index def41d1..1c4b355 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -43,7 +43,6 @@ /* Windows support */ #ifdef H5_HAVE_WIN32_API -#define H5PL_DEFAULT_PATH "%ALLUSERSPROFILE%/hdf5/lib/plugin" #define H5PL_PATH_SEPARATOR ";" /* Handle for dynamic library */ @@ -66,7 +65,6 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); /* Unix support */ #else /* H5_HAVE_WIN32_API */ -#define H5PL_DEFAULT_PATH "/usr/local/hdf5/lib/plugin" #define H5PL_PATH_SEPARATOR ":" /* Handle for dynamic library */ @@ -87,6 +85,8 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); typedef const void *(*H5PL_get_plugin_info_t)(void); #endif /* H5_HAVE_WIN32_API */ +#define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGIN + /* Special symbol to indicate no plugin loading */ #define H5PL_NO_PLUGIN "::" diff --git a/src/H5config.h.in b/src/H5config.h.in index fc41c5a..a86970a 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -17,6 +17,9 @@ /* Define if C++ compiler recognizes offsetof */ #undef CXX_HAVE_OFFSETOF +/* Define the default plugins path to compile */ +#undef DEFAULT_PLUGIN + /* Define the default virtual file driver to compile */ #undef DEFAULT_VFD diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index be05705..1a0f189 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -797,6 +797,40 @@ TOOLTEST5() { fi } +# ADD_HELP_TEST +TOOLTEST_HELP() { + + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .txt`.out" + actual_err="$TESTDIR/`basename $1 .txt`.err" + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + cat $actual_err >> $actual + + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect-CREATED + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected output (*.txt) differs from actual output (*.out)" + nerrors="`expr $nerrors + 1`" + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi + +} # Print a "SKIP" message SKIP() { @@ -873,7 +907,7 @@ IMPORTTEST() # prepare for test COPY_TESTFILES_TO_TESTDIR -#TOOLTEST h5dump-help.txt -h +TOOLTEST_HELP h5dump-help.txt -h # test data output redirection TOOLTEST tnoddl.ddl --enable-error-stack --ddl -y packedbits.h5 diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index f03ad69..176fc2b 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -44,6 +44,41 @@ IF (BUILD_TESTING) TARGET_LINK_LIBRARIES (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) SET_TARGET_PROPERTIES (h5repacktest PROPERTIES FOLDER tools) + #----------------------------------------------------------------------------- + # If plugin library tests can be tested + #----------------------------------------------------------------------------- + IF (BUILD_SHARED_LIBS) + SET (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") + SET (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + SET (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS}) + INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) + + ADD_LIBRARY (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SRC_DIR}/dynlib1.c) + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} " " " ") + TARGET_LINK_LIBRARIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS ( + ${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} + ${LIB_TYPE} + HDF5_TOOL_PLUGIN_LIB_NAME_RELEASE + HDF5_TOOL_PLUGIN_LIB_NAME_DEBUG + ) + + # make plugins dir + FILE (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + ADD_CUSTOM_COMMAND ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) + ENDIF (BUILD_SHARED_LIBS) + INCLUDE (CMakeTests.cmake) ENDIF (BUILD_TESTING) diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index c27aaa0..7f8f71b 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -79,12 +79,15 @@ ) SET (LIST_OTHER_TEST_FILES + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack-help.txt ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_ext.bin ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/ublock.bin ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack.info + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/deflate_limit.h5repack_layout.h5.ddl ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5.ddl - # tools/testfiles - ${HDF5_TOOLS_SRC_DIR}/testfiles/h5repack_filters.h5.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5.tst + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_test.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/plugin_test.h5repack_layout.h5.tst ) FOREACH (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) @@ -105,6 +108,37 @@ ############################################################################## ############################################################################## + MACRO (ADD_HELP_TEST testname resultcode) + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5REPACK-${testname} COMMAND $ ${ARGN}) + SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5REPACK-${testname}") + ELSE (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST ( + NAME H5REPACK-h5repack-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove h5repack-${testname}.out h5repack-${testname}.out.err + ) + SET_TESTS_PROPERTIES (H5REPACK-h5repack-${testname}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + ADD_TEST ( + NAME H5REPACK-h5repack-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=h5repack-${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=h5repack-${testname}.txt" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + SET_TESTS_PROPERTIES (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS "H5REPACK-h5repack-${testname}-clear-objects") + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_HELP_TEST) + MACRO (ADD_H5_TEST_OLD testname testtype testfile) IF (${testtype} STREQUAL "SKIP") IF (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -177,7 +211,7 @@ -D "TEST_OUTPUT=./testfiles/${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${testfilter}" - -D "TEST_REFERENCE=testfiles/${resultfile}.ddl" + -D "TEST_REFERENCE=testfiles/${resultfile}.tst" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) ENDIF (HDF5_ENABLE_USING_MEMCHECKER) @@ -212,7 +246,7 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=testfiles/${resultfile}.ddl" + -D "TEST_REFERENCE=testfiles/${testname}.${resultfile}.ddl" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) SET_TESTS_PROPERTIES (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}") @@ -303,6 +337,51 @@ SET_TESTS_PROPERTIES (H5REPACK_META-${testname} PROPERTIES DEPENDS H5REPACK_META-${testname}_M) ENDMACRO (ADD_H5_TEST_META) + MACRO (ADD_H5_UD_TEST testname resultcode resultfile) + IF (HDF5_BUILD_TOOLS AND NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5REPACK_UD-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${resultfile} + testfiles/${testname}.${resultfile}.out + testfiles/${testname}.${resultfile}.out.err + testfiles/${resultfile}-${testname}.out + testfiles/${resultfile}-${testname}.out.err + ) + ADD_TEST ( + NAME H5REPACK_UD-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN};${PROJECT_BINARY_DIR}/testfiles/${resultfile};${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_FILTER:STRING=O?...ing file[^\n]+\n" + -D "TEST_OUTPUT=./testfiles/${testname}.${resultfile}.out" + -D "TEST_REFERENCE=testfiles/${testname}.${resultfile}.tst" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + SET_TESTS_PROPERTIES (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-clearall-objects) + ADD_TEST ( + NAME H5REPACK_UD-h5dump-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=-pH;testfiles/out-${testname}.${resultfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=./testfiles/${resultfile}-${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=testfiles/${resultfile}-${testname}.ddl" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + SET_TESTS_PROPERTIES (H5REPACK_UD-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_UD-${testname}") + ENDIF (HDF5_BUILD_TOOLS AND NOT HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_H5_UD_TEST) + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -333,12 +412,13 @@ SET (FILE18 h5repack_layout2.h5) SET (FILE_REF h5repack_refs.h5) SET (FILE_ATTR_REF h5repack_attr_refs.h5) - + # Remove any output file left over from previous test run ADD_TEST ( NAME H5REPACK-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove + ./testfiles/h5dump-help.out ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out.err ./testfiles/h5repack_layout.h5-chunk_18x13-v.out @@ -353,6 +433,8 @@ ./testfiles/h5repack_layout.h5-compa-v.out.err ./testfiles/h5repack_layout.h5-conti-v.out ./testfiles/h5repack_layout.h5-conti-v.out.err + ./testfiles/h5repack_layout.h5-deflate_limit.out + ./testfiles/h5repack_layout.h5-deflate_limit.out.err ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.out ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.out.err ./testfiles/h5repack_layout.h5-dset2_compa-v.out @@ -375,10 +457,16 @@ ./testfiles/h5repack_layout.h5-layout_long_switches-v.out.err ./testfiles/h5repack_layout.h5-layout_short_switches-v.out ./testfiles/h5repack_layout.h5-layout_short_switches-v.out.err + ./testfiles/h5repack_layout.h5-plugin_test.out + ./testfiles/h5repack_layout.h5-plugin_test.out.err ./testfiles/h5repack_layout2.h5-contig_small_compa-v.out ./testfiles/h5repack_layout2.h5-contig_small_compa-v.out.err ./testfiles/h5repack_layout2.h5-contig_small_fixed_compa-v.out ./testfiles/h5repack_layout2.h5-contig_small_fixed_compa-v.out.err + ./testfiles/h5repack_layout3.h5-ckdim_biger-v.out + ./testfiles/h5repack_layout3.h5-ckdim_biger-v.out.err + ./testfiles/h5repack_layout3.h5-ckdim_smaller-v.out + ./testfiles/h5repack_layout3.h5-ckdim_smaller-v.out.err ./testfiles/h5repack_layout3.h5-chunk2chunk-v.out ./testfiles/h5repack_layout3.h5-chunk2chunk-v.out.err ./testfiles/h5repack_layout3.h5-chunk2compa-v.out @@ -431,11 +519,14 @@ ./testfiles/out-layout_long_switches.h5repack_layout.h5 ./testfiles/out-layout_short_switches.h5repack_layout.h5 ./testfiles/out-old_style_layout_short_switches.h5repack_layout.h5 + ./testfiles/out-plugin_test.h5repack_layout.h5 ./testfiles/out-shuffle_all.h5repack_layout.h5 ./testfiles/out-shuffle_individual.h5repack_layout.h5 ./testfiles/out-upgrade_layout.h5repack_layouto.h5 ./testfiles/out-contig_small_compa.h5repack_layout2.h5 ./testfiles/out-contig_small_fixed_compa.h5repack_layout2.h5 + ./testfiles/out-ckdim_biger.h5repack_layout3.h5 + ./testfiles/out-ckdim_smaller.h5repack_layout3.h5 ./testfiles/out-chunk2chunk.h5repack_layout3.h5 ./testfiles/out-chunk2compa.h5repack_layout3.h5 ./testfiles/out-chunk2conti.h5repack_layout3.h5 @@ -507,6 +598,8 @@ SET_TESTS_PROPERTIES (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") + ADD_HELP_TEST(help 0 -h) + ADD_TEST (NAME H5REPACK-testh5repack_detect_szip COMMAND $) IF (HDF5_ENABLE_SZIP_SUPPORT) IF (HDF5_ENABLE_SZIP_ENCODING) @@ -965,6 +1058,19 @@ ADD_H5_VERIFY_TEST (ckdim_smaller "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 CO ADD_H5_TEST_META (meta_short h5repack_layout.h5 -M 8192) ADD_H5_TEST_META (meta_long h5repack_layout.h5 --metadata_block_size=8192) +############################################################################## +### P L U G I N T E S T S +############################################################################## +IF (BUILD_SHARED_LIBS) + ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,1,9) +ELSE (BUILD_SHARED_LIBS) + MESSAGE (STATUS " **** Plugins libraries must be built as shared libraries **** ") + ADD_TEST ( + NAME H5REPACK-plugin + COMMAND ${CMAKE_COMMAND} -E echo "SKIP H5PLUGIN TESTING" + ) +ENDIF (BUILD_SHARED_LIBS) + IF (HDF5_TEST_VFD) # Run test with different Virtual File Driver FOREACH (vfd ${VFD_LIST}) diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am index 96f0082..c52112b 100644 --- a/tools/h5repack/Makefile.am +++ b/tools/h5repack/Makefile.am @@ -28,11 +28,14 @@ TEST_SCRIPT=h5repack.sh TEST_PROG=h5repacktst noinst_PROGRAMS=testh5repack_detect_szip +SCRIPT_DEPEND=h5repack$(EXEEXT) +if HAVE_SHARED_CONDITIONAL + TEST_SCRIPT += h5repack_plugin.sh +endif + check_SCRIPTS=$(TEST_SCRIPT) check_PROGRAMS=$(TEST_PROG) -SCRIPT_DEPEND=h5repack$(EXEEXT) - # Our main target, h5repack tool bin_PROGRAMS=h5repack @@ -56,9 +59,18 @@ testh5repack_detect_szip_SOURCES=testh5repack_detect_szip.c # The h5repack.sh script needs h5repacktst to run first. h5repack.sh.chkexe_: h5repacktst.chkexe_ +if HAVE_SHARED_CONDITIONAL + # Build it as shared library if configure is enabled for shared library. + lib_LTLIBRARIES=libdynlibadd.la + libdynlibadd_la_SOURCES=$(top_srcdir)/test/dynlib1.c + +install-exec-hook: + $(RM) $(DESTDIR)$(libdir)/*dynlib* +endif + # Temporary files. *.h5 are generated by h5repack. They should # copied to the testfiles/ directory if update is required. CHECK_CLEANFILES+=*.h5 *.bin -DISTCLEANFILES=h5repack.sh +DISTCLEANFILES=h5repack.sh h5repack_plugin.sh include $(top_srcdir)/config/conclude.am diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index fe3a11c..1b87fd6 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -31,6 +31,7 @@ # HDF5 Library Makefile(.in) # + VPATH = @srcdir@ am__make_dryrun = \ { \ @@ -68,11 +69,12 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/h5repack.sh.in $(top_srcdir)/bin/depcomp \ - $(top_srcdir)/bin/mkinstalldirs \ + $(srcdir)/h5repack.sh.in $(srcdir)/h5repack_plugin.sh.in \ + $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \ $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am noinst_PROGRAMS = testh5repack_detect_szip$(EXEEXT) +@HAVE_SHARED_CONDITIONAL_TRUE@am__append_1 = h5repack_plugin.sh check_PROGRAMS = $(am__EXEEXT_1) bin_PROGRAMS = h5repack$(EXEEXT) TESTS = $(am__EXEEXT_1) $(TEST_SCRIPT) @@ -83,9 +85,47 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = h5repack.sh +CONFIG_CLEAN_FILES = h5repack.sh h5repack_plugin.sh CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" +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__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libdynlibadd_la_LIBADD = +am__libdynlibadd_la_SOURCES_DIST = $(top_srcdir)/test/dynlib1.c +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlibadd_la_OBJECTS = dynlib1.lo +libdynlibadd_la_OBJECTS = $(am_libdynlibadd_la_OBJECTS) +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 = +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlibadd_la_rpath = -rpath \ +@HAVE_SHARED_CONDITIONAL_TRUE@ $(libdir) am__EXEEXT_1 = h5repacktst$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am__objects_1 = h5repack.$(OBJEXT) h5repack_copy.$(OBJEXT) \ @@ -96,10 +136,6 @@ am_h5repack_OBJECTS = $(am__objects_1) h5repack_main.$(OBJEXT) h5repack_OBJECTS = $(am_h5repack_OBJECTS) h5repack_LDADD = $(LDADD) h5repack_DEPENDENCIES = $(LIBH5TOOLS) $(LIBH5TEST) $(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 = h5repack_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(h5repack_LDFLAGS) $(LDFLAGS) -o $@ @@ -148,10 +184,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 = $(h5repack_SOURCES) $(h5repacktst_SOURCES) \ - $(testh5repack_detect_szip_SOURCES) -DIST_SOURCES = $(h5repack_SOURCES) $(h5repacktst_SOURCES) \ - $(testh5repack_detect_szip_SOURCES) +SOURCES = $(libdynlibadd_la_SOURCES) $(h5repack_SOURCES) \ + $(h5repacktst_SOURCES) $(testh5repack_detect_szip_SOURCES) +DIST_SOURCES = $(am__libdynlibadd_la_SOURCES_DIST) $(h5repack_SOURCES) \ + $(h5repacktst_SOURCES) $(testh5repack_detect_szip_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -450,10 +486,10 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 *.bin INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib # Test programs and scripts -TEST_SCRIPT = h5repack.sh +TEST_SCRIPT = h5repack.sh $(am__append_1) TEST_PROG = h5repacktst -check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = h5repack$(EXEEXT) +check_SCRIPTS = $(TEST_SCRIPT) # Add h5repack specific linker flags here h5repack_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) @@ -469,6 +505,8 @@ COMMON_SOURCES = h5repack.c h5repack_copy.c h5repack_filters.c \ h5repack_SOURCES = $(COMMON_SOURCES) h5repack_main.c h5repacktst_SOURCES = $(COMMON_SOURCES) h5repacktst.c testh5repack_detect_szip_SOURCES = testh5repack_detect_szip.c +@HAVE_SHARED_CONDITIONAL_TRUE@lib_LTLIBRARIES = libdynlibadd.la +@HAVE_SHARED_CONDITIONAL_TRUE@libdynlibadd_la_SOURCES = $(top_srcdir)/test/dynlib1.c DISTCLEANFILES = h5repack.sh # Automake needs to be taught how to build lib, progs, and tests targets. @@ -527,6 +565,44 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): h5repack.sh: $(top_builddir)/config.status $(srcdir)/h5repack.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +h5repack_plugin.sh: $(top_builddir)/config.status $(srcdir)/h5repack_plugin.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libdynlibadd.la: $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_DEPENDENCIES) $(EXTRA_libdynlibadd_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libdynlibadd_la_rpath) $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ @@ -607,6 +683,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynlib1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5repack.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5repack_copy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5repack_filters.Po@am__quote@ @@ -639,6 +716,13 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +dynlib1.lo: $(top_srcdir)/test/dynlib1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dynlib1.lo -MD -MP -MF $(DEPDIR)/dynlib1.Tpo -c -o dynlib1.lo `test -f '$(top_srcdir)/test/dynlib1.c' || echo '$(srcdir)/'`$(top_srcdir)/test/dynlib1.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dynlib1.Tpo $(DEPDIR)/dynlib1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/test/dynlib1.c' object='dynlib1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dynlib1.lo `test -f '$(top_srcdir)/test/dynlib1.c' || echo '$(srcdir)/'`$(top_srcdir)/test/dynlib1.c + mostlyclean-libtool: -rm -f *.lo @@ -745,9 +829,11 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am -all-am: Makefile $(PROGRAMS) all-local +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) all-local +install-binPROGRAMS: install-libLTLIBRARIES + installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -781,10 +867,12 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@HAVE_SHARED_CONDITIONAL_FALSE@install-exec-hook: clean: clean-am clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ - clean-libtool clean-noinstPROGRAMS mostlyclean-am + clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -810,8 +898,9 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-binPROGRAMS - +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: @@ -850,25 +939,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES -.MAKE: check-am install-am install-strip +.MAKE: check-am install-am install-exec-am install-strip .PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ - clean-libtool clean-noinstPROGRAMS cscopelist ctags 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 \ + clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS \ + cscopelist ctags 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-exec-hook install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES 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 tags uninstall uninstall-am \ - uninstall-binPROGRAMS + uninstall-binPROGRAMS uninstall-libLTLIBRARIES # List all build rules defined by HDF5 Makefiles as "PHONY" targets here. @@ -885,6 +975,11 @@ help: # The h5repack.sh script needs h5repacktst to run first. h5repack.sh.chkexe_: h5repacktst.chkexe_ +@HAVE_SHARED_CONDITIONAL_TRUE@ # Build it as shared library if configure is enabled for shared library. + +@HAVE_SHARED_CONDITIONAL_TRUE@install-exec-hook: +@HAVE_SHARED_CONDITIONAL_TRUE@ $(RM) $(DESTDIR)$(libdir)/*dynlib* + # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. build-lib: $(LIB) diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index d6437cf..5c44e1a 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -722,6 +722,7 @@ static int check_options(pack_opt_t *options) options->filter_g[k].cd_values[0]); break; default: + printf(" User Defined %d\n", filtn); break; } /* k */ }; @@ -1006,9 +1007,7 @@ static const char* get_sfilter(H5Z_filter_t filtn) return "NBIT"; else if (filtn==H5Z_FILTER_SCALEOFFSET) return "SOFF"; - else { - error_msg("input error in filter type\n"); - HDexit(EXIT_FAILURE); - } + else + return "UD"; } diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index 42b8ecb..583b6ef 100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -117,11 +117,15 @@ $SRC_TOOLS_TESTFILES/tfamily00010.h5 " LIST_OTHER_TEST_FILES=" +$SRC_H5REPACK_TESTFILES/h5repack-help.txt $SRC_H5REPACK_TESTFILES/h5repack_ext.bin $SRC_H5REPACK_TESTFILES/ublock.bin $SRC_H5REPACK_TESTFILES/h5repack.info +$SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl $SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl -$SRC_TOOLS_TESTFILES/h5repack_filters.h5.ddl +$SRC_H5REPACK_TESTFILES/h5repack_filters.h5.tst +$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl +$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst " # @@ -436,7 +440,7 @@ TOOLTEST1() # TOOLTESTV() { - expect="$TESTDIR/$2.ddl" + expect="$TESTDIR/$2.tst" actual="$TESTDIR/`basename $2 .ddl`.out" actual_err="$TESTDIR/`basename $2 .ddl`.err" @@ -468,7 +472,7 @@ TOOLTESTV() echo " PASSED" else echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" + echo " Expected result (*.tst) differs from actual result (*.out)" nerrors="`expr $nerrors + 1`" test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /' fi @@ -484,7 +488,7 @@ TOOLTEST_DUMP() { infile=$TESTDIR/$2 outfile=$TESTDIR/out-$1.$2 - expect="$TESTDIR/$2.ddl" + expect="$TESTDIR/$1.$2.ddl" actual="$TESTDIR/out-$1.$2.out" actual_err="$TESTDIR/out-$1.$2.err" @@ -592,6 +596,40 @@ TOOLTEST_META() rm -f $outfile } +# ADD_HELP_TEST +TOOLTEST_HELP() { + + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .txt`.out" + actual_err="$TESTDIR/`basename $1 .txt`.err" + shift + + # Run test. + TESTING $H5REPACK $@ + ( + cd $TESTDIR + $RUNSERIAL $H5REPACK_BIN "$@" + ) >$actual 2>$actual_err + cat $actual_err >> $actual + + if [ ! -f $expect ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect-CREATED + elif cmp -s $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected output (*.txt) differs from actual output (*.out)" + nerrors="`expr $nerrors + 1`" + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi + +} # This is different from $srcdir/../../bin/output_filter.sh STDOUT_FILTER() { @@ -630,6 +668,8 @@ fi # prepare for test COPY_TESTFILES_TO_TESTDIR +TOOLTEST_HELP h5repack-help.txt -h + # copy files (these files have no filters) TOOLTEST fill h5repack_fill.h5 TOOLTEST objs h5repack_objs.h5 diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 02337fd..2133b48 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -1273,7 +1273,6 @@ int do_copy_objects(hid_t fidin, */ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) goto error; - /*close */ if (H5Dclose(dset_out) < 0) goto error; @@ -1356,7 +1355,6 @@ int do_copy_objects(hid_t fidin, } /* end do we have request for filter/chunking */ - break; /*------------------------------------------------------------------------- @@ -1504,7 +1502,9 @@ static void print_dataset_info(hid_t dcpl_id, cd_values, sizeof(f_objname), f_objname, NULL); switch(filtn) { - default: + + case H5Z_FILTER_NONE: + HDstrcat(strfilter,"NONE "); break; case H5Z_FILTER_DEFLATE: @@ -1554,6 +1554,10 @@ static void print_dataset_info(hid_t dcpl_id, case H5Z_FILTER_SCALEOFFSET: HDstrcat(strfilter,"SCALEOFFSET "); break; + + default: + HDstrcat(strfilter,"UD "); + break; } /* switch */ }/*i*/ diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 6c7bc65..56e08ef 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -345,8 +345,13 @@ int apply_filters(const char* name, /* object name from traverse list */ { switch (obj.filter[i].filtn) { - default: - break; + + /*------------------------------------------------------------------------- + * H5Z_FILTER_NONE 0 , uncompress if compressed + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_NONE: + break; /*------------------------------------------------------------------------- * H5Z_FILTER_DEFLATE 1 , deflation like gzip @@ -436,6 +441,14 @@ int apply_filters(const char* name, /* object name from traverse list */ return -1; } break; + default: + { + if (H5Pset_filter (dcpl_id, obj.filter[i].filtn, H5Z_FLAG_MANDATORY, obj.filter[i].cd_nelmts, obj.filter[i].cd_values)<0) + return -1; + if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) + return -1; + } + break; } /* switch */ }/*i*/ diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index ff38068..b5f9d31 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -219,6 +219,7 @@ static void usage(const char *prog) printf(" FLET, to apply the HDF5 checksum filter\n"); printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n"); printf(" SOFF, to apply the HDF5 Scale/Offset filter\n"); + printf(" UD, to apply a user defined filter\n"); printf(" NONE, to remove all filters\n"); printf(" is optional filter parameter information\n"); printf(" GZIP= from 1-9\n"); @@ -229,6 +230,9 @@ static void usage(const char *prog) printf(" NBIT (no parameter)\n"); printf(" SOFF= scale_factor is an integer and scale_type\n"); printf(" is either IN or DS\n"); + printf(" UD=\n"); + printf(" required values for filter_number,cd_value_count,value_1\n"); + printf(" optional values for value_2 to value_N\n"); printf(" NONE (no parameter)\n"); printf("\n"); printf(" LAYT - is a string with the format:\n"); @@ -271,6 +275,10 @@ static void usage(const char *prog) printf("\n"); printf(" Add both filters SHUF and GZIP in this order to all datasets\n"); printf("\n"); + printf("6) h5repack -f UD=307,1,9 file1 file2 \n"); + printf("\n"); + printf(" Add bzip2 filter to all datasets\n"); + printf("\n"); } diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 9f798e9..8a297a7 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -31,6 +31,7 @@ * FLET, to apply the HDF5 checksum filter * NBIT, to apply the HDF5 NBIT filter (NBIT compression) * SOFF, to apply the HDF5 scale+offset filter (compression) + * UD, to apply a User Defined filter k, m, n1[,…,nm] * NONE, to remove the filter * * Examples: @@ -51,402 +52,468 @@ obj_list_t* parse_filter(const char *str, pack_opt_t *options, int *is_glb) { - unsigned i, u; - char c; - size_t len=HDstrlen(str); - int j, m, n, k, l, end_obj=-1, no_param=0; - char sobj[MAX_NC_NAME]; - char scomp[10]; - char stype[5]; - char smask[3]; - obj_list_t* obj_list=NULL; - unsigned pixels_per_block; - - - /* initialize compression info */ - HDmemset(filt,0,sizeof(filter_info_t)); - *is_glb = 0; - - /* check for the end of object list and number of objects */ - for ( i = 0, n = 0; i < len; i++) - { - c = str[i]; - if ( c==':' ) - { - end_obj=i; - } - if ( c==',' ) - { - n++; - } - } - - if (end_obj==-1) /* missing : */ - { - /* apply to all objects */ - options->all_filter=1; - *is_glb = 1; - } - - n++; - 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; - } - *n_objs=n; - - /* get object list */ - for ( j = 0, k = 0, n = 0; j < end_obj; j++, k++) - { - c = str[j]; - sobj[k] = c; - if ( c==',' || j==end_obj-1) - { - if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; - HDstrcpy(obj_list[n].obj,sobj); - HDmemset(sobj,0,sizeof(sobj)); - n++; - k=-1; - } - } - /* nothing after : */ - if (end_obj+1==(int)len) - { - if (obj_list) HDfree(obj_list); - error_msg("input Error: Invalid compression type in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - - - /* get filter additional parameters */ - m=0; - for ( i=end_obj+1, k=0, j=0; i - * 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\n",str); - HDexit(EXIT_FAILURE); - } - if (l==-1) - stype[m]=c; - else - { - smask[l]=c; - l++; - if (l==2) - { - smask[l]='\0'; - i=len-1; /* end */ - (*n_objs)--; /* we counted an extra ',' */ - if (HDstrcmp(smask,"NN")==0) - filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK; - 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"); - HDexit(EXIT_FAILURE); - } - - - } - } - - } /* u */ - } /*if */ - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET - * scaleoffset has the format SOFF= - * 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\n",str); - HDexit(EXIT_FAILURE); - } - if (l==-1) - stype[m]=c; - else - { - smask[l]=c; - l++; - if (l==2) - { - smask[l]='\0'; - i=len-1; /* end */ - (*n_objs)--; /* we counted an extra ',' */ - 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; - else - { - error_msg("scale type must be 'IN' or 'DS' \n"); - HDexit(EXIT_FAILURE); - } - - } - } - - } /* u */ - } /*if */ - - - /*------------------------------------------------------------------------- - * all other filters - *------------------------------------------------------------------------- - */ - - else - { - /* here we could have 1 or 2 digits */ - for ( m=0,u=i+1; u\n",str); - HDexit(EXIT_FAILURE); - } - stype[m]=c; - } /* u */ - - stype[m]='\0'; - } /*if */ - - - - filt->cd_values[j++]=atoi(stype); - i+=m; /* jump */ - } - else if (i==len-1) - { /*no more parameters */ - scomp[k+1]='\0'; - no_param=1; - } - - /*------------------------------------------------------------------------- - * translate from string to filter symbol - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5Z_FILTER_NONE - *------------------------------------------------------------------------- - */ - if (HDstrcmp(scomp,"NONE")==0) - { - filt->filtn=H5Z_FILTER_NONE; - filt->cd_nelmts = 0; - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"GZIP")==0) - { - filt->filtn=H5Z_FILTER_DEFLATE; - filt->cd_nelmts = 1; - if (no_param) - { /*no more parameters, GZIP must have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"SZIP")==0) - { - filt->filtn=H5Z_FILTER_SZIP; - filt->cd_nelmts = 2; - if (no_param) - { /*no more parameters, SZIP must have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SHUFFLE - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"SHUF")==0) - { - filt->filtn=H5Z_FILTER_SHUFFLE; - filt->cd_nelmts = 0; - if (m>0) - { /*shuffle does not have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("extra parameter in SHUF <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_FLETCHER32 - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"FLET")==0) - { - filt->filtn=H5Z_FILTER_FLETCHER32; - filt->cd_nelmts = 0; - if (m>0) - { /*shuffle does not have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("extra parameter in FLET <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_NBIT - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"NBIT")==0) - { - filt->filtn=H5Z_FILTER_NBIT; - filt->cd_nelmts = 0; - if (m>0) - { /*nbit does not have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("extra parameter in NBIT <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"SOFF")==0) - { - filt->filtn=H5Z_FILTER_SCALEOFFSET; - filt->cd_nelmts = 2; - if (no_param) - { /*no more parameters, SOFF must have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - else { - if (obj_list) HDfree(obj_list); - error_msg("invalid filter type in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - } /*i*/ - - /*------------------------------------------------------------------------- - * 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; - - - }; - - return obj_list; + unsigned i, u; + char c; + size_t len=HDstrlen(str); + int j, m, n, k, l, p, r, q, end_obj=-1, no_param=0; + char sobj[MAX_NC_NAME]; + char scomp[10]; + char stype[5]; + char smask[3]; + obj_list_t* obj_list=NULL; + unsigned pixels_per_block; + + + /* initialize compression info */ + HDmemset(filt,0,sizeof(filter_info_t)); + *is_glb = 0; + + /* check for the end of object list and number of objects */ + for ( i = 0, n = 0; i < len; i++) + { + c = str[i]; + if ( c==':' ) + { + end_obj=i; + } + if ( c==',' ) + { + n++; + } + } + + if (end_obj==-1) /* missing : */ + { + /* apply to all objects */ + options->all_filter=1; + *is_glb = 1; + } + + n++; + 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; + } + *n_objs=n; + + /* get object list */ + for ( j = 0, k = 0, n = 0; j < end_obj; j++, k++) + { + c = str[j]; + sobj[k] = c; + if ( c==',' || j==end_obj-1) + { + if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; + HDstrcpy(obj_list[n].obj,sobj); + HDmemset(sobj,0,sizeof(sobj)); + n++; + k=-1; + } + } + /* nothing after : */ + if (end_obj+1==(int)len) + { + if (obj_list) HDfree(obj_list); + error_msg("input Error: Invalid compression type in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + + + /* get filter additional parameters */ + m=0; + for ( i=end_obj+1, k=0, j=0; i + * 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\n",str); + HDexit(EXIT_FAILURE); + } + if (l==-1) + stype[m]=c; + else + { + smask[l]=c; + l++; + if (l==2) + { + smask[l]='\0'; + i=len-1; /* end */ + (*n_objs)--; /* we counted an extra ',' */ + if (HDstrcmp(smask,"NN")==0) + filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK; + 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"); + HDexit(EXIT_FAILURE); + } + + + } + } + + } /* u */ + } /*if */ + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SCALEOFFSET + * scaleoffset has the format SOFF= + * 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\n",str); + HDexit(EXIT_FAILURE); + } + if (l==-1) + stype[m]=c; + else + { + smask[l]=c; + l++; + if (l==2) + { + smask[l]='\0'; + i=len-1; /* end */ + (*n_objs)--; /* we counted an extra ',' */ + 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; + else + { + error_msg("scale type must be 'IN' or 'DS' \n"); + HDexit(EXIT_FAILURE); + } + + } + } + + } /* u */ + } /*if */ + /*------------------------------------------------------------------------- + * User Defined + * has the format UD= + * BZIP2 example + * UD=307,1,9 + *------------------------------------------------------------------------- + */ + + else if (HDstrcmp(scomp,"UD")==0) + { + l=-1; /* filter number index check */ + p=-1; /* CD_VAL count check */ + r=-1; /* CD_VAL check */ + for ( m=0,q=0,u=i+1; ufiltn=atoi(stype); + l=0; + } + else if (p==-1) + { + filt->cd_nelmts=atoi(stype); + p=0; + } + else + r=0; + q=0; + u++; /* skip ',' */ + } + c = str[u]; + if (!isdigit(c) && l==-1) + { + if (obj_list) HDfree(obj_list); + error_msg("filter number parameter is not a digit in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + stype[q]=c; + if (l==0 && p==0) + { + if (r==0) + filt->cd_values[j++]=atoi(stype); + } + + } /* u */ + + stype[q]='\0'; + } /*if */ + + + /*------------------------------------------------------------------------- + * all other filters + *------------------------------------------------------------------------- + */ + + else + { + /* here we could have 1 or 2 digits */ + for ( m=0,u=i+1; u\n",str); + HDexit(EXIT_FAILURE); + } + stype[m]=c; + } /* u */ + + stype[m]='\0'; + } /*if */ + + + + filt->cd_values[j++]=atoi(stype); + i+=m; /* jump */ + } + else if (i==len-1) + { /*no more parameters */ + scomp[k+1]='\0'; + no_param=1; + } + + /*------------------------------------------------------------------------- + * translate from string to filter symbol + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * H5Z_FILTER_NONE + *------------------------------------------------------------------------- + */ + if (HDstrcmp(scomp,"NONE")==0) + { + filt->filtn=H5Z_FILTER_NONE; + filt->cd_nelmts = 0; + } + + /*------------------------------------------------------------------------- + * H5Z_FILTER_DEFLATE + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"GZIP")==0) + { + filt->filtn=H5Z_FILTER_DEFLATE; + filt->cd_nelmts = 1; + if (no_param) + { /*no more parameters, GZIP must have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("missing compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SZIP + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"SZIP")==0) + { + filt->filtn=H5Z_FILTER_SZIP; + filt->cd_nelmts = 2; + if (no_param) + { /*no more parameters, SZIP must have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("missing compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SHUFFLE + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"SHUF")==0) + { + filt->filtn=H5Z_FILTER_SHUFFLE; + filt->cd_nelmts = 0; + if (m>0) + { /*shuffle does not have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("extra parameter in SHUF <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * H5Z_FILTER_FLETCHER32 + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"FLET")==0) + { + filt->filtn=H5Z_FILTER_FLETCHER32; + filt->cd_nelmts = 0; + if (m>0) + { /*shuffle does not have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("extra parameter in FLET <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * H5Z_FILTER_NBIT + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"NBIT")==0) + { + filt->filtn=H5Z_FILTER_NBIT; + filt->cd_nelmts = 0; + if (m>0) + { /*nbit does not have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("extra parameter in NBIT <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * H5Z_FILTER_SCALEOFFSET + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"SOFF")==0) + { + filt->filtn=H5Z_FILTER_SCALEOFFSET; + filt->cd_nelmts = 2; + if (no_param) + { /*no more parameters, SOFF must have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("missing compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * User Defined Filter + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"UD")==0) + { + if (filt->cd_nelmts != j) + { /* parameters does not match count */ + if (obj_list) HDfree(obj_list); + error_msg("incorrect number of compression parameters in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + else { + if (obj_list) HDfree(obj_list); + error_msg("invalid filter type in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + } /*i*/ + + /*------------------------------------------------------------------------- + * 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; + + + }; + + return obj_list; } diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in new file mode 100644 index 0000000..a45d1fe --- /dev/null +++ b/tools/h5repack/h5repack_plugin.sh.in @@ -0,0 +1,238 @@ +#! /bin/sh +# +# 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 files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic document set and is +# linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access +# to either file, you may request a copy from help@hdfgroup.org. +# +srcdir=@srcdir@ +TOP_BUILDDIR=@top_builddir@ + +# Determine backward compatibility options enabled +DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +H5REPACK=h5repack # The tool name +H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary + +H5DUMP=../h5dump/h5dump # The h5dump tool name +H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary + +nerrors=0 +verbose=yes +exit_code=$EXIT_SUCCESS + +TEST_NAME=ud_plugin +FROM_DIR=`pwd`/.libs +PLUGIN_LIB="$FROM_DIR/libdynlibadd.*" +PLUGIN_LIBDIR=testdir3 +RM="rm -rf" + +GREP='grep' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# source dirs +SRC_TOOLS="$srcdir/.." + +# testfiles source dirs for tools +SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles" + +TESTDIR=testfiles +test -d $TESTDIR || mkdir $TESTDIR + +###################################################################### +# test files +# -------------------------------------------------------------------- +# All the test files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# Any test files from other tools can be used in this framework. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_HDF5_TEST_FILES=" +$SRC_H5REPACK_TESTFILES/h5repack_layout.h5 +$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl +$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst +" + +# +# copy test files and expected output files from source dirs to test dir +# +COPY_TESTFILES="$LIST_HDF5_TEST_FILES" + +# Main Body +# Create test directories if not exists yet. +test -d $PLUGIN_LIBDIR || mkdir -p $PLUGIN_LIBDIR +if [ $? != 0 ]; then + echo "Failed to create test directory($PLUGIN_LIBDIR)" + exit $EXIT_FAILURE +fi + +# copy plugin library for test +$CP $PLUGIN_LIB $PLUGIN_LIBDIR +if [ $? != 0 ]; then + echo "Failed to copy plugin library ($PLUGIN_LIB) for test." + exit $EXIT_FAILURE +fi + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_LIBDIR}" + +COPY_TESTFILES_TO_TESTDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_TESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +# Print a $* message left justified in a field of 70 characters +# +MESSAGE() { + SPACES=" " + echo "$* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Verifying". +# +VERIFY() { + MESSAGE "Verifying $*" +} + +# This is different from $srcdir/../../bin/output_filter.sh +STDOUT_FILTER() { + result_file=$1 + tmp_file=/tmp/h5test_tmp_$$ + # Filter name of files. + cp $result_file $tmp_file + sed -e '/^Opening file/d' -e '/^Making file/d' \ + < $tmp_file > $result_file + # cleanup + rm -f $tmp_file +} + +# This runs h5repack comparing output with h5dump output +# from -pH option +# +TOOLTEST_DUMP() +{ + echo $@ + infile=$TESTDIR/$2 + outfile=$TESTDIR/out-$1.$2 + expect1="$TESTDIR/$1.$2.tst" + actual1="$TESTDIR/$1.$2.out" + actual1_err="$TESTDIR/$1.$2.err" + expect2="$TESTDIR/$2-$1.ddl" + actual2="$TESTDIR/$2-$1.out" + actual2_err="$TESTDIR/$2-$1.err" + + shift + shift + + # Run test. + TESTING $H5REPACK $@ + ( + $ENVCMD $H5REPACK_BIN "$@" $infile $outfile + ) >$actual1 2>$actual1_err + RET=$? + STDOUT_FILTER $actual1 + cat $actual1_err >> $actual1 + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + if cmp -s $expect1 $actual1; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.tst) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && diff -c $expect1 $actual1 |sed 's/^/ /' + fi + VERIFY h5dump output -pH $outfile + ( + $ENVCMD $H5DUMP_BIN -pH $outfile + ) >$actual2 2>$actual2_err + RET=$? + cat $actual2_err >> $actual2 + + if cmp -s $expect2 $actual2; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && diff -c $expect2 $actual2 |sed 's/^/ /' + fi + + fi + + + rm -f $actual1 $actual1_err $actual2 $actual2_err + rm -f $outfile +} + +############################################################################## +### T H E T E S T S +############################################################################## +# prepare for test +COPY_TESTFILES_TO_TESTDIR + +# Run the test +arg="h5repack_layout.h5 -v -f UD=257,1,9" +TOOLTEST_DUMP plugin_test $arg + +# print results +if test $nerrors -ne 0 ; then + echo "$nerrors errors encountered" + exit_code=$EXIT_FAILURE +else + echo "All Plugin API tests passed." + exit_code=$EXIT_SUCCESS +fi + +# Clean up temporary files/directories and leave +$RM $PLUGIN_LIBDIR +exit $exit_code diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index a57295b..42799f9 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -601,6 +601,9 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) switch (filtn) { + case H5Z_FILTER_NONE: + break; + case H5Z_FILTER_SHUFFLE: /* 1 private client value is returned by DCPL */ @@ -677,7 +680,17 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) break; default: - /* filter has no local values */ + if ( cd_nelmts != filter[i].cd_nelmts) + return 0; + + for( j = 0; j < cd_nelmts; j++) + { + if (cd_values[j] != filter[i].cd_values[j]) + { + return 0; + } + + } break; } /* switch */ diff --git a/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl new file mode 100644 index 0000000..d380201 --- /dev/null +++ b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl @@ -0,0 +1,130 @@ +HDF5 "./testfiles/out-deflate_limit.h5repack_layout.h5" { +GROUP "/" { + DATASET "dset1" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset3" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset4" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_chunk" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) } + STORAGE_LAYOUT { + CHUNKED ( 20, 10 ) + SIZE 1283 (2.494:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_compact" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_contiguous" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } +} +} diff --git a/tools/h5repack/testfiles/h5repack-help.txt b/tools/h5repack/testfiles/h5repack-help.txt new file mode 100644 index 0000000..6de1eb4 --- /dev/null +++ b/tools/h5repack/testfiles/h5repack-help.txt @@ -0,0 +1,122 @@ +usage: h5repack [OPTIONS] file1 file2 + file1 Input HDF5 File + file2 Output HDF5 File + OPTIONS + -h, --help Print a usage message and exit + -v, --verbose Verbose mode, print object information + -V, --version Print version number and exit + -n, --native Use a native HDF5 type when repacking + -L, --latest Use latest version of file format + -c L1, --compact=L1 Maximum number of links in header messages + -d L2, --indexed=L2 Minimum number of links in the indexed format + -s S[:F], --ssize=S[:F] Shared object header message minimum size + -m M, --minimum=M Do not apply the filter to datasets smaller than M + -e E, --file=E Name of file E with the -f and -l options + -u U, --ublock=U Name of file U with user block data to be added + -b B, --block=B Size of user block to be added + -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size + -t T, --threshold=T Threshold value for H5Pset_alignment + -a A, --alignment=A Alignment value for H5Pset_alignment + -f FILT, --filter=FILT Filter type + -l LAYT, --layout=LAYT Layout type + -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy + -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold + + M - is an integer greater than 1, size of dataset in bytes (default is 0) + E - is a filename. + S - is an integer + U - is a filename. + T - is an integer + A - is an integer greater than zero + B - is the user block size, any value that is 512 or greater and is + a power of 2 (1024 default) + F - is the shared object header message type, any of . If F is not specified, S applies to all messages + + FS_STRGY is the file space management strategy to use for the output file. + It is a string as listed below: + ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver + for file space allocation + ALL - Use non-persistent free-space managers, aggregators and virtual file driver + for file space allocation + AGGR_VFD - Use aggregators and virtual file driver for file space allocation + VFD - Use virtual file driver for file space allocation + + FS_THRD is the free-space section threshold to use for the output file. + It is the minimum size (in bytes) of free-space sections to be tracked + by the the library's free-space managers. + + FILT - is a string with the format: + + := + + is a comma separated list of object names, meaning apply + compression only to those objects. If no names are specified, the filter + is applied to all objects + can be: + GZIP, to apply the HDF5 GZIP filter (GZIP compression) + SZIP, to apply the HDF5 SZIP filter (SZIP compression) + SHUF, to apply the HDF5 shuffle filter + FLET, to apply the HDF5 checksum filter + NBIT, to apply the HDF5 NBIT filter (NBIT compression) + SOFF, to apply the HDF5 Scale/Offset filter + UD, to apply a user defined filter + NONE, to remove all filters + is optional filter parameter information + GZIP= from 1-9 + SZIP= pixels per block is a even number in + 2-32 and coding method is either EC or NN + SHUF (no parameter) + FLET (no parameter) + NBIT (no parameter) + SOFF= scale_factor is an integer and scale_type + is either IN or DS + UD= + required values for filter_number,cd_value_count,value_1 + optional values for value_2 to value_N + NONE (no parameter) + + LAYT - is a string with the format: + + := + + is a comma separated list of object names, meaning that + layout information is supplied for those objects. If no names are + specified, the layout type is applied to all objects + can be: + CHUNK, to apply chunking layout + COMPA, to apply compact layout + CONTI, to apply contiguous layout + is optional layout information + CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension + COMPA (no parameter) + CONTI (no parameter) + +Examples of use: + +1) h5repack -v -f GZIP=1 file1 file2 + + GZIP compression with level 1 to all objects + +2) h5repack -v -f A:SZIP=8,NN file1 file2 + + SZIP compression with 8 pixels per block and NN coding method to object A + +3) h5repack -v -l A,B:CHUNK=20x10 -f C,D,F:NONE file1 file2 + + Chunked layout, with a layout size of 20x10, to objects A and B + and remove filters to objects C, D, F + +4) h5repack -L -c 10 -s 20:dtype file1 file2 + + Using latest file format with maximum compact group size of 10 and + and minimum shared datatype size of 20 + +5) h5repack -f SHUF -f GZIP=1 file1 file2 + + Add both filters SHUF and GZIP in this order to all datasets + +6) h5repack -f UD=307,1,9 file1 file2 + + Add bzip2 filter to all datasets + diff --git a/tools/h5repack/testfiles/h5repack_filters.h5.tst b/tools/h5repack/testfiles/h5repack_filters.h5.tst new file mode 100644 index 0000000..36e65b9 --- /dev/null +++ b/tools/h5repack/testfiles/h5repack_filters.h5.tst @@ -0,0 +1,13 @@ +Objects to modify layout are... +Objects to apply filter are... + with GZIP filter + ...Found +----------------------------------------- + Type Filter (Compression) Name +----------------------------------------- + group / + dset /dset_all + dset GZIP (0.995:1) /dset_deflate + dset /dset_fletcher32 + dset /dset_nbit + dset /dset_shuffle diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl new file mode 100644 index 0000000..a7ba967 --- /dev/null +++ b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl @@ -0,0 +1,158 @@ +HDF5 "testfiles/out-plugin_test.h5repack_layout.h5" { +GROUP "/" { + DATASET "dset1" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset3" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset4" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_chunk" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) } + STORAGE_LAYOUT { + CHUNKED ( 20, 10 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_compact" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_contiguous" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } +} +} diff --git a/tools/h5repack/testfiles/h5repack_layout.h5.ddl b/tools/h5repack/testfiles/h5repack_layout.h5.ddl index d380201..00c74f4 100644 --- a/tools/h5repack/testfiles/h5repack_layout.h5.ddl +++ b/tools/h5repack/testfiles/h5repack_layout.h5.ddl @@ -1,129 +1,605 @@ -HDF5 "./testfiles/out-deflate_limit.h5repack_layout.h5" { +HDF5 "h5repack_layout.h5" { GROUP "/" { DATASET "dset1" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset2" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset3" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset4" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset_chunk" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) } - STORAGE_LAYOUT { - CHUNKED ( 20, 10 ) - SIZE 1283 (2.494:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset_compact" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset_contiguous" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } } diff --git a/tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst b/tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst new file mode 100644 index 0000000..7f9bd6e --- /dev/null +++ b/tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst @@ -0,0 +1,14 @@ +Objects to modify layout are... +Objects to apply filter are... + User Defined 257 +----------------------------------------- + Type Filter (Compression) Name +----------------------------------------- + group / + dset UD (1.000:1) /dset1 + dset UD (1.000:1) /dset2 + dset UD (1.000:1) /dset3 + dset UD (1.000:1) /dset4 + dset UD (1.000:1) /dset_chunk + dset UD (1.000:1) /dset_compact + dset UD (1.000:1) /dset_contiguous diff --git a/tools/testfiles/h5repack_filters.h5.ddl b/tools/testfiles/h5repack_filters.h5.ddl deleted file mode 100644 index 36e65b9..0000000 --- a/tools/testfiles/h5repack_filters.h5.ddl +++ /dev/null @@ -1,13 +0,0 @@ -Objects to modify layout are... -Objects to apply filter are... - with GZIP filter - ...Found ------------------------------------------ - Type Filter (Compression) Name ------------------------------------------ - group / - dset /dset_all - dset GZIP (0.995:1) /dset_deflate - dset /dset_fletcher32 - dset /dset_nbit - dset /dset_shuffle -- cgit v0.12 From 786526fd051d11fbbfb87ae711ccd0f6cd4c7731 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2013 10:35:00 -0500 Subject: [svn-r24105] Correct filename extension --- MANIFEST | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST b/MANIFEST index fededbb..b67c6bb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2137,7 +2137,7 @@ ./tools/h5repack/testfiles/h5repack_szip.h5 ./tools/h5repack/testfiles/ublock.bin ./tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl -./tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.ddl +./tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst ./tools/h5repack/testfiles/h5repack-help.txt ./tools/h5repack/testfiles/h5repack_filters.h5.tst ./tools/h5repack/testfiles/h5repack_layout.h5.ddl -- cgit v0.12 From 8b4cf4c8cb2f5ff61e12d9dcb2dc603772bcb097 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2013 12:59:07 -0500 Subject: [svn-r24109] Correct cygwin info --- release_docs/INSTALL_Cygwin.txt | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/release_docs/INSTALL_Cygwin.txt b/release_docs/INSTALL_Cygwin.txt index 5406820..d78cd85 100644 --- a/release_docs/INSTALL_Cygwin.txt +++ b/release_docs/INSTALL_Cygwin.txt @@ -5,7 +5,7 @@ Preconditions: -------------- -1. Installed Cygwin 1.7.5 or higher +1. Installed Cygwin 1.7.15 or higher To install the Cygwin net release, go to http://www.cygwin.com and click on "Install or update now!" icon. This will download a GUI @@ -19,13 +19,13 @@ Preconditions: Cygwin packages. To build HDF5 on Cygwin, Devel package (including gcc,gcc-g++, - gcc-g77, and gcc-java compiles, and gdb tool) should be installed. + gcc-gfortran, and gcc-java compiles, and gdb tool) should be installed. 2. Compilers Installed 2.1 C/C++ Compilers HDF5-1.8 Supported - gcc (4.3.4), which includes: + gcc (4.5.3), which includes: gcc4-core : C compiler gcc4-g++ : C++ compiler gcc4-fortran : fortran compiler @@ -51,7 +51,7 @@ Preconditions: 3.1 Zlib - zlib-1.2.2 or later is supported and tested on Cygwin. + zlib-1.2.5 or later is supported and tested on Cygwin. 3.2 Szip The HDF5 library has a predefined compression filter that uses @@ -61,8 +61,8 @@ Preconditions: http://hdfgroup.org/HDF5/doc_resource/SZIP/index.html. The latest supported public release of SZIP is available from - ftp://ftp.hdfgroup.org/lib-external/szip/2.0. Binary distribution can be - found under ftp://ftp.hdfgroup.org/lib-external/szip/2.0/bin/cygwin + ftp://ftp.hdfgroup.org/lib-external/szip/2.1. Binary distribution can be + found under ftp://ftp.hdfgroup.org/lib-external/szip/2.1/bin/cygwin Install HDF5 on Cygwin @@ -76,19 +76,19 @@ Install HDF5 on Cygwin The HDF5 source code is distributed in a variety of formats which can be unpacked with the following commands, each of which creates - an `hdf5-1.8.5' directory. + an `hdf5-1.8.x' directory. 2.1 Non-compressed tar archive (*.tar) - $ tar xf hdf5-1.8.5.tar + $ tar xf hdf5-1.8.x.tar 2.2 Gzip'd tar archive (*.tar.gz) - $ gunzip < hdf5-1.8.5.tar.gz | tar xf - + $ gunzip < hdf5-1.8.x.tar.gz | tar xf - 2.3 Bzip'd tar archive (*.tar.bz2) - $ bunzip2 < hdf5-1.8.5.tar.bz2 | tar xf - + $ bunzip2 < hdf5-1.8.x.tar.bz2 | tar xf - 2. Setup Environment @@ -233,7 +233,8 @@ Install HDF5 on Cygwin 8. Known Problems - Shared libraries can not be built on Cygwin In release 1.8. + dt_arith tests may fail due to the use of fork. This is a known issue + with cygwin on windows. ----------------------------------------------------------------------- -- cgit v0.12 From 2cb03fedded432eaebd7829fbb8c7c7a5f403508 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2013 13:00:46 -0500 Subject: [svn-r24110] Add new h5repack info --- release_docs/RELEASE.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a8f68e1..9a27d02 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -41,6 +41,10 @@ New Features Configuration: ------------- + - New configuration option added to change the default plugin path. + configure option is --with-default-plugin=location + cmake option is -DH5_DEFAULT_PLUGIN:PATH=location + HDFFV-8513. (ADB 2013/09/04) - CMake minimum is now 2.8.10. (ADB 2013/01/14) - A new tool, cmakehdf5, which is a build command script similar to buildhdf5 is added and is available in the bin directory. -- cgit v0.12 From 79c8e26fa7d8bb3e3ab59e5a69ea37cc385748c0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 6 Sep 2013 14:03:35 -0500 Subject: [svn-r24111] Description: Restrict GCC diagnostic pragmas to only gcc 4.6+ Tested on: Mac OSX/64 10.8.4 (amazon) w/gcc 4.8 --- src/H5private.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/H5private.h b/src/H5private.h index c376789..984f7da 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2359,20 +2359,15 @@ func_init_failed: \ * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas */ -/* These pragmas are only implemented in gcc 4.2+ */ -#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 +/* These pragmas are only implemented usefully in gcc 4.6+ */ +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 #define GCC_DIAG_STR(s) #s #define GCC_DIAG_JOINSTR(x,y) GCC_DIAG_STR(x ## y) #define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x) #define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x) - /* These pragmas are only implemented in gcc 4.6+ */ - #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 - #define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) - #define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop) - #else - #define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) - #define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(warning GCC_DIAG_JOINSTR(-W,x)) - #endif + + #define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) + #define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop) #else #define GCC_DIAG_OFF(x) #define GCC_DIAG_ON(x) -- cgit v0.12 From f825256c876fdd8e2f92002f71ef96e43a24b2a1 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 6 Sep 2013 15:27:13 -0500 Subject: [svn-r24113] Description: Reduce warnings w/gfortran in FORTRAN build by declaring interface for utility test routines. Tested on: Mac OSX/64 10.8.4 (amazon) w/gcc/g++/gfortran 4.8 --- fortran/test/fflush1.f90 | 1 + fortran/test/fflush2.f90 | 1 + fortran/test/fortranlib_test.f90 | 1 + fortran/test/fortranlib_test_1_8.f90 | 5 +++++ fortran/test/tH5A.f90 | 1 + fortran/test/tH5A_1_8.f90 | 15 +++++++++++++++ fortran/test/tH5D.f90 | 2 ++ fortran/test/tH5E.f90 | 1 + fortran/test/tH5F.f90 | 8 +++++++- fortran/test/tH5G.f90 | 1 + fortran/test/tH5G_1_8.f90 | 12 ++++++++++++ fortran/test/tH5I.f90 | 1 + fortran/test/tH5O.f90 | 3 +++ fortran/test/tH5P.f90 | 3 +++ fortran/test/tH5R.f90 | 2 ++ fortran/test/tH5S.f90 | 1 + fortran/test/tH5Sselect.f90 | 6 ++++++ fortran/test/tH5T.f90 | 4 ++++ fortran/test/tH5VL.f90 | 3 +++ fortran/test/tH5Z.f90 | 4 +++- fortran/test/tf.f90 | 6 ++++++ 21 files changed, 79 insertions(+), 2 deletions(-) diff --git a/fortran/test/fflush1.f90 b/fortran/test/fflush1.f90 index d35bfff..c03858f 100644 --- a/fortran/test/fflush1.f90 +++ b/fortran/test/fflush1.f90 @@ -30,6 +30,7 @@ PROGRAM FFLUSH1EXAMPLE USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE diff --git a/fortran/test/fflush2.f90 b/fortran/test/fflush2.f90 index d699150..83e957f 100644 --- a/fortran/test/fflush2.f90 +++ b/fortran/test/fflush2.f90 @@ -30,6 +30,7 @@ PROGRAM FFLUSH2EXAMPLE USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90 index 6268d15..d54397c 100644 --- a/fortran/test/fortranlib_test.f90 +++ b/fortran/test/fortranlib_test.f90 @@ -27,6 +27,7 @@ PROGRAM fortranlibtest USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER :: total_error = 0 diff --git a/fortran/test/fortranlib_test_1_8.f90 b/fortran/test/fortranlib_test_1_8.f90 index dc45560..5bf8f56 100644 --- a/fortran/test/fortranlib_test_1_8.f90 +++ b/fortran/test/fortranlib_test_1_8.f90 @@ -27,6 +27,7 @@ PROGRAM fortranlibtest USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER :: total_error = 0 @@ -116,6 +117,7 @@ END PROGRAM fortranlibtest SUBROUTINE dtransform(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -180,6 +182,7 @@ END SUBROUTINE dtransform SUBROUTINE test_genprop_basic_class(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -275,6 +278,7 @@ SUBROUTINE test_h5s_encode(cleanup, total_error) !****************************************************************/ USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -424,6 +428,7 @@ END SUBROUTINE test_h5s_encode SUBROUTINE test_scaleoffset(cleanup, total_error ) USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5A.f90 b/fortran/test/tH5A.f90 index cecaded..af65e37 100644 --- a/fortran/test/tH5A.f90 +++ b/fortran/test/tH5A.f90 @@ -36,6 +36,7 @@ ! USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5A_1_8.f90 b/fortran/test/tH5A_1_8.f90 index 32cb228..91ddc34 100644 --- a/fortran/test/tH5A_1_8.f90 +++ b/fortran/test/tH5A_1_8.f90 @@ -40,6 +40,7 @@ SUBROUTINE attribute_test_1_8(cleanup, total_error) ! USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -213,6 +214,7 @@ SUBROUTINE test_attr_corder_create_compact(fcpl,fapl, total_error) ! Needed for get_info_by_name USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE ! - - - arg types - - - @@ -401,6 +403,7 @@ SUBROUTINE test_attr_null_space(fcpl, fapl, total_error) !** !****************************************************************/ USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fcpl @@ -532,6 +535,7 @@ SUBROUTINE test_attr_create_by_name(new_format,fcpl,fapl, total_error) !****************************************************************/ USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -746,6 +750,7 @@ SUBROUTINE test_attr_info_by_idx(new_format, fcpl, fapl, total_error) !****************************************************************/ USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -951,6 +956,7 @@ END SUBROUTINE test_attr_info_by_idx SUBROUTINE attr_info_by_idx_check(obj_id, attrname, n, use_index, total_error ) USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -1091,6 +1097,7 @@ SUBROUTINE test_attr_shared_rename( fcpl, fapl, total_error) !****************************************************************/ USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -1412,6 +1419,7 @@ SUBROUTINE test_attr_delete_by_idx(new_format, fcpl, fapl, total_error) !****************************************************************/ USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -1773,6 +1781,7 @@ SUBROUTINE test_attr_shared_delete(fcpl, fapl, total_error) !****************************************************************/ USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2056,6 +2065,7 @@ SUBROUTINE test_attr_dense_open( fcpl, fapl, total_error) !****************************************************************/ USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2207,6 +2217,7 @@ END SUBROUTINE test_attr_dense_open SUBROUTINE test_attr_dense_verify(loc_id, max_attr, total_error) USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2302,6 +2313,7 @@ END SUBROUTINE test_attr_dense_verify SUBROUTINE test_attr_corder_create_basic( fcpl, fapl, total_error ) USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2424,6 +2436,7 @@ END SUBROUTINE test_attr_corder_create_basic SUBROUTINE test_attr_basic_write(fapl, total_error) USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2623,6 +2636,7 @@ END SUBROUTINE test_attr_basic_write SUBROUTINE test_attr_many(new_format, fcpl, fapl, total_error) USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2740,6 +2754,7 @@ END SUBROUTINE test_attr_many SUBROUTINE attr_open_check(fid, dsetname, obj_id, max_attrs, total_error ) USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fid diff --git a/fortran/test/tH5D.f90 b/fortran/test/tH5D.f90 index 9f7b50c..35832c4 100644 --- a/fortran/test/tH5D.f90 +++ b/fortran/test/tH5D.f90 @@ -36,6 +36,7 @@ ! SUBROUTINE datasettest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -252,6 +253,7 @@ SUBROUTINE extenddsettest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5E.f90 b/fortran/test/tH5E.f90 index 4d431a1..05fa885 100644 --- a/fortran/test/tH5E.f90 +++ b/fortran/test/tH5E.f90 @@ -36,6 +36,7 @@ ! This subroutine tests following functionalities: h5eprint_f USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5F.f90 b/fortran/test/tH5F.f90 index d8f683c..75c8cd7 100644 --- a/fortran/test/tH5F.f90 +++ b/fortran/test/tH5F.f90 @@ -33,6 +33,8 @@ ! in the first file. SUBROUTINE mountingtest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines + IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error @@ -289,6 +291,7 @@ SUBROUTINE reopentest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error @@ -474,7 +477,8 @@ ! created using the got property lists SUBROUTINE plisttest(cleanup, total_error) - USE HDF5 ! This module contains all necessary modules + USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error @@ -574,6 +578,7 @@ SUBROUTINE file_close(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error @@ -702,6 +707,7 @@ SUBROUTINE file_space(filename, cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE CHARACTER(*), INTENT(IN) :: filename LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5G.f90 b/fortran/test/tH5G.f90 index 6befa94..93b6a50 100644 --- a/fortran/test/tH5G.f90 +++ b/fortran/test/tH5G.f90 @@ -35,6 +35,7 @@ ! h5gget_comment_f USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5G_1_8.f90 b/fortran/test/tH5G_1_8.f90 index fd55ba9..7979846 100644 --- a/fortran/test/tH5G_1_8.f90 +++ b/fortran/test/tH5G_1_8.f90 @@ -30,6 +30,7 @@ !***** SUBROUTINE group_test(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -134,6 +135,7 @@ END SUBROUTINE group_test SUBROUTINE group_info(cleanup, fapl, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -450,6 +452,7 @@ SUBROUTINE group_info(cleanup, fapl, total_error) SUBROUTINE timestamps(cleanup, fapl, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -646,6 +649,7 @@ SUBROUTINE group_info(cleanup, fapl, total_error) SUBROUTINE mklinks(fapl, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -741,6 +745,7 @@ SUBROUTINE group_info(cleanup, fapl, total_error) SUBROUTINE test_move_preserves(fapl_id, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -948,6 +953,7 @@ SUBROUTINE lifecycle(cleanup, fapl2, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -1096,6 +1102,7 @@ SUBROUTINE lifecycle(cleanup, fapl2, total_error) ! USE ISO_C_BINDING USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -1165,6 +1172,7 @@ END SUBROUTINE cklinks SUBROUTINE delete_by_idx(cleanup, fapl, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -1406,6 +1414,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & hard_link, use_index, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(INOUT) :: total_error @@ -1509,6 +1518,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & SUBROUTINE test_lcpl(cleanup, fapl, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(INOUT) :: total_error @@ -1822,6 +1832,7 @@ END SUBROUTINE test_lcpl SUBROUTINE objcopy(fapl, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(INOUT) :: total_error @@ -1885,6 +1896,7 @@ END SUBROUTINE objcopy SUBROUTINE lapl_nlinks( fapl, total_error) USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fapl diff --git a/fortran/test/tH5I.f90 b/fortran/test/tH5I.f90 index 184edaf..bb4f24b 100644 --- a/fortran/test/tH5I.f90 +++ b/fortran/test/tH5I.f90 @@ -32,6 +32,7 @@ ! This subroutine tests following functionalities: h5iget_type_f USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5O.f90 b/fortran/test/tH5O.f90 index ea91631..2f20037 100644 --- a/fortran/test/tH5O.f90 +++ b/fortran/test/tH5O.f90 @@ -29,6 +29,7 @@ SUBROUTINE test_h5o(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -54,6 +55,7 @@ END SUBROUTINE test_h5o SUBROUTINE test_h5o_link(total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -576,6 +578,7 @@ END SUBROUTINE test_h5o_link SUBROUTINE test_h5o_plist(total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error diff --git a/fortran/test/tH5P.f90 b/fortran/test/tH5P.f90 index 4c78334..9e8ca5f 100644 --- a/fortran/test/tH5P.f90 +++ b/fortran/test/tH5P.f90 @@ -34,6 +34,7 @@ SUBROUTINE external_test(cleanup, total_error) ! h5pget_external_f USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -150,6 +151,7 @@ END SUBROUTINE external_test SUBROUTINE multi_file_test(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -419,6 +421,7 @@ END SUBROUTINE multi_file_test SUBROUTINE test_chunk_cache(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5R.f90 b/fortran/test/tH5R.f90 index ac105fc..2b19d1b 100644 --- a/fortran/test/tH5R.f90 +++ b/fortran/test/tH5R.f90 @@ -33,6 +33,7 @@ ! SUBROUTINE refobjtest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error @@ -241,6 +242,7 @@ END SUBROUTINE refobjtest ! SUBROUTINE refregtest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines ! use iso_c_binding ! NOTE: if this is uncommented, then need to move subroutine into another file. IMPLICIT NONE diff --git a/fortran/test/tH5S.f90 b/fortran/test/tH5S.f90 index e3a44ad..b958e6d 100644 --- a/fortran/test/tH5S.f90 +++ b/fortran/test/tH5S.f90 @@ -37,6 +37,7 @@ SUBROUTINE dataspace_basic_test(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5Sselect.f90 b/fortran/test/tH5Sselect.f90 index 1cbabe8..9d83350 100644 --- a/fortran/test/tH5Sselect.f90 +++ b/fortran/test/tH5Sselect.f90 @@ -40,6 +40,7 @@ SUBROUTINE test_select_hyperslab(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -319,6 +320,7 @@ SUBROUTINE test_select_element(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -695,6 +697,7 @@ SUBROUTINE test_basic_select(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -1033,6 +1036,7 @@ SUBROUTINE test_select_point(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -1359,6 +1363,7 @@ END SUBROUTINE test_select_point SUBROUTINE test_select_combine(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -1781,6 +1786,7 @@ END SUBROUTINE test_select_combine SUBROUTINE test_select_bounds(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5T.f90 b/fortran/test/tH5T.f90 index b42a8e6..b833426 100644 --- a/fortran/test/tH5T.f90 +++ b/fortran/test/tH5T.f90 @@ -45,6 +45,7 @@ USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -642,6 +643,7 @@ ! H5tset_cset_f, H5tget_strpad_f, H5tset_strpad_f USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -859,6 +861,7 @@ SUBROUTINE enumtest(cleanup, total_error) USE HDF5 + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -999,6 +1002,7 @@ SUBROUTINE test_derived_flt(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5VL.f90 b/fortran/test/tH5VL.f90 index 85feb2b..2a064dd 100644 --- a/fortran/test/tH5VL.f90 +++ b/fortran/test/tH5VL.f90 @@ -29,6 +29,7 @@ SUBROUTINE vl_test_integer(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -189,6 +190,7 @@ SUBROUTINE vl_test_real(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -360,6 +362,7 @@ SUBROUTINE vl_test_string(cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5Z.f90 b/fortran/test/tH5Z.f90 index cd6a343..8145061 100644 --- a/fortran/test/tH5Z.f90 +++ b/fortran/test/tH5Z.f90 @@ -31,7 +31,8 @@ ! This subroutine tests following functionalities: h5zfilter_avail_f, h5zunregister_f - USE HDF5 ! This module contains all necessary modules + USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -165,6 +166,7 @@ SUBROUTINE szip_test(szip_flag, cleanup, total_error) USE HDF5 ! This module contains all necessary modules + USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(OUT) :: szip_flag diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90 index 4f73fda..6303374 100644 --- a/fortran/test/tf.f90 +++ b/fortran/test/tf.f90 @@ -28,6 +28,10 @@ ! !***** +MODULE H5FORT_TESTS + +CONTAINS + !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) !DEC$attributes dllexport :: verify_real_kind_7 @@ -357,3 +361,5 @@ SUBROUTINE h5_env_nocleanup_f(HDF5_NOCLEANUP) END SUBROUTINE h5_env_nocleanup_f +END MODULE H5FORT_TESTS + -- cgit v0.12 From 2c6fc585fd0301a89dd06ad5abc4e97251a7d610 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Fri, 6 Sep 2013 17:42:10 -0500 Subject: [svn-r24114] Reverting the changes in r24113 for now because they break parallel make fortran. The changes aren't incorrect, but more work in needed on dependencies and also for enable-parallel. Reverted to r24112. --- fortran/test/fflush1.f90 | 1 - fortran/test/fflush2.f90 | 1 - fortran/test/fortranlib_test.f90 | 1 - fortran/test/fortranlib_test_1_8.f90 | 5 ----- fortran/test/tH5A.f90 | 1 - fortran/test/tH5A_1_8.f90 | 15 --------------- fortran/test/tH5D.f90 | 2 -- fortran/test/tH5E.f90 | 1 - fortran/test/tH5F.f90 | 8 +------- fortran/test/tH5G.f90 | 1 - fortran/test/tH5G_1_8.f90 | 12 ------------ fortran/test/tH5I.f90 | 1 - fortran/test/tH5O.f90 | 3 --- fortran/test/tH5P.f90 | 3 --- fortran/test/tH5R.f90 | 2 -- fortran/test/tH5S.f90 | 1 - fortran/test/tH5Sselect.f90 | 6 ------ fortran/test/tH5T.f90 | 4 ---- fortran/test/tH5VL.f90 | 3 --- fortran/test/tH5Z.f90 | 4 +--- fortran/test/tf.f90 | 6 ------ 21 files changed, 2 insertions(+), 79 deletions(-) diff --git a/fortran/test/fflush1.f90 b/fortran/test/fflush1.f90 index c03858f..d35bfff 100644 --- a/fortran/test/fflush1.f90 +++ b/fortran/test/fflush1.f90 @@ -30,7 +30,6 @@ PROGRAM FFLUSH1EXAMPLE USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE diff --git a/fortran/test/fflush2.f90 b/fortran/test/fflush2.f90 index 83e957f..d699150 100644 --- a/fortran/test/fflush2.f90 +++ b/fortran/test/fflush2.f90 @@ -30,7 +30,6 @@ PROGRAM FFLUSH2EXAMPLE USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90 index d54397c..6268d15 100644 --- a/fortran/test/fortranlib_test.f90 +++ b/fortran/test/fortranlib_test.f90 @@ -27,7 +27,6 @@ PROGRAM fortranlibtest USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER :: total_error = 0 diff --git a/fortran/test/fortranlib_test_1_8.f90 b/fortran/test/fortranlib_test_1_8.f90 index 5bf8f56..dc45560 100644 --- a/fortran/test/fortranlib_test_1_8.f90 +++ b/fortran/test/fortranlib_test_1_8.f90 @@ -27,7 +27,6 @@ PROGRAM fortranlibtest USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER :: total_error = 0 @@ -117,7 +116,6 @@ END PROGRAM fortranlibtest SUBROUTINE dtransform(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -182,7 +180,6 @@ END SUBROUTINE dtransform SUBROUTINE test_genprop_basic_class(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -278,7 +275,6 @@ SUBROUTINE test_h5s_encode(cleanup, total_error) !****************************************************************/ USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -428,7 +424,6 @@ END SUBROUTINE test_h5s_encode SUBROUTINE test_scaleoffset(cleanup, total_error ) USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5A.f90 b/fortran/test/tH5A.f90 index af65e37..cecaded 100644 --- a/fortran/test/tH5A.f90 +++ b/fortran/test/tH5A.f90 @@ -36,7 +36,6 @@ ! USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5A_1_8.f90 b/fortran/test/tH5A_1_8.f90 index 91ddc34..32cb228 100644 --- a/fortran/test/tH5A_1_8.f90 +++ b/fortran/test/tH5A_1_8.f90 @@ -40,7 +40,6 @@ SUBROUTINE attribute_test_1_8(cleanup, total_error) ! USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -214,7 +213,6 @@ SUBROUTINE test_attr_corder_create_compact(fcpl,fapl, total_error) ! Needed for get_info_by_name USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE ! - - - arg types - - - @@ -403,7 +401,6 @@ SUBROUTINE test_attr_null_space(fcpl, fapl, total_error) !** !****************************************************************/ USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fcpl @@ -535,7 +532,6 @@ SUBROUTINE test_attr_create_by_name(new_format,fcpl,fapl, total_error) !****************************************************************/ USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -750,7 +746,6 @@ SUBROUTINE test_attr_info_by_idx(new_format, fcpl, fapl, total_error) !****************************************************************/ USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -956,7 +951,6 @@ END SUBROUTINE test_attr_info_by_idx SUBROUTINE attr_info_by_idx_check(obj_id, attrname, n, use_index, total_error ) USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -1097,7 +1091,6 @@ SUBROUTINE test_attr_shared_rename( fcpl, fapl, total_error) !****************************************************************/ USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -1419,7 +1412,6 @@ SUBROUTINE test_attr_delete_by_idx(new_format, fcpl, fapl, total_error) !****************************************************************/ USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -1781,7 +1773,6 @@ SUBROUTINE test_attr_shared_delete(fcpl, fapl, total_error) !****************************************************************/ USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2065,7 +2056,6 @@ SUBROUTINE test_attr_dense_open( fcpl, fapl, total_error) !****************************************************************/ USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2217,7 +2207,6 @@ END SUBROUTINE test_attr_dense_open SUBROUTINE test_attr_dense_verify(loc_id, max_attr, total_error) USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2313,7 +2302,6 @@ END SUBROUTINE test_attr_dense_verify SUBROUTINE test_attr_corder_create_basic( fcpl, fapl, total_error ) USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2436,7 +2424,6 @@ END SUBROUTINE test_attr_corder_create_basic SUBROUTINE test_attr_basic_write(fapl, total_error) USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2636,7 +2623,6 @@ END SUBROUTINE test_attr_basic_write SUBROUTINE test_attr_many(new_format, fcpl, fapl, total_error) USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE @@ -2754,7 +2740,6 @@ END SUBROUTINE test_attr_many SUBROUTINE attr_open_check(fid, dsetname, obj_id, max_attrs, total_error ) USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fid diff --git a/fortran/test/tH5D.f90 b/fortran/test/tH5D.f90 index 35832c4..9f7b50c 100644 --- a/fortran/test/tH5D.f90 +++ b/fortran/test/tH5D.f90 @@ -36,7 +36,6 @@ ! SUBROUTINE datasettest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -253,7 +252,6 @@ SUBROUTINE extenddsettest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5E.f90 b/fortran/test/tH5E.f90 index 05fa885..4d431a1 100644 --- a/fortran/test/tH5E.f90 +++ b/fortran/test/tH5E.f90 @@ -36,7 +36,6 @@ ! This subroutine tests following functionalities: h5eprint_f USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5F.f90 b/fortran/test/tH5F.f90 index 75c8cd7..d8f683c 100644 --- a/fortran/test/tH5F.f90 +++ b/fortran/test/tH5F.f90 @@ -33,8 +33,6 @@ ! in the first file. SUBROUTINE mountingtest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines - IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error @@ -291,7 +289,6 @@ SUBROUTINE reopentest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error @@ -477,8 +474,7 @@ ! created using the got property lists SUBROUTINE plisttest(cleanup, total_error) - USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines + USE HDF5 ! This module contains all necessary modules IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error @@ -578,7 +574,6 @@ SUBROUTINE file_close(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error @@ -707,7 +702,6 @@ SUBROUTINE file_space(filename, cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE CHARACTER(*), INTENT(IN) :: filename LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5G.f90 b/fortran/test/tH5G.f90 index 93b6a50..6befa94 100644 --- a/fortran/test/tH5G.f90 +++ b/fortran/test/tH5G.f90 @@ -35,7 +35,6 @@ ! h5gget_comment_f USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5G_1_8.f90 b/fortran/test/tH5G_1_8.f90 index 7979846..fd55ba9 100644 --- a/fortran/test/tH5G_1_8.f90 +++ b/fortran/test/tH5G_1_8.f90 @@ -30,7 +30,6 @@ !***** SUBROUTINE group_test(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -135,7 +134,6 @@ END SUBROUTINE group_test SUBROUTINE group_info(cleanup, fapl, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -452,7 +450,6 @@ SUBROUTINE group_info(cleanup, fapl, total_error) SUBROUTINE timestamps(cleanup, fapl, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -649,7 +646,6 @@ SUBROUTINE group_info(cleanup, fapl, total_error) SUBROUTINE mklinks(fapl, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -745,7 +741,6 @@ SUBROUTINE group_info(cleanup, fapl, total_error) SUBROUTINE test_move_preserves(fapl_id, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -953,7 +948,6 @@ SUBROUTINE lifecycle(cleanup, fapl2, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -1102,7 +1096,6 @@ SUBROUTINE lifecycle(cleanup, fapl2, total_error) ! USE ISO_C_BINDING USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -1172,7 +1165,6 @@ END SUBROUTINE cklinks SUBROUTINE delete_by_idx(cleanup, fapl, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -1414,7 +1406,6 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & hard_link, use_index, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(INOUT) :: total_error @@ -1518,7 +1509,6 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & SUBROUTINE test_lcpl(cleanup, fapl, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(INOUT) :: total_error @@ -1832,7 +1822,6 @@ END SUBROUTINE test_lcpl SUBROUTINE objcopy(fapl, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(INOUT) :: total_error @@ -1896,7 +1885,6 @@ END SUBROUTINE objcopy SUBROUTINE lapl_nlinks( fapl, total_error) USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fapl diff --git a/fortran/test/tH5I.f90 b/fortran/test/tH5I.f90 index bb4f24b..184edaf 100644 --- a/fortran/test/tH5I.f90 +++ b/fortran/test/tH5I.f90 @@ -32,7 +32,6 @@ ! This subroutine tests following functionalities: h5iget_type_f USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5O.f90 b/fortran/test/tH5O.f90 index 2f20037..ea91631 100644 --- a/fortran/test/tH5O.f90 +++ b/fortran/test/tH5O.f90 @@ -29,7 +29,6 @@ SUBROUTINE test_h5o(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -55,7 +54,6 @@ END SUBROUTINE test_h5o SUBROUTINE test_h5o_link(total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error @@ -578,7 +576,6 @@ END SUBROUTINE test_h5o_link SUBROUTINE test_h5o_plist(total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE INTEGER, INTENT(OUT) :: total_error diff --git a/fortran/test/tH5P.f90 b/fortran/test/tH5P.f90 index 9e8ca5f..4c78334 100644 --- a/fortran/test/tH5P.f90 +++ b/fortran/test/tH5P.f90 @@ -34,7 +34,6 @@ SUBROUTINE external_test(cleanup, total_error) ! h5pget_external_f USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -151,7 +150,6 @@ END SUBROUTINE external_test SUBROUTINE multi_file_test(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -421,7 +419,6 @@ END SUBROUTINE multi_file_test SUBROUTINE test_chunk_cache(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5R.f90 b/fortran/test/tH5R.f90 index 2b19d1b..ac105fc 100644 --- a/fortran/test/tH5R.f90 +++ b/fortran/test/tH5R.f90 @@ -33,7 +33,6 @@ ! SUBROUTINE refobjtest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error @@ -242,7 +241,6 @@ END SUBROUTINE refobjtest ! SUBROUTINE refregtest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines ! use iso_c_binding ! NOTE: if this is uncommented, then need to move subroutine into another file. IMPLICIT NONE diff --git a/fortran/test/tH5S.f90 b/fortran/test/tH5S.f90 index b958e6d..e3a44ad 100644 --- a/fortran/test/tH5S.f90 +++ b/fortran/test/tH5S.f90 @@ -37,7 +37,6 @@ SUBROUTINE dataspace_basic_test(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5Sselect.f90 b/fortran/test/tH5Sselect.f90 index 9d83350..1cbabe8 100644 --- a/fortran/test/tH5Sselect.f90 +++ b/fortran/test/tH5Sselect.f90 @@ -40,7 +40,6 @@ SUBROUTINE test_select_hyperslab(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -320,7 +319,6 @@ SUBROUTINE test_select_element(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -697,7 +695,6 @@ SUBROUTINE test_basic_select(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -1036,7 +1033,6 @@ SUBROUTINE test_select_point(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -1363,7 +1359,6 @@ END SUBROUTINE test_select_point SUBROUTINE test_select_combine(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -1786,7 +1781,6 @@ END SUBROUTINE test_select_combine SUBROUTINE test_select_bounds(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5T.f90 b/fortran/test/tH5T.f90 index b833426..b42a8e6 100644 --- a/fortran/test/tH5T.f90 +++ b/fortran/test/tH5T.f90 @@ -45,7 +45,6 @@ USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -643,7 +642,6 @@ ! H5tset_cset_f, H5tget_strpad_f, H5tset_strpad_f USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -861,7 +859,6 @@ SUBROUTINE enumtest(cleanup, total_error) USE HDF5 - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -1002,7 +999,6 @@ SUBROUTINE test_derived_flt(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5VL.f90 b/fortran/test/tH5VL.f90 index 2a064dd..85feb2b 100644 --- a/fortran/test/tH5VL.f90 +++ b/fortran/test/tH5VL.f90 @@ -29,7 +29,6 @@ SUBROUTINE vl_test_integer(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -190,7 +189,6 @@ SUBROUTINE vl_test_real(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -362,7 +360,6 @@ SUBROUTINE vl_test_string(cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup diff --git a/fortran/test/tH5Z.f90 b/fortran/test/tH5Z.f90 index 8145061..cd6a343 100644 --- a/fortran/test/tH5Z.f90 +++ b/fortran/test/tH5Z.f90 @@ -31,8 +31,7 @@ ! This subroutine tests following functionalities: h5zfilter_avail_f, h5zunregister_f - USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines + USE HDF5 ! This module contains all necessary modules IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup @@ -166,7 +165,6 @@ SUBROUTINE szip_test(szip_flag, cleanup, total_error) USE HDF5 ! This module contains all necessary modules - USE H5FORT_TESTS ! This module contains all test routines IMPLICIT NONE LOGICAL, INTENT(OUT) :: szip_flag diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90 index 6303374..4f73fda 100644 --- a/fortran/test/tf.f90 +++ b/fortran/test/tf.f90 @@ -28,10 +28,6 @@ ! !***** -MODULE H5FORT_TESTS - -CONTAINS - !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) !DEC$attributes dllexport :: verify_real_kind_7 @@ -361,5 +357,3 @@ SUBROUTINE h5_env_nocleanup_f(HDF5_NOCLEANUP) END SUBROUTINE h5_env_nocleanup_f -END MODULE H5FORT_TESTS - -- cgit v0.12 From 6b54dac504ccaad3ec512b57ba8b92609a74490b Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Fri, 6 Sep 2013 17:48:28 -0500 Subject: [svn-r24115] Reduce warnings for conversions of different widths. h5committested on jam, ostrich, koala, and platypus. --- tools/h5dump/h5dump_ddl.c | 100 +++--- tools/h5dump/h5dump_xml.c | 844 +++++++++++++++++++++++----------------------- tools/lib/h5tools_dump.c | 198 +++++------ 3 files changed, 571 insertions(+), 571 deletions(-) diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 380eb8e..6aaa499 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -279,19 +279,19 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datasetbegin, name, h5tools_dump_header_format->datasetblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -302,7 +302,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -313,14 +313,14 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } else if(found_obj->displayed) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datasetbegin, name, h5tools_dump_header_format->datasetblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; @@ -329,12 +329,12 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -345,7 +345,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5Dclose(obj); goto done; @@ -398,7 +398,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->softlinkbegin, name, h5tools_dump_header_format->softlinkblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; @@ -411,18 +411,18 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED /* print the value of a soft link */ /* Standard DDL: no modification */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -433,7 +433,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(HDstrlen(h5tools_dump_header_format->softlinkend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(targbuf); break; @@ -443,14 +443,14 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED HDassert(targbuf); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->extlinkbegin, name, h5tools_dump_header_format->extlinkblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -472,20 +472,20 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -493,7 +493,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } /* end else */ } /* end else */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -504,35 +504,35 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(HDstrlen(h5tools_dump_header_format->extlinkend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(targbuf); break; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->udlinkbegin, name, h5tools_dump_header_format->udlinkblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "LINKCLASS %d", linfo->type); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->udlinkblockend)) { @@ -542,7 +542,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(HDstrlen(h5tools_dump_header_format->udlinkend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; } /* end switch */ @@ -684,7 +684,7 @@ dump_named_datatype(hid_t tid, const char *name) h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datatypebegin, name, h5tools_dump_header_format->datatypeblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5Oget_info(tid, &oinfo); @@ -705,7 +705,7 @@ dump_named_datatype(hid_t tid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); goto done; } else @@ -720,7 +720,7 @@ dump_named_datatype(hid_t tid, const char *name) h5tools_str_append(&buffer, ";"); } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; @@ -739,7 +739,7 @@ done: } if(HDstrlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -831,7 +831,7 @@ dump_group(hid_t gid, const char *name) h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->groupbegin, name, h5tools_dump_header_format->groupblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; @@ -877,7 +877,7 @@ dump_group(hid_t gid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; @@ -894,7 +894,7 @@ dump_group(hid_t gid, const char *name) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -905,7 +905,7 @@ dump_group(hid_t gid, const char *name) } if(HDstrlen(h5tools_dump_header_format->groupend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -974,14 +974,14 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datasetbegin, name, h5tools_dump_header_format->datasetblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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); @@ -1016,25 +1016,25 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) for(i=0; iline_ncols, 0, 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++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + 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, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; break; @@ -1068,7 +1068,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1079,7 +1079,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) } if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -1346,7 +1346,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *ainfo, vo if(op_name[0] != '/') { HDstrncat(obj_name, buf, (size_t)i + 1); if(buf[i-1] != '/') - HDstrncat(obj_name, "/", 2); + HDstrncat(obj_name, "/", (size_t)2); } HDstrncat(obj_name, op_name, (size_t)j + 1); @@ -1407,7 +1407,7 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data) } else k = 1; - search_name = (char *)HDmalloc(search_len + k); + search_name = (char *)HDmalloc((size_t)(search_len + k)); if(search_name == NULL) { error_msg("creating temporary link\n"); h5tools_setstatus(EXIT_FAILURE); @@ -1578,19 +1578,19 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe HDmemset(&buffer, 0, sizeof(h5tools_str_t)); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->attributebegin, attr, h5tools_dump_header_format->attributeblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->attributeblockend)) { @@ -1600,7 +1600,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe } if(HDstrlen(h5tools_dump_header_format->attributeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index f3fefba..03e1254 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -238,19 +238,19 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datasetbegin, name, h5tools_dump_header_format->datasetblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -261,7 +261,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU } if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -281,11 +281,11 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU char pointerxid[100]; /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(obj_path, dsetxid, sizeof(dsetxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -298,31 +298,31 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU t_obj_path, /* H5Path */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, sizeof(pointerxid), 1); + xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid,t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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); @@ -400,15 +400,15 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU } /* end else */ /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + 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, sizeof(targetxid), 0); + res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0); if (res == 0) { /* target obj found */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -425,12 +425,12 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU targetxid, /* TargetObj */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -446,7 +446,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU t_targbuf, /* TargetPath */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } HDfree(t_prefix); @@ -487,11 +487,11 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU char *t_targname = xml_escape_the_name(targname); /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -509,7 +509,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU targname, /* TargetPath*/ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -530,11 +530,11 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU char *t_obj_path = xml_escape_the_name(obj_path); /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -550,7 +550,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU linfo->type, /* LinkClass */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -902,7 +902,7 @@ xml_print_datatype(hid_t type, unsigned in_group) /* This should be defined somewhere else */ /* These 2 cases are handled the same right now, but probably will have something different eventually */ - char * dtxid = (char *)HDmalloc(100); + char * dtxid = (char *)HDmalloc((size_t)100); xml_name_to_XID(found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -910,38 +910,38 @@ xml_print_datatype(hid_t type, unsigned in_group) as it's name. */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>", xmlnsprefix, dtxid); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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 */ char *t_objname = xml_escape_the_name(found_obj->objname); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, dtxid, t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_setstatus(EXIT_FAILURE); } } @@ -950,12 +950,12 @@ xml_print_datatype(hid_t type, unsigned in_group) switch (H5Tget_class(type)) { case H5T_INTEGER: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; /* */ @@ -963,7 +963,7 @@ xml_print_datatype(hid_t type, unsigned in_group) sgn = H5Tget_sign(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -997,16 +997,16 @@ xml_print_datatype(hid_t type, unsigned in_group) sz = H5Tget_size(type); h5tools_str_append(&buffer, "%lu", (unsigned long)sz); h5tools_str_append(&buffer, "\" />"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_FLOAT: @@ -1017,16 +1017,16 @@ xml_print_datatype(hid_t type, unsigned in_group) ord = H5Tget_order(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1053,45 +1053,45 @@ xml_print_datatype(hid_t type, unsigned in_group) h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos); h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos); h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_append(&buffer, ""); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_STRING: @@ -1102,17 +1102,17 @@ xml_print_datatype(hid_t type, unsigned in_group) is_vlstr = H5Tis_variable_str(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1139,16 +1139,16 @@ xml_print_datatype(hid_t type, unsigned in_group) else { h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>"); } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_BITFIELD: @@ -1156,16 +1156,16 @@ xml_print_datatype(hid_t type, unsigned in_group) ord = H5Tget_order(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1185,33 +1185,33 @@ xml_print_datatype(hid_t type, unsigned in_group) size = H5Tget_size(type); h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_OPAQUE: /* */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1219,16 +1219,16 @@ xml_print_datatype(hid_t type, unsigned in_group) HDfree(mname); size = H5Tget_size(type); h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_COMPOUND: @@ -1238,12 +1238,12 @@ xml_print_datatype(hid_t type, unsigned in_group) nmembers = H5Tget_nmembers(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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 */ /* */ @@ -1258,12 +1258,12 @@ xml_print_datatype(hid_t type, unsigned in_group) t_fname = xml_escape_the_name(mname); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(mname); HDfree(t_fname); @@ -1271,12 +1271,12 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -1284,80 +1284,80 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_REFERENCE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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 */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_ENUM: @@ -1365,62 +1365,62 @@ xml_print_datatype(hid_t type, unsigned in_group) nmembs = H5Tget_nmembers(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -1428,22 +1428,22 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5Tclose(super); break; @@ -1454,14 +1454,14 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Print lead-in */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix); ndims = H5Tget_array_ndims(type); h5tools_str_append(&buffer, "%u\">", ndims); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -1470,12 +1470,12 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; for (i = 0; i < ndims; i++) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; @@ -1483,12 +1483,12 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -1496,34 +1496,34 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_setstatus(EXIT_FAILURE); break; } @@ -1592,7 +1592,7 @@ xml_dump_datatype(hid_t type) if(found_obj) { /* Shared datatype, must be entered as an object */ /* These 2 cases are the same now, but may change */ - char *dtxid = (char *)HDmalloc(100); + char *dtxid = (char *)HDmalloc((size_t)100); xml_name_to_XID(found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -1603,48 +1603,48 @@ xml_dump_datatype(hid_t type) */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>", xmlnsprefix, dtxid); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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 */ char *t_objname = xml_escape_the_name(found_obj->objname); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />", xmlnsprefix, dtxid, t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -1652,12 +1652,12 @@ xml_dump_datatype(hid_t type) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; @@ -1720,12 +1720,12 @@ xml_dump_dataspace(hid_t space) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataspace>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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) { @@ -1733,12 +1733,12 @@ xml_dump_dataspace(hid_t space) /* scalar dataspace (just a tag, no XML attrs. defined */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sScalarDataspace />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5S_SIMPLE: @@ -1746,56 +1746,56 @@ xml_dump_dataspace(hid_t space) /* */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">",xmlnsprefix, ndims); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* print the elements */ ctx.indent_level++; for (i = 0; i < ndims; i++) { if (maxsize[i] == H5S_UNLIMITED) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"UNLIMITED\"/>", xmlnsprefix,size[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>", xmlnsprefix,size[i], size[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>", xmlnsprefix, size[i], maxsize[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix ); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; #ifdef TMP @@ -1804,35 +1804,35 @@ xml_dump_dataspace(hid_t space) /* null dataspace (just a tag, no XML attrs. defined */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + 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, outputformat->line_ncols, 0, 0); + 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_NO_CLASS: default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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); @@ -1901,22 +1901,22 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU outputformat = &string_dataformat; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -2001,12 +2001,12 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "Unable to print data."); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -2022,17 +2022,17 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -2091,12 +2091,12 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, outputformat = &string_dataformat; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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) { @@ -2127,44 +2127,44 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; @@ -2172,112 +2172,112 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, case H5T_COMPOUND: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", H5Tget_class(type)); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; } } @@ -2285,32 +2285,32 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, /* The case of an attribute never yet written ?? * Or dataspace is H5S_NULL. */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; @@ -2320,12 +2320,12 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, H5Aclose(attr_id); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; @@ -2335,22 +2335,22 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); @@ -2416,15 +2416,15 @@ xml_dump_named_datatype(hid_t type, const char *name) string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - dtxid = (char *)HDmalloc(100); - parentxid = (char *)HDmalloc(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); xml_name_to_XID(tmp, dtxid, 100, 1); xml_name_to_XID(prefix, parentxid, 100, 1); - if(HDstrncmp(name, "#", 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 @@ -2435,7 +2435,7 @@ xml_dump_named_datatype(hid_t type, const char *name) */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2444,13 +2444,13 @@ xml_dump_named_datatype(hid_t type, const char *name) xmlnsprefix, name, dtxid, parentxid, HDstrcmp(prefix,"") ? t_prefix : "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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 */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2459,7 +2459,7 @@ xml_dump_named_datatype(hid_t type, const char *name) xmlnsprefix, t_name, dtxid, t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/")); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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_info(type, &oinfo); @@ -2484,25 +2484,25 @@ xml_dump_named_datatype(hid_t type, const char *name) ctx.indent_level++; - xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); + xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid, t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_objname); goto done; } @@ -2515,12 +2515,12 @@ xml_dump_named_datatype(hid_t type, const char *name) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; @@ -2529,23 +2529,23 @@ xml_dump_named_datatype(hid_t type, const char *name) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); done: @@ -2673,11 +2673,11 @@ xml_dump_group(hid_t gid, const char *name) } else { char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)HDmalloc(100); - char *parentxid = (char *)HDmalloc(100); + char *grpxid = (char *)HDmalloc((size_t)100); + char *parentxid = (char *)HDmalloc((size_t)100); if(found_obj->displayed) { - char *ptrstr = (char *)HDmalloc(100); + char *ptrstr = (char *)HDmalloc((size_t)100); /* already seen: enter a groupptr */ if(isRoot) { @@ -2685,13 +2685,13 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID("/", grpxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -2700,7 +2700,7 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2708,7 +2708,7 @@ xml_dump_group(hid_t gid, const char *name) "Parents=\"%s\" H5ParentPaths=\"%s\">", xmlnsprefix,t_name, grpxid, get_next_xid(), t_objname, parentxid, par_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -2720,7 +2720,7 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2728,7 +2728,7 @@ xml_dump_group(hid_t gid, const char *name) "Parents=\"%s\" H5ParentPaths=\"%s\" />", xmlnsprefix, ptrstr, t_objname, parentxid, par_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -2744,13 +2744,13 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID("/", grpxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -2760,14 +2760,14 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" >", xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -2826,11 +2826,11 @@ 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(100); - char *parentxid = (char *)HDmalloc(100); + char *grpxid = (char *)HDmalloc((size_t)100); + char *parentxid = (char *)HDmalloc((size_t)100); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2851,7 +2851,7 @@ xml_dump_group(hid_t gid, const char *name) HDfree(t_tmp); HDfree(par_name); } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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); @@ -2903,7 +2903,7 @@ xml_dump_group(hid_t gid, const char *name) } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2911,7 +2911,7 @@ xml_dump_group(hid_t gid, const char *name) h5tools_str_append(&buffer, "", xmlnsprefix); else h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); @@ -3036,23 +3036,23 @@ xml_print_refs(hid_t did, int source) if (!path) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", "NULL"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_path); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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--; @@ -3202,23 +3202,23 @@ xml_print_strs(hid_t did, int source) if (!onestring) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "NULL"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); if (t_onestring) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_onestring); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_onestring); } } @@ -3309,11 +3309,11 @@ check_filters(hid_t dcpl) if (nfilt <= 0) return; for (i = 0; i < nfilt; i++) { - filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, 120, namebuf, NULL); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3326,36 +3326,36 @@ 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, outputformat->line_ncols, 0, 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) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sFletcher32 />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sShuffle />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3396,7 +3396,7 @@ check_filters(hid_t dcpl) h5tools_str_append(&buffer, "Header=\"Raw\""); } h5tools_str_append(&buffer, "/>"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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 { @@ -3449,12 +3449,12 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; @@ -3467,126 +3467,126 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) const char * path = lookup_ref_path(*(hobj_ref_t *) buf); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", "NULL"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_path); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_path); } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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) { /* ????? */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + 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, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%f\"", *(float *) buf); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3596,126 +3596,126 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) buf = (char *) buf + sizeof(unsigned int); } h5tools_str_append(&buffer, "\""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + 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, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", H5Tget_class(type)); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; } } @@ -3724,12 +3724,12 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; @@ -3776,8 +3776,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) h5tool_format_t string_dataformat; hsize_t curr_pos = 0; /* total data element position */ - char *rstr = (char*) HDmalloc(100); - char *pstr = (char*) HDmalloc(100); + 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); @@ -3816,14 +3816,14 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) xml_name_to_XID(prefix, pstr, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">", xmlnsprefix, t_name, rstr, t_tmp, pstr, strcmp(prefix, "") ? t_prefix : "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -3848,24 +3848,24 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sChunkedLayout ", xmlnsprefix); ndims = H5Pget_chunk(dcpl, maxdims, chsize); h5tools_str_append(&buffer, "Ndims=\"%d\">", ndims); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; @@ -3873,21 +3873,21 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) for (i = 0; i < ndims; i++) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />", xmlnsprefix, chsize[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; @@ -3896,33 +3896,33 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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); @@ -3931,60 +3931,60 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sContiguousLayout/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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)) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sCompactLayout/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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.... ?? */ @@ -3995,7 +3995,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4036,30 +4036,30 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) } h5tools_str_append(&buffer, "\""); h5tools_str_append(&buffer, ">"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sFillValue>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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)) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoFill/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else { @@ -4067,23 +4067,23 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; @@ -4131,48 +4131,48 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; break; case H5T_COMPOUND: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; @@ -4183,68 +4183,68 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) case H5T_REFERENCE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; @@ -4256,36 +4256,36 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) break; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", H5Tget_class(type)); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; } } @@ -4294,30 +4294,30 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } @@ -4326,12 +4326,12 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) H5Pclose(dcpl); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -4395,22 +4395,22 @@ xml_print_enum(hid_t type) super = H5Tget_super(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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 @@ -4434,8 +4434,8 @@ xml_print_enum(hid_t type) } /* Get the names and raw values of all members */ - name = (char **)HDcalloc(nmembs, sizeof(char *)); - value = (unsigned char *)HDcalloc(nmembs, MAX(H5Tget_size(type), dst_size)); + 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++) { name[i] = H5Tget_member_name(type, i); @@ -4444,7 +4444,7 @@ xml_print_enum(hid_t type) /* Convert values to native datatype */ if (native > 0) - H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); + H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT); /* Sort members by increasing value */ /*not implemented yet */ @@ -4456,41 +4456,41 @@ xml_print_enum(hid_t type) char *t_name = xml_escape_the_name(name[i]); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sEnumElement>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", t_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sEnumValue>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4508,16 +4508,16 @@ xml_print_enum(hid_t type) h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d", *((long long *) ((void *) (value + i * dst_size)))); } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 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; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_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; diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 75d3c67..e1fdd4b 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -324,7 +324,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai ctx, &buffer, &curr_pos, ncols, i, elmt_counter); } else { - if(H5Rget_name(region_id, H5R_DATASET_REGION, memref, (char*) ref_name, 1024)<0) + if(H5Rget_name(region_id, H5R_DATASET_REGION, memref, (char*) ref_name, (size_t)1024)<0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_name failed"); ctx->need_prefix = TRUE; @@ -453,7 +453,7 @@ h5tools_print_region_data_blocks(hid_t region_id, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); /* Allocate space for the dimension array */ - if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) + if((dims1 = (hsize_t *) HDmalloc((size_t)(sizeof(hsize_t) * ndims))) == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); /* find the dimensions of each data space from the block coordinates */ @@ -2108,12 +2108,12 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ curr_pos = ctx->cur_column; h5tools_str_append(buffer, "H5T_STRING %s", h5tools_dump_header_format->strblockbegin); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2121,10 +2121,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "%s H5T_VARIABLE;", STRSIZE); else h5tools_str_append(buffer, "%s %d;", STRSIZE, (int) size); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2161,10 +2161,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "ERROR;"); break; } - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2200,10 +2200,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "ERROR;"); break; } - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2274,11 +2274,11 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "unknown_one_character_type;"); found_string_type: - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 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_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); if(H5Tclose(str_type) < 0) @@ -2321,7 +2321,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_OPAQUE: h5tools_str_append(buffer, "H5T_OPAQUE %s", h5tools_dump_header_format->structblockbegin); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; { char *ttag; @@ -2330,18 +2330,18 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed"); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); HDfree(ttag); } ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); @@ -2353,20 +2353,20 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ nmembers = (unsigned)snmembers; h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + 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; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_print_datatype(stream, buffer, info, ctx, mtype, TRUE); h5tools_str_append(buffer, " \"%s\";", mname); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(H5Tclose(mtype) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); } @@ -2377,7 +2377,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); @@ -2398,11 +2398,11 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); @@ -2411,14 +2411,14 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); h5tools_str_append(buffer, ";"); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_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); ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend); @@ -2627,9 +2627,9 @@ 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(nmembs, sizeof(char *)))) + if(NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)))) H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); - if(NULL == (value = (unsigned char *)HDcalloc(nmembs, MAX(type_size, dst_size)))) + if(NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size)))) H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); for (i = 0; i < nmembs; i++) { @@ -2640,7 +2640,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i /* Convert values to native datatype */ if (native > 0) - if(H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT) < 0) + if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); /* @@ -2651,7 +2651,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i /* Print members */ for (i = 0; i < nmembs; i++) { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "\"%s\"", name[i]); @@ -2680,7 +2680,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i } h5tools_str_append(buffer, ";"); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } CATCH @@ -2748,7 +2748,7 @@ h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, if (HDstrlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -2797,7 +2797,7 @@ h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, if (HDstrlen(h5tools_dump_header_format->dataspaceend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -2835,7 +2835,7 @@ h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s %d %s", OBJID, BEGIN, oid, END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -2933,7 +2933,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", STORAGE_LAYOUT, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(H5D_CHUNKED == H5Pget_layout(dcpl_id)) { ctx->indent_level++; @@ -2944,12 +2944,12 @@ 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,NELMTS(chsize),chsize); + 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3014,7 +3014,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, else { h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); } - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3023,7 +3023,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } else if(H5D_COMPACT == H5Pget_layout(dcpl_id)) { ctx->indent_level++; @@ -3033,14 +3033,14 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3049,7 +3049,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } else if(H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) { int next; @@ -3068,14 +3068,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", CONTIGUOUS); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", EXTERNAL, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + 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)next; j++) { @@ -3087,7 +3087,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "FILENAME %s SIZE " HSIZE_T_FORMAT, name, size); h5tools_str_append(&buffer, " OFFSET %ld", offset); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } ctx->indent_level--; @@ -3096,7 +3096,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3105,7 +3105,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } else { haddr_t ioffset; @@ -3117,14 +3117,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", CONTIGUOUS); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer,"SIZE " HSIZE_T_FORMAT, storage_size); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3132,7 +3132,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); ioffset = H5Dget_offset(obj_id); h5tools_str_append(&buffer,"OFFSET "H5_PRINTF_HADDR_FMT, ioffset); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3141,7 +3141,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } } /*------------------------------------------------------------------------- @@ -3154,7 +3154,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", FILTERS, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -3174,15 +3174,15 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, switch(filtn) { case H5Z_FILTER_DEFLATE: h5tools_str_append(&buffer, "%s %s %s %d %s", DEFLATE, BEGIN, DEFLATE_LEVEL, cd_values[0], END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + 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, ncols, 0, 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); break; case H5Z_FILTER_SZIP: { @@ -3190,7 +3190,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, szip_pixels_per_block = cd_values[1]; h5tools_str_append(&buffer, "%s %s",SZIP, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -3199,7 +3199,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3209,7 +3209,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "MODE %s", "HARDWARE"); else if(szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK) h5tools_str_append(&buffer, "MODE %s", "K13"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3219,7 +3219,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "CODING %s", "ENTROPY"); else if(szip_options_mask & H5_SZIP_NN_OPTION_MASK) h5tools_str_append(&buffer, "CODING %s", "NEAREST NEIGHBOUR"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3229,7 +3229,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "BYTE_ORDER %s", "LSB"); else if(szip_options_mask & H5_SZIP_MSB_OPTION_MASK) h5tools_str_append(&buffer, "BYTE_ORDER %s", "MSB"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + 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) { ctx->need_prefix = TRUE; @@ -3237,7 +3237,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "HEADER %s", "RAW"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } ctx->indent_level--; @@ -3247,16 +3247,16 @@ 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, ncols, 0, 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, ncols, 0, 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); break; default: /* filter do not have to be avaiable for showing registered filter info. @@ -3266,7 +3266,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, else */ h5tools_str_append(&buffer, "%s %s", "USER_DEFINED_FILTER", BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -3275,7 +3275,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(f_name[0] != '\0') { ctx->need_prefix = TRUE; @@ -3283,7 +3283,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "COMMENT %s", f_name); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 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; @@ -3294,7 +3294,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, for (j=0; jindent_level--; @@ -3303,7 +3303,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); break; }/*switch*/ } /*i*/ @@ -3315,7 +3315,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "NONE"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } ctx->indent_level--; @@ -3324,7 +3324,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); /*------------------------------------------------------------------------- * FILLVALUE @@ -3335,7 +3335,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", FILLVALUE, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -3360,7 +3360,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, HDassert(0); break; } - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3375,7 +3375,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_print_fill_value(&buffer, info, ctx, dcpl_id, type_id, obj_id); ctx->indent_level++; } - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + 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; @@ -3383,7 +3383,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); /*------------------------------------------------------------------------- * ALLOCATION_TIME @@ -3394,7 +3394,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "ALLOCATION_TIME %s", BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -3417,7 +3417,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, HDassert(0); break; } - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3426,7 +3426,7 @@ 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, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -3476,7 +3476,7 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "COMMENT \"%s\"", comment); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } /* end if */ @@ -3521,7 +3521,7 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->attributebegin, attr_name, h5tools_dump_header_format->attributeblockbegin); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(attr_id < 0) { error_msg("unable to open attribute \"%s\"\n", attr_name); @@ -3551,7 +3551,7 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, } ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); @@ -3563,7 +3563,7 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, if (HDstrlen(h5tools_dump_header_format->attributeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -3680,34 +3680,34 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, ncols = info->line_ncols; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->subsettingbegin, h5tools_dump_header_format->subsettingblockbegin); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + 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, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->startbegin, h5tools_dump_header_format->startblockbegin); h5tools_print_dims(&buffer, sset->start.data, dims); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->startend, h5tools_dump_header_format->startblockend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->stridebegin, h5tools_dump_header_format->strideblockbegin); h5tools_print_dims(&buffer, sset->stride.data, dims); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->strideend, h5tools_dump_header_format->strideblockend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->countbegin, h5tools_dump_header_format->countblockbegin); @@ -3718,10 +3718,10 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "DEFAULT"); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->countend, h5tools_dump_header_format->countblockend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->blockbegin, h5tools_dump_header_format->blockblockbegin); @@ -3732,7 +3732,7 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "DEFAULT"); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->blockend, h5tools_dump_header_format->blockblockend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3820,7 +3820,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, ctx->need_prefix = TRUE; h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->databegin, h5tools_dump_header_format->datablockbegin); - h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); /* Print all the values. */ if(obj_data) { @@ -3841,7 +3841,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, info = &string_dataformat; datactx.indent_level++; datactx.need_prefix = TRUE; - h5tools_simple_prefix(stream, info, &datactx, 0, 0); + h5tools_simple_prefix(stream, info, &datactx, (hsize_t)0, 0); string_dataformat = *info; string_dataformat.idx_fmt = "\""; @@ -3859,7 +3859,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, if((display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\""); - h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } H5Tclose(f_type); } @@ -3909,7 +3909,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, info = &string_dataformat; datactx.indent_level++; datactx.need_prefix = TRUE; - h5tools_simple_prefix(stream, info, &datactx, 0, 0); + h5tools_simple_prefix(stream, info, &datactx, (hsize_t)0, 0); string_dataformat = *info; string_dataformat.idx_fmt = "\""; @@ -3929,7 +3929,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\""); - h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } /* Reclaim any VL memory, if necessary */ @@ -3953,7 +3953,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, } ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, &outputformat, ctx, 0, 0); + h5tools_simple_prefix(stream, &outputformat, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->datablockend)) { @@ -3963,13 +3963,13 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, } if(HDstrlen(h5tools_dump_header_format->dataend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataend); - h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if (sset && obj_data) { ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, &outputformat, ctx, 0, 0); + h5tools_simple_prefix(stream, &outputformat, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->subsettingblockend)) { @@ -3979,7 +3979,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, } if(HDstrlen(h5tools_dump_header_format->subsettingend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->subsettingend); - h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } h5tools_str_close(&buffer); -- cgit v0.12 From f79eac6049aaf951cbd109214b8c45f6174fd4e7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 9 Sep 2013 13:30:25 -0500 Subject: [svn-r24116] Correct indentation and create single exit point. Tested : local linux --- tools/h5repack/h5repack.c | 1818 ++++++++++---------- tools/h5repack/h5repack_copy.c | 3243 ++++++++++++++++++------------------ tools/h5repack/h5repack_main.c | 1105 ++++++------ tools/h5repack/h5repack_opttable.c | 530 +++--- 4 files changed, 3270 insertions(+), 3426 deletions(-) diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 5c44e1a..742bb06 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -1,17 +1,17 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright by The HDF Group. * -* Copyright by the Board of Trustees of the University of Illinois. * -* All rights reserved. * -* * -* This file is part of HDF5. The full HDF5 copyright notice, including * -* terms governing use, modification, and redistribution, is contained in * -* the files COPYING and Copyright.html. COPYING can be found at the root * -* of the source code distribution tree; Copyright.html can be found at the * -* root level of an installed copy of the electronic HDF5 document set and * -* is linked from the top-level documents page. It can also be found at * -* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -* access to either file, you may request a copy from help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include #include @@ -23,223 +23,198 @@ #include "h5tools_utils.h" /*------------------------------------------------------------------------- -* File: h5repack.c -* Purpose: Public API functions -*------------------------------------------------------------------------- -*/ + * File: h5repack.c + * Purpose: Public API functions + *------------------------------------------------------------------------- + */ 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 const char* get_sfilter(H5Z_filter_t filtn); static int have_request(pack_opt_t *options); +/*------------------------------------------------------------------------- + * Function: h5repack + * + * Purpose: locate all high-level HDF5 objects in the file + * and compress/chunk them using options + * + * Algorithm: 2 traversals are made to the file; the 1st builds a list of + * the objects, the 2nd makes a copy of them, using the options; + * the reason for the 1st traversal is to check for invalid + * object name requests + * + * Return: 0, ok, -1, fail + * + * Programmer: pvn@ncsa.uiuc.edu + * + * Date: September, 22, 2003 + * + *------------------------------------------------------------------------- + */ +int h5repack(const char* infile, const char* outfile, pack_opt_t *options) { + /* check input */ + if (check_options(options) < 0) + return -1; + /* check for objects in input that are in the file */ + if (check_objects(infile, options) < 0) + return -1; -/*------------------------------------------------------------------------- -* Function: h5repack -* -* Purpose: locate all high-level HDF5 objects in the file -* and compress/chunk them using options -* -* Algorithm: 2 traversals are made to the file; the 1st builds a list of -* the objects, the 2nd makes a copy of them, using the options; -* the reason for the 1st traversal is to check for invalid -* object name requests -* -* Return: 0, ok, -1, fail -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: September, 22, 2003 -* -*------------------------------------------------------------------------- -*/ -int h5repack(const char* infile, - const char* outfile, - pack_opt_t *options) -{ - /* check input */ - if (check_options(options)<0) - return -1; - - /* check for objects in input that are in the file */ - if (check_objects(infile,options) < 0) - return -1; - - /* copy the objects */ - if (copy_objects(infile,outfile,options) < 0) - return -1; - - - return 0; + /* copy the objects */ + if (copy_objects(infile, outfile, options) < 0) + return -1; + + return 0; } +/*------------------------------------------------------------------------- + * Function: h5repack_init + * + * Purpose: initialize options + * + * Return: 0, ok, -1, fail + * + *------------------------------------------------------------------------- + */ +int h5repack_init(pack_opt_t *options, int verbose, + H5F_file_space_type_t strategy, hsize_t threshold) { + int k, n; -/*------------------------------------------------------------------------- -* Function: h5repack_init -* -* Purpose: initialize options -* -* Return: 0, ok, -1, fail -* -*------------------------------------------------------------------------- -*/ - -int -h5repack_init(pack_opt_t *options, int verbose, H5F_file_space_type_t strategy, - hsize_t threshold) -{ - int k, n; - - HDmemset(options, 0, sizeof(pack_opt_t)); - options->min_comp = 0; - options->verbose = verbose; - options->layout_g = H5D_LAYOUT_ERROR; - - for ( n = 0; n < H5_REPACK_MAX_NFILTERS; n++) - { - 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; - } - - options->fs_strategy = strategy; - options->fs_threshold = threshold; - - return (options_table_init(&(options->op_tbl))); -} + HDmemset(options, 0, sizeof(pack_opt_t)); + options->min_comp = 0; + options->verbose = verbose; + options->layout_g = H5D_LAYOUT_ERROR; + for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { + 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; + } -/*------------------------------------------------------------------------- -* Function: h5repack_end -* -* Purpose: free options table -* -*------------------------------------------------------------------------- -*/ - -int h5repack_end (pack_opt_t *options) -{ - return options_table_free(options->op_tbl); -} + options->fs_strategy = strategy; + options->fs_threshold = threshold; + return (options_table_init(&(options->op_tbl))); +} /*------------------------------------------------------------------------- -* Function: h5repack_addfilter -* -* Purpose: add a compression -f option to table -* Example: -f dset:GZIP=6 -* -* Return: 0, ok, -1, fail -* -*------------------------------------------------------------------------- -*/ -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 */ - filter_info_t filter; /* filter info for the current -f option entry */ - int n_objs; /* number of objects in the current -f or -l option entry */ - int is_glb; /* is the filter global */ - - - - /* parse the -f option */ - if(NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb))) - return -1; - - /* if it applies to all objects */ - if(is_glb) - { - int n; - - n = options->n_filter_g++; /* increase # of global filters */ - - if(options->n_filter_g > H5_REPACK_MAX_NFILTERS) - { - error_msg("maximum number of filters exceeded for <%s>\n", str); - HDfree(obj_list); - return -1; - } - - options->filter_g[n] = filter; - } - else - options_add_filter(obj_list, n_objs, filter, options->op_tbl); - - HDfree(obj_list); - return 0; + * Function: h5repack_end + * + * Purpose: free options table + * + *------------------------------------------------------------------------- + */ + +int h5repack_end(pack_opt_t *options) { + return options_table_free(options->op_tbl); } +/*------------------------------------------------------------------------- + * Function: h5repack_addfilter + * + * Purpose: add a compression -f option to table + * Example: -f dset:GZIP=6 + * + * Return: 0, ok, -1, fail + * + *------------------------------------------------------------------------- + */ +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 */ + filter_info_t filter; /* filter info for the current -f option entry */ + int n_objs; /* number of objects in the current -f or -l option entry */ + int is_glb; /* is the filter global */ + + /* parse the -f option */ + if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb))) + return -1; + + /* if it applies to all objects */ + if (is_glb) { + int n; + + n = options->n_filter_g++; /* increase # of global filters */ + + if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) { + error_msg("maximum number of filters exceeded for <%s>\n", str); + HDfree(obj_list); + return -1; + } + + options->filter_g[n] = filter; + } + else + options_add_filter(obj_list, n_objs, filter, options->op_tbl); + + HDfree(obj_list); + return 0; +} /*------------------------------------------------------------------------- -* Function: h5repack_addlayout -* -* Purpose: add a layout option -* -* Return: 0, ok, -1, fail -* -*------------------------------------------------------------------------- -*/ - - -int h5repack_addlayout(const char* str, - pack_opt_t *options) -{ - - obj_list_t *obj_list=NULL; /*one object list for the -t and -c option entry */ - int n_objs; /*number of objects in the current -t or -c option entry */ - pack_info_t pack; /*info about layout to extract from parse */ - int j; - - init_packobject(&pack); - - if (options->all_layout==1){ - error_msg("invalid layout input: 'all' option \ - is present with other objects <%s>\n",str); - return -1; - } - - /* parse the layout option */ - obj_list=parse_layout(str,&n_objs,&pack,options); - if (obj_list==NULL) - return -1; - - /* set layout option */ - options->layout_g = pack.layout; - - /* no individual dataset specified */ - if (options->all_layout==1 ) - { - if (pack.layout==H5D_CHUNKED) - { - /* -2 means the NONE option, remove chunking - and set the global layout to contiguous */ - if (pack.chunk.rank==-2) - { - options->layout_g = H5D_CONTIGUOUS; - } - /* otherwise set the global chunking type */ - else - { - options->chunk_g.rank=pack.chunk.rank; - for (j = 0; j < pack.chunk.rank; j++) - options->chunk_g.chunk_lengths[j] = pack.chunk.chunk_lengths[j]; - } - } - } - - /* individual dataset specified */ - if (options->all_layout==0) - options_add_layout(obj_list, - n_objs, - &pack, - options->op_tbl); - - HDfree(obj_list); - return 0; + * Function: h5repack_addlayout + * + * Purpose: add a layout option + * + * Return: 0, ok, -1, fail + * + *------------------------------------------------------------------------- + */ + +int h5repack_addlayout(const char* str, pack_opt_t *options) { + + obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */ + int n_objs; /*number of objects in the current -t or -c option entry */ + pack_info_t pack; /*info about layout to extract from parse */ + int j; + int ret_value = -1; + + init_packobject(&pack); + + if (options->all_layout == 1) { + error_msg( + "invalid layout input: 'all' option \ + is present with other objects <%s>\n", + str); + return ret_value; + } + + /* parse the layout option */ + obj_list = parse_layout(str, &n_objs, &pack, options); + if (obj_list) { + + /* set layout option */ + options->layout_g = pack.layout; + + /* no individual dataset specified */ + if (options->all_layout == 1) { + if (pack.layout == H5D_CHUNKED) { + /* -2 means the NONE option, remove chunking + and set the global layout to contiguous */ + if (pack.chunk.rank == -2) { + options->layout_g = H5D_CONTIGUOUS; + } + /* otherwise set the global chunking type */ + else { + options->chunk_g.rank = pack.chunk.rank; + for (j = 0; j < pack.chunk.rank; j++) + options->chunk_g.chunk_lengths[j] = + pack.chunk.chunk_lengths[j]; + } + } + } + + /* individual dataset specified */ + if (options->all_layout == 0) + ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl); + + HDfree(obj_list); + ret_value = 0; + } + + return ret_value; } /* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr() @@ -249,765 +224,720 @@ int h5repack_addlayout(const char* str, * others to static in h5repack_copy.c. */ /*------------------------------------------------------------------------- -* Function: copy_named_datatype -* -* Purpose: Copies the specified datatype anonymously, and returns an open -* id for that datatype in the output file. The first time this -* is called it scans every named datatype in travt into a -* private stack, afterwards it simply scans that stack. The id -* returned must be closed after it is no longer needed. -* named_datatype_free must be called before the program exits -* to free the stack. -* -* Programmer: Neil Fortner -* -* Date: April 14, 2009 -* -*------------------------------------------------------------------------- -*/ -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) -{ - 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 = -1; /* The identifier of the named dtype in the out file */ - - if(H5Oget_info(type_in, &oinfo) < 0) - goto error; - - if(*named_dt_head_p) - { - /* Stack already exists, search for the datatype */ - while(dt && dt->addr_in != oinfo.addr) - dt = dt->next; - - dt_ret = dt; - } - else - { - /* Create the stack */ - size_t i; - - for(i=0; inobjs; i++) - if(travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) - { - /* Push onto the stack */ - if(NULL == (dt = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) - goto error; - 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 = -1; - - /* Check if this type is the one requested */ - if(oinfo.addr == dt->addr_in) - { - HDassert(!dt_ret); - dt_ret = dt; - } /* end if */ - } /* end if */ - } /* end else */ - - /* Handle the case that the requested datatype was not found. This is - * possible if the datatype was committed anonymously in the input file. */ - if(!dt_ret) - { - /* Push the new datatype onto the stack */ - if(NULL == (dt_ret = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) - goto error; - 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 = -1; - } /* end if */ - - /* If the requested datatype does not yet exist in the output file, copy it - * anonymously */ - if(dt_ret->id_out < 0) - { - if (options->use_native==1) - dt_ret->id_out = h5tools_get_native_type(type_in); - else - dt_ret->id_out = H5Tcopy(type_in); - if(dt_ret->id_out < 0) - goto error; - if(H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto error; - } /* end if */ - - /* Set return value */ - ret_value = dt_ret->id_out; - - /* Increment the ref count on id_out, because the calling function will try - * to close it */ - if(H5Iinc_ref(ret_value) < 0) - goto error; - - return(ret_value); - -error: - return(-1); + * Function: copy_named_datatype + * + * Purpose: Copies the specified datatype anonymously, and returns an open + * id for that datatype in the output file. The first time this + * is called it scans every named datatype in travt into a + * private stack, afterwards it simply scans that stack. The id + * returned must be closed after it is no longer needed. + * named_datatype_free must be called before the program exits + * to free the stack. + * + * Programmer: Neil Fortner + * + * Date: April 14, 2009 + * + *------------------------------------------------------------------------- + */ +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) { + 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 = -1; /* The identifier of the named dtype in the out file */ + + if (H5Oget_info(type_in, &oinfo) < 0) + goto done; + + if (*named_dt_head_p) { + /* Stack already exists, search for the datatype */ + while (dt && dt->addr_in != oinfo.addr) + dt = dt->next; + + dt_ret = dt; + } + else { + /* Create the stack */ + size_t i; + + for (i = 0; i < travt->nobjs; i++) { + if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { + /* Push onto the stack */ + if (NULL == (dt = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) { + goto done; + } + 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 = -1; + + /* Check if this type is the one requested */ + if (oinfo.addr == dt->addr_in) { + HDassert(!dt_ret); + dt_ret = dt; + } /* end if */ + } /* end if */ + } /* end for */ + } /* end else */ + + /* Handle the case that the requested datatype was not found. This is + * possible if the datatype was committed anonymously in the input file. */ + if (!dt_ret) { + /* Push the new datatype onto the stack */ + if (NULL == (dt_ret = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) { + goto done; + } + 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 = -1; + } /* end if */ + + /* If the requested datatype does not yet exist in the output file, copy it + * anonymously */ + if (dt_ret->id_out < 0) { + if (options->use_native == 1) + dt_ret->id_out = h5tools_get_native_type(type_in); + else + dt_ret->id_out = H5Tcopy(type_in); + if (dt_ret->id_out < 0) + goto done; + if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto done; + } /* end if */ + + /* Set return value */ + ret_value = dt_ret->id_out; + + /* Increment the ref count on id_out, because the calling function will try + * to close it */ + if(H5Iinc_ref(ret_value) < 0) { + ret_value = -1; + } + +done: + return (ret_value); } /* end copy_named_datatype */ - /*------------------------------------------------------------------------- -* Function: named_datatype_free -* -* Purpose: Frees the stack of named datatypes. -* -* Programmer: Neil Fortner -* -* Date: April 14, 2009 -* -*------------------------------------------------------------------------- -*/ -int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) -{ - named_dt_t *dt = *named_dt_head_p; - - while(dt) - { - /* Pop the datatype off the stack and free it */ - if(H5Tclose(dt->id_out) < 0 && !ignore_err) - goto error; - dt = dt->next; - HDfree(*named_dt_head_p); - *named_dt_head_p = dt; - } /* end while */ - - return 0; - -error: - return -1; + * Function: named_datatype_free + * + * Purpose: Frees the stack of named datatypes. + * + * Programmer: Neil Fortner + * + * Date: April 14, 2009 + * + *------------------------------------------------------------------------- + */ +int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) { + named_dt_t *dt = *named_dt_head_p; + hid_t ret_value = -1; + + while (dt) { + /* Pop the datatype off the stack and free it */ + if (H5Tclose(dt->id_out) < 0 && !ignore_err) + goto done; + dt = dt->next; + HDfree(*named_dt_head_p); + *named_dt_head_p = dt; + } /* end while */ + + ret_value = 0; + +done: + return (ret_value); } /* end named_datatype_free */ /*------------------------------------------------------------------------- -* Function: copy_attr -* -* Purpose: copy attributes located in LOC_IN, which is obtained either from -* loc_id = H5Gopen2( fid, name); -* loc_id = H5Dopen2( fid, name); -* loc_id = H5Topen2( fid, name); -* -* Return: 0, ok, -1 no -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: October, 28, 2003 -* -*------------------------------------------------------------------------- -*/ -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=-1; /* attr ID */ - hid_t attr_out=-1; /* attr ID */ - hid_t space_id=-1; /* space ID */ - hid_t ftype_id=-1; /* file type ID */ - hid_t wtype_id=-1; /* 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 */ - char name[255]; - H5O_info_t oinfo; /* object info */ - int j; - unsigned u; - hbool_t is_ref=0; - H5T_class_t type_class = -1; - - if(H5Oget_info(loc_in, &oinfo) < 0) - goto error; - - /*------------------------------------------------------------------------- - * copy all attributes - *------------------------------------------------------------------------- - */ - 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) - goto error; - - /* get name */ - if(H5Aget_name(attr_id, (size_t)255, name) < 0) - goto error; - - /* get the file datatype */ - if((ftype_id = H5Aget_type(attr_id)) < 0 ) - goto error; - - /* Check if the datatype is committed */ - if((is_named = H5Tcommitted(ftype_id)) < 0) - goto error; - if(is_named && travt) { - hid_t fidout; - - /* Create out file id */ - if((fidout = H5Iget_file_id(loc_out)) < 0) - goto error; - - /* Copy named dt */ - if((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, - travt, options)) < 0) - { - H5Fclose(fidout); - goto error; - } /* end if */ - - if(H5Fclose(fidout) < 0) - goto error; - } /* end if */ - else { - if(options->use_native == 1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - } /* end else */ - - - /* get the dataspace handle */ - if((space_id = H5Aget_space(attr_id)) < 0) - goto error; - - /* get dimensions */ - if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - goto error; - - nelmts = 1; - for(j = 0; j < rank; j++) - nelmts *= dims[j]; - - if((msize = H5Tget_size(wtype_id)) == 0) - goto error; - - /*------------------------------------------------------------------------- - * object references are a special case. We cannot just copy the buffers, - * but instead we recreate the reference. - * This is done on a second sweep of the file that just copies the referenced - * objects at copy_refs_attr() - *------------------------------------------------------------------------- - */ - type_class = H5Tget_class(wtype_id); - is_ref = (type_class == H5T_REFERENCE); - if (type_class == H5T_VLEN ||type_class == H5T_ARRAY ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref = (is_ref || (H5Tget_class(base_type)==H5T_REFERENCE)); - H5Tclose(base_type); - } - - if (type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(wtype_id) ; - for (j=0; jverbose) - printf(FORMAT_OBJ_ATTR, "attr", name); - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if(H5Tclose(ftype_id) < 0) - goto error; - if(H5Tclose(wtype_id) < 0) - goto error; - if(H5Sclose(space_id) < 0) - goto error; - if(H5Aclose(attr_id) < 0) - goto error; - } /* u */ - - return 0; + * Function: copy_attr + * + * Purpose: copy attributes located in LOC_IN, which is obtained either from + * loc_id = H5Gopen2( fid, name); + * loc_id = H5Dopen2( fid, name); + * loc_id = H5Topen2( fid, name); + * + * Return: 0, ok, -1 no + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: October, 28, 2003 + * + *------------------------------------------------------------------------- + */ +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 = -1; /* attr ID */ + hid_t attr_out = -1; /* attr ID */ + hid_t space_id = -1; /* space ID */ + hid_t ftype_id = -1; /* file type ID */ + hid_t wtype_id = -1; /* 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 */ + char name[255]; + H5O_info_t oinfo; /* object info */ + int j; + unsigned u; + hbool_t is_ref = 0; + H5T_class_t type_class = -1; + + if (H5Oget_info(loc_in, &oinfo) < 0) + goto error; + + /*------------------------------------------------------------------------- + * copy all attributes + *------------------------------------------------------------------------- + */ + 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) + goto error; + + /* get name */ + if (H5Aget_name(attr_id, (size_t) 255, name) < 0) + goto error; + + /* get the file datatype */ + if ((ftype_id = H5Aget_type(attr_id)) < 0) + goto error; + + /* Check if the datatype is committed */ + if ((is_named = H5Tcommitted(ftype_id)) < 0) + goto error; + if (is_named && travt) { + hid_t fidout; + + /* Create out file id */ + if ((fidout = H5Iget_file_id(loc_out)) < 0) + goto error; + + /* Copy named dt */ + if ((wtype_id = copy_named_datatype(ftype_id, fidout, + named_dt_head_p, travt, options)) < 0) { + H5Fclose(fidout); + goto error; + } /* end if */ + + if (H5Fclose(fidout) < 0) + goto error; + } /* end if */ + else { + if (options->use_native == 1) + wtype_id = h5tools_get_native_type(ftype_id); + else + wtype_id = H5Tcopy(ftype_id); + } /* end else */ + + /* get the dataspace handle */ + if ((space_id = H5Aget_space(attr_id)) < 0) + goto error; + + /* get dimensions */ + if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) + goto error; + + nelmts = 1; + for (j = 0; j < rank; j++) + nelmts *= dims[j]; + + if ((msize = H5Tget_size(wtype_id)) == 0) + goto error; + + /*------------------------------------------------------------------------- + * object references are a special case. We cannot just copy the buffers, + * but instead we recreate the reference. + * This is done on a second sweep of the file that just copies the referenced + * objects at copy_refs_attr() + *------------------------------------------------------------------------- + */ + type_class = H5Tget_class(wtype_id); + is_ref = (type_class == H5T_REFERENCE); + if (type_class == H5T_VLEN || type_class == H5T_ARRAY) { + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE)); + H5Tclose(base_type); + } + + if (type_class == H5T_COMPOUND) { + int nmembers = H5Tget_nmembers(wtype_id); + for (j = 0; j < nmembers; j++) { + hid_t mtid = H5Tget_member_type(wtype_id, (unsigned) j); + H5T_class_t mtclass = H5Tget_class(mtid); + H5Tclose(mtid); + + if (mtclass == H5T_REFERENCE) { + is_ref = 1; + break; + } + } /* for (j=0; iverbose) + printf(FORMAT_OBJ_ATTR, "attr", name); + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + if (H5Tclose(ftype_id) < 0) + goto error; + if (H5Tclose(wtype_id) < 0) + goto error; + if (H5Sclose(space_id) < 0) + goto error; + if (H5Aclose(attr_id) < 0) + goto error; + } /* u */ + + return 0; error: - H5E_BEGIN_TRY { - if(buf) { - /* Check if we have VL data and string in the attribute's datatype that must - * be reclaimed */ - if (TRUE == h5tools_detect_vlen(wtype_id)) - H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); - - /* Free buf */ - HDfree(buf); - } /* end if */ - - H5Tclose(ftype_id); - H5Tclose(wtype_id); - H5Sclose(space_id); - H5Aclose(attr_id); - H5Aclose(attr_out); - } H5E_END_TRY; - - return -1; + H5E_BEGIN_TRY + { + if (buf) { + /* Check if we have VL data and string in the attribute's datatype that must + * be reclaimed */ + if (TRUE == h5tools_detect_vlen(wtype_id)) + H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); + + /* Free buf */ + HDfree(buf); + } /* end if */ + + H5Tclose(ftype_id); + H5Tclose(wtype_id); + H5Sclose(space_id); + H5Aclose(attr_id); + H5Aclose(attr_out); + } H5E_END_TRY; + + return -1; } /* end copy_attr() */ /*------------------------------------------------------------------------- -* Function: check_options -* -* Purpose: print options, checks for invalid options -* -* Return: void, return -1 on error -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: September, 22, 2003 -* -* Modification: -* Peter Cao, July 9, 2007 -* Add "-L, --latest" and other options to pack a file with the latest file format -* -*------------------------------------------------------------------------- -*/ -static int check_options(pack_opt_t *options) -{ - unsigned int i; - int k, j, has_cp=0, has_ck=0; - char slayout[30]; - - /*------------------------------------------------------------------------- - * objects to layout - *------------------------------------------------------------------------- - */ - if (options->verbose && have_request(options) /* only print if requested */) - { - printf("Objects to modify layout are...\n"); - if (options->all_layout==1) - { - 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_LAYOUT_ERROR: - case H5D_NLAYOUTS: - error_msg("invalid layout\n"); - return -1; - default: - strcpy(slayout,"invalid layout\n"); - return -1; - } - printf(" Apply %s layout to all\n", slayout); - if (H5D_CHUNKED==options->layout_g) - { - printf("with dimension ["); - for ( j = 0; j < options->chunk_g.rank; j++) - printf("%d ",(int)options->chunk_g.chunk_lengths[j]); - printf("]\n"); - } - } - }/* verbose */ - - for ( i = 0; i < options->op_tbl->nelems; i++) - { - char* name=options->op_tbl->objs[i].path; - - if (options->op_tbl->objs[i].chunk.rank>0) - { - if (options->verbose){ - printf(" <%s> with chunk size ",name); - for ( k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) - printf("%d ",(int)options->op_tbl->objs[i].chunk.chunk_lengths[k]); - printf("\n"); - } - has_ck=1; - } - else if (options->op_tbl->objs[i].chunk.rank==-2) - { - if (options->verbose) - printf(" <%s> %s\n",name,"NONE (contigous)"); - has_ck=1; - } - } - - if (options->all_layout==1 && has_ck) - { - error_msg("invalid chunking input: 'all' option\ + * Function: check_options + * + * Purpose: print options, checks for invalid options + * + * Return: void, return -1 on error + * + * Programmer: pvn@ncsa.uiuc.edu + * + * Date: September, 22, 2003 + * + * Modification: + * Peter Cao, July 9, 2007 + * Add "-L, --latest" and other options to pack a file with the latest file format + * + *------------------------------------------------------------------------- + */ +static int check_options(pack_opt_t *options) { + unsigned int i; + int k, j, has_cp = 0, has_ck = 0; + char slayout[30]; + + /*------------------------------------------------------------------------- + * objects to layout + *------------------------------------------------------------------------- + */ + if (options->verbose && have_request(options) /* only print if requested */) { + printf("Objects to modify layout are...\n"); + if (options->all_layout == 1) { + 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_LAYOUT_ERROR: + case H5D_NLAYOUTS: + error_msg("invalid layout\n"); + return -1; + default: + strcpy(slayout, "invalid layout\n"); + return -1; + } + printf(" Apply %s layout to all\n", slayout); + if (H5D_CHUNKED == options->layout_g) { + printf("with dimension ["); + for (j = 0; j < options->chunk_g.rank; j++) + printf("%d ", (int) options->chunk_g.chunk_lengths[j]); + printf("]\n"); + } + } + }/* verbose */ + + for (i = 0; i < options->op_tbl->nelems; i++) { + char* name = options->op_tbl->objs[i].path; + + if (options->op_tbl->objs[i].chunk.rank > 0) { + if (options->verbose) { + printf(" <%s> with chunk size ", name); + for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) + printf("%d ", + (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]); + printf("\n"); + } + has_ck = 1; + } + else if (options->op_tbl->objs[i].chunk.rank == -2) { + if (options->verbose) + printf(" <%s> %s\n", name, "NONE (contigous)"); + has_ck = 1; + } + } + + if (options->all_layout == 1 && has_ck) { + error_msg( + "invalid chunking input: 'all' option\ is present with other objects\n"); - return -1; - } - - /*------------------------------------------------------------------------- - * objects to filter - *------------------------------------------------------------------------- - */ - - if (options->verbose && have_request(options) /* only print if requested */) - { - printf("Objects to apply filter are...\n"); - if (options->all_filter==1) - { - - for (k = 0; k < options->n_filter_g; k++ ) - { - H5Z_filter_t filtn=options->filter_g[k].filtn; - switch (filtn) - { - case H5Z_FILTER_NONE: - printf(" Uncompress all\n"); - break; - case H5Z_FILTER_SHUFFLE: - case H5Z_FILTER_FLETCHER32: - printf(" All with %s\n",get_sfilter(filtn)); - break; - case H5Z_FILTER_SZIP: - case H5Z_FILTER_DEFLATE: - printf(" All with %s, parameter %d\n", - get_sfilter(filtn), - options->filter_g[k].cd_values[0]); - break; - default: - printf(" User Defined %d\n", filtn); - break; - } /* k */ - }; - } - } /* verbose */ - - for ( i = 0; i < options->op_tbl->nelems; i++) - { - pack_info_t pack = options->op_tbl->objs[i]; - char* name = pack.path; - - for ( j=0; jverbose) - { - printf(" <%s> with %s filter\n", - name, - get_sfilter(pack.filter[j].filtn)); - } - - has_cp=1; - - } /* j */ - } /* i */ - - if (options->all_filter==1 && has_cp) - { - error_msg("invalid compression input: 'all' option\ + return -1; + } + + /*------------------------------------------------------------------------- + * objects to filter + *------------------------------------------------------------------------- + */ + + if (options->verbose && have_request(options) /* only print if requested */) { + printf("Objects to apply filter are...\n"); + if (options->all_filter == 1) { + for (k = 0; k < options->n_filter_g; k++) { + H5Z_filter_t filtn = options->filter_g[k].filtn; + switch (filtn) { + case H5Z_FILTER_NONE: + printf(" Uncompress all\n"); + break; + case H5Z_FILTER_SHUFFLE: + case H5Z_FILTER_FLETCHER32: + printf(" All with %s\n", get_sfilter(filtn)); + break; + case H5Z_FILTER_SZIP: + case H5Z_FILTER_DEFLATE: + printf(" All with %s, parameter %d\n", get_sfilter(filtn), + options->filter_g[k].cd_values[0]); + break; + default: + printf(" User Defined %d\n", filtn); + break; + } /* k */ + }; + } + } /* verbose */ + + for (i = 0; i < options->op_tbl->nelems; i++) { + pack_info_t pack = options->op_tbl->objs[i]; + char* name = pack.path; + + for (j = 0; j < pack.nfilters; j++) { + if (options->verbose) { + printf(" <%s> with %s filter\n", name, + get_sfilter(pack.filter[j].filtn)); + } + + has_cp = 1; + + } /* j */ + } /* i */ + + if (options->all_filter == 1 && has_cp) { + error_msg( + "invalid compression input: 'all' option\ is present with other objects\n"); - return -1; - } - - /*------------------------------------------------------------------------- - * check options for the latest format - *------------------------------------------------------------------------- - */ - - if (options->grp_compact < 0) - { - error_msg("invalid maximum number of links to store as header messages\n"); - return -1; - } - if (options->grp_indexed < 0) - { - error_msg("invalid minimum number of links to store in the indexed format\n"); - return -1; - } - if (options->grp_indexed > options->grp_compact) - { - error_msg("minimum indexed size is greater than the maximum compact size\n"); - return -1; - } - for (i=0; i<8; i++) - { - if (options->msg_size[i]<0) - { - error_msg("invalid shared message size\n"); - return -1; - } - } - - - /*-------------------------------------------------------------------------------- - * verify new user userblock options; file name must be present - *--------------------------------------------------------------------------------- - */ - if ( options->ublock_filename != NULL && options->ublock_size == 0 ) - { - if ( options->verbose ) - { - printf("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 ) - { - error_msg("file name missing for user block\n", - options->ublock_filename); - return -1; - } - - - /*-------------------------------------------------------------------------------- - * verify alignment options; threshold is zero default but alignment not - *--------------------------------------------------------------------------------- - */ - - if ( options->alignment == 0 && options->threshold != 0 ) - { - error_msg("alignment for H5Pset_alignment missing\n"); - return -1; - } - - return 0; + return -1; + } + + /*------------------------------------------------------------------------- + * check options for the latest format + *------------------------------------------------------------------------- + */ + + if (options->grp_compact < 0) { + error_msg( + "invalid maximum number of links to store as header messages\n"); + return -1; + } + if (options->grp_indexed < 0) { + error_msg( + "invalid minimum number of links to store in the indexed format\n"); + return -1; + } + if (options->grp_indexed > options->grp_compact) { + error_msg( + "minimum indexed size is greater than the maximum compact size\n"); + return -1; + } + for (i = 0; i < 8; i++) { + if (options->msg_size[i] < 0) { + error_msg("invalid shared message size\n"); + return -1; + } + } + + /*-------------------------------------------------------------------------------- + * verify new user userblock options; file name must be present + *--------------------------------------------------------------------------------- + */ + if (options->ublock_filename != NULL && options->ublock_size == 0) { + if (options->verbose) { + printf( + "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) { + error_msg("file name missing for user block\n", + options->ublock_filename); + return -1; + } + + /*-------------------------------------------------------------------------------- + * verify alignment options; threshold is zero default but alignment not + *--------------------------------------------------------------------------------- + */ + + if (options->alignment == 0 && options->threshold != 0) { + error_msg("alignment for H5Pset_alignment missing\n"); + return -1; + } + + return 0; } - /*------------------------------------------------------------------------- -* Function: check_objects -* -* Purpose: locate all HDF5 objects in the file and compare with user -* supplied list -* -* Return: 0, ok, -1 no -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: September, 23, 2003 -* -*------------------------------------------------------------------------- -*/ -static int check_objects(const char* fname, - pack_opt_t *options) -{ - hid_t fid; - unsigned int i; - trav_table_t *travt = NULL; - - /* nothing to do */ - if(options->op_tbl->nelems == 0) - return 0; - - /*------------------------------------------------------------------------- - * open the file - *------------------------------------------------------------------------- - */ - if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) - { - printf("<%s>: %s\n", fname, H5FOPENERROR ); - return -1; - } - - /*------------------------------------------------------------------------- - * get the list of objects in the file - *------------------------------------------------------------------------- - */ - - /* init table */ - trav_table_init(&travt); - - /* get the list of objects in the file */ - if(h5trav_gettable(fid, travt) < 0) - goto out; - - /*------------------------------------------------------------------------- - * compare with user supplied list - *------------------------------------------------------------------------- - */ - - if(options->verbose) - printf("Opening file <%s>. Searching for objects to modify...\n", fname); - - for(i = 0; i < options->op_tbl->nelems; i++) - { - char* name=options->op_tbl->objs[i].path; - if(options->verbose) - printf(" <%s>",name); - - /* the input object names are present in the file and are valid */ - if(h5trav_getindext(name, travt) < 0) - { - error_msg("%s Could not find <%s> in file <%s>. Exiting...\n", - (options->verbose?"\n":""),name,fname); - goto out; - } - if(options->verbose) - printf("...Found\n"); - - /* check for extra filter conditions */ - switch(options->op_tbl->objs[i].filter->filtn) - { - /* chunk size must be smaller than pixels per block */ - case H5Z_FILTER_SZIP: - { - int j; - hsize_t csize = 1; - unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0]; - hsize_t dims[H5S_MAX_RANK]; - int rank; - hid_t did; - hid_t sid; - - if(options->op_tbl->objs[i].chunk.rank > 0) { - rank = options->op_tbl->objs[i].chunk.rank; - for(j = 0; j < rank; j++) - csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j]; - } - else { - if((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) - goto out; - if((sid = H5Dget_space(did)) < 0) - goto out; - if((rank = H5Sget_simple_extent_ndims(sid)) < 0) - goto out; - HDmemset(dims, 0, sizeof dims); - if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0) - goto out; - for(j = 0; j < rank; j++) - csize *= dims[j]; - if(H5Sclose(sid) < 0) - goto out; - if(H5Dclose(did) < 0) - goto out; - } - - if (csize < ppb ) { - printf(" \n"); - goto out; - } - } - break; - default: - break; - } - } /* i */ - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - H5Fclose(fid); - trav_table_free(travt); - return 0; + * Function: check_objects + * + * Purpose: locate all HDF5 objects in the file and compare with user + * supplied list + * + * Return: 0, ok, -1 no + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: September, 23, 2003 + * + *------------------------------------------------------------------------- + */ +static int check_objects(const char* fname, pack_opt_t *options) { + hid_t fid; + unsigned int i; + trav_table_t *travt = NULL; + + /* nothing to do */ + if (options->op_tbl->nelems == 0) + return 0; + + /*------------------------------------------------------------------------- + * open the file + *------------------------------------------------------------------------- + */ + if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) + < 0) { + printf("<%s>: %s\n", fname, H5FOPENERROR); + return -1; + } + + /*------------------------------------------------------------------------- + * get the list of objects in the file + *------------------------------------------------------------------------- + */ + + /* init table */ + trav_table_init(&travt); + + /* get the list of objects in the file */ + if (h5trav_gettable(fid, travt) < 0) + goto out; + + /*------------------------------------------------------------------------- + * compare with user supplied list + *------------------------------------------------------------------------- + */ + + if (options->verbose) + printf("Opening file <%s>. Searching for objects to modify...\n", + fname); + + for (i = 0; i < options->op_tbl->nelems; i++) { + char* name = options->op_tbl->objs[i].path; + if (options->verbose) + printf(" <%s>", name); + + /* the input object names are present in the file and are valid */ + if (h5trav_getindext(name, travt) < 0) { + error_msg("%s Could not find <%s> in file <%s>. Exiting...\n", + (options->verbose ? "\n" : ""), name, fname); + goto out; + } + if (options->verbose) + printf("...Found\n"); + + /* check for extra filter conditions */ + switch (options->op_tbl->objs[i].filter->filtn) { + /* chunk size must be smaller than pixels per block */ + case H5Z_FILTER_SZIP: + { + int j; + hsize_t csize = 1; + unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0]; + hsize_t dims[H5S_MAX_RANK]; + int rank; + hid_t did; + hid_t sid; + + if (options->op_tbl->objs[i].chunk.rank > 0) { + rank = options->op_tbl->objs[i].chunk.rank; + for (j = 0; j < rank; j++) + csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j]; + } + else { + if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) + goto out; + if ((sid = H5Dget_space(did)) < 0) + goto out; + if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) + goto out; + HDmemset(dims, 0, sizeof dims); + if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) + goto out; + for (j = 0; j < rank; j++) + csize *= dims[j]; + if (H5Sclose(sid) < 0) + goto out; + if (H5Dclose(did) < 0) + goto out; + } + + if (csize < ppb) { + printf( + " \n"); + goto out; + } + } + break; + default: + break; + } + } /* i */ + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + H5Fclose(fid); + trav_table_free(travt); + return 0; out: - H5Fclose(fid); - trav_table_free(travt); - return -1; + H5Fclose(fid); + trav_table_free(travt); + return -1; } +/*------------------------------------------------------------------------- + * Function: have_request + * + * Purpose: check if a filter or layout was requested + * + * Return: 1 yes, 0 no + * + * Date: May, 24, 2007 + * + *------------------------------------------------------------------------- + */ +static int have_request(pack_opt_t *options) { + if (options->all_filter || options->all_layout || options->op_tbl->nelems) + return 1; - - -/*------------------------------------------------------------------------- -* Function: have_request -* -* Purpose: check if a filter or layout was requested -* -* Return: 1 yes, 0 no -* -* Date: May, 24, 2007 -* -*------------------------------------------------------------------------- -*/ -static int have_request(pack_opt_t *options) -{ - - if (options->all_filter || options->all_layout || options->op_tbl->nelems) - return 1; - - return 0; + return 0; } - /*------------------------------------------------------------------------- -* Function: get_sfilter -* -* Purpose: return the filter as a string name -* -* Return: name of filter, exit on error -* -*------------------------------------------------------------------------- -*/ - -static const char* get_sfilter(H5Z_filter_t filtn) -{ - if (filtn==H5Z_FILTER_NONE) - return "NONE"; - else if (filtn==H5Z_FILTER_DEFLATE) - return "GZIP"; - else if (filtn==H5Z_FILTER_SZIP) - return "SZIP"; - else if (filtn==H5Z_FILTER_SHUFFLE) - return "SHUFFLE"; - else if (filtn==H5Z_FILTER_FLETCHER32) - return "FLETCHER32"; - else if (filtn==H5Z_FILTER_NBIT) - return "NBIT"; - else if (filtn==H5Z_FILTER_SCALEOFFSET) - return "SOFF"; - else - return "UD"; + * Function: get_sfilter + * + * Purpose: return the filter as a string name + * + * Return: name of filter, exit on error + * + *------------------------------------------------------------------------- + */ + +static const char* get_sfilter(H5Z_filter_t filtn) { + if (filtn == H5Z_FILTER_NONE) + return "NONE"; + else if (filtn == H5Z_FILTER_DEFLATE) + return "GZIP"; + else if (filtn == H5Z_FILTER_SZIP) + return "SZIP"; + else if (filtn == H5Z_FILTER_SHUFFLE) + return "SHUFFLE"; + else if (filtn == H5Z_FILTER_FLETCHER32) + return "FLETCHER32"; + else if (filtn == H5Z_FILTER_NBIT) + return "NBIT"; + else if (filtn == H5Z_FILTER_SCALEOFFSET) + return "SOFF"; + else + return "UD"; } diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 2133b48..521b9bd 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -1,36 +1,36 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright by The HDF Group. * -* Copyright by the Board of Trustees of the University of Illinois. * -* All rights reserved. * -* * -* This file is part of HDF5. The full HDF5 copyright notice, including * -* terms governing use, modification, and redistribution, is contained in * -* the files COPYING and Copyright.html. COPYING can be found at the root * -* of the source code distribution tree; Copyright.html can be found at the * -* root level of an installed copy of the electronic HDF5 document set and * -* is linked from the top-level documents page. It can also be found at * -* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -* access to either file, you may request a copy from help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" #include "h5tools.h" #include "h5tools_utils.h" /*------------------------------------------------------------------------- -* typedefs -*------------------------------------------------------------------------- -*/ + * typedefs + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- -* globals -*------------------------------------------------------------------------- -*/ + * globals + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- -* macros -*------------------------------------------------------------------------- -*/ + * macros + *------------------------------------------------------------------------- + */ /* size of buffer/# of bytes to xfer at a time when copying userblock */ #define USERBLOCK_XFER_SIZE 512 @@ -48,1705 +48,1630 @@ } \ } H5E_END_TRY; \ } - + /*------------------------------------------------------------------------- -* local functions -*------------------------------------------------------------------------- -*/ -static int Get_hyperslab (hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p); -static void print_dataset_info(hid_t dcpl_id,char *objname,double per, int pr); -static int do_copy_objects(hid_t fidin,hid_t fidout,trav_table_t *travt,pack_opt_t *options); -static int copy_user_block(const char *infile, const char *outfile, hsize_t size); + * local functions + *------------------------------------------------------------------------- + */ +static int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], + size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p); +static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr); +static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, + pack_opt_t *options); +static int copy_user_block(const char *infile, const char *outfile, + hsize_t size); #if defined (H5REPACK_DEBUG_USER_BLOCK) -static void print_user_block(const char *filename, hid_t fid); +static void print_user_block(const char *filename, hid_t fid); #endif static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata); /* get the major number from the error stack. */ -static herr_t walk_error_callback(UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) -{ - if (err_desc) - *((int *)udata) = err_desc->maj_num; - - return 0; +static herr_t walk_error_callback(UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) { + if (err_desc) + *((int *) udata) = err_desc->maj_num; + + return 0; } /*------------------------------------------------------------------------- -* Function: copy_objects -* -* Purpose: duplicate all HDF5 objects in the file -* -* Return: 0, ok, -1 no -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: October, 23, 2003 -* -* Modification: -* Peter Cao, June 13, 2007 -* Add "-L, --latest" and other options to pack a file with the latest file format -* -* Peter Cao, September 25, 2007 -* Copy user block when repacking a file -* -* Pedro Vicente, August 20, 2008 -* Add a user block to file if requested -* -*------------------------------------------------------------------------- -*/ - -int copy_objects(const char* fnamein, - const char* fnameout, - pack_opt_t *options) -{ - hid_t fidin; - hid_t fidout = -1; - trav_table_t *travt = NULL; - hsize_t ub_size = 0; /* size of user block */ - hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ - hid_t fapl = H5P_DEFAULT; /* file access property list ID */ - - /*------------------------------------------------------------------------- - * open input file - *------------------------------------------------------------------------- - */ - if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) - { - error_msg("<%s>: %s\n", fnamein, H5FOPENERROR ); - goto out; - } - - /* get user block size and file space strategy/threshold */ - { - hid_t fcpl_in; /* file creation property list ID for input file */ - - if((fcpl_in = H5Fget_create_plist(fidin)) < 0) - { - error_msg("failed to retrieve file creation property list\n"); - goto out; - } - - if(H5Pget_userblock(fcpl_in, &ub_size) < 0) - { - error_msg("failed to retrieve userblock size\n"); - goto out; - } - - if(!options->fs_strategy) - { - if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) - { - error_msg("failed to retrieve file space strategy\n"); - goto out; - } - } - - if(!options->fs_threshold) - { - if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) - { - error_msg("failed to retrieve file space threshold\n"); - goto out; - } - } - - if(H5Pclose(fcpl_in) < 0) - { - error_msg("failed to close property list\n"); - goto out; - } - } - - /* Check if we need to create a non-default file creation property list */ - if(options->latest || ub_size > 0) - { - /* Create file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { - error_msg("fail to create a file creation property list\n"); - goto out; - } - - if(ub_size > 0) - { - if(H5Pset_userblock(fcpl, ub_size) < 0) - { - error_msg("failed to set non-default userblock size\n"); - goto out; - } - } - - if(options->latest) - { - unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; - - /* 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) - { - error_msg("fail to adjust group creation parameters for root group\n"); - goto out; - } - - for(i = 0; i < 5; i++) - { - if(options->msg_size[i] > 0) - { - switch(i) - { - case 0: - mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG; - break; - - case 1: - mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG; - break; - - case 2: - mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG; - break; - - case 3: - mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG; - break; - - case 4: - mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG; - break; - default: - break; - } /* end switch */ - min_mesg_sizes[nindex] = (unsigned)options->msg_size[i]; - - nindex++; - } /* end if */ - } /* end for */ - - if(nindex > 0) - { - if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) - { - error_msg("fail to set the number of shared object header message indexes\n"); - goto out; - } - - /* 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) { - error_msg("fail to configure the specified shared object header message index\n"); - goto out; - } /* end if */ - } /* end for */ - } /* if (nindex>0) */ - - /* Create file access property list */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - { - error_msg("Could not create file access property list\n"); - goto out; - } /* end if */ - - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - { - error_msg("Could not set property for using latest version of the format\n"); - goto out; - } /* end if */ - } /* end if */ - } /* end if */ + * Function: copy_objects + * + * Purpose: duplicate all HDF5 objects in the file + * + * Return: 0, ok, -1 no + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: October, 23, 2003 + * + * Modification: + * Peter Cao, June 13, 2007 + * Add "-L, --latest" and other options to pack a file with the latest file format + * + * Peter Cao, September 25, 2007 + * Copy user block when repacking a file + * + * Pedro Vicente, August 20, 2008 + * Add a user block to file if requested + * + *------------------------------------------------------------------------- + */ + +int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) { + hid_t fidin; + hid_t fidout = -1; + trav_table_t *travt = NULL; + hsize_t ub_size = 0; /* size of user block */ + hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ + hid_t fapl = H5P_DEFAULT; /* file access property list ID */ + + /*------------------------------------------------------------------------- + * open input file + *------------------------------------------------------------------------- + */ + if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, + (size_t) 0)) < 0) { + error_msg("<%s>: %s\n", fnamein, H5FOPENERROR); + goto out; + } + + /* get user block size and file space strategy/threshold */ + { + hid_t fcpl_in; /* file creation property list ID for input file */ + + if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) { + error_msg("failed to retrieve file creation property list\n"); + goto out; + } + + if (H5Pget_userblock(fcpl_in, &ub_size) < 0) { + error_msg("failed to retrieve userblock size\n"); + goto out; + } + + if (!options->fs_strategy) { + if (H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) { + error_msg("failed to retrieve file space strategy\n"); + goto out; + } + } + + if (!options->fs_threshold) { + if (H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) { + error_msg("failed to retrieve file space threshold\n"); + goto out; + } + } + + if (H5Pclose(fcpl_in) < 0) { + error_msg("failed to close property list\n"); + goto out; + } + } + + /* Check if we need to create a non-default file creation property list */ + if (options->latest || ub_size > 0) { + /* Create file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + error_msg("fail to create a file creation property list\n"); + goto out; + } + + if (ub_size > 0) { + if (H5Pset_userblock(fcpl, ub_size) < 0) { + error_msg("failed to set non-default userblock size\n"); + goto out; + } + } + + if (options->latest) { + unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; + + /* 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) { + error_msg( + "fail to adjust group creation parameters for root group\n"); + goto out; + } + + for (i = 0; i < 5; i++) { + if (options->msg_size[i] > 0) { + switch (i) { + case 0: + mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG; + break; + + case 1: + mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG; + break; + + case 2: + mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG; + break; + + case 3: + mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG; + break; + + case 4: + mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG; + break; + default: + break; + } /* end switch */ + min_mesg_sizes[nindex] = (unsigned) options->msg_size[i]; + + nindex++; + } /* end if */ + } /* end for */ + + if (nindex > 0) { + if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) { + error_msg( + "fail to set the number of shared object header message indexes\n"); + goto out; + } + + /* 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) { + error_msg( + "fail to configure the specified shared object header message index\n"); + goto out; + } /* end if */ + } /* end for */ + } /* if (nindex>0) */ + + /* Create file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + error_msg("Could not create file access property list\n"); + goto out; + } /* end if */ + + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { + error_msg( + "Could not set property for using latest version of the format\n"); + goto out; + } /* end if */ + } /* end if */ + } /* end if */ #if defined (H5REPACK_DEBUG_USER_BLOCK) - print_user_block(fnamein, fidin); + print_user_block(fnamein, fidin); #endif - /*------------------------------------------------------------------------- - * set the new user userblock options in the FCPL (before H5Fcreate ) - *------------------------------------------------------------------------- - */ - if ( options->ublock_size > 0 ) - { - /* either use the FCPL already created or create a new one */ - if(fcpl == H5P_DEFAULT) - { - /* create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { - error_msg("fail to create a file creation property list\n"); - goto out; - } - } - - /* set user block size */ - if(H5Pset_userblock(fcpl, options->ublock_size) < 0) - { - error_msg("failed to set userblock size\n"); - goto out; - } - } - - /*------------------------------------------------------------------------- - * set alignment options - *------------------------------------------------------------------------- - */ - if ( options->alignment > 0 ) - { - /* either use the FAPL already created or create a new one */ - if (fapl == H5P_DEFAULT) - { - /* create a file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - { - error_msg("Could not create file access property list\n"); - goto out; - } - } - - if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) - { - error_msg("failed to set alignment\n"); - goto out; - } - } - - /*------------------------------------------------------------------------- - * set metadata block size option - *------------------------------------------------------------------------- - */ - if ( options->meta_block_size > 0 ) - { - /* either use the FAPL already created or create a new one */ - if (fapl == H5P_DEFAULT) - { - /* create a file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - { - error_msg("Could not create file access property list\n"); - goto out; - } - } - - if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) - { - error_msg("failed to set metadata block size\n"); - goto out; - } - } - - /*------------------------------------------------------------------------- - * set free-space strategy options - *------------------------------------------------------------------------- - */ - - /* either use the FCPL already created or create a new one */ - if(fcpl == H5P_DEFAULT) - { - /* create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { - error_msg("fail to create a file creation property list\n"); - goto out; - } - } - - /* set file space strategy and free space threshold */ - if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) - { - error_msg("failed to set file space strategy & threshold \n"); - goto out; - } - - /*------------------------------------------------------------------------- - * create the output file - *------------------------------------------------------------------------- - */ - if(options->verbose) - printf("Making file <%s>...\n",fnameout); - - if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) - { - error_msg("<%s>: Could not create file\n", fnameout ); - goto out; - } - - - /*------------------------------------------------------------------------- - * write a new user block if requested - *------------------------------------------------------------------------- - */ - if ( options->ublock_size > 0 ) - { - if ( copy_user_block( options->ublock_filename, fnameout, options->ublock_size) < 0 ) - { - error_msg("Could not copy user block. Exiting...\n"); - goto out; - - } - } - - /*------------------------------------------------------------------------- - * get list of objects - *------------------------------------------------------------------------- - */ - - /* init table */ - trav_table_init(&travt); - - /* get the list of objects in the file */ - if(h5trav_gettable(fidin, travt) < 0) - goto out; - - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - if(do_copy_objects(fidin, fidout, travt, options) < 0) - { - error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout); - goto out; - } /* end if */ - - /*------------------------------------------------------------------------- - * do the copy of referenced objects - * and create hard links - *------------------------------------------------------------------------- - */ - if ( do_copy_refobjs(fidin, fidout, travt, options) < 0 ) - { - printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout); - goto out; - } - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if(fapl > 0) - H5Pclose(fapl); - - if(fcpl > 0) - H5Pclose(fcpl); - - H5Fclose(fidin); - H5Fclose(fidout); - - /* free table */ - trav_table_free(travt); - travt = NULL; - - /*------------------------------------------------------------------------- - * write only the input file user block if there is no user block file input - *------------------------------------------------------------------------- - */ - - if( ub_size > 0 && options->ublock_size == 0 ) - { - if ( copy_user_block(fnamein, fnameout, ub_size) < 0 ) - { - error_msg("Could not copy user block. Exiting...\n"); - goto out; - - } - } - - return 0; - - /*------------------------------------------------------------------------- - * out - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * set the new user userblock options in the FCPL (before H5Fcreate ) + *------------------------------------------------------------------------- + */ + if (options->ublock_size > 0) { + /* either use the FCPL already created or create a new one */ + if (fcpl == H5P_DEFAULT) { + /* create a file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + error_msg("fail to create a file creation property list\n"); + goto out; + } + } + + /* set user block size */ + if (H5Pset_userblock(fcpl, options->ublock_size) < 0) { + error_msg("failed to set userblock size\n"); + goto out; + } + } + + /*------------------------------------------------------------------------- + * set alignment options + *------------------------------------------------------------------------- + */ + if (options->alignment > 0) { + /* either use the FAPL already created or create a new one */ + if (fapl == H5P_DEFAULT) { + /* create a file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + error_msg("Could not create file access property list\n"); + goto out; + } + } + + if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { + error_msg("failed to set alignment\n"); + goto out; + } + } + + /*------------------------------------------------------------------------- + * set metadata block size option + *------------------------------------------------------------------------- + */ + if (options->meta_block_size > 0) { + /* either use the FAPL already created or create a new one */ + if (fapl == H5P_DEFAULT) { + /* create a file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + error_msg("Could not create file access property list\n"); + goto out; + } + } + + if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) { + error_msg("failed to set metadata block size\n"); + goto out; + } + } + + /*------------------------------------------------------------------------- + * set free-space strategy options + *------------------------------------------------------------------------- + */ + + /* either use the FCPL already created or create a new one */ + if (fcpl == H5P_DEFAULT) { + /* create a file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + error_msg("fail to create a file creation property list\n"); + goto out; + } + } + + /* set file space strategy and free space threshold */ + if (H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) { + error_msg("failed to set file space strategy & threshold \n"); + goto out; + } + + /*------------------------------------------------------------------------- + * create the output file + *------------------------------------------------------------------------- + */ + if (options->verbose) + printf("Making file <%s>...\n", fnameout); + + if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { + error_msg("<%s>: Could not create file\n", fnameout); + goto out; + } + + /*------------------------------------------------------------------------- + * write a new user block if requested + *------------------------------------------------------------------------- + */ + if (options->ublock_size > 0) { + if (copy_user_block(options->ublock_filename, fnameout, + options->ublock_size) < 0) { + error_msg("Could not copy user block. Exiting...\n"); + goto out; + + } + } + + /*------------------------------------------------------------------------- + * get list of objects + *------------------------------------------------------------------------- + */ + + /* init table */ + trav_table_init(&travt); + + /* get the list of objects in the file */ + if (h5trav_gettable(fidin, travt) < 0) + goto out; + + /*------------------------------------------------------------------------- + * do the copy + *------------------------------------------------------------------------- + */ + if (do_copy_objects(fidin, fidout, travt, options) < 0) { + error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout); + goto out; + } /* end if */ + + /*------------------------------------------------------------------------- + * do the copy of referenced objects + * and create hard links + *------------------------------------------------------------------------- + */ + if (do_copy_refobjs(fidin, fidout, travt, options) < 0) { + printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, + fnameout); + goto out; + } + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + if (fapl > 0) + H5Pclose(fapl); + + if (fcpl > 0) + H5Pclose(fcpl); + + H5Fclose(fidin); + H5Fclose(fidout); + + /* free table */ + trav_table_free(travt); + travt = NULL; + + /*------------------------------------------------------------------------- + * write only the input file user block if there is no user block file input + *------------------------------------------------------------------------- + */ + + if (ub_size > 0 && options->ublock_size == 0) { + if (copy_user_block(fnamein, fnameout, ub_size) < 0) { + error_msg("Could not copy user block. Exiting...\n"); + goto out; + + } + } + + return 0; + + /*------------------------------------------------------------------------- + * out + *------------------------------------------------------------------------- + */ out: - H5E_BEGIN_TRY - { - H5Pclose(fapl); - H5Pclose(fcpl); - H5Fclose(fidin); - H5Fclose(fidout); - } H5E_END_TRY; - if(travt) - trav_table_free(travt); - - return -1; + H5E_BEGIN_TRY + { + H5Pclose(fapl); + H5Pclose(fcpl); + H5Fclose(fidin); + H5Fclose(fidout); + }H5E_END_TRY; + if (travt) + trav_table_free(travt); + + return -1; } /*------------------------------------------------------------------------- -* Function: Get_hyperslab -* -* Purpose: Calulate a hyperslab from a dataset for higher performance. -* The size of hyperslab is limitted by H5TOOLS_BUFSIZE. -* Return the hyperslab dimentions and size in byte. -* -* Return: 0 - SUCCEED, -1 FAILED -* -* Parameters: -* dcpl_id : [IN] dataset creation property. -* rank_dset : [IN] dataset rank -* dims_dset[] : [IN] dataset dimentions -* size_datum : [IN] size of a data element in byte -* dims_hslab[] : [OUT] calculated hyperslab dimentions -* * hslab_nbytes_p : [OUT] total byte of the hyperslab -* -* Programmer: Jonathan Kim -* Date: Feburary, 2012 -* Update: -* The hyperslab calucation would be depend on if the dataset is chunked -* or not. -* -* There care 3 conditions to cover: -* 1. If chunked and a chunk fits in buffer, each chunk would be a unit of -* collection and the boundary would be dataset's dims. -* 2. If chunked but a chunk doesn't fit in buffer, each data element would -* be a unit of collection and the boundary would be the chunk itself. -* 3. If not chunked, each data element would be a unit of collection and -* the boundary would be dataset's dims. -* -* The calulation starts from the last dimention (h5dump dims output). -* -* Note: -* Added for JIRA HDFFV-7862. -*-----------------------------------------*/ - -int Get_hyperslab (hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], - size_t size_datum, - hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) -{ - int status = 0; - int k; - H5D_layout_t dset_layout; - int rank_chunk; - hsize_t dims_chunk[H5S_MAX_RANK]; - hsize_t size_chunk=1; - hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ - hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ - hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */ - hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */ - hsize_t hslab_nbytes; /* size of hyperslab in byte */ - - /* init to set as size of a data element */ - hslab_nbytes = size_datum; - - /* get layout of dataset */ - dset_layout = H5Pget_layout(dcpl_id); - - /* if dataset is chunked */ - if ( dset_layout == H5D_CHUNKED ) - { - /* get chunk dims */ - rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); - if (rank_chunk < 0) - { - status = -1; - goto out; - } - - for (k = rank_dset; k > 0; --k) - size_chunk *= dims_chunk[k-1]; - - /* figure out how many chunks can fit in the hyperslab buffer */ - nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk; - - - /* 1. if a chunk fit in hyperslab buffer */ - if (nchunk_fit >= 1) - { - /* Calulate a hyperslab that contains as many chunks that can fit - * in hyperslab buffer. Hyperslab will be increased starting from - * the last dimention of the dataset (see h5dump's dims output). - * The calculation boundary is dataset dims. - * In the loop, used mapping from a datum to a chunk to figure out - * chunk based hyperslab. - */ - for (k = rank_dset; k > 0; --k) - { - /* map dataset dimentions with a chunk dims */ - chunk_dims_map[k-1]= dims_dset[k-1] / dims_chunk[k-1]; - - /* if reminder exist, increse by 1 to cover partial edge chunks */ - if (dims_dset[k-1] % dims_chunk[k-1] > 0) - chunk_dims_map[k-1]++; - - /* get mapped hyperslab dims */ - hs_dims_map[k-1] = MIN (nchunk_fit, chunk_dims_map[k-1]); - - /* prepare next round */ - nchunk_fit = nchunk_fit / chunk_dims_map[k-1]; - /* if a chunk is bigger than the rest of buffer */ - if (nchunk_fit == 0) - nchunk_fit=1; - - /* get hyperslab dimentions as unmapping to actual size */ - dims_hslab[k-1] = MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k-1]; - } - } - /* 2. if a chunk is bigger than hyperslab buffer */ - else - { - /* Calulate a hyperslab that contains as many data elements that - * can fit in hyperslab buffer. Hyperslab will be increased - * starting from the last dimention of the chunk (see h5dump's dims - * output). - * The calculation boundary is a chunk dims. - */ - for (k = rank_dset; k > 0; --k) - { - ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; - - /* if a datum is bigger than rest of buffer */ - if ( ndatum_fit == 0) - ndatum_fit = 1; - /* get hyperslab dimentions within a chunk boundary */ - dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k - 1]; - - if (hslab_nbytes <= 0) - { - status = -1; - goto out; - } - } - } - } - /* 3. if dataset is not chunked */ - else - { - /* Calulate a hyperslab that contains as many data elements that can - * fit in hyperslab buffer. Hyperslab will be increased starting from - * the last dimention of the dataset (see h5dump's dims output). - * The calculation boundary is dataset dims. - */ - for (k = rank_dset; k > 0; --k) - { - ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; - - /* if a datum is bigger than rest of buffer */ - if ( ndatum_fit == 0) - ndatum_fit = 1; - /* get hyperslab dimentions within dataset boundary */ - dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k - 1]; - - if (hslab_nbytes <= 0) - { - status = -1; - goto out; - } - } - } - - /* pass out the hyperslab size*/ - *hslab_nbytes_p = hslab_nbytes; + * Function: Get_hyperslab + * + * Purpose: Calulate a hyperslab from a dataset for higher performance. + * The size of hyperslab is limitted by H5TOOLS_BUFSIZE. + * Return the hyperslab dimentions and size in byte. + * + * Return: 0 - SUCCEED, -1 FAILED + * + * Parameters: + * dcpl_id : [IN] dataset creation property. + * rank_dset : [IN] dataset rank + * dims_dset[] : [IN] dataset dimentions + * size_datum : [IN] size of a data element in byte + * dims_hslab[] : [OUT] calculated hyperslab dimentions + * * hslab_nbytes_p : [OUT] total byte of the hyperslab + * + * Programmer: Jonathan Kim + * Date: Feburary, 2012 + * Update: + * The hyperslab calucation would be depend on if the dataset is chunked + * or not. + * + * There care 3 conditions to cover: + * 1. If chunked and a chunk fits in buffer, each chunk would be a unit of + * collection and the boundary would be dataset's dims. + * 2. If chunked but a chunk doesn't fit in buffer, each data element would + * be a unit of collection and the boundary would be the chunk itself. + * 3. If not chunked, each data element would be a unit of collection and + * the boundary would be dataset's dims. + * + * The calulation starts from the last dimention (h5dump dims output). + * + * Note: + * Added for JIRA HDFFV-7862. + *-----------------------------------------*/ + +int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], + size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) { + int status = 0; + int k; + H5D_layout_t dset_layout; + int rank_chunk; + hsize_t dims_chunk[H5S_MAX_RANK]; + hsize_t size_chunk = 1; + hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ + hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ + hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */ + hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */ + hsize_t hslab_nbytes; /* size of hyperslab in byte */ + + /* init to set as size of a data element */ + hslab_nbytes = size_datum; + + /* get layout of dataset */ + dset_layout = H5Pget_layout(dcpl_id); + + /* if dataset is chunked */ + if (dset_layout == H5D_CHUNKED) { + /* get chunk dims */ + rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); + if (rank_chunk < 0) { + status = -1; + goto out; + } + + for (k = rank_dset; k > 0; --k) + size_chunk *= dims_chunk[k - 1]; + + /* figure out how many chunks can fit in the hyperslab buffer */ + nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk; + + /* 1. if a chunk fit in hyperslab buffer */ + if (nchunk_fit >= 1) { + /* Calulate a hyperslab that contains as many chunks that can fit + * in hyperslab buffer. Hyperslab will be increased starting from + * the last dimention of the dataset (see h5dump's dims output). + * The calculation boundary is dataset dims. + * In the loop, used mapping from a datum to a chunk to figure out + * chunk based hyperslab. + */ + for (k = rank_dset; k > 0; --k) { + /* map dataset dimentions with a chunk dims */ + chunk_dims_map[k - 1] = dims_dset[k - 1] / dims_chunk[k - 1]; + + /* if reminder exist, increse by 1 to cover partial edge chunks */ + if (dims_dset[k - 1] % dims_chunk[k - 1] > 0) + chunk_dims_map[k - 1]++; + + /* get mapped hyperslab dims */ + hs_dims_map[k - 1] = MIN (nchunk_fit, chunk_dims_map[k-1]); + + /* prepare next round */ + nchunk_fit = nchunk_fit / chunk_dims_map[k - 1]; + /* if a chunk is bigger than the rest of buffer */ + if (nchunk_fit == 0) + nchunk_fit = 1; + + /* get hyperslab dimentions as unmapping to actual size */ + dims_hslab[k - 1] = + MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + } + } + /* 2. if a chunk is bigger than hyperslab buffer */ + else { + /* Calulate a hyperslab that contains as many data elements that + * can fit in hyperslab buffer. Hyperslab will be increased + * starting from the last dimention of the chunk (see h5dump's dims + * output). + * The calculation boundary is a chunk dims. + */ + for (k = rank_dset; k > 0; --k) { + ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; + + /* if a datum is bigger than rest of buffer */ + if (ndatum_fit == 0) + ndatum_fit = 1; + /* get hyperslab dimentions within a chunk boundary */ + dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + + if (hslab_nbytes <= 0) { + status = -1; + goto out; + } + } + } + } + /* 3. if dataset is not chunked */ + else { + /* Calulate a hyperslab that contains as many data elements that can + * fit in hyperslab buffer. Hyperslab will be increased starting from + * the last dimention of the dataset (see h5dump's dims output). + * The calculation boundary is dataset dims. + */ + for (k = rank_dset; k > 0; --k) { + ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; + + /* if a datum is bigger than rest of buffer */ + if (ndatum_fit == 0) + ndatum_fit = 1; + /* get hyperslab dimentions within dataset boundary */ + dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + + if (hslab_nbytes <= 0) { + status = -1; + goto out; + } + } + } + + /* pass out the hyperslab size*/ + *hslab_nbytes_p = hslab_nbytes; out: - return status; + return status; } /*------------------------------------------------------------------------- -* Function: do_copy_objects -* -* Purpose: duplicate all HDF5 objects in the file -* -* Return: 0, ok, -1 no -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: October, 23, 2003 -* -* Modifications: -* -* July 2004: Introduced the extra EC or NN option for SZIP -* -* December 2004: Added a check for H5Dcreate; if the dataset cannot be created -* with the requested filter, use the input one -* -* October 2006: Read/write using the file type by default. -* -* October 2006: Read by hyperslabs for big datasets. -* -* A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done -* i.e., if the memory needed to read a dataset is greater than this limit, -* then hyperslab I/O is done instead of one operation I/O -* For each dataset, the memory needed is calculated according to -* -* memory needed = number of elements * size of each element -* -* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations -* are done -* -* H5Dread( input_dataset1 ) -* H5Dread( input_dataset2 ) -* -* with all elements in the datasets selected. If the memory needed is greater than -* H5TOOLS_MALLOCSIZE, then the following operations are done instead: -* -* a strip mine is defined for each dimension k (a strip mine is defined as a -* hyperslab whose size is memory manageable) according to the formula -* -* (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) -* -* where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures -* that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip -* mine size k is simply defined as its dimension k, but for larger datasets the -* hyperslab size is still memory manageable. -* a cycle is done until the number of elements in the dataset is reached. In each -* iteration, two parameters are defined for the function H5Sselect_hyperslab, -* the start and size of each hyperslab, according to -* -* (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) -* -* where hyperslab_offset [k] is initially set to zero, and later incremented in -* hyperslab_size[k] offsets. The reason for the operation -* -* dimension[k] - hyperslab_offset[k] -* -* in (2) is that, when using the strip mine size, it assures that the "remaining" part -* of the dataset that does not fill an entire strip mine is processed. -* -* November 2006: Use H5Ocopy in the copy of objects. The logic for using -* H5Ocopy or not is if a change of filters or layout is requested by the user -* then use read/write else use H5Ocopy. -* -* May, 1, 2008: Add a printing of the compression ratio of old size / new size -* -* Feburary 2012: improve Read/Write by hyperslabs for big datasets. -* Programmer: Jonathan Kim -* -* A threshold of H5TOOLS_MALLOCSIZE is the limit upon which I/O hyperslab is done -* i.e., if the memory needed to read a dataset is greater than this limit, -* then hyperslab I/O is done instead of one operation I/O -* For each dataset, the memory needed is calculated according to -* -* memory needed = number of elements * size of each element -* -* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations -* are done -* -* H5Dread( input_dataset ) -* H5Dwrite( output_dataset ) -* -* with all elements in the datasets selected. If the memory needed is greater than -* H5TOOLS_MALLOCSIZE, then the following operations are done instead: -* -* 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()). -* 2. Calculate the hyperslab selections as the selection is moving forward. -* Selection would be same as the hyperslab except for the remaining edge portion -* of the dataset. The code take care of the remaining portion if exist. -* -*------------------------------------------------------------------------- -*/ - -int do_copy_objects(hid_t fidin, - hid_t fidout, - trav_table_t *travt, - pack_opt_t *options) /* repack options */ + * Function: do_copy_objects + * + * Purpose: duplicate all HDF5 objects in the file + * + * Return: 0, ok, -1 no + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: October, 23, 2003 + * + * Modifications: + * + * July 2004: Introduced the extra EC or NN option for SZIP + * + * December 2004: Added a check for H5Dcreate; if the dataset cannot be created + * with the requested filter, use the input one + * + * October 2006: Read/write using the file type by default. + * + * October 2006: Read by hyperslabs for big datasets. + * + * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done + * i.e., if the memory needed to read a dataset is greater than this limit, + * then hyperslab I/O is done instead of one operation I/O + * For each dataset, the memory needed is calculated according to + * + * memory needed = number of elements * size of each element + * + * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations + * are done + * + * H5Dread( input_dataset1 ) + * H5Dread( input_dataset2 ) + * + * with all elements in the datasets selected. If the memory needed is greater than + * H5TOOLS_MALLOCSIZE, then the following operations are done instead: + * + * a strip mine is defined for each dimension k (a strip mine is defined as a + * hyperslab whose size is memory manageable) according to the formula + * + * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) + * + * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures + * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip + * mine size k is simply defined as its dimension k, but for larger datasets the + * hyperslab size is still memory manageable. + * a cycle is done until the number of elements in the dataset is reached. In each + * iteration, two parameters are defined for the function H5Sselect_hyperslab, + * the start and size of each hyperslab, according to + * + * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) + * + * where hyperslab_offset [k] is initially set to zero, and later incremented in + * hyperslab_size[k] offsets. The reason for the operation + * + * dimension[k] - hyperslab_offset[k] + * + * in (2) is that, when using the strip mine size, it assures that the "remaining" part + * of the dataset that does not fill an entire strip mine is processed. + * + * November 2006: Use H5Ocopy in the copy of objects. The logic for using + * H5Ocopy or not is if a change of filters or layout is requested by the user + * then use read/write else use H5Ocopy. + * + * May, 1, 2008: Add a printing of the compression ratio of old size / new size + * + * Feburary 2012: improve Read/Write by hyperslabs for big datasets. + * Programmer: Jonathan Kim + * + * A threshold of H5TOOLS_MALLOCSIZE is the limit upon which I/O hyperslab is done + * i.e., if the memory needed to read a dataset is greater than this limit, + * then hyperslab I/O is done instead of one operation I/O + * For each dataset, the memory needed is calculated according to + * + * memory needed = number of elements * size of each element + * + * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations + * are done + * + * H5Dread( input_dataset ) + * H5Dwrite( output_dataset ) + * + * with all elements in the datasets selected. If the memory needed is greater than + * H5TOOLS_MALLOCSIZE, then the following operations are done instead: + * + * 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()). + * 2. Calculate the hyperslab selections as the selection is moving forward. + * Selection would be same as the hyperslab except for the remaining edge portion + * of the dataset. The code take care of the remaining portion if exist. + * + *------------------------------------------------------------------------- + */ + +int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, + pack_opt_t *options) /* repack options */ { - hid_t grp_in = -1; /* group ID */ - hid_t grp_out = -1; /* group ID */ - hid_t dset_in = -1; /* read dataset ID */ - hid_t dset_out = -1; /* write dataset ID */ - hid_t gcpl_in = -1; /* group creation property list */ - hid_t gcpl_out = -1; /* group creation property list */ - hid_t type_in = -1; /* named type ID */ - hid_t type_out = -1; /* named type ID */ - hid_t dcpl_in = -1; /* dataset creation property list ID */ - hid_t dcpl_out = -1; /* dataset creation property list ID */ - hid_t f_space_id = -1; /* file space ID */ - hid_t ftype_id = -1; /* file type ID */ - hid_t wtype_id = -1; /* read/write type ID */ - 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 */ - unsigned i; - unsigned u; - int is_ref=0; - htri_t is_named; - hbool_t limit_maxdims; - hsize_t size_dset; - - - /*------------------------------------------------------------------------- - * copy the suppplied object list - *------------------------------------------------------------------------- - */ - - if (options->verbose) - { - printf("-----------------------------------------\n"); - printf(" Type Filter (Compression) Name\n"); - printf("-----------------------------------------\n"); - } - - for ( i = 0; i < travt->nobjs; i++) - { - /* init variables per obj */ - buf = NULL; - limit_maxdims = FALSE; - - switch ( travt->objs[i].type ) - { - - case H5TRAV_TYPE_UNKNOWN: - HDassert(0); - break; - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_GROUP - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_GROUP: - - if (options->verbose) - { - printf(FORMAT_OBJ,"group",travt->objs[i].name ); - } - - /* open input group */ - if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - - /* get input group creation property list */ - if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) - goto error; - - /* query and set the group creation properties */ - if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) - goto error; - - /* set up group creation property list */ - if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0) - goto error; - - if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0) - goto error; - - - /*------------------------------------------------------------------------- - * 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) - goto error; - } - - 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) - goto error; - } - - if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) - goto error; - - } - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if(copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0) - goto error; - - - if(H5Pclose(gcpl_out) < 0) - goto error; - if(H5Pclose(gcpl_in) < 0) - goto error; - if(H5Gclose(grp_out) < 0) - goto error; - if(H5Gclose(grp_in) < 0) - goto error; - - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_DATASET - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_DATASET: - - 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 */ - for (u = 0; u < options->op_tbl->nelems; u++) { - - if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) { - if (options->op_tbl->objs[u].filter->filtn > 0) { - req_filter = 1; - } - } - } - - /* 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) - goto error; - if((ftype_id = H5Dget_type(dset_in)) < 0) - goto error; - if(H5T_REFERENCE == H5Tget_class(ftype_id)) - is_ref = 1; - - /* Check if the datatype is committed */ - if((is_named = H5Tcommitted(ftype_id)) < 0) - goto error; - if(is_named) - if((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0) - goto error; - - if(H5Tclose(ftype_id) < 0) - goto error; - if(H5Dclose(dset_in) < 0) - goto error; - - - /*------------------------------------------------------------------------- - * 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 ( options->op_tbl->nelems || - options->all_filter == 1 || - options->all_layout == 1 || - is_ref || - is_named) - { - - int j; - - if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - if((f_space_id = H5Dget_space(dset_in)) < 0) - goto error; - if((ftype_id = H5Dget_type(dset_in)) < 0) - goto error; - if((dcpl_in = H5Dget_create_plist(dset_in)) < 0) - goto error; - if((dcpl_out = H5Pcopy(dcpl_in)) < 0) - goto error; - if((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) - goto error; - HDmemset(dims, 0, sizeof dims); - if(H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) - goto error; - - if(H5Dget_space_status(dset_in, &space_status) < 0) - goto error; - - nelmts = 1; - for(j = 0; j < rank; j++) - nelmts *= dims[j]; - - /* wtype_id will have already been set if using a named dtype */ - if(!is_named) { - if(options->use_native == 1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - } /* end if */ - - if((msize = H5Tget_size(wtype_id)) == 0) - goto error; - - /* size of current dset */ - size_dset = nelmts * msize; - - /*------------------------------------------------------------------------- - * 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; - - /*------------------------------------------------------------------------- - * 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 (H5T_REFERENCE!=H5Tget_class(wtype_id)) - { - /* get the storage size of the input dataset */ - dsize_in=H5Dget_storage_size(dset_in); - - /* 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) - goto error; - } - - /* 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 convert to COMPACT */ - if (options->layout_g == H5D_COMPACT) - { - /* should be smaller than 64K */ - 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 ); - } - - /*------------------------------------------------------------------------- - * 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 - *------------------------------------------------------------------------- - */ - H5E_BEGIN_TRY { - dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); - } H5E_END_TRY; - - if(dset_out == FAIL) - { - if(options->verbose) - printf(" warning: could not create dataset <%s>. Applying original settings\n", - travt->objs[i].name); - - if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) - goto error; - apply_f = 0; - } - - /*------------------------------------------------------------------------- - * 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); - - if(buf != NULL) { - /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - CHECK_H5DRW_ERROR(H5Dwrite, dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - - /* 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) - goto error; - } - 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 = -1; /* dataset creation property list ID */ - - /* check if we have VL data in the dataset's datatype */ - if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) - vl_data = TRUE; - - - /* check first if writing dataset is chunked, - * if so use its chunk layout for better performance. */ - dset_layout = H5Pget_layout(dcpl_out); - if (dset_layout == H5D_CHUNKED) - dcpl_tmp = dcpl_out; /* writing dataset */ - else /* if reading dataset is chunked */ - { - dset_layout = H5Pget_layout(dcpl_in); - if (dset_layout == H5D_CHUNKED) - dcpl_tmp = dcpl_in; /* reading dataset */ - } - - /* get hyperslab dims and size in byte */ - if(Get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) - goto error; - - hslab_buf = HDmalloc((size_t)hslab_nbytes); - - hslab_nelmts = hslab_nbytes / p_type_nbytes; - hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL); - - /* the 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) - goto error; - if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0) - goto error; - } - else - { - H5Sselect_all(f_space_id); - H5Sselect_all(hslab_space); - hs_select_nelmts = 1; - } /* rank */ - - /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); - CHECK_H5DRW_ERROR(H5Dwrite, dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); - - /* reclaim any VL memory, if necessary */ - if(vl_data) - H5Dvlen_reclaim(wtype_id, 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; - } /* k */ - } /* elmtno */ - - H5Sclose(hslab_space); - /* free */ - if (hslab_buf!=NULL) - { - HDfree(hslab_buf); - hslab_buf=NULL; - } - } /* hyperslab read */ - } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */ - - /*------------------------------------------------------------------------- - * 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 ) - printf(" \n", - travt->objs[i].name, - (int)options->min_comp); - - if ( has_filter && apply_f == 0 ) - printf(" \n", - travt->objs[i].name); - - } /* verbose */ - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - goto error; - /*close */ - if (H5Dclose(dset_out) < 0) - goto error; - - }/*!H5T_REFERENCE*/ - }/*h5tools_canreadf*/ - - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if (H5Tclose(ftype_id) < 0) - goto error; - if (H5Tclose(wtype_id) < 0) - goto error; - if (H5Pclose(dcpl_in) < 0) - goto error; - if (H5Pclose(dcpl_out) < 0) - goto error; - if (H5Sclose(f_space_id) < 0) - goto error; - if (H5Dclose(dset_in) < 0) - goto error; - - } - /*------------------------------------------------------------------------- - * we do not have request for filter/chunking use H5Ocopy instead - *------------------------------------------------------------------------- - */ - else - { - hid_t pid; - - /* create property to pass copy options */ - if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) - goto error; - - /* set options for object copy */ - if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) - goto error; - - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - - 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 */ - pid, /* Properties which apply to the copy */ - H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ - goto error; - - /* close property */ - if(H5Pclose(pid) < 0) - goto error; - - - /*------------------------------------------------------------------------- - * copy attrs manually - *------------------------------------------------------------------------- - */ - if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - goto error; - if(H5Dclose(dset_in) < 0) - goto error; - if(H5Dclose(dset_out) < 0) - goto error; - - - if (options->verbose) - printf(FORMAT_OBJ,"dset",travt->objs[i].name ); - - - } /* end do we have request for filter/chunking */ - - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_NAMED_DATATYPE - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_NAMED_DATATYPE: - - if(options->verbose) - printf(FORMAT_OBJ, "type", travt->objs[i].name); - - if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - - /* Copy the datatype anonymously */ - if((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, - travt, options)) < 0) - goto error; - - /* Link in to group structure */ - if(H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, - H5P_DEFAULT, H5P_DEFAULT) < 0) - goto error; - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if(copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0) - goto error; - - if(H5Tclose(type_in) < 0) - goto error; - if(H5Tclose(type_out) < 0) - goto error; - - - - break; - - - /*------------------------------------------------------------------------- - * 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) - printf(FORMAT_OBJ, "link", travt->objs[i].name); - - if(H5Lcopy(fidin, travt->objs[i].name,fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto error; - - if (options->verbose) - printf(FORMAT_OBJ,"link",travt->objs[i].name ); - - } - break; - - default: - goto error; - } /* switch */ - - /* free */ - if (buf!=NULL) - { - HDfree(buf); - buf=NULL; - } - - } /* i */ - - /* Finalize (link) the stack of named datatypes (if any) */ - named_datatype_free(&named_dt_head, 0); - - return 0; + hid_t grp_in = -1; /* group ID */ + hid_t grp_out = -1; /* group ID */ + hid_t dset_in = -1; /* read dataset ID */ + hid_t dset_out = -1; /* write dataset ID */ + hid_t gcpl_in = -1; /* group creation property list */ + hid_t gcpl_out = -1; /* group creation property list */ + hid_t type_in = -1; /* named type ID */ + hid_t type_out = -1; /* named type ID */ + hid_t dcpl_in = -1; /* dataset creation property list ID */ + hid_t dcpl_out = -1; /* dataset creation property list ID */ + hid_t f_space_id = -1; /* file space ID */ + hid_t ftype_id = -1; /* file type ID */ + hid_t wtype_id = -1; /* read/write type ID */ + 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 */ + unsigned i; + unsigned u; + int is_ref = 0; + htri_t is_named; + hbool_t limit_maxdims; + hsize_t size_dset; + + /*------------------------------------------------------------------------- + * copy the suppplied object list + *------------------------------------------------------------------------- + */ + + if (options->verbose) { + printf("-----------------------------------------\n"); + printf(" Type Filter (Compression) Name\n"); + printf("-----------------------------------------\n"); + } + + for (i = 0; i < travt->nobjs; i++) { + /* init variables per obj */ + buf = NULL; + limit_maxdims = FALSE; + + switch (travt->objs[i].type) { + + case H5TRAV_TYPE_UNKNOWN: + HDassert(0); + break; + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_GROUP + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_GROUP: + + if (options->verbose) { + printf(FORMAT_OBJ, "group", travt->objs[i].name); + } + + /* open input group */ + if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) + < 0) + goto error; + + /* get input group creation property list */ + if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) + goto error; + + /* query and set the group creation properties */ + if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) + goto error; + + /* set up group creation property list */ + if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto error; + + if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0) + goto error; + + /*------------------------------------------------------------------------- + * 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) + goto error; + } + 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) + goto error; + } + + if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, + H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) + goto error; + + } + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0) + goto error; + + if (H5Pclose(gcpl_out) < 0) + goto error; + if (H5Pclose(gcpl_in) < 0) + goto error; + if (H5Gclose(grp_out) < 0) + goto error; + if (H5Gclose(grp_in) < 0) + goto error; + + break; + + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_DATASET + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_DATASET: + + 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 */ + for (u = 0; u < options->op_tbl->nelems; u++) { + + if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) { + if (options->op_tbl->objs[u].filter->filtn > 0) { + req_filter = 1; + } + } + } + + /* 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) + goto error; + if ((ftype_id = H5Dget_type(dset_in)) < 0) + goto error; + if (H5T_REFERENCE == H5Tget_class(ftype_id)) + is_ref = 1; + + /* Check if the datatype is committed */ + if ((is_named = H5Tcommitted(ftype_id)) < 0) + goto error; + if (is_named) + if ((wtype_id = copy_named_datatype(ftype_id, fidout, + &named_dt_head, travt, options)) < 0) + goto error; + + if (H5Tclose(ftype_id) < 0) + goto error; + if (H5Dclose(dset_in) < 0) + goto error; + + /*------------------------------------------------------------------------- + * 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 (options->op_tbl->nelems || options->all_filter == 1 + || options->all_layout == 1 || is_ref || is_named) { + + int j; + + if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + goto error; + if ((f_space_id = H5Dget_space(dset_in)) < 0) + goto error; + if ((ftype_id = H5Dget_type(dset_in)) < 0) + goto error; + if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0) + goto error; + if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) + goto error; + if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) + goto error; + HDmemset(dims, 0, sizeof dims); + if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) + goto error; + + if (H5Dget_space_status(dset_in, &space_status) < 0) + goto error; + + nelmts = 1; + for (j = 0; j < rank; j++) + nelmts *= dims[j]; + + /* wtype_id will have already been set if using a named dtype */ + if (!is_named) { + if (options->use_native == 1) + wtype_id = h5tools_get_native_type(ftype_id); + else + wtype_id = H5Tcopy(ftype_id); + } /* end if */ + + if ((msize = H5Tget_size(wtype_id)) == 0) + goto error; + + /* size of current dset */ + size_dset = nelmts * msize; + + /*------------------------------------------------------------------------- + * 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; + + /*------------------------------------------------------------------------- + * 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 (H5T_REFERENCE != H5Tget_class(wtype_id)) { + /* get the storage size of the input dataset */ + dsize_in = H5Dget_storage_size(dset_in); + + /* 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) + goto error; + } + + /* 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 convert to COMPACT */ + if (options->layout_g == H5D_COMPACT) { + /* should be smaller than 64K */ + 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); + } + + /*------------------------------------------------------------------------- + * 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 + *------------------------------------------------------------------------- + */ + H5E_BEGIN_TRY + { + dset_out = H5Dcreate2(fidout, + travt->objs[i].name, wtype_id, + f_space_id, H5P_DEFAULT, dcpl_out, + H5P_DEFAULT); + }H5E_END_TRY; + + if (dset_out == FAIL) { + if (options->verbose) + printf( + " warning: could not create dataset <%s>. Applying original settings\n", + travt->objs[i].name); + + if ((dset_out = H5Dcreate2(fidout, + travt->objs[i].name, wtype_id, f_space_id, + H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) + goto error; + apply_f = 0; + } + + /*------------------------------------------------------------------------- + * 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); + + if (buf != NULL) { + /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ + CHECK_H5DRW_ERROR(H5Dread, dset_in, wtype_id, + H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + CHECK_H5DRW_ERROR(H5Dwrite, dset_out, wtype_id, + H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + + /* 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) + goto error; + } + 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 = -1; /* dataset creation property list ID */ + + /* check if we have VL data in the dataset's datatype */ + if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) + vl_data = TRUE; + + /* check first if writing dataset is chunked, + * if so use its chunk layout for better performance. */ + dset_layout = H5Pget_layout(dcpl_out); + if (dset_layout == H5D_CHUNKED) + dcpl_tmp = dcpl_out; /* writing dataset */ + else { /* if reading dataset is chunked */ + dset_layout = H5Pget_layout(dcpl_in); + if (dset_layout == H5D_CHUNKED) + dcpl_tmp = dcpl_in; /* reading dataset */ + } + + /* get hyperslab dims and size in byte */ + if (Get_hyperslab(dcpl_tmp, rank, dims, + p_type_nbytes, hslab_dims, + &hslab_nbytes) < 0) + goto error; + + hslab_buf = HDmalloc((size_t)hslab_nbytes); + + hslab_nelmts = hslab_nbytes / p_type_nbytes; + hslab_space = H5Screate_simple(1, &hslab_nelmts, + NULL); + + /* the 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) + goto error; + if (H5Sselect_hyperslab(hslab_space, + H5S_SELECT_SET, zero, NULL, + &hs_select_nelmts, NULL) < 0) + goto error; + } + else { + H5Sselect_all(f_space_id); + H5Sselect_all(hslab_space); + hs_select_nelmts = 1; + } /* rank */ + + /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ + CHECK_H5DRW_ERROR(H5Dread, dset_in, + wtype_id, hslab_space, f_space_id, + H5P_DEFAULT, hslab_buf); + CHECK_H5DRW_ERROR(H5Dwrite, dset_out, + wtype_id, hslab_space, f_space_id, + H5P_DEFAULT, hslab_buf); + + /* reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(wtype_id, 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; + } /* k */ + } /* elmtno */ + + H5Sclose(hslab_space); + /* free */ + if (hslab_buf != NULL) { + HDfree(hslab_buf); + hslab_buf = NULL; + } + } /* hyperslab read */ + } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */ + + /*------------------------------------------------------------------------- + * 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) + printf( + " \n", + travt->objs[i].name, + (int) options->min_comp); + + if (has_filter && apply_f == 0) + printf( + " \n", + travt->objs[i].name); + + } /* verbose */ + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(dset_in, dset_out, &named_dt_head, travt, + options) < 0) + goto error; + /*close */ + if (H5Dclose(dset_out) < 0) + goto error; + + }/*!H5T_REFERENCE*/ + }/*h5tools_canreadf*/ + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + if (H5Tclose(ftype_id) < 0) + goto error; + if (H5Tclose(wtype_id) < 0) + goto error; + if (H5Pclose(dcpl_in) < 0) + goto error; + if (H5Pclose(dcpl_out) < 0) + goto error; + if (H5Sclose(f_space_id) < 0) + goto error; + if (H5Dclose(dset_in) < 0) + goto error; + + } + /*------------------------------------------------------------------------- + * we do not have request for filter/chunking use H5Ocopy instead + *------------------------------------------------------------------------- + */ + else { + hid_t pid; + + /* create property to pass copy options */ + if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) + goto error; + + /* set options for object copy */ + if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) + goto error; + + /*------------------------------------------------------------------------- + * do the copy + *------------------------------------------------------------------------- + */ + + 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 */ + pid, /* Properties which apply to the copy */ + H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ + goto error; + + /* close property */ + if (H5Pclose(pid) < 0) + goto error; + + /*------------------------------------------------------------------------- + * copy attrs manually + *------------------------------------------------------------------------- + */ + if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) + < 0) + goto error; + if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, + H5P_DEFAULT)) < 0) + goto error; + if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) + < 0) + goto error; + if (H5Dclose(dset_in) < 0) + goto error; + if (H5Dclose(dset_out) < 0) + goto error; + + if (options->verbose) + printf(FORMAT_OBJ, "dset", travt->objs[i].name); + + } /* end do we have request for filter/chunking */ + + break; + + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_NAMED_DATATYPE + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_NAMED_DATATYPE: + + if (options->verbose) + printf(FORMAT_OBJ, "type", travt->objs[i].name); + + if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) + < 0) + goto error; + + /* Copy the datatype anonymously */ + if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, + travt, options)) < 0) + goto error; + + /* Link in to group structure */ + if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, + H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(type_in, type_out, &named_dt_head, travt, options) + < 0) + goto error; + + if (H5Tclose(type_in) < 0) + goto error; + if (H5Tclose(type_out) < 0) + goto error; + + break; + + /*------------------------------------------------------------------------- + * 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) + printf(FORMAT_OBJ, "link", travt->objs[i].name); + + if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, + H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; + + if (options->verbose) + printf(FORMAT_OBJ, "link", travt->objs[i].name); + + } + break; + + default: + goto error; + } /* switch */ + + /* free */ + if (buf != NULL) { + HDfree(buf); + buf = NULL; + } + + } /* i */ + + /* Finalize (link) the stack of named datatypes (if any) */ + named_datatype_free(&named_dt_head, 0); + + return 0; error: - H5E_BEGIN_TRY { - H5Gclose(grp_in); - H5Gclose(grp_out); - H5Pclose(dcpl_in); - H5Pclose(gcpl_in); - H5Pclose(gcpl_out); - H5Sclose(f_space_id); - H5Dclose(dset_in); - H5Dclose(dset_out); - H5Tclose(ftype_id); - H5Tclose(wtype_id); - H5Tclose(type_in); - H5Tclose(type_out); - named_datatype_free(&named_dt_head, 1); - } H5E_END_TRY; - /* free */ - if (buf!=NULL) - HDfree(buf); - if (hslab_buf!=NULL) - HDfree(hslab_buf); - return -1; + H5E_BEGIN_TRY + { + H5Gclose(grp_in); + H5Gclose(grp_out); + H5Pclose(dcpl_in); + H5Pclose(gcpl_in); + H5Pclose(gcpl_out); + H5Sclose(f_space_id); + H5Dclose(dset_in); + H5Dclose(dset_out); + H5Tclose(ftype_id); + H5Tclose(wtype_id); + H5Tclose(type_in); + H5Tclose(type_out); + named_datatype_free(&named_dt_head, 1); + }H5E_END_TRY; + /* free */ + if (buf != NULL) + HDfree(buf); + if (hslab_buf != NULL) + HDfree(hslab_buf); + return -1; } - /*------------------------------------------------------------------------- -* Function: print_dataset_info -* -* Purpose: print name, filters, percentage compression of a dataset -* -*------------------------------------------------------------------------- -*/ -static void print_dataset_info(hid_t dcpl_id, - char *objname, - double ratio, - int pr) -{ - char strfilter[255]; + * Function: print_dataset_info + * + * Purpose: print name, filters, percentage compression of a dataset + * + *------------------------------------------------------------------------- + */ +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 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"); + HDstrcpy(strfilter, "\0"); - /* get information about input filters */ - if((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - return; + /* get information about input filters */ + if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) + return; - for(i = 0; i < nfilters; i++) { - cd_nelmts = NELMTS(cd_values); + 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_objname), f_objname, NULL); + filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts, + cd_values, sizeof(f_objname), f_objname, NULL); - switch(filtn) { + switch (filtn) { - case H5Z_FILTER_NONE: - HDstrcat(strfilter,"NONE "); - break; + case H5Z_FILTER_NONE: + HDstrcat(strfilter, "NONE "); + break; - case H5Z_FILTER_DEFLATE: - HDstrcat(strfilter,"GZIP "); + case H5Z_FILTER_DEFLATE: + HDstrcat(strfilter, "GZIP "); #if defined (PRINT_DEBUG) - { - unsigned level=cd_values[0]; - sprintf(temp,"(%d)",level); - HDstrcat(strfilter,temp); - } + { + unsigned level=cd_values[0]; + sprintf(temp,"(%d)",level); + HDstrcat(strfilter,temp); + } #endif - break; + break; - case H5Z_FILTER_SZIP: - HDstrcat(strfilter,"SZIP "); + case H5Z_FILTER_SZIP: + HDstrcat(strfilter, "SZIP "); #if defined (PRINT_DEBUG) - { - unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/ - unsigned ppb=cd_values[1]; - sprintf(temp,"(%d,",ppb); - HDstrcat(strfilter,temp); - if (options_mask & H5_SZIP_EC_OPTION_MASK) - HDstrcpy(temp,"EC) "); - else if (options_mask & H5_SZIP_NN_OPTION_MASK) - HDstrcpy(temp,"NN) "); - } - HDstrcat(strfilter,temp); + { + unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/ + unsigned ppb=cd_values[1]; + sprintf(temp,"(%d,",ppb); + HDstrcat(strfilter,temp); + if (options_mask & H5_SZIP_EC_OPTION_MASK) + HDstrcpy(temp,"EC) "); + else if (options_mask & H5_SZIP_NN_OPTION_MASK) + HDstrcpy(temp,"NN) "); + } + HDstrcat(strfilter,temp); #endif - break; - - case H5Z_FILTER_SHUFFLE: - HDstrcat(strfilter,"SHUF "); - break; - - case H5Z_FILTER_FLETCHER32: - HDstrcat(strfilter,"FLET "); - break; - - case H5Z_FILTER_NBIT: - HDstrcat(strfilter,"NBIT "); - break; - - case H5Z_FILTER_SCALEOFFSET: - HDstrcat(strfilter,"SCALEOFFSET "); - break; - - default: - HDstrcat(strfilter,"UD "); - break; - } /* switch */ - }/*i*/ - - if(!pr) - printf(FORMAT_OBJ,"dset",objname ); - else - { - char str[255], temp[28]; - HDstrcpy(str,"dset "); - HDstrcat(str,strfilter); - sprintf(temp," (%.3f:1)",ratio); - HDstrcat(str,temp); - printf(FORMAT_OBJ,str,objname); - } + break; + + case H5Z_FILTER_SHUFFLE: + HDstrcat(strfilter, "SHUF "); + break; + + case H5Z_FILTER_FLETCHER32: + HDstrcat(strfilter, "FLET "); + break; + + case H5Z_FILTER_NBIT: + HDstrcat(strfilter, "NBIT "); + break; + + case H5Z_FILTER_SCALEOFFSET: + HDstrcat(strfilter, "SCALEOFFSET "); + break; + + default: + HDstrcat(strfilter, "UD "); + break; + } /* switch */ + }/*i*/ + + if (!pr) + printf(FORMAT_OBJ, "dset", objname); + else { + char str[255], temp[28]; + HDstrcpy(str, "dset "); + HDstrcat(str, strfilter); + sprintf(temp, " (%.3f:1)", ratio); + HDstrcat(str, temp); + printf(FORMAT_OBJ, str, objname); + } } - /*------------------------------------------------------------------------- -* Function: copy_user_block -* -* Purpose: copy user block from one file to another -* -* Return: 0, ok, -1 no -* -* Programmer: Peter Cao -* -* Date: October, 25, 2007 -* -*------------------------------------------------------------------------- -*/ -static int -copy_user_block(const char *infile, const char *outfile, hsize_t size) -{ - int infid = -1, outfid = -1; /* File descriptors */ - int status = 0; /* Return value */ - - /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ - HDassert(size > 0); - - /* Open files */ - if((infid = HDopen(infile, O_RDONLY, 0)) < 0) { - status = -1; - goto done; - } - if((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0) { - status = -1; - goto done; - } - - /* 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 */ - - /* Read buffer from source file */ - if(size > USERBLOCK_XFER_SIZE) - nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE); - else - nread = HDread(infid, rbuf, (size_t)size); - if(nread < 0) { - status = -1; - goto done; - } /* end if */ - - /* Write buffer to destination file */ - /* (compensating for interrupted writes & checking for errors, etc.) */ - nbytes = nread; - 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 */ - status = -1; - goto done; - } /* end if */ - HDassert(nwritten > 0); - HDassert(nwritten <= nbytes); - - /* Update # of bytes left & offset in buffer */ - nbytes -= nwritten; - wbuf += nwritten; - HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); - } /* end while */ - - /* Update size of userblock left to transfer */ - size = size - (hsize_t)nread; - } /* end while */ + * Function: copy_user_block + * + * Purpose: copy user block from one file to another + * + * Return: 0, ok, -1 no + * + * Programmer: Peter Cao + * + * Date: October, 25, 2007 + * + *------------------------------------------------------------------------- + */ +static int copy_user_block(const char *infile, const char *outfile, + hsize_t size) { + int infid = -1, outfid = -1; /* File descriptors */ + int status = 0; /* Return value */ + + /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ + HDassert(size > 0); + + /* Open files */ + if ((infid = HDopen(infile, O_RDONLY, 0)) < 0) { + status = -1; + goto done; + } + if ((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0) { + status = -1; + goto done; + } + + /* 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 */ + + /* Read buffer from source file */ + if (size > USERBLOCK_XFER_SIZE) + nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE); + else + nread = HDread(infid, rbuf, (size_t)size); + if (nread < 0) { + status = -1; + goto done; + } /* end if */ + + /* Write buffer to destination file */ + /* (compensating for interrupted writes & checking for errors, etc.) */ + nbytes = nread; + 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 */ + status = -1; + goto done; + } /* end if */ + HDassert(nwritten > 0); + HDassert(nwritten <= nbytes); + + /* Update # of bytes left & offset in buffer */ + nbytes -= nwritten; + wbuf += nwritten; + HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); + } /* end while */ + + /* Update size of userblock left to transfer */ + size = size - (hsize_t) nread; + } /* end while */ done: - if(infid > 0) - HDclose(infid); - if(outfid > 0) - HDclose(outfid); + if (infid > 0) + HDclose(infid); + if (outfid > 0) + HDclose(outfid); - return status; + return status; } - - /*------------------------------------------------------------------------- -* Function: print_user_block -* -* Purpose: print user block -* -* Return: 0, ok, -1 no -* -* Programmer: Pedro Vicente -* -* Date: August, 20, 2008 -* -*------------------------------------------------------------------------- -*/ + * Function: print_user_block + * + * Purpose: print user block + * + * Return: 0, ok, -1 no + * + * Programmer: Pedro Vicente + * + * Date: August, 20, 2008 + * + *------------------------------------------------------------------------- + */ #if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid) { - int fh; /* file handle */ - hsize_t ub_size; /* user block size */ - hsize_t size; /* size read */ - hid_t fcpl; /* file creation property list ID for HDF5 file */ - int i; - - /* get user block size */ - if(( fcpl = H5Fget_create_plist(fid)) < 0) - { - error_msg("failed to retrieve file creation property list\n"); - goto done; - } - - if(H5Pget_userblock(fcpl, &ub_size) < 0) - { - error_msg("failed to retrieve userblock size\n"); - goto done; - } - - if(H5Pclose(fcpl) < 0) - { - error_msg("failed to close property list\n"); - goto done; - } - - /* open file */ - if((fh = HDopen(filename, O_RDONLY, 0)) < 0) - { - goto done; - } - - size = ub_size; - - /* read file */ - while(size > 0) - { - ssize_t nread; /* # of bytes read */ - char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */ - - /* read buffer */ - if(size > USERBLOCK_XFER_SIZE) - nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE); - else - nread = HDread(fh, rbuf, (size_t)size); - - for(i = 0; i < nread; i++) - { - - printf("%c ", rbuf[i]); - - } - printf("\n"); - - if(nread < 0) - { - goto done; - } - - - /* update size of userblock left to transfer */ - size -= nread; - } + int fh; /* file handle */ + hsize_t ub_size; /* user block size */ + hsize_t size; /* size read */ + hid_t fcpl; /* file creation property list ID for HDF5 file */ + int i; -done: - if(fh > 0) - HDclose(fh); + /* get user block size */ + if(( fcpl = H5Fget_create_plist(fid)) < 0) { + error_msg("failed to retrieve file creation property list\n"); + goto done; + } + + if(H5Pget_userblock(fcpl, &ub_size) < 0) { + error_msg("failed to retrieve userblock size\n"); + goto done; + } + + if(H5Pclose(fcpl) < 0) { + error_msg("failed to close property list\n"); + goto done; + } + + /* open file */ + if((fh = HDopen(filename, O_RDONLY, 0)) < 0) { + goto done; + } + size = ub_size; + + /* read file */ + while(size > 0) { + ssize_t nread; /* # of bytes read */ + char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */ + + /* read buffer */ + if(size > USERBLOCK_XFER_SIZE) + nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE); + else + nread = HDread(fh, rbuf, (size_t)size); + + for(i = 0; i < nread; i++) { + + printf("%c ", rbuf[i]); + + } + printf("\n"); + + if(nread < 0) { + goto done; + } + + /* update size of userblock left to transfer */ + size -= nread; + } + +done: + if(fh > 0) + HDclose(fh); - return; + return; } #endif diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index b5f9d31..7af776d 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -20,267 +20,345 @@ /* Name of tool */ #define PROGRAMNAME "h5repack" -static void usage(const char *prog); -static void parse_command_line(int argc, const char **argv, pack_opt_t* options); -static void read_info(const char *filename,pack_opt_t *options); - +static int parse_command_line(int argc, const char **argv, pack_opt_t* options); /* module-scoped variables */ -static int has_i_o = 0; -const char *infile = NULL; -const char *outfile = NULL; - +static int has_i_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 = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:T:"; -static struct long_options l_opts[] = { - { "help", no_arg, 'h' }, - { "version", no_arg, 'V' }, - { "verbose", no_arg, 'v' }, - { "filter", require_arg, 'f' }, - { "layout", require_arg, 'l' }, - { "minimum", require_arg, 'm' }, - { "file", require_arg, 'e' }, - { "native", no_arg, 'n' }, - { "latest", no_arg, 'L' }, - { "compact", require_arg, 'c' }, - { "indexed", require_arg, 'd' }, - { "ssize", require_arg, 's' }, - { "ublock", require_arg, 'u' }, - { "block", require_arg, 'b' }, - { "metadata_block_size", require_arg, 'M' }, - { "threshold", require_arg, 't' }, - { "alignment", require_arg, 'a' }, - { "infile", require_arg, 'i' }, /* -i for backward compability */ - { "outfile", require_arg, 'o' }, /* -o for backward compability */ - { "fs_strategy", require_arg, 'S' }, - { "fs_threshold", require_arg, 'T' }, - { NULL, 0, '\0' } -}; - - - +static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", + no_arg, 'V' }, { "verbose", no_arg, 'v' }, + { "filter", require_arg, 'f' }, { "layout", require_arg, 'l' }, { + "minimum", require_arg, 'm' }, { "file", require_arg, 'e' }, { + "native", no_arg, 'n' }, { "latest", no_arg, 'L' }, { "compact", + require_arg, 'c' }, { "indexed", require_arg, 'd' }, { "ssize", + require_arg, 's' }, { "ublock", require_arg, 'u' }, { "block", + require_arg, 'b' }, { "metadata_block_size", require_arg, 'M' }, + { "threshold", require_arg, 't' }, { "alignment", require_arg, 'a' }, { + "infile", require_arg, 'i' }, /* -i for backward compability */ + { "outfile", require_arg, 'o' }, /* -o for backward compability */ + { "fs_strategy", require_arg, 'S' }, + { "fs_threshold", require_arg, 'T' }, { NULL, 0, '\0' } }; /*------------------------------------------------------------------------- - * Function: main + * Function: usage * - * Purpose: h5repack main program + * Purpose: print usage * - * Return: Success: EXIT_SUCCESS(0) + * Return: void * - * Failure: EXIT_FAILURE(1) + *------------------------------------------------------------------------- + */ +static void usage(const char *prog) { + printf("usage: %s [OPTIONS] file1 file2\n", prog); + printf(" file1 Input HDF5 File\n"); + printf(" file2 Output HDF5 File\n"); + printf(" OPTIONS\n"); + printf(" -h, --help Print a usage message and exit\n"); + printf( + " -v, --verbose Verbose mode, print object information\n"); + printf(" -V, --version Print version number and exit\n"); + printf( + " -n, --native Use a native HDF5 type when repacking\n"); + printf(" -L, --latest Use latest version of file format\n"); + printf( + " -c L1, --compact=L1 Maximum number of links in header messages\n"); + printf( + " -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); + printf( + " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); + printf( + " -m M, --minimum=M Do not apply the filter to datasets smaller than M\n"); + printf( + " -e E, --file=E Name of file E with the -f and -l options\n"); + printf( + " -u U, --ublock=U Name of file U with user block data to be added\n"); + printf(" -b B, --block=B Size of user block to be added\n"); + printf( + " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n"); + printf(" -t T, --threshold=T Threshold value for H5Pset_alignment\n"); + printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n"); + printf(" -f FILT, --filter=FILT Filter type\n"); + printf(" -l LAYT, --layout=LAYT Layout type\n"); + printf( + " -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n"); + printf( + " -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n"); + + printf("\n"); + + printf( + " M - is an integer greater than 1, size of dataset in bytes (default is 0) \n"); + printf(" E - is a filename.\n"); + printf(" S - is an integer\n"); + printf(" U - is a filename.\n"); + printf(" T - is an integer\n"); + printf(" A - is an integer greater than zero\n"); + printf( + " B - is the user block size, any value that is 512 or greater and is\n"); + printf(" a power of 2 (1024 default)\n"); + printf( + " F - is the shared object header message type, any of . If F is not specified, S applies to all messages\n"); + printf("\n"); + printf( + " FS_STRGY is the file space management strategy to use for the output file.\n"); + printf(" It is a string as listed below:\n"); + printf( + " ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n"); + printf(" for file space allocation\n"); + printf( + " ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n"); + printf(" for file space allocation\n"); + printf( + " AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n"); + printf(" VFD - Use virtual file driver for file space allocation\n"); + printf("\n"); + printf( + " FS_THRD is the free-space section threshold to use for the output file.\n"); + printf( + " It is the minimum size (in bytes) of free-space sections to be tracked\n"); + printf(" by the the library's free-space managers.\n"); + printf("\n"); + + printf(" FILT - is a string with the format:\n"); + printf("\n"); + printf(" :=\n"); + printf("\n"); + printf( + " is a comma separated list of object names, meaning apply\n"); + printf( + " compression only to those objects. If no names are specified, the filter\n"); + printf(" is applied to all objects\n"); + printf(" can be:\n"); + printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n"); + printf(" SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n"); + printf(" SHUF, to apply the HDF5 shuffle filter\n"); + printf(" FLET, to apply the HDF5 checksum filter\n"); + printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n"); + printf(" SOFF, to apply the HDF5 Scale/Offset filter\n"); + printf(" UD, to apply a user defined filter\n"); + printf(" NONE, to remove all filters\n"); + printf( + " is optional filter parameter information\n"); + printf(" GZIP= from 1-9\n"); + printf( + " SZIP= pixels per block is a even number in\n"); + printf(" 2-32 and coding method is either EC or NN\n"); + printf(" SHUF (no parameter)\n"); + printf(" FLET (no parameter)\n"); + printf(" NBIT (no parameter)\n"); + printf( + " SOFF= scale_factor is an integer and scale_type\n"); + printf(" is either IN or DS\n"); + printf( + " UD=\n"); + printf( + " required values for filter_number,cd_value_count,value_1\n"); + printf(" optional values for value_2 to value_N\n"); + printf(" NONE (no parameter)\n"); + printf("\n"); + printf(" LAYT - is a string with the format:\n"); + printf("\n"); + printf(" :=\n"); + printf("\n"); + printf( + " is a comma separated list of object names, meaning that\n"); + printf( + " layout information is supplied for those objects. If no names are\n"); + printf(" specified, the layout type is applied to all objects\n"); + printf(" can be:\n"); + printf(" CHUNK, to apply chunking layout\n"); + printf(" COMPA, to apply compact layout\n"); + printf(" CONTI, to apply contiguous layout\n"); + printf(" is optional layout information\n"); + printf( + " CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); + printf(" COMPA (no parameter)\n"); + printf(" CONTI (no parameter)\n"); + printf("\n"); + printf("Examples of use:\n"); + printf("\n"); + printf("1) h5repack -v -f GZIP=1 file1 file2\n"); + printf("\n"); + printf(" GZIP compression with level 1 to all objects\n"); + printf("\n"); + printf("2) h5repack -v -f A:SZIP=8,NN file1 file2\n"); + printf("\n"); + printf( + " SZIP compression with 8 pixels per block and NN coding method to object A\n"); + printf("\n"); + printf("3) h5repack -v -l A,B:CHUNK=20x10 -f C,D,F:NONE file1 file2\n"); + printf("\n"); + printf( + " Chunked layout, with a layout size of 20x10, to objects A and B\n"); + printf(" and remove filters to objects C, D, F\n"); + printf("\n"); + printf("4) h5repack -L -c 10 -s 20:dtype file1 file2 \n"); + printf("\n"); + printf( + " Using latest file format with maximum compact group size of 10 and\n"); + printf(" and minimum shared datatype size of 20\n"); + printf("\n"); + printf("5) h5repack -f SHUF -f GZIP=1 file1 file2 \n"); + printf("\n"); + printf(" Add both filters SHUF and GZIP in this order to all datasets\n"); + printf("\n"); + printf("6) h5repack -f UD=307,1,9 file1 file2 \n"); + printf("\n"); + printf(" Add bzip2 filter to all datasets\n"); + printf("\n"); +} + +/*------------------------------------------------------------------------- + * Function: leave * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Purpose: Shutdown MPI & HDF5 and call exit() * - * Date: May 9, 2003 + * Return: Does not return * - * Comments: + * Programmer: Quincey Koziol + * Saturday, 31. January 2004 + * + * Modifications: * *------------------------------------------------------------------------- */ -int main(int argc, const char **argv) -{ - - pack_opt_t options; /*the global options */ - int ret=-1; - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Initialize h5tools lib */ - h5tools_init(); - - /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */ - if ( h5tools_getenv_update_hyperslab_bufsize() < 0) - HDexit(EXIT_FAILURE); - - /* initialize options */ - h5repack_init(&options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t)0); - - parse_command_line(argc, argv, &options); - - /* get file names if they were not yet got */ - if ( has_i_o == 0 ) - { - - if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL ) - { - infile = argv[ opt_ind ]; - outfile = argv[ opt_ind + 1 ]; - - if ( HDstrcmp( infile, outfile ) == 0 ) - { - error_msg("file names cannot be the same\n"); - usage(h5tools_getprogname()); - HDexit(EXIT_FAILURE); - - } - } - - else - { - error_msg("file names missing\n"); - usage(h5tools_getprogname()); - HDexit(EXIT_FAILURE); - } - } - - - /* pack it */ - ret=h5repack(infile,outfile,&options); +static void leave(int ret) { + h5tools_close(); - /* free tables */ - h5repack_end(&options); - - if (ret==-1) - return 1; - else - return 0; + HDexit(ret); } - - /*------------------------------------------------------------------------- - * Function: usage + * Function: read_info * - * Purpose: print usage + * Purpose: read comp and chunk options from a file * - * Return: void + * Return: void, exit on error + * + * Programmer: pvn@ncsa.uiuc.edu + * + * Date: September, 22, 2003 * *------------------------------------------------------------------------- */ -static void usage(const char *prog) -{ - printf("usage: %s [OPTIONS] file1 file2\n", prog); - printf(" file1 Input HDF5 File\n"); - printf(" file2 Output HDF5 File\n"); - printf(" OPTIONS\n"); - printf(" -h, --help Print a usage message and exit\n"); - printf(" -v, --verbose Verbose mode, print object information\n"); - printf(" -V, --version Print version number and exit\n"); - printf(" -n, --native Use a native HDF5 type when repacking\n"); - printf(" -L, --latest Use latest version of file format\n"); - printf(" -c L1, --compact=L1 Maximum number of links in header messages\n"); - printf(" -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); - printf(" -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); - printf(" -m M, --minimum=M Do not apply the filter to datasets smaller than M\n"); - printf(" -e E, --file=E Name of file E with the -f and -l options\n"); - printf(" -u U, --ublock=U Name of file U with user block data to be added\n"); - printf(" -b B, --block=B Size of user block to be added\n"); - printf(" -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n"); - printf(" -t T, --threshold=T Threshold value for H5Pset_alignment\n"); - printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n"); - printf(" -f FILT, --filter=FILT Filter type\n"); - printf(" -l LAYT, --layout=LAYT Layout type\n"); - printf(" -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n"); - printf(" -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n"); - - printf("\n"); - - printf(" M - is an integer greater than 1, size of dataset in bytes (default is 0) \n"); - printf(" E - is a filename.\n"); - printf(" S - is an integer\n"); - printf(" U - is a filename.\n"); - printf(" T - is an integer\n"); - printf(" A - is an integer greater than zero\n"); - printf(" B - is the user block size, any value that is 512 or greater and is\n"); - printf(" a power of 2 (1024 default)\n"); - printf(" F - is the shared object header message type, any of . If F is not specified, S applies to all messages\n"); - printf("\n"); - printf(" FS_STRGY is the file space management strategy to use for the output file.\n"); - printf(" It is a string as listed below:\n"); - printf(" ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n"); - printf(" for file space allocation\n"); - printf(" ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n"); - printf(" for file space allocation\n"); - printf(" AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n"); - printf(" VFD - Use virtual file driver for file space allocation\n"); - printf("\n"); - printf(" FS_THRD is the free-space section threshold to use for the output file.\n"); - printf(" It is the minimum size (in bytes) of free-space sections to be tracked\n"); - printf(" by the the library's free-space managers.\n"); - printf("\n"); - - printf(" FILT - is a string with the format:\n"); - printf("\n"); - printf(" :=\n"); - printf("\n"); - printf(" is a comma separated list of object names, meaning apply\n"); - printf(" compression only to those objects. If no names are specified, the filter\n"); - printf(" is applied to all objects\n"); - printf(" can be:\n"); - printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n"); - printf(" SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n"); - printf(" SHUF, to apply the HDF5 shuffle filter\n"); - printf(" FLET, to apply the HDF5 checksum filter\n"); - printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n"); - printf(" SOFF, to apply the HDF5 Scale/Offset filter\n"); - printf(" UD, to apply a user defined filter\n"); - printf(" NONE, to remove all filters\n"); - printf(" is optional filter parameter information\n"); - printf(" GZIP= from 1-9\n"); - printf(" SZIP= pixels per block is a even number in\n"); - printf(" 2-32 and coding method is either EC or NN\n"); - printf(" SHUF (no parameter)\n"); - printf(" FLET (no parameter)\n"); - printf(" NBIT (no parameter)\n"); - printf(" SOFF= scale_factor is an integer and scale_type\n"); - printf(" is either IN or DS\n"); - printf(" UD=\n"); - printf(" required values for filter_number,cd_value_count,value_1\n"); - printf(" optional values for value_2 to value_N\n"); - printf(" NONE (no parameter)\n"); - printf("\n"); - printf(" LAYT - is a string with the format:\n"); - printf("\n"); - printf(" :=\n"); - printf("\n"); - printf(" is a comma separated list of object names, meaning that\n"); - printf(" layout information is supplied for those objects. If no names are\n"); - printf(" specified, the layout type is applied to all objects\n"); - printf(" can be:\n"); - printf(" CHUNK, to apply chunking layout\n"); - printf(" COMPA, to apply compact layout\n"); - printf(" CONTI, to apply contiguous layout\n"); - printf(" is optional layout information\n"); - printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); - printf(" COMPA (no parameter)\n"); - printf(" CONTI (no parameter)\n"); - printf("\n"); - printf("Examples of use:\n"); - printf("\n"); - printf("1) h5repack -v -f GZIP=1 file1 file2\n"); - printf("\n"); - printf(" GZIP compression with level 1 to all objects\n"); - printf("\n"); - printf("2) h5repack -v -f A:SZIP=8,NN file1 file2\n"); - printf("\n"); - printf(" SZIP compression with 8 pixels per block and NN coding method to object A\n"); - printf("\n"); - printf("3) h5repack -v -l A,B:CHUNK=20x10 -f C,D,F:NONE file1 file2\n"); - printf("\n"); - printf(" Chunked layout, with a layout size of 20x10, to objects A and B\n"); - printf(" and remove filters to objects C, D, F\n"); - printf("\n"); - printf("4) h5repack -L -c 10 -s 20:dtype file1 file2 \n"); - printf("\n"); - printf(" Using latest file format with maximum compact group size of 10 and\n"); - printf(" and minimum shared datatype size of 20\n"); - printf("\n"); - printf("5) h5repack -f SHUF -f GZIP=1 file1 file2 \n"); - printf("\n"); - printf(" Add both filters SHUF and GZIP in this order to all datasets\n"); - printf("\n"); - printf("6) h5repack -f UD=307,1,9 file1 file2 \n"); - printf("\n"); - printf(" Add bzip2 filter to all datasets\n"); - printf("\n"); -} +static +int read_info(const char *filename, pack_opt_t *options) { + + char stype[10]; + char comp_info[1024]; + FILE *fp = NULL; + char c; + int i, rc = 1; + int ret_value = EXIT_SUCCESS; + + if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) { + error_msg("cannot open options file %s\n", filename); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + + /* cycle until end of file reached */ + while (1) { + rc = fscanf(fp, "%s", stype); + if (rc == -1) + break; + + /*------------------------------------------------------------------------- + * filter + *------------------------------------------------------------------------- + */ + if (HDstrcmp(stype,"-f") == 0) { + /* find begining of info */ + i = 0; + c = '0'; + while (c != ' ') { + fscanf(fp, "%c", &c); + if (HDfeof(fp)) + break; + } + c = '0'; + /* go until end */ + while (c != ' ') { + fscanf(fp, "%c", &c); + comp_info[i] = c; + i++; + if (HDfeof(fp)) + break; + if (c == 10 /*eol*/) + break; + } + comp_info[i - 1] = '\0'; /*cut the last " */ + + if (h5repack_addfilter(comp_info, options) == -1) { + error_msg("could not add compression option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } + /*------------------------------------------------------------------------- + * layout + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(stype,"-l") == 0) { + + /* find begining of info */ + i = 0; + c = '0'; + while (c != ' ') { + fscanf(fp, "%c", &c); + if (HDfeof(fp)) + break; + } + c = '0'; + /* go until end */ + while (c != ' ') { + fscanf(fp, "%c", &c); + comp_info[i] = c; + i++; + if (HDfeof(fp)) + break; + if (c == 10 /*eol*/) + break; + } + comp_info[i - 1] = '\0'; /*cut the last " */ + + if (h5repack_addlayout(comp_info, options) == -1) { + error_msg("could not add chunck option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } + /*------------------------------------------------------------------------- + * not valid + *------------------------------------------------------------------------- + */ + else { + error_msg("bad file format for %s", filename); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } + +done: + if (fp) + HDfclose(fp); + + return ret_value; +} /*------------------------------------------------------------------------- * Function: parse_command_line @@ -291,316 +369,275 @@ static void usage(const char *prog) */ static -void parse_command_line(int argc, const char **argv, pack_opt_t* options) -{ - - int opt; - - /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) - { - switch ((char)opt) - { - - /* -i for backward compability */ - case 'i': - infile = opt_arg; - has_i_o = 1; - break; - /* -o for backward compability */ - case 'o': - outfile = opt_arg; - has_i_o = 1; - break; - - - case 'h': - usage(h5tools_getprogname()); - HDexit(EXIT_SUCCESS); - case 'V': - print_version(h5tools_getprogname()); - HDexit(EXIT_SUCCESS); - case 'v': - options->verbose = 1; - break; - case 'f': - - /* parse the -f filter option */ - if (h5repack_addfilter( opt_arg, options)<0) - { - error_msg("in parsing filter\n"); - HDexit(EXIT_FAILURE); - } - break; - case 'l': - - /* parse the -l layout option */ - if (h5repack_addlayout( opt_arg, options)<0) - { - error_msg("in parsing layout\n"); - HDexit(EXIT_FAILURE); - } - break; - - - case 'm': - - options->min_comp = HDatoi( opt_arg ); - if ((int)options->min_comp<=0) - { - error_msg("invalid minimum compress size <%s>\n", opt_arg ); - HDexit(EXIT_FAILURE); - } - break; - - case 'e': - read_info( opt_arg, options); - break; - - case 'n': - options->use_native = 1; - break; - - case 'L': - options->latest = 1; - break; - - case 'c': - - options->grp_compact = HDatoi( opt_arg ); - if (options->grp_compact>0) - options->latest = 1; /* must use latest format */ - break; - - - case 'd': - - options->grp_indexed = HDatoi( opt_arg ); - if (options->grp_indexed>0) - options->latest = 1; /* must use latest format */ - break; - - case 's': - - { - - int idx = 0; - int ssize = 0; - char *msgPtr = HDstrchr( opt_arg, ':'); - options->latest = 1; /* 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) == 0) { - options->msg_size[0] = ssize; - } - else if (HDstrncmp(msgType, "dtype", 5) == 0) { - options->msg_size[1] = ssize; - } - else if (HDstrncmp(msgType, "fill", 4) == 0) { - options->msg_size[2] = ssize; - } - else if (HDstrncmp(msgType, "pline", 5) == 0) { - options->msg_size[3] = ssize; - } - else if (HDstrncmp(msgType, "attr", 4) == 0) { - options->msg_size[4] = ssize; - } - } - } - - break; - - case 'u': - - options->ublock_filename = opt_arg; - break; - - case 'b': - - options->ublock_size = (hsize_t)HDatol( opt_arg ); - break; - - case 'M': - - options->meta_block_size = (hsize_t)HDatol( opt_arg ); - break; - - case 't': - - options->threshold = (hsize_t)HDatol( opt_arg ); - break; - - case 'a': - - options->alignment = HDatol( opt_arg ); - if ( options->alignment < 1 ) - { - error_msg("invalid alignment size\n", opt_arg ); - HDexit(EXIT_FAILURE); - } - break; - - case 'S': - { - char strategy[MAX_NC_NAME]; - - HDstrcpy(strategy, opt_arg); - if(!HDstrcmp(strategy, "ALL_PERSIST")) - options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST; - else if(!HDstrcmp(strategy, "ALL")) - options->fs_strategy = H5F_FILE_SPACE_ALL; - else if(!HDstrcmp(strategy, "AGGR_VFD")) - options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD; - else if(!HDstrcmp(strategy, "VFD")) - options->fs_strategy = H5F_FILE_SPACE_VFD; - else { - error_msg("invalid file space management strategy\n", opt_arg ); - HDexit(EXIT_FAILURE); - } - break; - } - - case 'T': - - options->fs_threshold = (hsize_t)HDatol( opt_arg ); - break; - default: - break; - } /* switch */ - - - } /* while */ - - if ( has_i_o == 0 ) - { - /* check for file names to be processed */ - if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL) - { - error_msg("missing file names\n"); - usage(h5tools_getprogname()); - HDexit(EXIT_FAILURE); - } - } - +int parse_command_line(int argc, const char **argv, pack_opt_t* options) { + + int opt; + int ret_value = 0; + + /* parse command line options */ + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + switch ((char) opt) { + + /* -i for backward compability */ + case 'i': + infile = opt_arg; + has_i_o = 1; + break; + + /* -o for backward compability */ + case 'o': + outfile = opt_arg; + has_i_o = 1; + break; + + case 'h': + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + ret_value = -1; + goto done; + + case 'V': + print_version(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + ret_value = -1; + goto done; + + case 'v': + options->verbose = 1; + break; + + case 'f': + /* parse the -f filter option */ + if (h5repack_addfilter(opt_arg, options) < 0) { + error_msg("in parsing filter\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'l': + /* parse the -l layout option */ + if (h5repack_addlayout(opt_arg, options) < 0) { + error_msg("in parsing layout\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'm': + options->min_comp = HDatoi( opt_arg ); + if ((int) options->min_comp <= 0) { + error_msg("invalid minimum compress size <%s>\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'e': + ret_value = read_info(opt_arg, options); + if (ret_value < 0) + goto done; + break; + + case 'n': + options->use_native = 1; + break; + + case 'L': + options->latest = 1; + break; + + case 'c': + options->grp_compact = HDatoi( opt_arg ); + if (options->grp_compact > 0) + options->latest = 1; /* must use latest format */ + break; + + case 'd': + options->grp_indexed = HDatoi( opt_arg ); + if (options->grp_indexed > 0) + options->latest = 1; /* must use latest format */ + break; + + case 's': + { + int idx = 0; + int ssize = 0; + char *msgPtr = HDstrchr( opt_arg, ':'); + options->latest = 1; /* 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) == 0) { + options->msg_size[0] = ssize; + } + else if (HDstrncmp(msgType, "dtype", 5) == 0) { + options->msg_size[1] = ssize; + } + else if (HDstrncmp(msgType, "fill", 4) == 0) { + options->msg_size[2] = ssize; + } + else if (HDstrncmp(msgType, "pline", 5) == 0) { + options->msg_size[3] = ssize; + } + else if (HDstrncmp(msgType, "attr", 4) == 0) { + options->msg_size[4] = ssize; + } + } + } + break; + + case 'u': + options->ublock_filename = opt_arg; + break; + + case 'b': + options->ublock_size = (hsize_t) HDatol( opt_arg ); + break; + + case 'M': + options->meta_block_size = (hsize_t) HDatol( opt_arg ); + break; + + case 't': + options->threshold = (hsize_t) HDatol( opt_arg ); + break; + + case 'a': + options->alignment = HDatol( opt_arg ); + if (options->alignment < 1) { + error_msg("invalid alignment size\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'S': + { + char strategy[MAX_NC_NAME]; + + HDstrcpy(strategy, opt_arg); + if (!HDstrcmp(strategy, "ALL_PERSIST")) + options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST; + else if (!HDstrcmp(strategy, "ALL")) + options->fs_strategy = H5F_FILE_SPACE_ALL; + else if (!HDstrcmp(strategy, "AGGR_VFD")) + options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD; + else if (!HDstrcmp(strategy, "VFD")) + options->fs_strategy = H5F_FILE_SPACE_VFD; + else { + error_msg("invalid file space management strategy\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + } + break; + + case 'T': + options->fs_threshold = (hsize_t) HDatol( opt_arg ); + break; + + default: + break; + } /* switch */ + + } /* while */ + + if (has_i_o == 0) { + /* check for file names to be processed */ + if (argc <= opt_ind || argv[opt_ind + 1] == NULL) { + error_msg("missing file names\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + } + } + +done: + return ret_value; } /*------------------------------------------------------------------------- - * Function: read_info + * Function: main * - * Purpose: read comp and chunk options from a file + * Purpose: h5repack main program * - * Return: void, exit on error + * Return: Success: EXIT_SUCCESS(0) * - * Programmer: pvn@ncsa.uiuc.edu + * Failure: EXIT_FAILURE(1) * - * Date: September, 22, 2003 + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: May 9, 2003 + * + * Comments: * *------------------------------------------------------------------------- */ - -static -void read_info(const char *filename, - pack_opt_t *options) -{ - - char stype[10]; - char comp_info[1024]; - FILE *fp; - char c; - int i, rc=1; - - if ((fp = HDfopen(filename, "r")) == (FILE *)NULL) { - error_msg("cannot open options file %s\n", filename); - HDexit(EXIT_FAILURE); - } - - /* cycle until end of file reached */ - while( 1 ) - { - rc=fscanf(fp, "%s", stype); - if (rc==-1) - break; - - /*------------------------------------------------------------------------- - * filter - *------------------------------------------------------------------------- - */ - if (HDstrcmp(stype,"-f") == 0) { - - /* find begining of info */ - i=0; c='0'; - while( c!=' ' ) - { - fscanf(fp, "%c", &c); - if (HDfeof(fp)) break; - } - c='0'; - /* go until end */ - while( c!=' ' ) - { - fscanf(fp, "%c", &c); - comp_info[i]=c; - i++; - if (HDfeof(fp)) break; - if (c==10 /*eol*/) break; - } - comp_info[i-1]='\0'; /*cut the last " */ - - if (h5repack_addfilter(comp_info,options)==-1){ - error_msg("could not add compression option\n"); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * layout - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(stype,"-l") == 0) { - - /* find begining of info */ - i=0; c='0'; - while( c!=' ' ) - { - fscanf(fp, "%c", &c); - if (HDfeof(fp)) break; - } - c='0'; - /* go until end */ - while( c!=' ' ) - { - fscanf(fp, "%c", &c); - comp_info[i]=c; - i++; - if (HDfeof(fp)) break; - if (c==10 /*eol*/) break; - } - comp_info[i-1]='\0'; /*cut the last " */ - - if (h5repack_addlayout(comp_info,options)==-1){ - error_msg("could not add chunck option\n"); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * not valid - *------------------------------------------------------------------------- - */ - else { - error_msg("bad file format for %s", filename); - HDexit(EXIT_FAILURE); - } - } - - HDfclose(fp); - return; +int main(int argc, const char **argv) { + + pack_opt_t options; /*the global options */ + int ret = -1; + + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + + /* Initialize h5tools lib */ + h5tools_init(); + + /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */ + if (h5tools_getenv_update_hyperslab_bufsize() < 0) { + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + + /* initialize options */ + h5repack_init(&options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t) 0); + + if (parse_command_line(argc, argv, &options) < 0) + goto done; + + /* get file names if they were not yet got */ + if (has_i_o == 0) { + + if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) { + infile = argv[opt_ind]; + outfile = argv[opt_ind + 1]; + + if ( HDstrcmp( infile, outfile ) == 0) { + error_msg("file names cannot be the same\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + } + else { + error_msg("file names missing\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + } + + /* pack it */ + h5tools_setstatus(h5repack(infile, outfile, &options)); + +done: + /* free tables */ + h5repack_end(&options); + + leave(h5tools_getstatus()); } + diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index bcddbb9..b54e887 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -1,4 +1,4 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -27,21 +27,19 @@ *------------------------------------------------------------------------- */ -void init_packobject(pack_info_t *obj) -{ - int j, k; - - HDstrcpy(obj->path,"\0"); - for ( j=0; jfilter[j].filtn = -1; - for ( k=0; kfilter[j].cd_values[k] = 0; - } - obj->chunk.rank = -1; - obj->refobj_id = -1; - obj->layout = H5D_LAYOUT_ERROR; - obj->nfilters = 0; +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; + 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; } /*------------------------------------------------------------------------- @@ -54,19 +52,16 @@ void init_packobject(pack_info_t *obj) *------------------------------------------------------------------------- */ -static void aux_tblinsert_filter(pack_opttbl_t *table, - unsigned int I, - filter_info_t filt) -{ - if (table->objs[ I ].nfiltersobjs[ I ].filter[ table->objs[ I ].nfilters++ ] = filt; - } - else - { - error_msg("cannot insert the filter in this object.\ +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; + } + else { + error_msg( + "cannot insert the filter in this object.\ Maximum capacity exceeded\n"); - } + } } /*------------------------------------------------------------------------- @@ -79,33 +74,28 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, *------------------------------------------------------------------------- */ -static void aux_tblinsert_layout(pack_opttbl_t *table, - unsigned int I, - pack_info_t *pack) -{ - int k; - - table->objs[I].layout = pack->layout; - if (H5D_CHUNKED==pack->layout) - { - /* -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].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]; - } - } +static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, + pack_info_t *pack) { + int k; + + table->objs[I].layout = pack->layout; + if (H5D_CHUNKED == pack->layout) { + /* -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].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]; + } + } } - /*------------------------------------------------------------------------- * Function: aux_inctable * @@ -116,21 +106,20 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, *------------------------------------------------------------------------- */ -static int aux_inctable(pack_opttbl_t *table, int n_objs ) -{ - unsigned int i; - - table->size += n_objs; - table->objs = (pack_info_t*)HDrealloc(table->objs, table->size * sizeof(pack_info_t)); - if (table->objs==NULL) { - error_msg("not enough memory for options table\n"); - return -1; - } - for (i = table->nelems; i < table->size; i++) - { - init_packobject(&table->objs[i]); - } - return 0; +static int aux_inctable(pack_opttbl_t *table, int n_objs) { + unsigned int i; + + table->size += n_objs; + table->objs = + (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t)); + if (table->objs == NULL) { + error_msg("not enough memory for options table\n"); + return -1; + } + for (i = table->nelems; i < table->size; i++) { + init_packobject(&table->objs[i]); + } + return 0; } @@ -143,31 +132,29 @@ static int aux_inctable(pack_opttbl_t *table, int n_objs ) * *------------------------------------------------------------------------- */ -int options_table_init( pack_opttbl_t **tbl ) -{ - unsigned int i; - pack_opttbl_t *table; - - if(NULL == (table = (pack_opttbl_t *)HDmalloc(sizeof(pack_opttbl_t)))) - { - error_msg("not enough memory for options table\n"); - return -1; - } - - table->size = 30; - table->nelems = 0; - if(NULL == (table->objs = (pack_info_t*)HDmalloc(table->size * sizeof(pack_info_t)))) - { - error_msg("not enough memory for options table\n"); - HDfree(table); - return -1; - } - - for(i = 0; i < table->size; i++) - init_packobject(&table->objs[i]); - - *tbl = table; - return 0; +int options_table_init(pack_opttbl_t **tbl) { + unsigned int i; + pack_opttbl_t *table; + + if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) { + error_msg("not enough memory for options table\n"); + return -1; + } + + table->size = 30; + table->nelems = 0; + if (NULL == (table->objs = + (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) { + error_msg("not enough memory for options table\n"); + HDfree(table); + return -1; + } + + for (i = 0; i < table->size; i++) + init_packobject(&table->objs[i]); + + *tbl = table; + return 0; } @@ -181,11 +168,10 @@ int options_table_init( pack_opttbl_t **tbl ) *------------------------------------------------------------------------- */ -int options_table_free( pack_opttbl_t *table ) -{ - HDfree(table->objs); - HDfree(table); - return 0; +int options_table_free(pack_opttbl_t *table) { + HDfree(table->objs); + HDfree(table); + return 0; } /*------------------------------------------------------------------------- @@ -198,95 +184,81 @@ int options_table_free( pack_opttbl_t *table ) *------------------------------------------------------------------------- */ - -int options_add_layout( obj_list_t *obj_list, - int n_objs, - pack_info_t *pack, - pack_opttbl_t *table ) -{ - unsigned int i, I; - int j, added=0, found=0; - - /* increase the size of the collection by N_OBJS if necessary */ - if (table->nelems+n_objs >= table->size) - { - if (aux_inctable(table,n_objs)<0) - return -1; - } - - /* search if this object is already in the table; "path" is the key */ - if (table->nelems>0) - { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) - { - /* 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) - { - /* already chunk info inserted for this one; exit */ - if (table->objs[i].chunk.rank>0) - { - error_msg("chunk information already inserted for <%s>\n",obj_list[j].obj); - HDexit(EXIT_FAILURE); - } - /* insert the layout info */ - else - { - aux_tblinsert_layout(table,i,pack); - found=1; - break; - } - } /* if */ - } /* i */ - - if (found==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); - } - /* cases where we have an already inserted name but there is a new name also - example: - -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20 - dset1 is already inserted, but dset2 must also be - */ - else if (found==1 && 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 */ - else - { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) - { - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path,obj_list[j].obj); - aux_tblinsert_layout(table,I,pack); - - } - } - - table->nelems+= added; - - return 0; +int options_add_layout(obj_list_t *obj_list, int n_objs, pack_info_t *pack, + pack_opttbl_t *table) { + unsigned int i, I; + int j, added = 0, found = 0; + + /* increase the size of the collection by N_OBJS if necessary */ + if (table->nelems + n_objs >= table->size) { + if (aux_inctable(table, n_objs) < 0) + return -1; + } + + /* search if this object is already in the table; "path" is the key */ + if (table->nelems > 0) { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + /* 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) { + /* already chunk info inserted for this one; exit */ + if (table->objs[i].chunk.rank > 0) { + error_msg( + "chunk information already inserted for <%s>\n", + obj_list[j].obj); + HDexit(EXIT_FAILURE); + } + /* insert the layout info */ + else { + aux_tblinsert_layout(table, i, pack); + found = 1; + break; + } + } /* if */ + } /* i */ + + if (found == 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); + } + /* cases where we have an already inserted name but there is a new name also + example: + -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20 + dset1 is already inserted, but dset2 must also be + */ + else if (found == 1 + && 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 */ + else { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_layout(table, I, pack); + + } + } + + table->nelems += added; + + return 0; } - - /*------------------------------------------------------------------------- * Function: options_add_filter * @@ -297,81 +269,70 @@ int options_add_layout( obj_list_t *obj_list, *------------------------------------------------------------------------- */ -int options_add_filter(obj_list_t *obj_list, - int n_objs, - filter_info_t filt, - pack_opttbl_t *table ) -{ - - unsigned int i, I; - int j, added=0, found=0; - - /* increase the size of the collection by N_OBJS if necessary */ - if (table->nelems+n_objs >= table->size) - { - if (aux_inctable(table,n_objs)<0) - return -1; - } - - /* search if this object is already in the table; "path" is the key */ - if (table->nelems>0) - { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) - { - /* 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) - { - /* insert */ - aux_tblinsert_filter(table,i,filt); - found=1; - break; - } /* if */ - } /* i */ - - if (found==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); - } - /* cases where we have an already inserted name but there is a new name also - example: - -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1 - dset1 is already inserted, but dset2 must also be - */ - else if (found==1 && 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 */ - } - - /* first time insertion */ - else - { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) - { - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path,obj_list[j].obj); - aux_tblinsert_filter(table,I,filt); - } - } - - table->nelems+= added; - - return 0; +int options_add_filter(obj_list_t *obj_list, int n_objs, filter_info_t filt, + pack_opttbl_t *table) { + + unsigned int i, I; + int j, added = 0, found = 0; + + /* increase the size of the collection by N_OBJS if necessary */ + if (table->nelems + n_objs >= table->size) { + if (aux_inctable(table, n_objs) < 0) + return -1; + } + + /* search if this object is already in the table; "path" is the key */ + if (table->nelems > 0) { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + /* 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) { + /* insert */ + aux_tblinsert_filter(table, i, filt); + found = 1; + break; + } /* if */ + } /* i */ + + if (found == 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); + } + /* cases where we have an already inserted name but there is a new name also + example: + -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1 + dset1 is already inserted, but dset2 must also be + */ + else if (found == 1 + && 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 */ + } + + /* first time insertion */ + else { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_filter(table, I, filt); + } + } + + table->nelems += added; + + return 0; } /*------------------------------------------------------------------------- @@ -384,34 +345,25 @@ int options_add_filter(obj_list_t *obj_list, *------------------------------------------------------------------------- */ -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 */ - - - for ( i = 0; i < table->nelems; i++) - { - /* make full path (start with "/") to compare correctly */ - if (HDstrncmp(table->objs[i].path, "/", 1)) - { - HDstrcpy(tbl_path, "/"); - HDstrcat(tbl_path, table->objs[i].path); - } - else - HDstrcpy(tbl_path, table->objs[i].path); - - /* found it */ - if (HDstrcmp(tbl_path, path)==0) - { - return (&table->objs[i]); - } - } - - return NULL; +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 */ + + for (i = 0; i < table->nelems; i++) { + /* make full path (start with "/") to compare correctly */ + if (HDstrncmp(table->objs[i].path, "/", 1)) { + HDstrcpy(tbl_path, "/"); + HDstrcat(tbl_path, table->objs[i].path); + } + else + HDstrcpy(tbl_path, table->objs[i].path); + + /* found it */ + if (HDstrcmp(tbl_path, path) == 0) { + return (&table->objs[i]); + } + } + + return NULL; } - - - -- cgit v0.12 From a1071ada16895400ab19e0d704a512b98d0c8cbb Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 9 Sep 2013 17:43:57 -0500 Subject: [svn-r24118] Comment out test until configure sets conditional correctly --- tools/h5repack/h5repack_plugin.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in index a45d1fe..e8ba83e 100644 --- a/tools/h5repack/h5repack_plugin.sh.in +++ b/tools/h5repack/h5repack_plugin.sh.in @@ -222,7 +222,7 @@ COPY_TESTFILES_TO_TESTDIR # Run the test arg="h5repack_layout.h5 -v -f UD=257,1,9" -TOOLTEST_DUMP plugin_test $arg +#TOOLTEST_DUMP plugin_test $arg # print results if test $nerrors -ne 0 ; then -- cgit v0.12 From b0d34310f5ff752c5ab1ef3a0c88229aea32c31f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 10 Sep 2013 08:59:22 -0500 Subject: [svn-r24119] Add new tests to memcheck ignore list --- config/cmake/CTestCustom.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index c16f9a6..cb32827 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -35,6 +35,7 @@ SET (CTEST_CUSTOM_MEMCHECK_IGNORE h5test-clear-error_test-objects h5test-clear-links_env-objects PERFORM_h5perform-clear-objects + HL_TOOLS-clear-objects hl_test-clear-objects hl_fortran_test-clear-objects ######### tools/h5copy ######### @@ -202,6 +203,7 @@ SET (CTEST_CUSTOM_MEMCHECK_IGNORE H5REPACK_VERIFY_LAYOUT-contig_small_fixed_compa #uses grepTest.cmake H5REPACK_VERIFY_LAYOUT_ALL-layout_long_switches #uses grepTest.cmake H5REPACK_VERIFY_LAYOUT_ALL-layout_short_switches #uses grepTest.cmake + H5REPACK-plugin ######### tools/h5stat ######### H5STAT-clearall-objects ######### tools/misc ######### -- cgit v0.12 From 175e82e4843dbf2d6bec7f7121798338f4564379 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 10 Sep 2013 09:24:34 -0500 Subject: [svn-r24120] HDFFV-8345: plugin test properly checks static-exec result to include test. Tested: jam --- aclocal.m4 | 3 +- configure | 94 ++++++++++-------------------------- configure.ac | 5 +- src/libhdf5.settings.in | 2 +- tools/h5repack/Makefile.am | 4 +- tools/h5repack/Makefile.in | 4 +- tools/h5repack/h5repack_plugin.sh.in | 2 +- 7 files changed, 37 insertions(+), 77 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 4e5a489..e6aae87 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -11,7 +11,6 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, @@ -373,7 +372,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue + test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the diff --git a/configure b/configure index dd8f3ea..f8c182f 100755 --- a/configure +++ b/configure @@ -691,6 +691,8 @@ USE_FILTER_SZIP USE_FILTER_DEFLATE AM_MAKEFLAGS LT_STATIC_EXEC +USE_PLUGINS_CONDITIONAL_FALSE +USE_PLUGINS_CONDITIONAL_TRUE CPP OTOOL64 OTOOL @@ -3235,7 +3237,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ## AM_INIT_AUTOMAKE takes a list of options that should be applied to ## every Makefile.am when automake is run. -am__api_version='1.13' +am__api_version='1.12' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -3419,8 +3421,8 @@ if test x"${MISSING+set}" != xset; then esac fi # Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 @@ -3660,45 +3662,6 @@ else fi rmdir .tst 2>/dev/null -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=1;; -esac -am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." @@ -3761,17 +3724,12 @@ mkdir_p='$(MKDIR_P)' # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar pax cpio none' - am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' - # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; @@ -12381,10 +12339,6 @@ _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= @@ -14963,14 +14917,10 @@ fi # before this can be enabled. hardcode_into_libs=yes - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" - + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -18862,14 +18812,10 @@ fi # before this can be enabled. hardcode_into_libs=yes - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" - + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -21742,14 +21688,10 @@ fi # before this can be enabled. hardcode_into_libs=yes - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" - + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -22096,12 +22038,22 @@ if test "X$STATIC_EXEC" = "Xyes"; then ## Issue a warning if -static flag is not supported. if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." + LT_STATIC_EXEC="" + else + LT_STATIC_EXEC="-all-static" fi - LT_STATIC_EXEC="-all-static" else echo "no" LT_STATIC_EXEC="" fi + if test "X$LT_STATIC_EXEC" = X; then + USE_PLUGINS_CONDITIONAL_TRUE= + USE_PLUGINS_CONDITIONAL_FALSE='#' +else + USE_PLUGINS_CONDITIONAL_TRUE='#' + USE_PLUGINS_CONDITIONAL_FALSE= +fi + @@ -33407,6 +33359,10 @@ if test -z "${CXX_SHARED_CONDITIONAL_TRUE}" && test -z "${CXX_SHARED_CONDITIONAL as_fn_error $? "conditional \"CXX_SHARED_CONDITIONAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${USE_PLUGINS_CONDITIONAL_TRUE}" && test -z "${USE_PLUGINS_CONDITIONAL_FALSE}"; then + as_fn_error $? "conditional \"USE_PLUGINS_CONDITIONAL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${BUILD_SHARED_SZIP_CONDITIONAL_TRUE}" && test -z "${BUILD_SHARED_SZIP_CONDITIONAL_FALSE}"; then as_fn_error $? "conditional \"BUILD_SHARED_SZIP_CONDITIONAL\" was never defined. @@ -35190,7 +35146,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} rm -f libhdf5.settings.TMP ;; "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Older Autoconf quotes --file arguments for eval, but not when files + # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in @@ -35241,7 +35197,7 @@ $as_echo X"$mf" | DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue + test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the diff --git a/configure.ac b/configure.ac index 0ae405e..be0d635 100644 --- a/configure.ac +++ b/configure.ac @@ -1046,12 +1046,15 @@ if test "X$STATIC_EXEC" = "Xyes"; then ## Issue a warning if -static flag is not supported. if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." + LT_STATIC_EXEC="" + else + LT_STATIC_EXEC="-all-static" fi - LT_STATIC_EXEC="-all-static" else echo "no" LT_STATIC_EXEC="" fi +AM_CONDITIONAL([USE_PLUGINS_CONDITIONAL], [test "X$LT_STATIC_EXEC" = X]) AC_SUBST([LT_STATIC_EXEC]) diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 343fa34..b594cc2 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -25,7 +25,7 @@ Compiling Options: AM_CPPFLAGS: @AM_CPPFLAGS@ Shared C Library: @enable_shared@ Static C Library: @enable_static@ - Statically Linked Executables: @STATIC_EXEC@ + Statically Linked Executables: @LT_STATIC_EXEC@ LDFLAGS: @LDFLAGS@ H5_LDFLAGS: @H5_LDFLAGS@ AM_LDFLAGS: @AM_LDFLAGS@ diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am index c52112b..663e501 100644 --- a/tools/h5repack/Makefile.am +++ b/tools/h5repack/Makefile.am @@ -30,7 +30,9 @@ noinst_PROGRAMS=testh5repack_detect_szip SCRIPT_DEPEND=h5repack$(EXEEXT) if HAVE_SHARED_CONDITIONAL - TEST_SCRIPT += h5repack_plugin.sh +if USE_PLUGINS_CONDITIONAL + TEST_SCRIPT += h5repack_plugin.sh +endif endif check_SCRIPTS=$(TEST_SCRIPT) diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index 1b87fd6..aa51cd1 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -74,7 +74,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am noinst_PROGRAMS = testh5repack_detect_szip$(EXEEXT) -@HAVE_SHARED_CONDITIONAL_TRUE@am__append_1 = h5repack_plugin.sh +@HAVE_SHARED_CONDITIONAL_TRUE@@USE_PLUGINS_CONDITIONAL_TRUE@am__append_1 = h5repack_plugin.sh check_PROGRAMS = $(am__EXEEXT_1) bin_PROGRAMS = h5repack$(EXEEXT) TESTS = $(am__EXEEXT_1) $(TEST_SCRIPT) @@ -507,7 +507,7 @@ h5repacktst_SOURCES = $(COMMON_SOURCES) h5repacktst.c testh5repack_detect_szip_SOURCES = testh5repack_detect_szip.c @HAVE_SHARED_CONDITIONAL_TRUE@lib_LTLIBRARIES = libdynlibadd.la @HAVE_SHARED_CONDITIONAL_TRUE@libdynlibadd_la_SOURCES = $(top_srcdir)/test/dynlib1.c -DISTCLEANFILES = h5repack.sh +DISTCLEANFILES = h5repack.sh h5repack_plugin.sh # 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., diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in index e8ba83e..a45d1fe 100644 --- a/tools/h5repack/h5repack_plugin.sh.in +++ b/tools/h5repack/h5repack_plugin.sh.in @@ -222,7 +222,7 @@ COPY_TESTFILES_TO_TESTDIR # Run the test arg="h5repack_layout.h5 -v -f UD=257,1,9" -#TOOLTEST_DUMP plugin_test $arg +TOOLTEST_DUMP plugin_test $arg # print results if test $nerrors -ne 0 ; then -- cgit v0.12 From 2465c432f02e70b733c2c3ebaf154c4b4811821e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 11 Sep 2013 12:09:06 -0500 Subject: [svn-r24124] HDFFV-8345: Changed usage txt to use dsetN instead ofletters for objects in examples. Tested: local linux --- tools/h5repack/h5repack_main.c | 111 ++++++++++------------------- tools/h5repack/testfiles/h5repack-help.txt | 10 +-- 2 files changed, 42 insertions(+), 79 deletions(-) diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 7af776d..4c512a4 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -61,81 +61,55 @@ static void usage(const char *prog) { printf(" file2 Output HDF5 File\n"); printf(" OPTIONS\n"); printf(" -h, --help Print a usage message and exit\n"); - printf( - " -v, --verbose Verbose mode, print object information\n"); + printf(" -v, --verbose Verbose mode, print object information\n"); printf(" -V, --version Print version number and exit\n"); - printf( - " -n, --native Use a native HDF5 type when repacking\n"); + printf(" -n, --native Use a native HDF5 type when repacking\n"); printf(" -L, --latest Use latest version of file format\n"); - printf( - " -c L1, --compact=L1 Maximum number of links in header messages\n"); - printf( - " -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); - printf( - " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); - printf( - " -m M, --minimum=M Do not apply the filter to datasets smaller than M\n"); - printf( - " -e E, --file=E Name of file E with the -f and -l options\n"); - printf( - " -u U, --ublock=U Name of file U with user block data to be added\n"); + printf(" -c L1, --compact=L1 Maximum number of links in header messages\n"); + printf(" -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); + printf(" -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); + printf(" -m M, --minimum=M Do not apply the filter to datasets smaller than M\n"); + printf(" -e E, --file=E Name of file E with the -f and -l options\n"); + printf(" -u U, --ublock=U Name of file U with user block data to be added\n"); printf(" -b B, --block=B Size of user block to be added\n"); - printf( - " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n"); + printf(" -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n"); printf(" -t T, --threshold=T Threshold value for H5Pset_alignment\n"); printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n"); printf(" -f FILT, --filter=FILT Filter type\n"); printf(" -l LAYT, --layout=LAYT Layout type\n"); - printf( - " -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n"); - printf( - " -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n"); - + printf(" -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n"); + printf(" -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n"); printf("\n"); - - printf( - " M - is an integer greater than 1, size of dataset in bytes (default is 0) \n"); + printf(" M - is an integer greater than 1, size of dataset in bytes (default is 0) \n"); printf(" E - is a filename.\n"); printf(" S - is an integer\n"); printf(" U - is a filename.\n"); printf(" T - is an integer\n"); printf(" A - is an integer greater than zero\n"); - printf( - " B - is the user block size, any value that is 512 or greater and is\n"); + printf(" B - is the user block size, any value that is 512 or greater and is\n"); printf(" a power of 2 (1024 default)\n"); - printf( - " F - is the shared object header message type, any of . If F is not specified, S applies to all messages\n"); + printf(" F - is the shared object header message type, any of . If F is not specified, S applies to all messages\n"); printf("\n"); - printf( - " FS_STRGY is the file space management strategy to use for the output file.\n"); + printf(" FS_STRGY is the file space management strategy to use for the output file.\n"); printf(" It is a string as listed below:\n"); - printf( - " ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n"); + printf(" ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n"); printf(" for file space allocation\n"); - printf( - " ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n"); + printf(" ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n"); printf(" for file space allocation\n"); - printf( - " AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n"); + printf(" AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n"); printf(" VFD - Use virtual file driver for file space allocation\n"); printf("\n"); - printf( - " FS_THRD is the free-space section threshold to use for the output file.\n"); - printf( - " It is the minimum size (in bytes) of free-space sections to be tracked\n"); + printf(" FS_THRD is the free-space section threshold to use for the output file.\n"); + printf(" It is the minimum size (in bytes) of free-space sections to be tracked\n"); printf(" by the the library's free-space managers.\n"); printf("\n"); - printf(" FILT - is a string with the format:\n"); printf("\n"); printf(" :=\n"); printf("\n"); - printf( - " is a comma separated list of object names, meaning apply\n"); - printf( - " compression only to those objects. If no names are specified, the filter\n"); + printf(" is a comma separated list of object names, meaning apply\n"); + printf(" compression only to those objects. If no names are specified, the filter\n"); printf(" is applied to all objects\n"); printf(" can be:\n"); printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n"); @@ -146,22 +120,17 @@ static void usage(const char *prog) { printf(" SOFF, to apply the HDF5 Scale/Offset filter\n"); printf(" UD, to apply a user defined filter\n"); printf(" NONE, to remove all filters\n"); - printf( - " is optional filter parameter information\n"); + printf(" is optional filter parameter information\n"); printf(" GZIP= from 1-9\n"); - printf( - " SZIP= pixels per block is a even number in\n"); + printf(" SZIP= pixels per block is a even number in\n"); printf(" 2-32 and coding method is either EC or NN\n"); printf(" SHUF (no parameter)\n"); printf(" FLET (no parameter)\n"); printf(" NBIT (no parameter)\n"); - printf( - " SOFF= scale_factor is an integer and scale_type\n"); + printf(" SOFF= scale_factor is an integer and scale_type\n"); printf(" is either IN or DS\n"); - printf( - " UD=\n"); - printf( - " required values for filter_number,cd_value_count,value_1\n"); + printf(" UD=\n"); + printf(" required values for filter_number,cd_value_count,value_1\n"); printf(" optional values for value_2 to value_N\n"); printf(" NONE (no parameter)\n"); printf("\n"); @@ -169,18 +138,15 @@ static void usage(const char *prog) { printf("\n"); printf(" :=\n"); printf("\n"); - printf( - " is a comma separated list of object names, meaning that\n"); - printf( - " layout information is supplied for those objects. If no names are\n"); + printf(" is a comma separated list of object names, meaning that\n"); + printf(" layout information is supplied for those objects. If no names are\n"); printf(" specified, the layout type is applied to all objects\n"); printf(" can be:\n"); printf(" CHUNK, to apply chunking layout\n"); printf(" COMPA, to apply compact layout\n"); printf(" CONTI, to apply contiguous layout\n"); printf(" is optional layout information\n"); - printf( - " CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); + printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); printf(" COMPA (no parameter)\n"); printf(" CONTI (no parameter)\n"); printf("\n"); @@ -190,21 +156,18 @@ static void usage(const char *prog) { printf("\n"); printf(" GZIP compression with level 1 to all objects\n"); printf("\n"); - printf("2) h5repack -v -f A:SZIP=8,NN file1 file2\n"); + printf("2) h5repack -v -f dset1:SZIP=8,NN file1 file2\n"); printf("\n"); - printf( - " SZIP compression with 8 pixels per block and NN coding method to object A\n"); + printf(" SZIP compression with 8 pixels per block and NN coding method to object dset1\n"); printf("\n"); - printf("3) h5repack -v -l A,B:CHUNK=20x10 -f C,D,F:NONE file1 file2\n"); + printf("3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2\n"); printf("\n"); - printf( - " Chunked layout, with a layout size of 20x10, to objects A and B\n"); - printf(" and remove filters to objects C, D, F\n"); + printf(" Chunked layout, with a layout size of 20x10, to objects dset1 and dset2\n"); + printf(" and remove filters to objects dset3, dset4, dset5\n"); printf("\n"); printf("4) h5repack -L -c 10 -s 20:dtype file1 file2 \n"); printf("\n"); - printf( - " Using latest file format with maximum compact group size of 10 and\n"); + printf(" Using latest file format with maximum compact group size of 10 and\n"); printf(" and minimum shared datatype size of 20\n"); printf("\n"); printf("5) h5repack -f SHUF -f GZIP=1 file1 file2 \n"); diff --git a/tools/h5repack/testfiles/h5repack-help.txt b/tools/h5repack/testfiles/h5repack-help.txt index 6de1eb4..c70b031 100644 --- a/tools/h5repack/testfiles/h5repack-help.txt +++ b/tools/h5repack/testfiles/h5repack-help.txt @@ -98,14 +98,14 @@ Examples of use: GZIP compression with level 1 to all objects -2) h5repack -v -f A:SZIP=8,NN file1 file2 +2) h5repack -v -f dset1:SZIP=8,NN file1 file2 - SZIP compression with 8 pixels per block and NN coding method to object A + SZIP compression with 8 pixels per block and NN coding method to object dset1 -3) h5repack -v -l A,B:CHUNK=20x10 -f C,D,F:NONE file1 file2 +3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2 - Chunked layout, with a layout size of 20x10, to objects A and B - and remove filters to objects C, D, F + Chunked layout, with a layout size of 20x10, to objects dset1 and dset2 + and remove filters to objects dset3, dset4, dset5 4) h5repack -L -c 10 -s 20:dtype file1 file2 -- cgit v0.12 From 9feb3e641d66703bbe9136700840e11b0ec45a11 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 12 Sep 2013 10:13:37 -0500 Subject: [svn-r24126] Correct mac pinifo.list vars --- CMakeInstallation.cmake | 15 ++++++----- config/cmake/CPack.Info.plist.in | 57 ++++++++++++++++++---------------------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 8a7cf16..4a81cf9 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -230,6 +230,15 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) SET (CPACK_SET_DESTDIR TRUE) # Required when packaging, and set CMAKE_INSTALL_PREFIX to "/". LIST (APPEND CPACK_GENERATOR "Bundle") + SET (CPACK_BUNDLE_NAME "${HDF5_PACKAGE_STRING}") + SET (CPACK_BUNDLE_LOCATION "/") # make sure CMAKE_INSTALL_PREFIX ends in / + SET (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/") + SET (CPACK_BUNDLE_ICON "${HDF5_RESOURCES_DIR}/hdf.gif") + SET (CPACK_BUNDLE_PLIST "${HDF5_BINARY_DIR}/CMakeFiles/Info.plist") +# SET (CPACK_BUNDLE_STARTUP_COMMAND "${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-startup.sh") + SET (CPACK_APPLE_GUI_INFO_STRING "HDF5 (Hierarchical Data Format 5) Software Library and Utilities") + SET (CPACK_APPLE_GUI_COPYRIGHT "Copyright © 2006-2013 by The HDF Group. All rights reserved.") + SET (CPACK_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION}") #----------------------------------------------------------------------------- # Configure the Info.plist file for the install bundle #----------------------------------------------------------------------------- @@ -237,12 +246,6 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) ${HDF5_RESOURCES_DIR}/CPack.Info.plist.in ${HDF5_BINARY_DIR}/CMakeFiles/Info.plist @ONLY ) - SET (CPACK_BUNDLE_NAME "${HDF5_PACKAGE_STRING}") - SET (CPACK_BUNDLE_LOCATION "/") # make sure CMAKE_INSTALL_PREFIX ends in / - SET (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/") - SET (CPACK_BUNDLE_ICON "${HDF5_RESOURCES_DIR}/hdf.gif") - SET (CPACK_BUNDLE_PLIST "${HDF5_BINARY_DIR}/CMakeFiles/Info.plist") -# SET (CPACK_BUNDLE_STARTUP_COMMAND "${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-startup.sh") ELSE (WIN32) SET (CPACK_PACKAGING_INSTALL_PREFIX "/usr") SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) diff --git a/config/cmake/CPack.Info.plist.in b/config/cmake/CPack.Info.plist.in index a701a61..6cf2a94 100644 --- a/config/cmake/CPack.Info.plist.in +++ b/config/cmake/CPack.Info.plist.in @@ -1,37 +1,32 @@ - -IFMajorVersion -@CPACK_PACKAGE_VERSION_MAJOR@ -IFMinorVersion -@CPACK_PACKAGE_VERSION_MINOR@ -IFPkgFlagAllowBackRev - -IFPkgFlagAuthorizationAction -AdminAuthorization -IFPkgFlagDefaultLocation -@CPACK_PACKAGE_DEFAULT_LOCATION@ -IFPkgFlagInstallFat - -IFPkgFlagIsRequired - -IFPkgFlagOverwritePermissions - -IFPkgFlagRelocatable -<@CPACK_PACKAGE_RELOCATABLE@/> -IFPkgFlagRestartAction -NoRestart -IFPkgFlagRootVolumeOnly - -IFPkgFlagUpdateInstalledLanguages - -IFPkgFlagUseUserMask - -IFPkgFormatVersion -0.10000000149011612 -CFBundleIdentifier -org.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@ + CFBundleDevelopmentRegion + English + CFBundleExecutable + @CPACK_PACKAGE_FILE_NAME@ + CFBundleIconFile + @CPACK_BUNDLE_ICON@ + CFBundleIdentifier + org.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@ + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + @CPACK_PACKAGE_VERSIO@ + CFBundleShortVersionString + @CPACK_SHORT_VERSION_STRING@ + CSResourcesFileMapped + + CFBundleName + @CPACK_BUNDLE_NAME@ + CFBundleGetInfoString + @CPACK_APPLE_GUI_INFO_STRING@ + NSHumanReadableCopyright + @CPACK_APPLE_GUI_COPYRIGHT@ -- cgit v0.12 From d088d3285c34f6ae3b02337d6dfcca17bcb9c7c3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 12 Sep 2013 11:09:42 -0500 Subject: [svn-r24127] Comment out bundle packing --- CMakeInstallation.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 4a81cf9..aa34b9c 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -229,7 +229,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) SET (CPACK_PACKAGE_ICON "${HDF5_RESOURCES_DIR}/hdf.gif") SET (CPACK_SET_DESTDIR TRUE) # Required when packaging, and set CMAKE_INSTALL_PREFIX to "/". - LIST (APPEND CPACK_GENERATOR "Bundle") +# LIST (APPEND CPACK_GENERATOR "Bundle") SET (CPACK_BUNDLE_NAME "${HDF5_PACKAGE_STRING}") SET (CPACK_BUNDLE_LOCATION "/") # make sure CMAKE_INSTALL_PREFIX ends in / SET (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/") -- cgit v0.12 From 06828464790a100546de1cbb2a52ae6a33f67e32 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 12 Sep 2013 13:12:34 -0500 Subject: [svn-r24128] Change option name for WDTP --- CMakeFilters.cmake | 10 +++++----- release_docs/INSTALL_CMake.txt | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 01594d0..bc78fa6 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -25,11 +25,11 @@ IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT SET (ZLIB_URL ${ZLIB_SVN_URL}) SET (SZIP_URL ${SZIP_SVN_URL}) ELSEIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - IF (NOT TGZ_PATH) - SET (TGZ_PATH ${HDF5_SOURCE_DIR}) - ENDIF (NOT TGZ_PATH) - SET (ZLIB_URL ${TGZ_PATH}/${ZLIB_TGZ_NAME}) - SET (SZIP_URL ${TGZ_PATH}/${SZIP_TGZ_NAME}) + IF (NOT TGZPATH) + SET (TGZPATH ${HDF5_SOURCE_DIR}) + ENDIF (NOT TGZPATH) + SET (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME}) + SET (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME}) ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") SET (ZLIB_USE_EXTERNAL 0) SET (SZIP_USE_EXTERNAL 0) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 95ebec9..5594610 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -102,7 +102,7 @@ II. Preconditions HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" ZLIB_TGZ_NAME:STRING="zlib_src.ext" SZIP_TGZ_NAME:STRING="szip_src.ext" - TGZ_PATH:STRING="some_location" + TGZPATH:STRING="some_location" where "some_location" is the URL or full path to the compressed file and ext is the type of compression file. @@ -327,7 +327,7 @@ These five steps are described in detail below. file) are: ZLIB_TGZ_NAME:STRING="zlib_src.ext" SZIP_TGZ_NAME:STRING="szip_src.ext" - TGZ_PATH:STRING="some_location" + TGZPATH:STRING="some_location" where "some_location/xxxx_src.ext" is the URL or full path to the compressed file and where ext is the type of the compression file such as .bz2, .tar, .tar.gz, .tgz, or .zip. -- cgit v0.12 From f6949a66d7bef00c15ee7542f3e3503ffae75877 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 13 Sep 2013 14:22:57 -0500 Subject: [svn-r24136] Add base set of warnings for gcc --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ddc562..fde7616 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -460,6 +460,7 @@ ENDIF (HDF5_DISABLE_COMPILER_WARNINGS) # break into groups (from the config/gnu-flags file) #----------------------------------------------------------------------------- IF (NOT MSVC) + SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline") # Append warning flags # Don't use the '-Wtraditional' flag, we're way past having K&R C code # SET (H5_CFLAGS "${H5_CFLAGS} -Wtraditional") -- cgit v0.12 From 3c021d3a7775df18247de19cee3805178cd2666c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 13 Sep 2013 15:34:55 -0500 Subject: [svn-r24137] Cast constants to specified type. Cast smaller vars to larger type. Cast calculation result to correct type. Tested: local linux --- tools/h5ls/h5ls.c | 70 +++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 832d91f..14fdb65 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1460,13 +1460,13 @@ dump_dataset_values(hid_t dset) /* Print all the values. */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Data:\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 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; if (h5tools_dump_dset(rawoutstream, info, &ctx, dset, -1, NULL) < 0) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Unable to print data."); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } H5Tclose(f_type); @@ -1534,7 +1534,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, case H5S_SCALAR: /* scalar dataspace */ h5tools_str_append(&buffer, " scalar\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 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: @@ -1545,20 +1545,20 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, nelmts *= size[i]; } h5tools_str_append(&buffer, "}\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 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, info->line_ncols, 0, 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, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); break; } /* end switch */ @@ -1567,7 +1567,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, h5tools_str_append(&buffer, " Type: "); print_type(&buffer, type, 15); h5tools_str_append(&buffer, "\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Data */ outputformat = *info; @@ -1583,7 +1583,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, else { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Data:\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); outputformat.line_1st = NULL; outputformat.line_pre = " %s "; outputformat.line_cont = " %s "; @@ -1719,7 +1719,7 @@ dataset_list1(hid_t dset) if (space_type==H5S_SCALAR) h5tools_str_append(&buffer, "SCALAR"); else if (space_type==H5S_NULL) h5tools_str_append(&buffer, "NULL"); h5tools_str_append(&buffer, "}"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + 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); @@ -1786,7 +1786,7 @@ dataset_list2(hid_t dset, const char UNUSED *name) if (H5D_CHUNKED==H5Pget_layout(dcpl)) { hsize_t chsize[64]; /* chunk size in elements */ - ndims = H5Pget_chunk(dcpl, NELMTS(chsize), chsize/*out*/); + ndims = H5Pget_chunk(dcpl, (int)NELMTS(chsize), chsize/*out*/); h5tools_str_append(&buffer, " %-10s {", "Chunks:"); total = H5Tget_size(type); for (i=0; iline_ncols, 0, 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) @@ -1959,7 +1959,7 @@ datatype_list2(hid_t type, const char 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, info->line_ncols, 0, 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); } @@ -2009,7 +2009,7 @@ 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, info->line_ncols, 0, 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) { @@ -2019,7 +2019,7 @@ 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, info->line_ncols, 0, 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 = (-1); /* ID of object opened */ @@ -2030,7 +2030,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void if(obj_type >= 0 && (obj = 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, info->line_ncols, 0, 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 */ @@ -2040,7 +2040,7 @@ 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, info->line_ncols, 0, 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 @@ -2058,7 +2058,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr); h5tools_str_append(&buffer, " %-10s %u\n", "Links:", (unsigned)oinfo->rc); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + 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) { @@ -2073,7 +2073,7 @@ 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, info->line_ncols, 0, 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 */ @@ -2093,7 +2093,7 @@ 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, info->line_ncols, 0, 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); } @@ -2113,7 +2113,7 @@ done: if(iter->symlink_target) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "}\n"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 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); @@ -2180,7 +2180,7 @@ 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, info->line_ncols, 0, 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; @@ -2191,10 +2191,10 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) 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, info->line_ncols, 0, 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, info->line_ncols, 0, 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) @@ -2220,7 +2220,7 @@ 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, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } break; @@ -2252,7 +2252,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) h5tools_str_append(&buffer, "/"); h5tools_str_append(&buffer, path); h5tools_str_append(&buffer, "}"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + 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 */ @@ -2266,10 +2266,10 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) 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, info->line_ncols, 0, 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, info->line_ncols, 0, 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) @@ -2304,7 +2304,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) 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, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); break; } /* end switch */ @@ -2355,7 +2355,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) } else print_obj_name(&buffer, iter, oname, "**NOT FOUND**"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 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 */ @@ -2365,7 +2365,7 @@ 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, info->line_ncols, 0, 0); + 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. */ @@ -2459,7 +2459,7 @@ get_width(void) { /* Unix with ioctl(TIOCGWINSZ) */ struct winsize w; - if (ioctl(2, 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) @@ -2616,9 +2616,9 @@ main(int argc, const char *argv[]) simple_output_g = TRUE; } else if(!HDstrcmp(argv[argno], "--string")) { string_g = TRUE; - } else if(!HDstrncmp(argv[argno], "--vfd=", 6)) { + } else if(!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) { preferred_driver = argv[argno]+6; - } else if(!HDstrncmp(argv[argno], "--width=", 8)) { + } else if(!HDstrncmp(argv[argno], "--width=", (size_t)8)) { width_g = (int)HDstrtol(argv[argno]+8, &rest, 0); if(0 == width_g) @@ -2646,7 +2646,7 @@ main(int argc, const char *argv[]) leave(EXIT_SUCCESS); } else if(!HDstrcmp(argv[argno], "--hexdump")) { hexdump_g = TRUE; - } else if(!HDstrncmp(argv[argno], "-w", 2)) { + } else if(!HDstrncmp(argv[argno], "-w", (size_t)2)) { if(argv[argno][2]) { s = argv[argno] + 2; } else if((argno + 1) >= argc) { @@ -2856,7 +2856,7 @@ main(int argc, const char *argv[]) h5tools_str_reset(&buffer); print_obj_name(&buffer, &iter, oname, "**NOT FOUND**"); - h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + 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 */ -- cgit v0.12 From a8c63e28d570c1eea5a23b9ed684efb4cd24e3ba Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 13 Sep 2013 16:11:30 -0500 Subject: [svn-r24138] Cast constants to specified type. Cast smaller vars to larger type. Cast calculation result to correct type. Changed int member to hbool_t Tested: local linux --- tools/h5diff/h5diff_common.c | 7 ++++--- tools/lib/h5diff.c | 14 +++++++------- tools/lib/h5diff.h | 2 +- tools/lib/h5diff_array.c | 10 +++++----- tools/lib/h5diff_attr.c | 12 ++++++------ tools/lib/h5tools_filters.c | 2 +- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index b8e46f3..cf46e74 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -15,6 +15,7 @@ #include #include +#include "H5private.h" #include "h5diff.h" #include "h5diff_common.h" #include "h5tools.h" @@ -135,7 +136,7 @@ void parse_command_line(int argc, options->m_verbose_level = 0; break; } - else if (!strncmp (argv[i], "-v", 2)) + else if (!strncmp (argv[i], "-v", (size_t)2)) { options->m_verbose_level = atoi(&argv[i][2]); break; @@ -149,7 +150,7 @@ void parse_command_line(int argc, options->m_verbose_level = 0; break; } - else if ( !strncmp (argv[i], "--verbose", 9) && argv[i][9]=='=') + else if ( !strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') { options->m_verbose_level = atoi(&argv[i][10]); break; @@ -164,7 +165,7 @@ void parse_command_line(int argc, options->m_report = 1; break; case 'l': - options->follow_links = 1; + options->follow_links = TRUE; break; case 'x': options->no_dangle_links = 1; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 1752155..541525d 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -839,10 +839,10 @@ hsize_t h5diff(const char *fname1, { h5difftrace("h5diff no object specified\n"); /* set root group */ - obj1fullname = (char*)HDcalloc(2, sizeof(char)); + obj1fullname = (char*)HDcalloc((size_t)2, sizeof(char)); HDstrcat(obj1fullname, "/"); obj1type = H5TRAV_TYPE_GROUP; - obj2fullname = (char*)HDcalloc(2, sizeof(char)); + obj2fullname = (char*)HDcalloc((size_t)2, sizeof(char)); HDstrcat(obj2fullname, "/"); obj2type = H5TRAV_TYPE_GROUP; } @@ -1554,9 +1554,9 @@ hsize_t diff(hid_t file1_id, hid_t grp1_id = (-1); hid_t grp2_id = (-1); int ret; - int is_dangle_link1 = 0; - int is_dangle_link2 = 0; - int is_hard_link = 0; + hbool_t is_dangle_link1 = FALSE; + hbool_t is_dangle_link2 = FALSE; + hbool_t is_hard_link = FALSE; hsize_t nfound = 0; h5trav_type_t object_type; @@ -1598,7 +1598,7 @@ hsize_t diff(hid_t file1_id, goto out; } else - is_dangle_link1 = 1; + is_dangle_link1 = TRUE; } else if (ret < 0) goto out; @@ -1616,7 +1616,7 @@ hsize_t diff(hid_t file1_id, goto out; } else - is_dangle_link2 = 1; + is_dangle_link2 = TRUE; } else if (ret < 0) goto out; diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 9e1c8bb..04b640f 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -71,7 +71,7 @@ typedef struct { double percent; /* relative error value */ int n; /* count, compare up to count */ hsize_t count; /* count value */ - int follow_links; /* follow symbolic links */ + hbool_t follow_links; /* follow symbolic links */ int no_dangle_links; /* return error when find dangling link */ int err_stat; /* an error ocurred (1, error, 0, no error) */ int cmn_objs; /* do we have common objects */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 7dba0e5..d08c23f 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -5792,14 +5792,14 @@ int ull2float(unsigned long long ull_value, float *f_value) src_size = H5Tget_size(H5T_NATIVE_ULLONG); dst_size = H5Tget_size(H5T_NATIVE_FLOAT); - buf = (unsigned char*)HDcalloc(1, MAX(src_size, dst_size)); + buf = (unsigned char*)HDcalloc((size_t)1, MAX(src_size, dst_size)); if(!buf) goto error; HDmemcpy(buf, &ull_value, src_size); /* do conversion */ - if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, 1, buf, NULL, dxpl_id)<0) + if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id)<0) goto error; HDmemcpy(f_value, buf, dst_size); @@ -6358,9 +6358,9 @@ static void get_member_types(hid_t tid, mcomp_t *members) return; members->n = (unsigned)nmembs; - members->ids = (hid_t *)HDcalloc(members->n, sizeof(hid_t)); - members->offsets = (size_t *)HDcalloc(members->n, sizeof(size_t)); - members->m = (mcomp_t **)HDcalloc(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++) { diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index ef1d761..44b623f 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -169,7 +169,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr1_id, ATTR_NAME_MAX, name1) < 0) + if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) goto error; /*------------------ @@ -177,7 +177,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr2_id, ATTR_NAME_MAX, name2) < 0) + if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) goto error; /* criteria is string compare */ @@ -225,7 +225,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr1_id, ATTR_NAME_MAX, name1) < 0) + if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) goto error; table_attr_mark_exist(infile, name1, table_lp); @@ -247,7 +247,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr2_id, ATTR_NAME_MAX, name2) < 0) + if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) goto error; table_attr_mark_exist(infile, name2, table_lp); @@ -447,8 +447,8 @@ hsize_t diff_attr(hid_t loc1_id, for(j = 0; j < rank1; j++) nelmts1 *= dims1[j]; - buf1 = (void *)HDmalloc((unsigned)(nelmts1 * msize1)); - buf2 = (void *)HDmalloc((unsigned)(nelmts1 * msize2)); + buf1 = (void *)HDmalloc((size_t)(nelmts1 * msize1)); + buf2 = (void *)HDmalloc((size_t)(nelmts1 * msize2)); if(buf1 == NULL || buf2 == NULL) { parallel_print( "cannot read into memory\n" ); goto error; diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 341a5c9..2da21ef 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -62,7 +62,7 @@ int 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, 0, 0, NULL)) < 0) + if((filtn = H5Pget_filter2(dcpl_id, (unsigned)i, 0, 0, 0, (size_t)0, 0, NULL)) < 0) return -1; switch(filtn) -- cgit v0.12 From 309f3e7a23805c7be1fb65e00338fea831f977e7 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Fri, 13 Sep 2013 16:49:39 -0500 Subject: [svn-r24139] Remove "will never be exectued" warnings in H5detect.c Tested: jam, koala, ostrich (h5committest) --- src/H5detect.c | 116 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 74 insertions(+), 42 deletions(-) diff --git a/src/H5detect.c b/src/H5detect.c index 2bf0d2d..caed569 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -200,15 +200,17 @@ precision (detected_t *d) } } - /*------------------------------------------------------------------------- - * Function: DETECT_I + * Function: DETECT_I/DETECT_BYTE * - * Purpose: This macro takes a type like `int' and a base name like + * Purpose: These macro takes a type like `int' and a base name like * `nati' and detects the byte order. The VAR is used to * construct the names of the C variables defined. * + * DETECT_I is used for types that are larger than one byte, + * DETECT_BYTE is used for types that are exactly one byte. + * * Return: void * * Programmer: Robb Matzke @@ -229,46 +231,52 @@ precision (detected_t *d) * Robb Matzke, 5 Nov 1996 * Removed HFILE and CFILE arguments. * + * Neil Fortner, 6 Sep 2013 + * Split macro into DETECT_I and DETECT_BYTE macros, extracted + * common cod einto DETECT_I_BYTE_CORE. This was done to remove + * "will never be executed" warnings. + * *------------------------------------------------------------------------- */ -#define DETECT_I(TYPE,VAR,INFO) { \ - TYPE _v; \ - int _int_v; \ - int _i, _j; \ - unsigned char *_x; \ +#define DETECT_I_BYTE_CORE(TYPE,VAR,INFO,DETECT_TYPE) { \ + DETECT_TYPE _v; \ + int _i, _j; \ + unsigned char *_x; \ \ - HDmemset(&INFO, 0, sizeof(INFO)); \ - INFO.varname = #VAR; \ - INFO.size = sizeof(TYPE); \ + HDmemset(&INFO, 0, sizeof(INFO)); \ + INFO.varname = #VAR; \ + INFO.size = sizeof(TYPE); \ \ - if(sizeof(TYPE) != 1) { \ - for(_i = sizeof(TYPE), _v = 0; _i > 0; --_i) \ - _v = (_v << 8) + _i; \ - for(_i = 0, _x = (unsigned char *)&_v; _i < (signed)sizeof(TYPE); _i++) { \ - _j = (*_x++) - 1; \ - HDassert(_j < (signed)sizeof(TYPE)); \ - INFO.perm[_i] = _j; \ - } /* end for */ \ - } else { /*Not able to detect order if type size is 1 byte. Use native int \ - *instead. No effect on data, just make it look correct. */ \ - for(_i = sizeof(int), _int_v = 0; _i > 0; --_i) \ - _int_v = (_int_v << 8) + _i; \ - for(_i = 0, _x = (unsigned char *)&_int_v; _i < (signed)sizeof(int); _i++) { \ - _j = (*_x++)-1; \ - HDassert(_j < (signed)sizeof(int)); \ - INFO.perm[_i] = _j; \ - } /* end for */ \ - } /* end else */ \ + for(_i = sizeof(DETECT_TYPE), _v = 0; _i > 0; --_i) \ + _v = (_v << 8) + _i; \ + for(_i = 0, _x = (unsigned char *)&_v; _i < (signed)sizeof(DETECT_TYPE); _i++) { \ + _j = (*_x++) - 1; \ + HDassert(_j < (signed)sizeof(DETECT_TYPE)); \ + INFO.perm[_i] = _j; \ + } /* end for */ \ \ - INFO.sign = ('U' != *(#VAR)); \ - precision (&(INFO)); \ - ALIGNMENT(TYPE, INFO); \ - if(!HDstrcmp(INFO.varname, "SCHAR") || !HDstrcmp(INFO.varname, "SHORT") || \ - !HDstrcmp(INFO.varname, "INT") || !HDstrcmp(INFO.varname, "LONG") || \ - !HDstrcmp(INFO.varname, "LLONG")) { \ - COMP_ALIGNMENT(TYPE, INFO.comp_align); \ - } \ + INFO.sign = ('U' != *(#VAR)); \ + precision (&(INFO)); \ + ALIGNMENT(TYPE, INFO); \ + if(!HDstrcmp(INFO.varname, "SCHAR") || !HDstrcmp(INFO.varname, "SHORT") || \ + !HDstrcmp(INFO.varname, "INT") || !HDstrcmp(INFO.varname, "LONG") || \ + !HDstrcmp(INFO.varname, "LLONG")) { \ + COMP_ALIGNMENT(TYPE, INFO.comp_align); \ + } \ +} + +#define DETECT_BYTE(TYPE,VAR,INFO) { \ + HDcompile_assert(sizeof(TYPE) == 1); \ + \ + DETECT_I_BYTE_CORE(TYPE,VAR,INFO,int) \ } + +#define DETECT_I(TYPE,VAR,INFO) { \ + HDcompile_assert(sizeof(TYPE) > 1); \ + \ + DETECT_I_BYTE_CORE(TYPE,VAR,INFO,TYPE) \ +} + /*------------------------------------------------------------------------- * Function: DETECT_F @@ -939,7 +947,7 @@ bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b) for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { if ((aa & 1) != (bb & 1)) return i * 8 + j; } - HDassert("INTERNAL ERROR" && 0); + fprintf(stderr, "INTERNAL ERROR"); HDabort(); } } @@ -1279,8 +1287,8 @@ bit.\n"; static void detect_C89_integers(void) { - DETECT_I(signed char, SCHAR, d_g[nd_g]); nd_g++; - DETECT_I(unsigned char, UCHAR, d_g[nd_g]); nd_g++; + DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; + DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++; DETECT_I(int, INT, d_g[nd_g]); nd_g++; @@ -1330,22 +1338,46 @@ static void detect_C99_integers8(void) { #if H5_SIZEOF_INT8_T>0 + #if H5_SIZEOF_INT8_T==1 + DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; + #else DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++; + #endif #endif #if H5_SIZEOF_UINT8_T>0 - DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; + #if H5_SIZEOF_UINT8_T==1 + DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; + #else + DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; + #endif #endif #if H5_SIZEOF_INT_LEAST8_T>0 + #if H5_SIZEOF_INT_LEAST8_T==1 + DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + #else DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + #endif #endif #if H5_SIZEOF_UINT_LEAST8_T>0 + #if H5_SIZEOF_UINT_LEAST8_T==1 + DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + #else DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + #endif #endif #if H5_SIZEOF_INT_FAST8_T>0 + #if H5_SIZEOF_INT_FAST8_T==1 + DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; + #else DETECT_I(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; + #endif #endif #if H5_SIZEOF_UINT_FAST8_T>0 - DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + #if H5_SIZEOF_UINT_FAST8_T==1 + DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + #else + DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + #endif #endif } -- cgit v0.12 From a80cf34324810aa52c97586950606bbfc64b0e37 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Fri, 13 Sep 2013 17:03:22 -0500 Subject: [svn-r24140] Purpose: Remove problematic abandonment of error stack Description: H5Fis_hdf5 uses H5F_locate_signature to check if the file is hdf5. If it does not locate the signature, H5F_locate_signature would issue an error and return HADDR_UNDEF. H5Fis_hdf5 does not consider it an error if the signature is not found, so it does not issue an error or clear the stack. The filled stack could then cause issues later on. Changed H5F_locate_signature to return herr_t, not issue an error if the signature is not found, and added a parameter for a pointer to the signature address that the function fills in. Tested: jam, koala, ostrich (h5committest) --- src/H5F.c | 13 +++++++----- src/H5Fpkg.h | 2 +- src/H5Fsuper.c | 62 ++++++++++++++++++++++++++++++---------------------------- 3 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 78fe79f..676daef 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -825,22 +825,25 @@ done: htri_t H5Fis_hdf5(const char *name) { - H5FD_t *file = NULL; /* Low-level file struct */ - htri_t ret_value; /* Return value */ + H5FD_t *file = NULL; /* Low-level file struct */ + haddr_t sig_addr; /* Address of hdf5 file signature */ + htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "*s", name); /* Check args and all the boring stuff. */ if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") /* Open the file at the virtual file layer */ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") /* The file is an hdf5 file if the hdf5 file signature can be found */ - ret_value = (HADDR_UNDEF != H5F_locate_signature(file, H5AC_ind_dxpl_id)); + if(H5F_locate_signature(file, H5AC_ind_dxpl_id, &sig_addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature") + ret_value = (HADDR_UNDEF != sig_addr); done: /* Close the file */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2465222..5d4ca2f 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -296,7 +296,7 @@ H5_DLLVAR const H5AC_class_t H5AC_SUPERBLOCK[1]; /* General routines */ H5_DLL herr_t H5F_init(void); -H5_DLL haddr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id); +H5_DLL herr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id, haddr_t *sig_addr); H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing); /* File mount related routines */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 8205392..a1c67ec 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -100,34 +100,33 @@ H5F_init_super_interface(void) /*------------------------------------------------------------------------- - * Function: H5F_locate_signature + * Function: H5F_locate_signature * - * Purpose: Finds the HDF5 superblock signature in a file. The signature - * can appear at address 0, or any power of two beginning with - * 512. + * Purpose: Finds the HDF5 superblock signature in a file. The + * signature can appear at address 0, or any power of two + * beginning with 512. * - * Return: Success: The absolute format address of the signature. - * - * Failure: HADDR_UNDEF + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * Programmer: Robb Matzke + * Friday, November 7, 1997 * *------------------------------------------------------------------------- */ -haddr_t -H5F_locate_signature(H5FD_t *file, hid_t dxpl_id) +herr_t +H5F_locate_signature(H5FD_t *file, hid_t dxpl_id, haddr_t *sig_addr) { - haddr_t addr, eoa; - uint8_t buf[H5F_SIGNATURE_LEN]; - unsigned n, maxpow; - haddr_t ret_value; /* Return value */ + haddr_t addr, eoa; + uint8_t buf[H5F_SIGNATURE_LEN]; + unsigned n, maxpow; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Find the least N such that 2^N is larger than the file size */ if(HADDR_UNDEF == (addr = H5FD_get_eof(file)) || HADDR_UNDEF == (eoa = H5FD_get_eoa(file, H5FD_MEM_SUPER))) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to obtain EOF/EOA value") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to obtain EOF/EOA value") for(maxpow = 0; addr; maxpow++) addr >>= 1; maxpow = MAX(maxpow, 9); @@ -137,26 +136,27 @@ H5F_locate_signature(H5FD_t *file, hid_t dxpl_id) * powers of two larger than 9. */ for(n = 8; n < maxpow; n++) { - addr = (8 == n) ? 0 : (haddr_t)1 << n; - if(H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to set EOA value for file signature") - if(H5FD_read(file, dxpl_id, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to read file signature") - if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) + addr = (8 == n) ? 0 : (haddr_t)1 << n; + if(H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to set EOA value for file signature") + if(H5FD_read(file, dxpl_id, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature") + if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) break; } /* end for */ /* * If the signature was not found then reset the EOA value and return - * failure. + * HADDR_UNDEF. */ if(n >= maxpow) { - (void)H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa); /* Ignore return value */ - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to find a valid file signature") + if(H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value") + *sig_addr = HADDR_UNDEF; } /* end if */ - - /* Set return value */ - ret_value = addr; + else + /* Set return value */ + *sig_addr = addr; done: FUNC_LEAVE_NOAPI(ret_value) @@ -330,8 +330,10 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) /* Find the superblock */ - if(HADDR_UNDEF == (super_addr = H5F_locate_signature(f->shared->lf, dxpl_id))) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to find file signature") + if(H5F_locate_signature(f->shared->lf, dxpl_id, &super_addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature") + if(HADDR_UNDEF == super_addr) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "file signature not found") /* Check for userblock present */ if(H5F_addr_gt(super_addr, 0)) { -- cgit v0.12 From 27ed849cad4c7e88a540a34f46e70acde04721da Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sat, 14 Sep 2013 22:53:59 -0500 Subject: [svn-r24142] Purpose: Fix bug in tests Description: - Passing the c_str() of an std string into a C function caused failure on OpenVMS. Added a work around using temporary string. (th5s.cpp) - Passing incorrect file access property list caused test_datasize() to fail. Fixed. - Close a group in test_dset, before the file can be properly closed. This should fix the problem on OpenVMS. Platforms tested: Linux/32 2.6 (jam) SunOS 5.11 (emu) Linux/ppc64 (ostrich) --- c++/test/dsets.cpp | 9 ++++++--- c++/test/th5s.cpp | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 643762b..58436f1 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -283,13 +283,13 @@ test_simple_io( H5File& file) *------------------------------------------------------------------------- */ static herr_t -test_datasize() +test_datasize(FileAccPropList &fapl) { SUBTEST("DataSet::getInMemDataSize()"); try { // Open FILE1. - H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, FileAccPropList::DEFAULT); + H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); // Open dataset DSET_SIMPLE_IO_NAME. DataSet dset = file.openDataSet (DSET_SIMPLE_IO_NAME); @@ -1067,9 +1067,12 @@ void test_dset() nerrors += test_multiopen (file)<0 ?1:0; nerrors += test_types(file)<0 ?1:0; + // Close group "emit diagnostics". + grp.close(); + // Close the file before testing data size. file.close(); - nerrors += test_datasize() <0 ? 1:0; + nerrors += test_datasize(fapl) <0 ? 1:0; } catch (Exception E) { diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 7947a9b..cfdeb1f 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -188,7 +188,10 @@ static void test_h5s_basic() * If this test fails and the H5S_MAX_RANK variable has changed, follow * the instructions in space_overflow.c for regenating the th5s.h5 file. */ - const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str()); + char *tmp_str = new char[TESTFILE.length()+1]; + strcpy(tmp_str, TESTFILE.c_str()); + const char *testfile = H5_get_srcdir_filename(tmp_str); + delete []tmp_str; // Create file H5File fid1(testfile, H5F_ACC_RDONLY); -- cgit v0.12 From afb5fc5c35eaa01b086390ab8691aea49a4a93a4 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 16 Sep 2013 09:39:52 -0500 Subject: [svn-r24143] Description: Fixed comments, documentation, and mis-matched DOXYGEN_SHOULD_SKIP_THIS pairs. Platforms tested: Linux/32 2.6 (jam) Regenerated and verified generated documentation. --- c++/src/H5AbstractDs.h | 7 +++---- c++/src/H5AtomType.cpp | 4 +++- c++/src/H5AtomType.h | 2 ++ c++/src/H5Attribute.cpp | 3 ++- c++/src/H5CommonFG.cpp | 2 ++ c++/src/H5CommonFG.h | 2 +- c++/src/H5DataSet.cpp | 7 +++++-- c++/src/H5DataSet.h | 2 +- c++/src/H5DataSpace.cpp | 5 ++++- c++/src/H5DataSpace.h | 3 +++ c++/src/H5DataType.cpp | 5 ++++- c++/src/H5DataType.h | 2 ++ c++/src/H5File.cpp | 9 +++++++-- c++/src/H5File.h | 3 +-- c++/src/H5Group.cpp | 5 ++++- c++/src/H5Group.h | 2 ++ c++/src/H5IdComponent.cpp | 8 ++++++++ c++/src/H5IdComponent.h | 2 ++ c++/src/H5Location.cpp | 32 +++++++++++++++++++++----------- c++/src/H5Location.h | 2 +- c++/src/H5Object.cpp | 2 +- c++/src/H5Object.h | 2 +- c++/src/H5PredType.cpp | 2 ++ c++/src/H5PredType.h | 2 ++ c++/src/H5PropList.cpp | 5 ++++- c++/src/H5PropList.h | 2 ++ 26 files changed, 90 insertions(+), 32 deletions(-) diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 354b47b..192f8ce 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -51,18 +51,17 @@ class H5_DLLCPP AbstractDs { StrType getStrType() const; VarLenType getVarLenType() const; - // Gets the size in memory of this abstract dataset. + ///\brief Gets the size in memory of this abstract dataset. virtual size_t getInMemDataSize() const = 0; - // Gets the dataspace of this abstract dataset - pure virtual. + ///\brief Gets the dataspace of this abstract dataset - pure virtual. virtual DataSpace getSpace() const = 0; // Gets the class of the datatype that is used by this abstract // dataset. H5T_class_t getTypeClass() const; - // Returns the amount of storage size required for this abstract - // dataset - pure virtual. + ///\brief Returns the amount of storage size required - pure virtual. virtual hsize_t getStorageSize() const = 0; ///\brief Returns this class name. diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp index 975cad6..09f762f 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -45,7 +45,6 @@ AtomType::AtomType() : DataType() {} // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {} -#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: AtomType copy constructor @@ -53,6 +52,7 @@ AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {} // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::AtomType( const AtomType& original ) : DataType( original ) {} +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: AtomType::setSize @@ -285,12 +285,14 @@ void AtomType::setPad( H5T_pad_t lsb, H5T_pad_t msb ) const } } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: AtomType destructor ///\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::~AtomType() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS #ifndef H5_NO_NAMESPACE } // end namespace diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index 25770f5..7c9a891 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -60,11 +60,13 @@ class H5_DLLCPP AtomType : public DataType { ///\brief Returns this class name. virtual H5std_string fromClass () const { return("AtomType"); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Copy constructor - makes copy of the original object AtomType( const AtomType& original ); // Noop destructor virtual ~AtomType(); +#endif // DOXYGEN_SHOULD_SKIP_THIS protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 120ed39..d684b8f 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -411,7 +411,8 @@ void Attribute::flush(H5F_scope_t scope) const //-------------------------------------------------------------------------- // Function: Attribute::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this attribute +///\return Attribute identifier // Description: // Class hierarchy is revised to address bugzilla 1068. Class // AbstractDS and Attribute are moved out of H5Object. In diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 0651c29..d6fe5dc 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -1138,6 +1138,7 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const } #endif /* H5_NO_DEPRECATED_SYMBOLS */ +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: CommonFG default constructor ///\brief Default constructor. @@ -1151,6 +1152,7 @@ CommonFG::CommonFG() {} // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CommonFG::~CommonFG() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 4f32d21..22e193a 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -152,7 +152,6 @@ class H5_DLLCPP CommonFG { /// object id, i.e. file or group id. virtual hid_t getLocId() const = 0; -#endif // DOXYGEN_SHOULD_SKIP_THIS /// For subclasses, H5File and Group, to throw appropriate exception. virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0; @@ -162,6 +161,7 @@ class H5_DLLCPP CommonFG { // Noop destructor. virtual ~CommonFG(); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; // end of CommonFG declaration diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 6a1524d..3e3893c 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -430,7 +430,7 @@ void DataSet::read( void* buf, const DataType& mem_type, const DataSpace& mem_sp // Function: DataSet::read ///\brief This is an overloaded member function, provided for convenience. /// It takes a reference to a \c H5std_string for the buffer. -///\param buf - IN: Buffer for read data +///\param strg - IN: Buffer for read data string ///\param mem_type - IN: Memory datatype ///\param mem_space - IN: Memory dataspace ///\param file_space - IN: Dataset's dataspace in the file @@ -647,6 +647,7 @@ void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space) //-------------------------------------------------------------------------- // Function: DataSet::getId ///\brief Get the id of this dataset. +///\return DataSet identifier // Description: // Class hierarchy is revised to address bugzilla 1068. Class // AbstractDs and Attribute are moved out of H5Object. In @@ -726,8 +727,9 @@ void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space HDfree(strg_C); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: DataSet::p_setId (private) +// Function: DataSet::p_setId (protected) ///\brief Sets the identifier of this dataset to a new value. /// ///\exception H5::IdComponentException when the attempt to close the HDF5 @@ -753,6 +755,7 @@ void DataSet::p_setId(const hid_t new_id) // increment the reference counter of the new id //incRefCount(); } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DataSet::close diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index 54e9d6f..bc80046 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -105,7 +105,6 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { private: hid_t id; // HDF5 dataset id -#ifndef DOXYGEN_SHOULD_SKIP_THIS // This function contains the common code that is used by // getTypeClass and various API functions getXxxType // defined in AbstractDs for generic datatype and specific @@ -117,6 +116,7 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const; protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the dataset id. virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 755ca5b..2e2bb35 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -556,7 +556,8 @@ void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const h //-------------------------------------------------------------------------- // Function: DataSpace::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this dataspace +///\return Dataspace identifier // Modification: // May 2008 - BMR // Class hierarchy is revised to address bugzilla 1068. Class @@ -570,6 +571,7 @@ hid_t DataSpace::getId() const return(id); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DataSpace::p_setId ///\brief Sets the identifier of this object to a new value. @@ -594,6 +596,7 @@ void DataSpace::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DataSpace::close diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index 9afb8ab..b88144a 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -122,8 +122,11 @@ class H5_DLLCPP DataSpace : public IdComponent { hid_t id; // HDF5 dataspace id protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the dataspace id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS + }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 99525bc..8a62471 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -681,7 +681,8 @@ bool DataType::isVariableStr() const //-------------------------------------------------------------------------- // Function: DataType::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this datatype +///\return Datatype identifier // Modification: // May 2008 - BMR // Class hierarchy is revised to address bugzilla 1068. Class @@ -695,6 +696,7 @@ hid_t DataType::getId() const return(id); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DataType::p_setId ///\brief Sets the identifier of this object to a new value. @@ -719,6 +721,7 @@ void DataType::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: DataType::close diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 98514bb..6e56622 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -120,10 +120,12 @@ class H5_DLLCPP DataType : public H5Object { virtual ~DataType(); protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS hid_t id; // HDF5 datatype id // Sets the datatype id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS private: void p_commit(hid_t loc_id, const char* name); diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index ede7469..65191ae 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -116,6 +116,7 @@ H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPro } } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // This function is private and contains common code between the // constructors taking a string or a char* @@ -146,6 +147,7 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro } } } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5File copy constructor @@ -518,7 +520,8 @@ hid_t H5File::getLocId() const //-------------------------------------------------------------------------- // Function: H5File::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this file +///\return File identifier // Modification: // May 2008 - BMR // Class hierarchy is revised to address bugzilla 1068. Class @@ -532,8 +535,9 @@ hid_t H5File::getId() const return(id); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5File::p_setId +// Function: H5File::p_setId (protected) ///\brief Sets the identifier of this object to a new value. /// ///\exception H5::IdComponentException when the attempt to close the HDF5 @@ -556,6 +560,7 @@ void H5File::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5File::close diff --git a/c++/src/H5File.h b/c++/src/H5File.h index cfb6bdf..f906de6 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -100,13 +100,12 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { private: hid_t id; // HDF5 file id -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // This function is private and contains common code between the // constructors taking a string or a char* void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ); protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the HDF5 file id. virtual void p_setId(const hid_t new_id); diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index e83b635..eff7e50 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -149,7 +149,8 @@ Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() //-------------------------------------------------------------------------- // Function: Group::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this group +///\return Group identifier // Modification: // May 2008 - BMR // Class hierarchy is revised to address bugzilla 1068. Class @@ -163,6 +164,7 @@ hid_t Group::getId() const return(id); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: Group::p_setId ///\brief Sets the identifier of this object to a new value. @@ -187,6 +189,7 @@ void Group::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: Group::close diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index e4c2415..3b53293 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -62,8 +62,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { hid_t id; // HDF5 group id protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the group id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 9f96277..4a997ab 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -321,6 +321,14 @@ bool IdComponent::p_valid_id(const hid_t obj_id) return true; } +// Notes about IdComponent::id +// May 2008 - BMR +// Class hierarchy is revised to address bugzilla 1068... +// ...member IdComponent::id is moved into subclasses, and +// IdComponent::getId now becomes pure virtual function. +// (reasons: 1. encountered problems when adding H5Location; +// 2. Scott Meyers, item 33) + #endif // DOXYGEN_SHOULD_SKIP_THIS #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index 7dc1da3..17ed552 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -44,8 +44,10 @@ class H5_DLLCPP IdComponent { // Assignment operator. IdComponent& operator=( const IdComponent& rhs ); +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Gets the identifier of this object. virtual hid_t getId () const = 0; +#endif // DOXYGEN_SHOULD_SKIP_THIS // Sets the identifier of this object to a new value. void setId(const hid_t new_id); diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 98878d7..fcf7ff4 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -69,8 +69,6 @@ H5Location::H5Location() : IdComponent(0) {} //-------------------------------------------------------------------------- H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} -#endif // DOXYGEN_SHOULD_SKIP_THIS - //-------------------------------------------------------------------------- // Function: H5Location copy constructor ///\brief Copy constructor: makes a copy of the original H5Location @@ -80,6 +78,8 @@ H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} //-------------------------------------------------------------------------- H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {} +#endif // DOXYGEN_SHOULD_SKIP_THIS + //-------------------------------------------------------------------------- // Function: H5Location::createAttribute ///\brief Creates an attribute for a group, dataset, or named datatype. @@ -376,6 +376,8 @@ H5std_string H5Location::getFileName() const } } +#ifndef DOXYGEN_SHOULD_SKIP_THIS + //-------------------------------------------------------------------------- // Function: H5Location::p_reference (protected) // Purpose Creates a reference to an HDF5 object or a dataset region. @@ -395,6 +397,8 @@ void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_ty } } +#endif // DOXYGEN_SHOULD_SKIP_THIS + //-------------------------------------------------------------------------- // Function: H5Location::reference ///\brief Creates a reference to an HDF5 object or a dataset region. @@ -456,6 +460,7 @@ void H5Location::reference(void* ref, const H5std_string& name) const reference(ref, name.c_str()); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location::p_dereference (protected) // Purpose Dereference a ref into an hdf5 object. @@ -482,6 +487,7 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty // No failure, set id to the object return(temp_id); } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location::dereference @@ -560,16 +566,16 @@ void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_ty // Function: H5Location::getObjType ///\brief Retrieves the type of object that an object reference points to. ///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT \tReference is an object reference. -/// \li \c H5R_DATASET_REGION \tReference is a dataset region reference. +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. ///\param ref - IN: Reference to query ///\return An object type, which can be one of the following: -/// \li \c H5G_UNKNOWN \tA failure occurs. (-1) -/// \li \c H5G_GROUP \tObject is a group. -/// \li \c H5G_DATASET \tObject is a dataset. -/// \li \c H5G_TYPE Object \tis a named datatype -/// \li \c H5G_LINK \tObject is a symbolic link. -/// \li \c H5G_UDLINK \tObject is a user-defined link. +/// \li \c H5G_UNKNOWN - A failure occurs. (-1) +/// \li \c H5G_GROUP - Object is a group. +/// \li \c H5G_DATASET - Object is a dataset. +/// \li \c H5G_TYPE Object - is a named datatype +/// \li \c H5G_LINK - Object is a symbolic link. +/// \li \c H5G_UDLINK - Object is a user-defined link. ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - May, 2004 // Modification @@ -585,6 +591,7 @@ H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const } } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location::p_get_obj_type (protected) // Purpose Retrieves the type of object that an object reference points to. @@ -611,9 +618,9 @@ H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const } return(obj_type); } +#endif // DOXYGEN_SHOULD_SKIP_THIS #endif /* H5_NO_DEPRECATED_SYMBOLS */ - //-------------------------------------------------------------------------- // Function: H5Location::getRefObjType ///\brief Retrieves the type of object that an object reference points to. @@ -640,6 +647,7 @@ H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const } } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location::p_get_ref_obj_type (protected) // Purpose Retrieves the type of object that an object reference points to. @@ -697,6 +705,8 @@ hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const //-------------------------------------------------------------------------- H5Location::~H5Location() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS + #ifndef H5_NO_NAMESPACE } // end namespace #endif diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 8eae454..1f54439 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -106,7 +106,7 @@ class H5_DLLCPP H5Location : public IdComponent { void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - // For subclasses. + ///\brief Returns an identifier. (pure virtual) virtual hid_t getId() const = 0; protected: diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index e29e80e..b596092 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -52,7 +52,6 @@ H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {} -#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Object copy constructor @@ -69,6 +68,7 @@ H5Object::H5Object( const H5Object& original ) : H5Location( original ) {} // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Object::~H5Object() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS #ifndef H5_NO_NAMESPACE } // end namespace diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index bfd5e6f..8441491 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -40,6 +40,7 @@ namespace H5 { class H5_DLLCPP H5Object : public H5Location { public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Copy constructor: makes copy of an H5Object object. H5Object(const H5Object& original); @@ -47,7 +48,6 @@ class H5_DLLCPP H5Object : public H5Location { virtual ~H5Object(); protected: -#ifndef DOXYGEN_SHOULD_SKIP_THIS // Default constructor H5Object(); diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 9dfc760..27cfd3a 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -56,6 +56,7 @@ PredType::PredType( const hid_t predtype_id ) : AtomType( predtype_id ) // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType::PredType() : AtomType() {} +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: PredType copy constructor @@ -65,6 +66,7 @@ PredType::PredType() : AtomType() {} //-------------------------------------------------------------------------- PredType::PredType( const PredType& original ) : AtomType( original ) {} +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Flag to terminate HDF5 library in DataType::~DataType const PredType PredType::AtExit(H5CPP_EXITED); diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 8a04f0c..5dc5d36 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -32,7 +32,9 @@ namespace H5 { before the other PredType objects are created. At exit, when this special PredType object is to be destructed, no HDF5 library function will be called and the library will be terminated. -BMR, Mar 30, 2012 */ +#ifndef DOXYGEN_SHOULD_SKIP_THIS #define H5CPP_EXITED -3 // -3 is less likely to be used elsewhere +#endif // DOXYGEN_SHOULD_SKIP_THIS class H5_DLLCPP PredType : public AtomType { public: diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index ceea15f..c14d74f 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -216,7 +216,8 @@ void PropList::copyProp( PropList& dest, PropList& src, const H5std_string& name //-------------------------------------------------------------------------- // Function: PropList::getId -// Purpose: Get the id of this attribute +///\brief Get the id of this property list +///\return Property list identifier // Description: // Class hierarchy is revised to address bugzilla 1068. Class // AbstractDS and Attribute are moved out of H5Object. In @@ -229,6 +230,7 @@ hid_t PropList::getId() const return(id); } +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: PropList::p_setId ///\brief Sets the identifier of this object to a new value. @@ -253,6 +255,7 @@ void PropList::p_setId(const hid_t new_id) // reset object's id to the given id id = new_id; } +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: PropList::close diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 7e47b32..a4057d4 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -110,10 +110,12 @@ class H5_DLLCPP PropList : public IdComponent { virtual ~PropList(); protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS hid_t id; // HDF5 property list id // Sets the property list id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; #ifndef H5_NO_NAMESPACE -- cgit v0.12 From 54a659cb99af799999fbf191d57edb1e1fbbc5df Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 18 Sep 2013 16:56:48 -0500 Subject: [svn-r24157] Add back STGZ packaging - .sh compressed package --- CMakeInstallation.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index aa34b9c..18464ac 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -247,6 +247,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) ${HDF5_BINARY_DIR}/CMakeFiles/Info.plist @ONLY ) ELSE (WIN32) + LIST (APPEND CPACK_GENERATOR "STGZ") SET (CPACK_PACKAGING_INSTALL_PREFIX "/usr") SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) -- cgit v0.12 From 18b896112c1fd7db68323a9dd4a18cfa19deedc2 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 18 Sep 2013 20:54:54 -0500 Subject: [svn-r24161] Purpose: More on HDFFV-7520 and HDFFV-533 Description: - Completed the changes in revisions r22836 and r23438 with improvement on wrappers such as reference, dereference, get region, and set/getcomment. - Added more tests. Platforms tested: Linux/32 2.6 (jam) SunOS 5.11 (emu) Linux/ppc64 (ostrich) --- c++/src/H5Attribute.cpp | 1 + c++/src/H5CommonFG.cpp | 131 ----------- c++/src/H5CommonFG.h | 12 - c++/src/H5DataSet.cpp | 49 +---- c++/src/H5DataSet.h | 8 +- c++/src/H5DataSpace.cpp | 2 +- c++/src/H5DataType.cpp | 13 +- c++/src/H5DataType.h | 8 +- c++/src/H5File.h | 3 - c++/src/H5Group.cpp | 17 +- c++/src/H5Group.h | 10 +- c++/src/H5IdComponent.cpp | 2 +- c++/src/H5Location.cpp | 421 ++++++++++++++++++++++++----------- c++/src/H5Location.h | 51 +++-- c++/src/H5Object.cpp | 1 - c++/src/H5PropList.cpp | 5 +- c++/test/trefer.cpp | 548 ++++++++++++++++++++++++++++++++++++++++++++-- 17 files changed, 907 insertions(+), 375 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index d684b8f..a98a970 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -44,6 +44,7 @@ namespace H5 { #endif // H5_NO_STD #endif +class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate //-------------------------------------------------------------------------- // Function: Attribute default constructor ///\brief Default constructor: Creates a stub attribute diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index d6fe5dc..3bf4b4f 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -460,137 +460,6 @@ H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const } //-------------------------------------------------------------------------- -// Function: CommonFG::setComment -///\brief Sets or resets the comment for an object specified by its name. -///\param name - IN: Name of the object -///\param comment - IN: New comment -///\exception H5::FileIException or H5::GroupIException -///\par Description -/// If \a comment is an empty string or a null pointer, the comment -/// message is removed from the object. -/// Comments should be relatively short, null-terminated, ASCII -/// strings. They can be attached to any object that has an -/// object header, e.g., data sets, groups, named data types, -/// and data spaces, but not symbolic links. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void CommonFG::setComment( const char* name, const char* comment ) const -{ - herr_t ret_value = H5Oset_comment_by_name( getLocId(), name, comment, H5P_DEFAULT ); - if( ret_value < 0 ) - throwException("setComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name and \a comment. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void CommonFG::setComment( const H5std_string& name, const H5std_string& comment ) const -{ - setComment( name.c_str(), comment.c_str() ); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::removeComment -///\brief Removes the comment from an object specified by its name. -///\param name - IN: Name of the object -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - May 2005 -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void CommonFG::removeComment(const char* name) const -{ - herr_t ret_value = H5Oset_comment_by_name(getLocId(), name, NULL, H5P_DEFAULT); - if( ret_value < 0 ) - throwException("removeComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::removeComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - May 2005 -//-------------------------------------------------------------------------- -void CommonFG::removeComment(const H5std_string& name) const -{ - removeComment (name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::getComment -///\brief Retrieves comment for the specified object and its comment's -/// length. -///\param name - IN: Name of the object -///\param bufsize - IN: Length of the comment to retrieve -///\return Comment string -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const -{ - // bufsize is default to 256 - // temporary variable - hid_t loc_id = getLocId(); // temporary variable - - // temporary C-string for the object's comment; bufsize already including - // null character - char* comment_C = new char[bufsize]; - ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); - - // if the actual length of the comment is longer than bufsize and bufsize - // was the default value, i.e., not given by the user, then call - // H5Oget_comment_by_name again with the correct value. - // If the call to H5Oget_comment_by_name returned an error, skip this block - // and throw an exception below. - if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) - { - size_t new_size = ret_value; - delete []comment_C; - comment_C = new char[new_size]; // new_size including null terminator - ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); - } - - // if H5Oget_comment_by_name returns SUCCEED, return the string comment, - // otherwise, throw an exception - if( ret_value < 0 ) { - delete []comment_C; - throwException("getComment", "H5Oget_comment_by_name failed"); - } - - H5std_string comment = H5std_string(comment_C); - delete []comment_C; - return (comment); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::getComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string CommonFG::getComment( const H5std_string& name, size_t bufsize ) const -{ - return( getComment( name.c_str(), bufsize )); -} - -//-------------------------------------------------------------------------- // Function: CommonFG::mount ///\brief Mounts the file \a child onto this group. ///\param name - IN: Name of the group diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 22e193a..b02b05b 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -49,18 +49,6 @@ class H5_DLLCPP CommonFG { DataSet openDataSet(const char* name) const; DataSet openDataSet(const H5std_string& name) const; - // Retrieves comment for the HDF5 object specified by its name. - H5std_string getComment(const char* name, size_t bufsize=256) const; - H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; - - // Removes the comment for the HDF5 object specified by its name. - void removeComment(const char* name) const; - void removeComment(const H5std_string& name) const; - - // Sets the comment for an HDF5 object specified by its name. - void setComment(const char* name, const char* comment) const; - void setComment(const H5std_string& name, const H5std_string& comment) const; - // Returns the value of a symbolic link. H5std_string getLinkval(const char* link_name, size_t size=0) const; H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const; diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 3e3893c..7f6c553 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -27,6 +27,7 @@ #include "H5Object.h" #include "H5PropList.h" #include "H5DxferProp.h" +#include "H5DaccProp.h" #include "H5DcreatProp.h" #include "H5FaccProp.h" #include "H5FcreatProp.h" @@ -79,57 +80,29 @@ DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(origi //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a +///\brief Given a reference, ref, to an hdf5 location, creates a /// DataSet object -///\param obj - IN: Dataset reference object is in or location of +///\param loc - IN: Dataset reference object is in or location of /// object that the dataset is located within. ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type - default to H5R_OBJECT ///\exception H5::DataSetIException ///\par Description -/// \c obj can be DataSet, Group, H5File, or named DataType, that +/// \c loc can be DataSet, Group, H5File, or named DataType, that /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() +DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object() { - try { - id = p_dereference(obj.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by object", - deref_error.getDetailMsg()); - } + H5Location::dereference(loc, ref, ref_type, plist); } //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a -/// DataSet object -///\param h5file - IN: Location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// Jul, 2008 -// Added for application convenience. -//-------------------------------------------------------------------------- -DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() -{ - try { - id = p_dereference(h5file.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by HDF5 file", - deref_error.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a +///\brief Given a reference, ref, to an hdf5 attribute, creates a /// DataSet object ///\param attr - IN: Specifying location where the referenced object is in ///\param ref - IN: Reference pointer @@ -140,12 +113,12 @@ DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : Abstrac // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() +DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object() { - try { - id = p_dereference(attr.getId(), ref, ref_type); + try { + id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by attribute", + throw ReferenceException("DataSet constructor - by dereferenced", deref_error.getDetailMsg()); } } diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index bc80046..e2fe702 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -76,16 +76,12 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSet"); } // Creates a dataset by way of dereference. - DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // Default constructor. DataSet(); diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 2e2bb35..059c812 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -446,7 +446,7 @@ void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const } //-------------------------------------------------------------------------- -// Function: DataSpace::H5Sselect_elements +// Function: DataSpace::selectElements ///\brief Selects array elements to be included in the selection for /// this dataspace. ///\param op - IN: Operator specifying how the new selection is to be diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 8a62471..9e9433f 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -100,7 +100,7 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() + /* DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() { try { id = p_dereference(obj.getId(), ref, ref_type); @@ -109,6 +109,7 @@ DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Obje deref_error.getDetailMsg()); } } + */ //-------------------------------------------------------------------------- // Function: DataType overload constructor - dereference @@ -123,14 +124,16 @@ DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Obje // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() +DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() { - try { + H5Location::dereference(loc, ref, ref_type, plist); + /* try { id = p_dereference(h5file.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("DataType constructor - located by an H5File", deref_error.getDetailMsg()); } + */ } //-------------------------------------------------------------------------- @@ -146,10 +149,10 @@ DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Obj // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() +DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() { try { - id = p_dereference(attr.getId(), ref, ref_type); + id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException deref_error) { throw ReferenceException("DataType constructor - located by an Attribute", deref_error.getDetailMsg()); diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 6e56622..e4254b0 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -30,9 +30,8 @@ class H5_DLLCPP DataType : public H5Object { DataType( const DataType& original ); // Creates a datatype by way of dereference. - DataType(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataType(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataType(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // Closes this datatype. virtual void close(); @@ -101,9 +100,6 @@ class H5_DLLCPP DataType : public H5Object { // Checks whether this datatype is a variable-length string. bool isVariableStr() const; - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataType"); } diff --git a/c++/src/H5File.h b/c++/src/H5File.h index f906de6..2abffea 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -61,9 +61,6 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { // and datatypes) in the same file. void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Returns the pointer to the file handle of the low-level file driver. void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; void getVFDHandle(void **file_handle) const; diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index eff7e50..3150025 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -99,14 +99,18 @@ Group::Group(const hid_t existing_id) : H5Object() /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() + /* Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() + */ +Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() { - try { - id = p_dereference(obj.getId(), ref, ref_type); + H5Location::dereference(loc, ref, ref_type, plist); + /* try { + id = p_dereference(loc.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("Group constructor - located by an H5Object", deref_error.getDetailMsg()); } + */ } //-------------------------------------------------------------------------- @@ -118,7 +122,7 @@ Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() + /* Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() { try { id = p_dereference(h5file.getId(), ref, ref_type); @@ -127,6 +131,7 @@ Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() deref_error.getDetailMsg()); } } + */ //-------------------------------------------------------------------------- // Function: Group overload constructor - dereference @@ -137,10 +142,10 @@ Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() +Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() { try { - id = p_dereference(attr.getId(), ref, ref_type); + id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException deref_error) { throw ReferenceException("Group constructor - located by an Attribute", deref_error.getDetailMsg()); diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 3b53293..4003c21 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -26,9 +26,6 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Close this group. virtual void close(); - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("Group"); } @@ -39,9 +36,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { virtual hid_t getLocId() const; // Creates a group by way of dereference. - Group(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - Group(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + /* Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + */ + Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // default constructor Group(); diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 4a997ab..f902116 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -269,7 +269,7 @@ IdComponent::IdComponent() {} // Description: // This function is protected so that the user applications can // only have access to its code via allowable classes, namely, -// H5File and H5Object subclasses. +// Attribute and H5Location subclasses. // Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string IdComponent::p_get_file_name() const diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index fcf7ff4..f03072d 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -22,6 +22,7 @@ #include "H5Location.h" #include "H5Object.h" #include "H5DcreatProp.h" +#include "H5DaccProp.h" #include "H5DxferProp.h" #include "H5FaccProp.h" #include "H5FcreatProp.h" @@ -55,17 +56,17 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, } //-------------------------------------------------------------------------- -// Function: H5Location default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location default constructor (protected) +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location() : IdComponent(0) {} //-------------------------------------------------------------------------- -// Function: H5Location overloaded constructor (protected) -// Purpose Creates an H5Location object using the id of an existing HDF5 -// object. -// Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location overloaded constructor (protected) +// Purpose Creates an H5Location object using the id of an existing HDF5 +// object. +// Parameters object_id - IN: Id of an existing HDF5 object +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} @@ -78,6 +79,30 @@ H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} //-------------------------------------------------------------------------- H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {} +//-------------------------------------------------------------------------- +// Function: H5Location constructor +///\brief Dereferences into an HDF5 object, given an HDF5 location. +///\param loc - IN: H5Location instance to copy +///\param ref - IN: Name of the object to be referenced +///\param ref_type - IN: Dataspace with selection +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- + // Dereferences into an HDF5 object, given an HDF5 location. + /* H5Location::H5Location(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) +{ + hid_t temp_id; + try { + temp_id = p_dereference(loc.getId(), ref, ref_type, plist); + } + catch (ReferenceException deref_error) { + throw ReferenceException("H5Location constructor - by dereferenced", + deref_error.getDetailMsg()); + } + setId(temp_id); +} + */ + + #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- @@ -342,7 +367,7 @@ void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& new /// which can be either of these values: /// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file /// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::FileIException +///\exception H5::Exception ///\par Description /// This location is used to identify the file to be flushed. // Programmer Binh-Minh Ribler - 2012 @@ -355,7 +380,7 @@ void H5Location::flush(H5F_scope_t scope) const herr_t ret_value = H5Fflush(getId(), scope); if( ret_value < 0 ) { - throw FileIException(inMemFunc("flush"), "H5Fflush failed"); + throw Exception(inMemFunc("flush"), "H5Fflush failed"); } } @@ -376,17 +401,147 @@ H5std_string H5Location::getFileName() const } } +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief Sets or resets the comment for an object specified by its name. +///\param name - IN: Name of the object +///\param comment - IN: New comment +///\exception H5::Exception +///\par Description +/// If \a comment is an empty string or a null pointer, the comment +/// message is removed from the object. +/// Comments should be relatively short, null-terminated, ASCII +/// strings. They can be attached to any object that has an +/// object header, e.g., data sets, groups, named data types, +/// and data spaces, but not symbolic links. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// Modification +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void H5Location::setComment(const char* name, const char* comment) const +{ + herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT); + if( ret_value < 0 ) + throw Exception("setComment", "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name and \a comment. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const +{ + setComment(name.c_str(), comment.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeComment +///\brief Removes the comment from an object specified by its name. +///\param name - IN: Name of the object +///\exception H5::Exception +// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void H5Location::removeComment(const char* name) const +{ + herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT); + if( ret_value < 0 ) + throw Exception("removeComment", "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +void H5Location::removeComment(const H5std_string& name) const +{ + removeComment (name.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getComment +///\brief Retrieves comment for the specified object and its comment's +/// length. +///\param name - IN: Name of the object +///\param bufsize - IN: Length of the comment to retrieve +///\return Comment string +///\exception H5::Exception +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +H5std_string H5Location::getComment(const char* name, size_t bufsize) const +{ + // bufsize is default to 256 + // temporary variable + hid_t loc_id = getId(); // temporary variable + + // temporary C-string for the object's comment; bufsize already including + // null character + char* comment_C = new char[bufsize]; + ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); + + // if the actual length of the comment is longer than bufsize and bufsize + // was the default value, i.e., not given by the user, then call + // H5Oget_comment_by_name again with the correct value. + // If the call to H5Oget_comment_by_name returned an error, skip this block + // and throw an exception below. + if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) + { + size_t new_size = ret_value; + delete []comment_C; + comment_C = new char[new_size]; // new_size including null terminator + ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); + } + + // if H5Oget_comment_by_name returns SUCCEED, return the string comment, + // otherwise, throw an exception + if (ret_value < 0) { + delete []comment_C; + throw Exception("getComment", "H5Oget_comment_by_name failed"); + } + + H5std_string comment = H5std_string(comment_C); + delete []comment_C; + return (comment); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +H5std_string H5Location::getComment(const H5std_string& name, size_t bufsize) const +{ + return(getComment(name.c_str(), bufsize)); +} #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. +// Function: H5Location::p_reference (protected) +// Purpose Creates a reference to an HDF5 object or a dataset region. // Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 +// name - IN: Name of the object to be referenced +// dataspace - IN: Dataspace with selection +// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION +// Exception H5::IdComponentException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const { @@ -400,17 +555,18 @@ void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_ty #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: +// Function: H5Location::reference +///\brief Creates a reference to an HDF5 object or a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: /// \li \c H5R_OBJECT - Reference is an object reference. /// \li \c H5R_DATASET_REGION - Reference is a dataset region /// reference. - this is the default -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +///\exception H5::ReferenceException +///\notes This method is more suitable for a dataset region reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const { @@ -423,23 +579,25 @@ void H5Location::reference(void* ref, const char* name, const DataSpace& dataspa } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it only creates -/// a reference to an HDF5 object, not to a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c char pointer -///\exception H5::ReferenceException -///\par Description -// This function passes H5R_OBJECT and -1 to the protected -// function for it to pass to the C API H5Rcreate -// to create a reference to the named object. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +/// reference. - this is the default +///\exception H5::ReferenceException +///\notes This method is more suitable for a dataset region reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const char* name) const +void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const { try { - p_reference(ref, name, -1, H5R_OBJECT); + p_reference(ref, name.c_str(), dataspace.getId(), ref_type); } catch (ReferenceException E) { throw ReferenceException("H5Location::reference", E.getDetailMsg()); @@ -447,17 +605,45 @@ void H5Location::reference(void* ref, const char* name) const } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it does not take +/// a DataSpace object and the reference type must be specified. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +///\exception H5::ReferenceException +///\notes This method is more suitable for an object reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const H5std_string& name) const +void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const { - reference(ref, name.c_str()); + try { + p_reference(ref, name, -1, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::reference", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for the object's name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c H5std_string +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +///\notes This method is more suitable for an object reference. +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const +{ + reference(ref, name.c_str(), ref_type); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -475,10 +661,16 @@ void H5Location::reference(void* ref, const H5std_string& name) const // May 2008 - BMR // Moved from IdComponent. //-------------------------------------------------------------------------- -hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type) +hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist) { + hid_t plist_id; + if (p_valid_id(plist.getId())) + plist_id = plist.getId(); + else + plist_id = H5P_DEFAULT; + hid_t temp_id; - temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref); + temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref); if (temp_id < 0) { throw ReferenceException("", "H5Rdereference failed"); @@ -496,16 +688,16 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type) +void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) { hid_t temp_id; try { - temp_id = p_dereference(obj.getId(), ref, ref_type); + temp_id = p_dereference(loc.getId(), ref, ref_type, plist); } catch (ReferenceException E) { throw ReferenceException("H5Location::dereference - located by object", E.getDetailMsg()); @@ -515,45 +707,21 @@ void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type //-------------------------------------------------------------------------- // Function: H5Location::dereference -///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. -///\param h5file - IN: HDF5 file specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May, 2008 -// Corrected missing parameters. - BMR -//-------------------------------------------------------------------------- -void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - try { - temp_id = p_dereference(h5file.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Location::dereference - located by file", E.getDetailMsg()); - } - p_setId(temp_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::dereference ///\brief Dereferences a reference into an HDF5 object, given an attribute. ///\param attr - IN: Attribute specifying the location of the referenced object ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) +void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) { hid_t temp_id; try { - temp_id = p_dereference(attr.getId(), ref, ref_type); + temp_id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException E) { throw ReferenceException("H5Location::dereference - located by attribute", E.getDetailMsg()); @@ -593,20 +761,20 @@ H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_UNKNOWN \tFailure occurs (-1) -// H5G_GROUP \tObject is a group. -// H5G_DATASET \tObject is a dataset. -// H5G_TYPE Object \tis a named datatype. -// H5G_LINK \tObject is a symbolic link. -// H5G_UDLINK \tObject is a user-defined link. -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5G_UNKNOWN \tFailure occurs (-1) +// H5G_GROUP \tObject is a group. +// H5G_DATASET \tObject is a dataset. +// H5G_TYPE Object \tis a named datatype. +// H5G_LINK \tObject is a symbolic link. +// H5G_UDLINK \tObject is a user-defined link. +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const { @@ -622,20 +790,20 @@ H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- -// Function: H5Location::getRefObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\return An object type, which can be one of the following: -/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) -/// \li \c H5O_TYPE_GROUP - Object is a group -/// \li \c H5O_TYPE_DATASET - Object is a dataset -/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype -/// \li \c H5O_TYPE_NTYPES - Number of different object types -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRefObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref - IN: Reference to query +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. +///\return An object type, which can be one of the following: +/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) +/// \li \c H5O_TYPE_GROUP - Object is a group +/// \li \c H5O_TYPE_DATASET - Object is a dataset +/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +/// \li \c H5O_TYPE_NTYPES - Number of different object types +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const { @@ -649,19 +817,19 @@ H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_ref_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_ref_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: // H5O_TYPE_UNKNOWN - Unknown object type (-1) // H5O_TYPE_GROUP - Object is a group // H5O_TYPE_DATASET - Object is a dataset // H5O_TYPE_NAMED_DATATYPE - Object is a named datatype // H5O_TYPE_NTYPES - Number of object types -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const { @@ -677,24 +845,29 @@ H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const //-------------------------------------------------------------------------- -// Function: H5Location::p_get_region (protected) -// Purpose Retrieves a dataspace with the region pointed to selected. -// Parameters -// ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -// ref - IN: Reference to get region of -// Return Dataspace id -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRegion +///\brief Retrieves a dataspace with the region pointed to selected. +///\param ref - IN: Reference to get region of +///\param ref_type - IN: Type of reference to get region of - default +// to H5R_DATASET_REGION +///\return DataSpace object +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const +DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const { hid_t space_id = H5Rget_region(getId(), ref_type, ref); if (space_id < 0) { throw ReferenceException("", "H5Rget_region failed"); } - return(space_id); + try { + DataSpace dataspace(space_id); + return(dataspace); + } + catch (DataSpaceIException E) { + throw ReferenceException("H5Location::getRegion", E.getDetailMsg()); + } } diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 1f54439..996cc21 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -36,12 +36,12 @@ typedef void (*attr_operator_t)( H5Location& loc/*in*/, class UserData4Aiterate { // user data for attribute iteration public: - attr_operator_t op; - void* opData; - H5Location* location; + attr_operator_t op; + void* opData; + H5Location* location; }; -// An H5Location can be a file, group, dataset, named datatype, or attribute. +// An H5Location can be a file, group, dataset, or committed datatype. class H5_DLLCPP H5Location : public IdComponent { public: @@ -85,29 +85,47 @@ class H5_DLLCPP H5Location : public IdComponent { bool attrExists(const char* name) const; bool attrExists(const H5std_string& name) const; + // Renames the named attribute to a new name. + void renameAttr(const char* oldname, const char* newname) const; + void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + // Removes the named attribute from this location. void removeAttr(const char* name) const; void removeAttr(const H5std_string& name) const; - // Renames the named attribute to a new name. - void renameAttr(const char* oldname, const char* newname) const; - void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + // Sets the comment for an HDF5 object specified by its name. + void setComment(const char* name, const char* comment) const; + void setComment(const H5std_string& name, const H5std_string& comment) const; + + // Retrieves comment for the HDF5 object specified by its name. + H5std_string getComment(const char* name, size_t bufsize=256) const; + H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; + + // Removes the comment for the HDF5 object specified by its name. + void removeComment(const char* name) const; + void removeComment(const H5std_string& name) const; // Creates a reference to a named object or to a dataset region // in this object. + void reference(void* ref, const char* name, + H5R_type_t ref_type = H5R_OBJECT) const; + void reference(void* ref, const H5std_string& name, + H5R_type_t ref_type = H5R_DATASET_REGION) const; void reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const char* name) const; - void reference(void* ref, const H5std_string& name) const; + void reference(void* ref, const H5std_string& name, const DataSpace& dataspace, + H5R_type_t ref_type = H5R_DATASET_REGION) const; // Open a referenced object whose location is specified by either // a file, an HDF5 object, or an attribute. - void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - ///\brief Returns an identifier. (pure virtual) - virtual hid_t getId() const = 0; + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + + ///\brief Returns an identifier. (pure virtual) + virtual hid_t getId() const = 0; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -124,7 +142,7 @@ class H5_DLLCPP H5Location : public IdComponent { void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; // Dereferences a ref into an HDF5 id. - hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type); + hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist); #ifndef H5_NO_DEPRECATED_SYMBOLS // Retrieves the type of object that an object reference points to. @@ -134,9 +152,6 @@ class H5_DLLCPP H5Location : public IdComponent { // Retrieves the type of object that an object reference points to. H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; - // Retrieves a dataspace with the region pointed to selected. - hid_t p_get_region(void *ref, H5R_type_t ref_type) const; - // Noop destructor. virtual ~H5Location(); diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index b596092..1d96f2e 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -52,7 +52,6 @@ H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {} - //-------------------------------------------------------------------------- // Function: H5Object copy constructor ///\brief Copy constructor: makes a copy of the original H5Object diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index c14d74f..e070406 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -39,7 +39,7 @@ namespace H5 { //-------------------------------------------------------------------------- ///\brief Constant for default property. //-------------------------------------------------------------------------- -const PropList PropList::DEFAULT( H5P_DEFAULT ); +const PropList PropList::DEFAULT; //-------------------------------------------------------------------------- // Function Default constructor @@ -644,6 +644,9 @@ void PropList::removeProp(const H5std_string& name) const //-------------------------------------------------------------------------- bool PropList::operator==(const PropList& rhs) const { + fprintf(stderr, "operator==\n"); +H5Eprint2(H5E_DEFAULT, stderr); + htri_t ret_value = H5Pequal(id, rhs.getId()); if( ret_value > 0 ) return true; diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index ce18e58..6acf8a9 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -27,13 +27,6 @@ #endif #include -#ifndef H5_NO_NAMESPACE -#ifndef H5_NO_STD - using std::cerr; - using std::endl; -#endif // H5_NO_STD -#endif - #include "H5Cpp.h" // C++ API header file #ifndef H5_NO_NAMESPACE @@ -44,11 +37,10 @@ const H5std_string FILE1("trefer1.h5"); const H5std_string FILE2("trefer2.h5"); -const H5std_string FILE3("trefer3.h5"); -const H5std_string DSET_DEFAULT_NAME("default"); // Dataset 1 const H5std_string DSET1_NAME("Dataset1"); +const H5std_string DSET2_NAME("Dataset2"); const int DSET1_LEN = 8; const H5std_string MEMBER1( "a_name" ); @@ -56,15 +48,15 @@ const H5std_string MEMBER2( "b_name" ); const H5std_string MEMBER3( "c_name" ); // 1-D dataset with fixed dimensions -const H5std_string SPACE1_NAME("Space1"); const int SPACE1_RANK = 1; const int SPACE1_DIM1 = 4; -// 2-D dataset with fixed dimensions -const H5std_string SPACE2_NAME("Space2"); +/* Larger 1-D dataset with fixed dimensions */ +const int SPACE3_RANK = 1; +const int SPACE3_DIM1 = 100; -// Larger 1-D dataset with fixed dimensions -const H5std_string SPACE3_NAME("Space3"); +/* Element selection information */ +const int POINT1_NPOINTS = 10; // Compound datatype typedef struct s1_t { @@ -75,8 +67,122 @@ typedef struct s1_t { /**************************************************************** ** -** test_reference_obj(): Test basic object reference functionality. -** Tests references to various kinds of objects +** test_reference_params(): Test basic H5R (reference) parameters +** for correct processing +** +****************************************************************/ +static void +test_reference_params(void) +{ + const char *write_comment = "Foo!"; /* Comments for group */ + + // Output message about test being performed + SUBTEST("Object Reference Parameters"); + + H5File* file1 = NULL; + try { + hobj_ref_t *wbuf, // buffer to write to disk + *rbuf, // buffer read from disk + *tbuf; // temp. buffer read from disk + + // Allocate write & read buffers + int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t)); + wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + + // Create file FILE1 + file1 = new H5File (FILE1, H5F_ACC_TRUNC); + + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a group + Group group = file1->createGroup("Group1"); + + // Set group's comment + group.setComment(".", write_comment); + + // Create a dataset (inside /Group1) + DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); + + unsigned *tu32; // Temporary pointer to uint32 data + int i; + for (tu32=(unsigned *)wbuf, i=0; icreateDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); + + /* Test parameters to H5Location::reference */ + try { + file1->reference(NULL, "/Group1/Dataset1"); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], NULL); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], ""); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION); + } catch (ReferenceException E) {} // We expect this to fail + + // Close resources + dataset.close(); + file1->close(); + // Let sid1 go out of scope + + // Free memory buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCDetailMsg()); + } + + if(file1) + delete file1; +} /* test_reference_param() */ + +/**************************************************************** +** +** test_reference_obj(): Test basic object reference functions +** to various kinds of objects ** ****************************************************************/ static void test_reference_obj(void) @@ -321,6 +427,412 @@ static void test_reference_obj(void) delete file1; } // test_reference_obj() + +/**************************************************************** +** +** test_reference_group(): Test object reference functionality +** Tests for correct behavior of various routines on +** dereferenced group +** +****************************************************************/ +#define GROUPNAME "/group" +#define GROUPNAME2 "group2" +#define GROUPNAME3 "group3" +#define DSETNAME "/dset" +#define DSETNAME2 "dset2" +#define NAME_SIZE 16 + +static void +test_reference_group(void) +{ + hobj_ref_t wref; /* Reference to write */ + hobj_ref_t rref; /* Reference to read */ + int i; // counting variables + const H5std_string write_comment="Foo!"; // Comments for group + + // Output message about test being performed + SUBTEST("Object Reference to Group"); + + H5File* file1 = NULL; + try { + // Create file with a group and a dataset containing an object reference to the group + + // Create file FILE1 + file1 = new H5File (FILE1, H5F_ACC_TRUNC); + + // Create scalar dataspace + DataSpace sid1; + + // Create a group + Group group = file1->createGroup(GROUPNAME); + + /* Create nested groups */ + Group group2 = group.createGroup(GROUPNAME2); + group2.close(); + group2 = group.createGroup(GROUPNAME3); + group2.close(); + + // Create bottom dataset + DataSet dset1 = group.createDataSet(DSETNAME2, PredType::NATIVE_INT, sid1); + dset1.close(); + + // Close group 1 + group.close(); + + // Create dataset + DataSet dset2 = file1->createDataSet(DSETNAME, PredType::STD_REF_OBJ, sid1); + + file1->reference(&wref, GROUPNAME); + + // Write selection to disk + dset2.write(&wref, PredType::STD_REF_OBJ); + + // Close resources + dset2.close(); + sid1.close(); + file1->close(); + + /* + * Re-open the file and test deferencing group + */ + + // Re-open file + file1->openFile(FILE1, H5F_ACC_RDWR); + + // Re-open dataset + dset1 = file1->openDataSet(DSETNAME); + + // Read in the reference + dset1.read(&rref, PredType::STD_REF_OBJ); + + // Dereference to get the group + Group refgroup(dset1, &rref); + + // Dereference group object the other way + group.dereference(dset1, &rref); + + /* + * Various queries on the group opened + */ + + // Check number of objects in the group dereferenced by constructor + hsize_t nobjs = refgroup.getNumObjs(); + verify_val(nobjs, 3, "H5Group::getNumObjs", __LINE__, __FILE__); + + // Check number of objects in the group dereferenced by ::reference + nobjs = group.getNumObjs(); + verify_val(nobjs, 3, "H5Group::getNumObjs", __LINE__, __FILE__); + + // Check getting file name given the group dereferenced via constructor + H5std_string fname = refgroup.getFileName(); + verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__); + + // Check getting file name given the group dereferenced by ::reference + fname = group.getFileName(); + verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__); + + // Unlink one of the objects in the dereferenced group, and re-check + refgroup.unlink(GROUPNAME2); + nobjs = refgroup.getNumObjs(); + verify_val(nobjs, 2, "H5Group::getNumObjs", __LINE__, __FILE__); + + // Close resources + group.close(); + refgroup.close(); + dset1.close(); + file1->close(); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_group()", __LINE__, __FILE__, E.getCDetailMsg()); + } + + if(file1) + delete file1; +} /* test_reference_group() */ + +/**************************************************************** +** +** test_reference_region_1D(): Test 1-D reference functionality +** Tests 1-D references to various kinds of objects +** +****************************************************************/ +static void +test_reference_region_1D(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dset1, /* Dataset ID */ + dset3; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid3; /* Dataspace ID #3 */ + hid_t dapl_id; /* Dataset access property list */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims3[] = {SPACE3_DIM1}; + hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t * coords; /* Coordinate buffer */ + hsize_t low[SPACE3_RANK]; /* Selection bounds */ + hsize_t high[SPACE3_RANK]; /* Selection bounds */ + uint8_t *tu8; /* Temporary pointer to uint8 data */ + H5O_type_t obj_type; /* Object type */ + int i; /* counting variables */ + herr_t ret; /* Generic return value */ + + // Output message about test being performed + SUBTEST("1-D Dataset Region Reference Functions"); + + try { + hdset_reg_ref_t *wbuf, // buffer to write to disk + *rbuf, // buffer read from disk + *tbuf; // temp. buffer read from disk + uint8_t *dwbuf, // Buffer for writing numeric data to disk + *drbuf; // Buffer for reading numeric data from disk + + // Allocate write & read buffers + wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); + rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); + dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); + drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); + + // Create file FILE1 + H5File file1(FILE2, H5F_ACC_TRUNC); + + // Create dataspace for datasets + hsize_t dims3[] = {SPACE3_DIM1}; + DataSpace sid3(SPACE3_RANK, dims3); + + // Create dataset access property list + PropList dapl(H5P_DATASET_ACCESS); + + // Create a dataset + DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3); + + uint8_t *tu8; // Temporary pointer to uint8 data + for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) + *tu8++ = i * 3; // from C test + + // Write selection to disk + dset3.write(dwbuf, PredType::STD_U8LE); + + // Close Dataset + dset3.close(); + + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a dataset (inside /Group1) + DataSet dset1 = file1.createDataSet(DSET1_NAME, PredType::STD_REF_DSETREG, sid1); + + /* Create references */ + + /* Select 15 2x1 hyperslabs for first reference */ + start[0] = 2; + stride[0] = 5; + count[0] = 15; + block[0] = 2; + + // Select a hyperslab region to add to the current selected region + sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); + + // Get and verify the number of elements in a dataspace selection + hssize_t nelms = sid3.getSelectNpoints(); + verify_val(nelms, 30, "DataSet::getRefObjType", __LINE__, __FILE__); + + // Store first dataset region + file1.reference(&wbuf[0], "/Dataset2", sid3); + + // Get and verify object type + H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION); + verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + + /* Select sequence of ten points for second reference */ + coord1[0][0] = 16; + coord1[1][0] = 22; + coord1[2][0] = 38; + coord1[3][0] = 41; + coord1[4][0] = 52; + coord1[5][0] = 63; + coord1[6][0] = 70; + coord1[7][0] = 89; + coord1[8][0] = 97; + coord1[9][0] = 3; + + // Selects array elements to be included in the selection for sid3 + sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1); + + // Get and verify the number of elements in a dataspace selection + nelms = sid3.getSelectNpoints(); + verify_val(nelms, 10, "DataSet::getRefObjType", __LINE__, __FILE__); + + // Store first dataset region + file1.reference(&wbuf[1], "/Dataset2", sid3); + + // Write selection to disk + dset1.write(wbuf, PredType::STD_REF_DSETREG); + + // Close disk dataspace, dataset, and file + sid1.close(); + dset1.close(); + sid3.close(); + file1.close(); + + // Re-open the file + file1.openFile(FILE2, H5F_ACC_RDWR); + + // Open the dataset + dset1 = file1.openDataSet("/Dataset1"); + + // Read selection from disk + dset1.read(rbuf, PredType::STD_REF_DSETREG); + + // Dereference dataset object by ctor, from the location where + // 'dset1' is located + dset3.dereference(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); + + /* DataSet adset3(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); + */ + + // Get and verify object type + obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION); + verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + + // Check information in the referenced dataset, i.e., adset3 + + // Get dataspace of adset3 the verify number of elements + sid1 = dset3.getSpace(); + nelms = sid1.getSimpleExtentNpoints(); + verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + + // Read from disk + dset3.read(drbuf, PredType::STD_U8LE); + + for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++) + verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + + // Get the referenced region and verify values + + // Get region + DataSpace reg_sp = dset1.getRegion(&rbuf[0]); + + // Get and verify number of elements in a dataspace selection + nelms = reg_sp.getSelectNpoints(); + verify_val((long)nelms, 30, "DataSpace::getSelectNpoints", __LINE__, __FILE__); + + // Get and verify number of hyperslab blocks + nelms = reg_sp.getSelectHyperNblocks(); + verify_val((long)nelms, 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__); + + /* Allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2); + + // Get the list of hyperslab blocks currently selected + reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords); + + // Verify values in the list + verify_val(coords[0], 2, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[1], 3, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[2], 7, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[3], 8, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[4], 12, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[5], 13, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[6], 17, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[7], 18, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[8], 22, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[9], 23, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[10], 27, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[11], 28, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[12], 32, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[13], 33, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[14], 37, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[15], 38, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[16], 42, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[17], 43, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[18], 47, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[19], 48, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[20], 52, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[21], 53, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[22], 57, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[23], 58, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[24], 62, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[25], 63, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[26], 67, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[27], 68, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[28], 72, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[29], 73, "Hyperslab Coordinates", __LINE__, __FILE__); + + HDfree(coords); + + // Check boundaries + reg_sp.getSelectBounds(low, high); + verify_val(low[0], 2, "DataSpace::getSelectBounds", __LINE__, __FILE__); + verify_val(high[0], 73, "DataSpace::getSelectBounds", __LINE__, __FILE__); + + /* Close region space */ + reg_sp.close(); + + // Get the referenced region and verify values + + // Get region + DataSpace elm_sp = dset1.getRegion(&rbuf[1]); + + // Get and verify number of element points in the current selection + hssize_t nelmspts = elm_sp.getSelectElemNpoints(); + verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__); + + /* Allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)); + + // Get the list of element points currently selected + elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords); + + // Verify points + verify_val(coords[0], coord1[0][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[1], coord1[1][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[2], coord1[2][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[3], coord1[3][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[4], coord1[4][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[5], coord1[5][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[6], coord1[6][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[7], coord1[7][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[8], coord1[8][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[9], coord1[9][0], "Element Coordinates", __LINE__, __FILE__); + + HDfree(coords); + + // Check boundaries + elm_sp.getSelectBounds(low, high); + verify_val(low[0], 3, "DataSpace::getSelectBounds", __LINE__, __FILE__); + verify_val(high[0], 97, "DataSpace::getSelectBounds", __LINE__, __FILE__); + + // Close element space + elm_sp.close(); + + // Close resources + sid1.close(); + dset3.close(); + dset1.close(); + file1.close(); + + // Free memory buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_region_1D()", __LINE__, __FILE__, E.getCDetailMsg()); + } + +} /* test_reference_region_1D() */ + + /**************************************************************** ** ** test_reference_compat(): Test basic object reference functionality. @@ -346,7 +858,10 @@ void test_reference(void) // Output message about test being performed MESSAGE(5, ("Testing References\n")); + test_reference_params(); // Test basic parameters of reference functionality test_reference_obj(); // Test basic object reference functionality + test_reference_group(); // Test group reference functionality + test_reference_region_1D(); // Test 1-D reference functionality test_reference_compat(); // Tests deprecated reference routines (not yet) } // test_reference() @@ -363,5 +878,6 @@ extern "C" void cleanup_reference(void) { HDremove(FILE1.c_str()); + HDremove(FILE2.c_str()); } -- cgit v0.12 From d95f5e293a2c550f24522a98873a08ad7942ee06 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 18 Sep 2013 21:41:00 -0500 Subject: [svn-r24162] backing out a commit that includes wrong files --- c++/src/H5Attribute.cpp | 1 - c++/src/H5CommonFG.cpp | 131 +++++++++++ c++/src/H5CommonFG.h | 12 + c++/src/H5DataSet.cpp | 49 ++++- c++/src/H5DataSet.h | 8 +- c++/src/H5DataSpace.cpp | 2 +- c++/src/H5DataType.cpp | 13 +- c++/src/H5DataType.h | 8 +- c++/src/H5File.h | 3 + c++/src/H5Group.cpp | 17 +- c++/src/H5Group.h | 10 +- c++/src/H5IdComponent.cpp | 2 +- c++/src/H5Location.cpp | 421 +++++++++++------------------------ c++/src/H5Location.h | 51 ++--- c++/src/H5Object.cpp | 1 + c++/src/H5PropList.cpp | 5 +- c++/test/trefer.cpp | 548 ++-------------------------------------------- 17 files changed, 375 insertions(+), 907 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index a98a970..d684b8f 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -44,7 +44,6 @@ namespace H5 { #endif // H5_NO_STD #endif -class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate //-------------------------------------------------------------------------- // Function: Attribute default constructor ///\brief Default constructor: Creates a stub attribute diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 3bf4b4f..d6fe5dc 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -460,6 +460,137 @@ H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const } //-------------------------------------------------------------------------- +// Function: CommonFG::setComment +///\brief Sets or resets the comment for an object specified by its name. +///\param name - IN: Name of the object +///\param comment - IN: New comment +///\exception H5::FileIException or H5::GroupIException +///\par Description +/// If \a comment is an empty string or a null pointer, the comment +/// message is removed from the object. +/// Comments should be relatively short, null-terminated, ASCII +/// strings. They can be attached to any object that has an +/// object header, e.g., data sets, groups, named data types, +/// and data spaces, but not symbolic links. +// Programmer Binh-Minh Ribler - 2000 +// Modification +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void CommonFG::setComment( const char* name, const char* comment ) const +{ + herr_t ret_value = H5Oset_comment_by_name( getLocId(), name, comment, H5P_DEFAULT ); + if( ret_value < 0 ) + throwException("setComment", "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name and \a comment. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void CommonFG::setComment( const H5std_string& name, const H5std_string& comment ) const +{ + setComment( name.c_str(), comment.c_str() ); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::removeComment +///\brief Removes the comment from an object specified by its name. +///\param name - IN: Name of the object +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - May 2005 +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void CommonFG::removeComment(const char* name) const +{ + herr_t ret_value = H5Oset_comment_by_name(getLocId(), name, NULL, H5P_DEFAULT); + if( ret_value < 0 ) + throwException("removeComment", "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::removeComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - May 2005 +//-------------------------------------------------------------------------- +void CommonFG::removeComment(const H5std_string& name) const +{ + removeComment (name.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::getComment +///\brief Retrieves comment for the specified object and its comment's +/// length. +///\param name - IN: Name of the object +///\param bufsize - IN: Length of the comment to retrieve +///\return Comment string +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const +{ + // bufsize is default to 256 + // temporary variable + hid_t loc_id = getLocId(); // temporary variable + + // temporary C-string for the object's comment; bufsize already including + // null character + char* comment_C = new char[bufsize]; + ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); + + // if the actual length of the comment is longer than bufsize and bufsize + // was the default value, i.e., not given by the user, then call + // H5Oget_comment_by_name again with the correct value. + // If the call to H5Oget_comment_by_name returned an error, skip this block + // and throw an exception below. + if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) + { + size_t new_size = ret_value; + delete []comment_C; + comment_C = new char[new_size]; // new_size including null terminator + ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); + } + + // if H5Oget_comment_by_name returns SUCCEED, return the string comment, + // otherwise, throw an exception + if( ret_value < 0 ) { + delete []comment_C; + throwException("getComment", "H5Oget_comment_by_name failed"); + } + + H5std_string comment = H5std_string(comment_C); + delete []comment_C; + return (comment); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::getComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5std_string CommonFG::getComment( const H5std_string& name, size_t bufsize ) const +{ + return( getComment( name.c_str(), bufsize )); +} + +//-------------------------------------------------------------------------- // Function: CommonFG::mount ///\brief Mounts the file \a child onto this group. ///\param name - IN: Name of the group diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index b02b05b..22e193a 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -49,6 +49,18 @@ class H5_DLLCPP CommonFG { DataSet openDataSet(const char* name) const; DataSet openDataSet(const H5std_string& name) const; + // Retrieves comment for the HDF5 object specified by its name. + H5std_string getComment(const char* name, size_t bufsize=256) const; + H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; + + // Removes the comment for the HDF5 object specified by its name. + void removeComment(const char* name) const; + void removeComment(const H5std_string& name) const; + + // Sets the comment for an HDF5 object specified by its name. + void setComment(const char* name, const char* comment) const; + void setComment(const H5std_string& name, const H5std_string& comment) const; + // Returns the value of a symbolic link. H5std_string getLinkval(const char* link_name, size_t size=0) const; H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const; diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 7f6c553..3e3893c 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -27,7 +27,6 @@ #include "H5Object.h" #include "H5PropList.h" #include "H5DxferProp.h" -#include "H5DaccProp.h" #include "H5DcreatProp.h" #include "H5FaccProp.h" #include "H5FcreatProp.h" @@ -80,29 +79,57 @@ DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(origi //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 location, creates a +///\brief Given a reference, ref, to an hdf5 dataset, creates a /// DataSet object -///\param loc - IN: Dataset reference object is in or location of +///\param obj - IN: Dataset reference object is in or location of /// object that the dataset is located within. ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type - default to H5R_OBJECT ///\exception H5::DataSetIException ///\par Description -/// \c loc can be DataSet, Group, H5File, or named DataType, that +/// \c obj can be DataSet, Group, H5File, or named DataType, that /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object() +DataSet::DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() { - H5Location::dereference(loc, ref, ref_type, plist); + try { + id = p_dereference(obj.getId(), ref, ref_type); + } catch (ReferenceException deref_error) { + throw ReferenceException("DataSet constructor - located by object", + deref_error.getDetailMsg()); + } } //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 attribute, creates a +///\brief Given a reference, ref, to an hdf5 dataset, creates a +/// DataSet object +///\param h5file - IN: Location referenced object is in +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type - default to H5R_OBJECT +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// Jul, 2008 +// Added for application convenience. +//-------------------------------------------------------------------------- +DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() +{ + try { + id = p_dereference(h5file.getId(), ref, ref_type); + } catch (ReferenceException deref_error) { + throw ReferenceException("DataSet constructor - located by HDF5 file", + deref_error.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: DataSet overload constructor - dereference +///\brief Given a reference, ref, to an hdf5 dataset, creates a /// DataSet object ///\param attr - IN: Specifying location where the referenced object is in ///\param ref - IN: Reference pointer @@ -113,12 +140,12 @@ DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, co // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object() +DataSet::DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() { - try { - id = p_dereference(attr.getId(), ref, ref_type, plist); + try { + id = p_dereference(attr.getId(), ref, ref_type); } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - by dereferenced", + throw ReferenceException("DataSet constructor - located by attribute", deref_error.getDetailMsg()); } } diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index e2fe702..bc80046 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -76,12 +76,16 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSet"); } // Creates a dataset by way of dereference. - DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); // Default constructor. DataSet(); diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 059c812..2e2bb35 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -446,7 +446,7 @@ void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const } //-------------------------------------------------------------------------- -// Function: DataSpace::selectElements +// Function: DataSpace::H5Sselect_elements ///\brief Selects array elements to be included in the selection for /// this dataspace. ///\param op - IN: Operator specifying how the new selection is to be diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 9e9433f..8a62471 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -100,7 +100,7 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- - /* DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() +DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() { try { id = p_dereference(obj.getId(), ref, ref_type); @@ -109,7 +109,6 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() deref_error.getDetailMsg()); } } - */ //-------------------------------------------------------------------------- // Function: DataType overload constructor - dereference @@ -124,16 +123,14 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() +DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() { - H5Location::dereference(loc, ref, ref_type, plist); - /* try { + try { id = p_dereference(h5file.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("DataType constructor - located by an H5File", deref_error.getDetailMsg()); } - */ } //-------------------------------------------------------------------------- @@ -149,10 +146,10 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() +DataType::DataType(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() { try { - id = p_dereference(attr.getId(), ref, ref_type, plist); + id = p_dereference(attr.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("DataType constructor - located by an Attribute", deref_error.getDetailMsg()); diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index e4254b0..6e56622 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -30,8 +30,9 @@ class H5_DLLCPP DataType : public H5Object { DataType( const DataType& original ); // Creates a datatype by way of dereference. - DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataType(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataType(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataType(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); // Closes this datatype. virtual void close(); @@ -100,6 +101,9 @@ class H5_DLLCPP DataType : public H5Object { // Checks whether this datatype is a variable-length string. bool isVariableStr() const; + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataType"); } diff --git a/c++/src/H5File.h b/c++/src/H5File.h index 2abffea..f906de6 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -61,6 +61,9 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { // and datatypes) in the same file. void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + // Returns the pointer to the file handle of the low-level file driver. void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; void getVFDHandle(void **file_handle) const; diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 3150025..eff7e50 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -99,18 +99,14 @@ Group::Group(const hid_t existing_id) : H5Object() /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- - /* Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() - */ -Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() +Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() { - H5Location::dereference(loc, ref, ref_type, plist); - /* try { - id = p_dereference(loc.getId(), ref, ref_type); + try { + id = p_dereference(obj.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("Group constructor - located by an H5Object", deref_error.getDetailMsg()); } - */ } //-------------------------------------------------------------------------- @@ -122,7 +118,7 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- - /* Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() +Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() { try { id = p_dereference(h5file.getId(), ref, ref_type); @@ -131,7 +127,6 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const deref_error.getDetailMsg()); } } - */ //-------------------------------------------------------------------------- // Function: Group overload constructor - dereference @@ -142,10 +137,10 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() +Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() { try { - id = p_dereference(attr.getId(), ref, ref_type, plist); + id = p_dereference(attr.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("Group constructor - located by an Attribute", deref_error.getDetailMsg()); diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 4003c21..3b53293 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -26,6 +26,9 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Close this group. virtual void close(); + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("Group"); } @@ -36,10 +39,9 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { virtual hid_t getLocId() const; // Creates a group by way of dereference. - Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - /* Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - */ - Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + Group(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + Group(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); // default constructor Group(); diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index f902116..4a997ab 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -269,7 +269,7 @@ IdComponent::IdComponent() {} // Description: // This function is protected so that the user applications can // only have access to its code via allowable classes, namely, -// Attribute and H5Location subclasses. +// H5File and H5Object subclasses. // Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string IdComponent::p_get_file_name() const diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index f03072d..fcf7ff4 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -22,7 +22,6 @@ #include "H5Location.h" #include "H5Object.h" #include "H5DcreatProp.h" -#include "H5DaccProp.h" #include "H5DxferProp.h" #include "H5FaccProp.h" #include "H5FcreatProp.h" @@ -56,17 +55,17 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, } //-------------------------------------------------------------------------- -// Function: H5Location default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location default constructor (protected) +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location() : IdComponent(0) {} //-------------------------------------------------------------------------- -// Function: H5Location overloaded constructor (protected) -// Purpose Creates an H5Location object using the id of an existing HDF5 -// object. -// Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location overloaded constructor (protected) +// Purpose Creates an H5Location object using the id of an existing HDF5 +// object. +// Parameters object_id - IN: Id of an existing HDF5 object +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} @@ -79,30 +78,6 @@ H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} //-------------------------------------------------------------------------- H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {} -//-------------------------------------------------------------------------- -// Function: H5Location constructor -///\brief Dereferences into an HDF5 object, given an HDF5 location. -///\param loc - IN: H5Location instance to copy -///\param ref - IN: Name of the object to be referenced -///\param ref_type - IN: Dataspace with selection -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- - // Dereferences into an HDF5 object, given an HDF5 location. - /* H5Location::H5Location(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) -{ - hid_t temp_id; - try { - temp_id = p_dereference(loc.getId(), ref, ref_type, plist); - } - catch (ReferenceException deref_error) { - throw ReferenceException("H5Location constructor - by dereferenced", - deref_error.getDetailMsg()); - } - setId(temp_id); -} - */ - - #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- @@ -367,7 +342,7 @@ void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& new /// which can be either of these values: /// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file /// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::Exception +///\exception H5::FileIException ///\par Description /// This location is used to identify the file to be flushed. // Programmer Binh-Minh Ribler - 2012 @@ -380,7 +355,7 @@ void H5Location::flush(H5F_scope_t scope) const herr_t ret_value = H5Fflush(getId(), scope); if( ret_value < 0 ) { - throw Exception(inMemFunc("flush"), "H5Fflush failed"); + throw FileIException(inMemFunc("flush"), "H5Fflush failed"); } } @@ -401,147 +376,17 @@ H5std_string H5Location::getFileName() const } } -//-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief Sets or resets the comment for an object specified by its name. -///\param name - IN: Name of the object -///\param comment - IN: New comment -///\exception H5::Exception -///\par Description -/// If \a comment is an empty string or a null pointer, the comment -/// message is removed from the object. -/// Comments should be relatively short, null-terminated, ASCII -/// strings. They can be attached to any object that has an -/// object header, e.g., data sets, groups, named data types, -/// and data spaces, but not symbolic links. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -// Modification -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void H5Location::setComment(const char* name, const char* comment) const -{ - herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT); - if( ret_value < 0 ) - throw Exception("setComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name and \a comment. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -//-------------------------------------------------------------------------- -void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const -{ - setComment(name.c_str(), comment.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::removeComment -///\brief Removes the comment from an object specified by its name. -///\param name - IN: Name of the object -///\exception H5::Exception -// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void H5Location::removeComment(const char* name) const -{ - herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT); - if( ret_value < 0 ) - throw Exception("removeComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::removeComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) -//-------------------------------------------------------------------------- -void H5Location::removeComment(const H5std_string& name) const -{ - removeComment (name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getComment -///\brief Retrieves comment for the specified object and its comment's -/// length. -///\param name - IN: Name of the object -///\param bufsize - IN: Length of the comment to retrieve -///\return Comment string -///\exception H5::Exception -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -H5std_string H5Location::getComment(const char* name, size_t bufsize) const -{ - // bufsize is default to 256 - // temporary variable - hid_t loc_id = getId(); // temporary variable - - // temporary C-string for the object's comment; bufsize already including - // null character - char* comment_C = new char[bufsize]; - ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); - - // if the actual length of the comment is longer than bufsize and bufsize - // was the default value, i.e., not given by the user, then call - // H5Oget_comment_by_name again with the correct value. - // If the call to H5Oget_comment_by_name returned an error, skip this block - // and throw an exception below. - if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) - { - size_t new_size = ret_value; - delete []comment_C; - comment_C = new char[new_size]; // new_size including null terminator - ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); - } - - // if H5Oget_comment_by_name returns SUCCEED, return the string comment, - // otherwise, throw an exception - if (ret_value < 0) { - delete []comment_C; - throw Exception("getComment", "H5Oget_comment_by_name failed"); - } - - H5std_string comment = H5std_string(comment_C); - delete []comment_C; - return (comment); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -//-------------------------------------------------------------------------- -H5std_string H5Location::getComment(const H5std_string& name, size_t bufsize) const -{ - return(getComment(name.c_str(), bufsize)); -} #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. +// Function: H5Location::p_reference (protected) +// Purpose Creates a reference to an HDF5 object or a dataset region. // Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 +// name - IN: Name of the object to be referenced +// dataspace - IN: Dataspace with selection +// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION +// Exception H5::IdComponentException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const { @@ -555,18 +400,17 @@ void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_ty #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: +// Function: H5Location::reference +///\brief Creates a reference to an HDF5 object or a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: /// \li \c H5R_OBJECT - Reference is an object reference. /// \li \c H5R_DATASET_REGION - Reference is a dataset region /// reference. - this is the default -///\exception H5::ReferenceException -///\notes This method is more suitable for a dataset region reference. -// Programmer Binh-Minh Ribler - May, 2004 +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const { @@ -579,49 +423,23 @@ void H5Location::reference(void* ref, const char* name, const DataSpace& dataspa } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference. - this is the default -///\exception H5::ReferenceException -///\notes This method is more suitable for a dataset region reference. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const -{ - try { - p_reference(ref, name.c_str(), dataspace.getId(), ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Location::reference", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it does not take -/// a DataSpace object and the reference type must be specified. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -///\exception H5::ReferenceException -///\notes This method is more suitable for an object reference. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it only creates +/// a reference to an HDF5 object, not to a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c char pointer +///\exception H5::ReferenceException +///\par Description +// This function passes H5R_OBJECT and -1 to the protected +// function for it to pass to the C API H5Rcreate +// to create a reference to the named object. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const +void H5Location::reference(void* ref, const char* name) const { try { - p_reference(ref, name, -1, ref_type); + p_reference(ref, name, -1, H5R_OBJECT); } catch (ReferenceException E) { throw ReferenceException("H5Location::reference", E.getDetailMsg()); @@ -629,21 +447,17 @@ void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) con } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -///\notes This method is more suitable for an object reference. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for the object's name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c H5std_string +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const +void H5Location::reference(void* ref, const H5std_string& name) const { - reference(ref, name.c_str(), ref_type); + reference(ref, name.c_str()); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -661,16 +475,10 @@ void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_t // May 2008 - BMR // Moved from IdComponent. //-------------------------------------------------------------------------- -hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist) +hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type) { - hid_t plist_id; - if (p_valid_id(plist.getId())) - plist_id = plist.getId(); - else - plist_id = H5P_DEFAULT; - hid_t temp_id; - temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref); + temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref); if (temp_id < 0) { throw ReferenceException("", "H5Rdereference failed"); @@ -688,16 +496,16 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) +void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type) { hid_t temp_id; try { - temp_id = p_dereference(loc.getId(), ref, ref_type, plist); + temp_id = p_dereference(obj.getId(), ref, ref_type); } catch (ReferenceException E) { throw ReferenceException("H5Location::dereference - located by object", E.getDetailMsg()); @@ -707,21 +515,45 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t //-------------------------------------------------------------------------- // Function: H5Location::dereference +///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. +///\param h5file - IN: HDF5 file specifying the location of the referenced object +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// May, 2008 +// Corrected missing parameters. - BMR +//-------------------------------------------------------------------------- +void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) +{ + hid_t temp_id; + try { + temp_id = p_dereference(h5file.getId(), ref, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::dereference - located by file", E.getDetailMsg()); + } + p_setId(temp_id); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::dereference ///\brief Dereferences a reference into an HDF5 object, given an attribute. ///\param attr - IN: Attribute specifying the location of the referenced object ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) +void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) { hid_t temp_id; try { - temp_id = p_dereference(attr.getId(), ref, ref_type, plist); + temp_id = p_dereference(attr.getId(), ref, ref_type); } catch (ReferenceException E) { throw ReferenceException("H5Location::dereference - located by attribute", E.getDetailMsg()); @@ -761,20 +593,20 @@ H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_UNKNOWN \tFailure occurs (-1) -// H5G_GROUP \tObject is a group. -// H5G_DATASET \tObject is a dataset. -// H5G_TYPE Object \tis a named datatype. -// H5G_LINK \tObject is a symbolic link. -// H5G_UDLINK \tObject is a user-defined link. -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5G_UNKNOWN \tFailure occurs (-1) +// H5G_GROUP \tObject is a group. +// H5G_DATASET \tObject is a dataset. +// H5G_TYPE Object \tis a named datatype. +// H5G_LINK \tObject is a symbolic link. +// H5G_UDLINK \tObject is a user-defined link. +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const { @@ -790,20 +622,20 @@ H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- -// Function: H5Location::getRefObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\return An object type, which can be one of the following: -/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) -/// \li \c H5O_TYPE_GROUP - Object is a group -/// \li \c H5O_TYPE_DATASET - Object is a dataset -/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype -/// \li \c H5O_TYPE_NTYPES - Number of different object types -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRefObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref - IN: Reference to query +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. +///\return An object type, which can be one of the following: +/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) +/// \li \c H5O_TYPE_GROUP - Object is a group +/// \li \c H5O_TYPE_DATASET - Object is a dataset +/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +/// \li \c H5O_TYPE_NTYPES - Number of different object types +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const { @@ -817,19 +649,19 @@ H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_ref_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_ref_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: // H5O_TYPE_UNKNOWN - Unknown object type (-1) // H5O_TYPE_GROUP - Object is a group // H5O_TYPE_DATASET - Object is a dataset // H5O_TYPE_NAMED_DATATYPE - Object is a named datatype // H5O_TYPE_NTYPES - Number of object types -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const { @@ -845,29 +677,24 @@ H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const //-------------------------------------------------------------------------- -// Function: H5Location::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -///\return DataSpace object -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::p_get_region (protected) +// Purpose Retrieves a dataspace with the region pointed to selected. +// Parameters +// ref_type - IN: Type of reference to get region of - default +// to H5R_DATASET_REGION +// ref - IN: Reference to get region of +// Return Dataspace id +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const +hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const { hid_t space_id = H5Rget_region(getId(), ref_type, ref); if (space_id < 0) { throw ReferenceException("", "H5Rget_region failed"); } - try { - DataSpace dataspace(space_id); - return(dataspace); - } - catch (DataSpaceIException E) { - throw ReferenceException("H5Location::getRegion", E.getDetailMsg()); - } + return(space_id); } diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 996cc21..1f54439 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -36,12 +36,12 @@ typedef void (*attr_operator_t)( H5Location& loc/*in*/, class UserData4Aiterate { // user data for attribute iteration public: - attr_operator_t op; - void* opData; - H5Location* location; + attr_operator_t op; + void* opData; + H5Location* location; }; -// An H5Location can be a file, group, dataset, or committed datatype. +// An H5Location can be a file, group, dataset, named datatype, or attribute. class H5_DLLCPP H5Location : public IdComponent { public: @@ -85,47 +85,29 @@ class H5_DLLCPP H5Location : public IdComponent { bool attrExists(const char* name) const; bool attrExists(const H5std_string& name) const; - // Renames the named attribute to a new name. - void renameAttr(const char* oldname, const char* newname) const; - void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; - // Removes the named attribute from this location. void removeAttr(const char* name) const; void removeAttr(const H5std_string& name) const; - // Sets the comment for an HDF5 object specified by its name. - void setComment(const char* name, const char* comment) const; - void setComment(const H5std_string& name, const H5std_string& comment) const; - - // Retrieves comment for the HDF5 object specified by its name. - H5std_string getComment(const char* name, size_t bufsize=256) const; - H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; - - // Removes the comment for the HDF5 object specified by its name. - void removeComment(const char* name) const; - void removeComment(const H5std_string& name) const; + // Renames the named attribute to a new name. + void renameAttr(const char* oldname, const char* newname) const; + void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; // Creates a reference to a named object or to a dataset region // in this object. - void reference(void* ref, const char* name, - H5R_type_t ref_type = H5R_OBJECT) const; - void reference(void* ref, const H5std_string& name, - H5R_type_t ref_type = H5R_DATASET_REGION) const; void reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const H5std_string& name, const DataSpace& dataspace, - H5R_type_t ref_type = H5R_DATASET_REGION) const; + void reference(void* ref, const char* name) const; + void reference(void* ref, const H5std_string& name) const; // Open a referenced object whose location is specified by either // a file, an HDF5 object, or an attribute. - void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - - ///\brief Returns an identifier. (pure virtual) - virtual hid_t getId() const = 0; + ///\brief Returns an identifier. (pure virtual) + virtual hid_t getId() const = 0; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -142,7 +124,7 @@ class H5_DLLCPP H5Location : public IdComponent { void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; // Dereferences a ref into an HDF5 id. - hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist); + hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type); #ifndef H5_NO_DEPRECATED_SYMBOLS // Retrieves the type of object that an object reference points to. @@ -152,6 +134,9 @@ class H5_DLLCPP H5Location : public IdComponent { // Retrieves the type of object that an object reference points to. H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; + // Retrieves a dataspace with the region pointed to selected. + hid_t p_get_region(void *ref, H5R_type_t ref_type) const; + // Noop destructor. virtual ~H5Location(); diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 1d96f2e..b596092 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -52,6 +52,7 @@ H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {} + //-------------------------------------------------------------------------- // Function: H5Object copy constructor ///\brief Copy constructor: makes a copy of the original H5Object diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index e070406..c14d74f 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -39,7 +39,7 @@ namespace H5 { //-------------------------------------------------------------------------- ///\brief Constant for default property. //-------------------------------------------------------------------------- -const PropList PropList::DEFAULT; +const PropList PropList::DEFAULT( H5P_DEFAULT ); //-------------------------------------------------------------------------- // Function Default constructor @@ -644,9 +644,6 @@ void PropList::removeProp(const H5std_string& name) const //-------------------------------------------------------------------------- bool PropList::operator==(const PropList& rhs) const { - fprintf(stderr, "operator==\n"); -H5Eprint2(H5E_DEFAULT, stderr); - htri_t ret_value = H5Pequal(id, rhs.getId()); if( ret_value > 0 ) return true; diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 6acf8a9..ce18e58 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -27,6 +27,13 @@ #endif #include +#ifndef H5_NO_NAMESPACE +#ifndef H5_NO_STD + using std::cerr; + using std::endl; +#endif // H5_NO_STD +#endif + #include "H5Cpp.h" // C++ API header file #ifndef H5_NO_NAMESPACE @@ -37,10 +44,11 @@ const H5std_string FILE1("trefer1.h5"); const H5std_string FILE2("trefer2.h5"); +const H5std_string FILE3("trefer3.h5"); +const H5std_string DSET_DEFAULT_NAME("default"); // Dataset 1 const H5std_string DSET1_NAME("Dataset1"); -const H5std_string DSET2_NAME("Dataset2"); const int DSET1_LEN = 8; const H5std_string MEMBER1( "a_name" ); @@ -48,15 +56,15 @@ const H5std_string MEMBER2( "b_name" ); const H5std_string MEMBER3( "c_name" ); // 1-D dataset with fixed dimensions +const H5std_string SPACE1_NAME("Space1"); const int SPACE1_RANK = 1; const int SPACE1_DIM1 = 4; -/* Larger 1-D dataset with fixed dimensions */ -const int SPACE3_RANK = 1; -const int SPACE3_DIM1 = 100; +// 2-D dataset with fixed dimensions +const H5std_string SPACE2_NAME("Space2"); -/* Element selection information */ -const int POINT1_NPOINTS = 10; +// Larger 1-D dataset with fixed dimensions +const H5std_string SPACE3_NAME("Space3"); // Compound datatype typedef struct s1_t { @@ -67,122 +75,8 @@ typedef struct s1_t { /**************************************************************** ** -** test_reference_params(): Test basic H5R (reference) parameters -** for correct processing -** -****************************************************************/ -static void -test_reference_params(void) -{ - const char *write_comment = "Foo!"; /* Comments for group */ - - // Output message about test being performed - SUBTEST("Object Reference Parameters"); - - H5File* file1 = NULL; - try { - hobj_ref_t *wbuf, // buffer to write to disk - *rbuf, // buffer read from disk - *tbuf; // temp. buffer read from disk - - // Allocate write & read buffers - int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t)); - wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); - rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); - tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); - - // Create file FILE1 - file1 = new H5File (FILE1, H5F_ACC_TRUNC); - - // Create dataspace for datasets - hsize_t dims1[] = {SPACE1_DIM1}; - DataSpace sid1(SPACE1_RANK, dims1); - - // Create a group - Group group = file1->createGroup("Group1"); - - // Set group's comment - group.setComment(".", write_comment); - - // Create a dataset (inside /Group1) - DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); - - unsigned *tu32; // Temporary pointer to uint32 data - int i; - for (tu32=(unsigned *)wbuf, i=0; icreateDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); - - /* Test parameters to H5Location::reference */ - try { - file1->reference(NULL, "/Group1/Dataset1"); - } catch (ReferenceException E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], NULL); - } catch (ReferenceException E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], ""); - } catch (ReferenceException E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE); - } catch (ReferenceException E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION); - } catch (ReferenceException E) {} // We expect this to fail - - // Close resources - dataset.close(); - file1->close(); - // Let sid1 go out of scope - - // Free memory buffers - HDfree(wbuf); - HDfree(rbuf); - HDfree(tbuf); - - PASSED(); - } // end try - catch (Exception E) { - issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCDetailMsg()); - } - - if(file1) - delete file1; -} /* test_reference_param() */ - -/**************************************************************** -** -** test_reference_obj(): Test basic object reference functions -** to various kinds of objects +** test_reference_obj(): Test basic object reference functionality. +** Tests references to various kinds of objects ** ****************************************************************/ static void test_reference_obj(void) @@ -427,412 +321,6 @@ static void test_reference_obj(void) delete file1; } // test_reference_obj() - -/**************************************************************** -** -** test_reference_group(): Test object reference functionality -** Tests for correct behavior of various routines on -** dereferenced group -** -****************************************************************/ -#define GROUPNAME "/group" -#define GROUPNAME2 "group2" -#define GROUPNAME3 "group3" -#define DSETNAME "/dset" -#define DSETNAME2 "dset2" -#define NAME_SIZE 16 - -static void -test_reference_group(void) -{ - hobj_ref_t wref; /* Reference to write */ - hobj_ref_t rref; /* Reference to read */ - int i; // counting variables - const H5std_string write_comment="Foo!"; // Comments for group - - // Output message about test being performed - SUBTEST("Object Reference to Group"); - - H5File* file1 = NULL; - try { - // Create file with a group and a dataset containing an object reference to the group - - // Create file FILE1 - file1 = new H5File (FILE1, H5F_ACC_TRUNC); - - // Create scalar dataspace - DataSpace sid1; - - // Create a group - Group group = file1->createGroup(GROUPNAME); - - /* Create nested groups */ - Group group2 = group.createGroup(GROUPNAME2); - group2.close(); - group2 = group.createGroup(GROUPNAME3); - group2.close(); - - // Create bottom dataset - DataSet dset1 = group.createDataSet(DSETNAME2, PredType::NATIVE_INT, sid1); - dset1.close(); - - // Close group 1 - group.close(); - - // Create dataset - DataSet dset2 = file1->createDataSet(DSETNAME, PredType::STD_REF_OBJ, sid1); - - file1->reference(&wref, GROUPNAME); - - // Write selection to disk - dset2.write(&wref, PredType::STD_REF_OBJ); - - // Close resources - dset2.close(); - sid1.close(); - file1->close(); - - /* - * Re-open the file and test deferencing group - */ - - // Re-open file - file1->openFile(FILE1, H5F_ACC_RDWR); - - // Re-open dataset - dset1 = file1->openDataSet(DSETNAME); - - // Read in the reference - dset1.read(&rref, PredType::STD_REF_OBJ); - - // Dereference to get the group - Group refgroup(dset1, &rref); - - // Dereference group object the other way - group.dereference(dset1, &rref); - - /* - * Various queries on the group opened - */ - - // Check number of objects in the group dereferenced by constructor - hsize_t nobjs = refgroup.getNumObjs(); - verify_val(nobjs, 3, "H5Group::getNumObjs", __LINE__, __FILE__); - - // Check number of objects in the group dereferenced by ::reference - nobjs = group.getNumObjs(); - verify_val(nobjs, 3, "H5Group::getNumObjs", __LINE__, __FILE__); - - // Check getting file name given the group dereferenced via constructor - H5std_string fname = refgroup.getFileName(); - verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__); - - // Check getting file name given the group dereferenced by ::reference - fname = group.getFileName(); - verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__); - - // Unlink one of the objects in the dereferenced group, and re-check - refgroup.unlink(GROUPNAME2); - nobjs = refgroup.getNumObjs(); - verify_val(nobjs, 2, "H5Group::getNumObjs", __LINE__, __FILE__); - - // Close resources - group.close(); - refgroup.close(); - dset1.close(); - file1->close(); - - PASSED(); - } // end try - catch (Exception E) { - issue_fail_msg("test_reference_group()", __LINE__, __FILE__, E.getCDetailMsg()); - } - - if(file1) - delete file1; -} /* test_reference_group() */ - -/**************************************************************** -** -** test_reference_region_1D(): Test 1-D reference functionality -** Tests 1-D references to various kinds of objects -** -****************************************************************/ -static void -test_reference_region_1D(void) -{ - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ - dset3; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ - sid3; /* Dataspace ID #3 */ - hid_t dapl_id; /* Dataset access property list */ - hsize_t dims1[] = {SPACE1_DIM1}, - dims3[] = {SPACE3_DIM1}; - hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ - hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ - hsize_t * coords; /* Coordinate buffer */ - hsize_t low[SPACE3_RANK]; /* Selection bounds */ - hsize_t high[SPACE3_RANK]; /* Selection bounds */ - uint8_t *tu8; /* Temporary pointer to uint8 data */ - H5O_type_t obj_type; /* Object type */ - int i; /* counting variables */ - herr_t ret; /* Generic return value */ - - // Output message about test being performed - SUBTEST("1-D Dataset Region Reference Functions"); - - try { - hdset_reg_ref_t *wbuf, // buffer to write to disk - *rbuf, // buffer read from disk - *tbuf; // temp. buffer read from disk - uint8_t *dwbuf, // Buffer for writing numeric data to disk - *drbuf; // Buffer for reading numeric data from disk - - // Allocate write & read buffers - wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); - rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); - dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); - drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); - - // Create file FILE1 - H5File file1(FILE2, H5F_ACC_TRUNC); - - // Create dataspace for datasets - hsize_t dims3[] = {SPACE3_DIM1}; - DataSpace sid3(SPACE3_RANK, dims3); - - // Create dataset access property list - PropList dapl(H5P_DATASET_ACCESS); - - // Create a dataset - DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3); - - uint8_t *tu8; // Temporary pointer to uint8 data - for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) - *tu8++ = i * 3; // from C test - - // Write selection to disk - dset3.write(dwbuf, PredType::STD_U8LE); - - // Close Dataset - dset3.close(); - - // Create dataspace for datasets - hsize_t dims1[] = {SPACE1_DIM1}; - DataSpace sid1(SPACE1_RANK, dims1); - - // Create a dataset (inside /Group1) - DataSet dset1 = file1.createDataSet(DSET1_NAME, PredType::STD_REF_DSETREG, sid1); - - /* Create references */ - - /* Select 15 2x1 hyperslabs for first reference */ - start[0] = 2; - stride[0] = 5; - count[0] = 15; - block[0] = 2; - - // Select a hyperslab region to add to the current selected region - sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); - - // Get and verify the number of elements in a dataspace selection - hssize_t nelms = sid3.getSelectNpoints(); - verify_val(nelms, 30, "DataSet::getRefObjType", __LINE__, __FILE__); - - // Store first dataset region - file1.reference(&wbuf[0], "/Dataset2", sid3); - - // Get and verify object type - H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION); - verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); - - /* Select sequence of ten points for second reference */ - coord1[0][0] = 16; - coord1[1][0] = 22; - coord1[2][0] = 38; - coord1[3][0] = 41; - coord1[4][0] = 52; - coord1[5][0] = 63; - coord1[6][0] = 70; - coord1[7][0] = 89; - coord1[8][0] = 97; - coord1[9][0] = 3; - - // Selects array elements to be included in the selection for sid3 - sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1); - - // Get and verify the number of elements in a dataspace selection - nelms = sid3.getSelectNpoints(); - verify_val(nelms, 10, "DataSet::getRefObjType", __LINE__, __FILE__); - - // Store first dataset region - file1.reference(&wbuf[1], "/Dataset2", sid3); - - // Write selection to disk - dset1.write(wbuf, PredType::STD_REF_DSETREG); - - // Close disk dataspace, dataset, and file - sid1.close(); - dset1.close(); - sid3.close(); - file1.close(); - - // Re-open the file - file1.openFile(FILE2, H5F_ACC_RDWR); - - // Open the dataset - dset1 = file1.openDataSet("/Dataset1"); - - // Read selection from disk - dset1.read(rbuf, PredType::STD_REF_DSETREG); - - // Dereference dataset object by ctor, from the location where - // 'dset1' is located - dset3.dereference(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); - - /* DataSet adset3(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); - */ - - // Get and verify object type - obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION); - verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); - - // Check information in the referenced dataset, i.e., adset3 - - // Get dataspace of adset3 the verify number of elements - sid1 = dset3.getSpace(); - nelms = sid1.getSimpleExtentNpoints(); - verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - - // Read from disk - dset3.read(drbuf, PredType::STD_U8LE); - - for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++) - verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - - // Get the referenced region and verify values - - // Get region - DataSpace reg_sp = dset1.getRegion(&rbuf[0]); - - // Get and verify number of elements in a dataspace selection - nelms = reg_sp.getSelectNpoints(); - verify_val((long)nelms, 30, "DataSpace::getSelectNpoints", __LINE__, __FILE__); - - // Get and verify number of hyperslab blocks - nelms = reg_sp.getSelectHyperNblocks(); - verify_val((long)nelms, 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__); - - /* Allocate space for the hyperslab blocks */ - coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2); - - // Get the list of hyperslab blocks currently selected - reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords); - - // Verify values in the list - verify_val(coords[0], 2, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[1], 3, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[2], 7, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[3], 8, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[4], 12, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[5], 13, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[6], 17, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[7], 18, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[8], 22, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[9], 23, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[10], 27, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[11], 28, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[12], 32, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[13], 33, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[14], 37, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[15], 38, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[16], 42, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[17], 43, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[18], 47, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[19], 48, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[20], 52, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[21], 53, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[22], 57, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[23], 58, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[24], 62, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[25], 63, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[26], 67, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[27], 68, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[28], 72, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[29], 73, "Hyperslab Coordinates", __LINE__, __FILE__); - - HDfree(coords); - - // Check boundaries - reg_sp.getSelectBounds(low, high); - verify_val(low[0], 2, "DataSpace::getSelectBounds", __LINE__, __FILE__); - verify_val(high[0], 73, "DataSpace::getSelectBounds", __LINE__, __FILE__); - - /* Close region space */ - reg_sp.close(); - - // Get the referenced region and verify values - - // Get region - DataSpace elm_sp = dset1.getRegion(&rbuf[1]); - - // Get and verify number of element points in the current selection - hssize_t nelmspts = elm_sp.getSelectElemNpoints(); - verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__); - - /* Allocate space for the hyperslab blocks */ - coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)); - - // Get the list of element points currently selected - elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords); - - // Verify points - verify_val(coords[0], coord1[0][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[1], coord1[1][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[2], coord1[2][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[3], coord1[3][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[4], coord1[4][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[5], coord1[5][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[6], coord1[6][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[7], coord1[7][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[8], coord1[8][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[9], coord1[9][0], "Element Coordinates", __LINE__, __FILE__); - - HDfree(coords); - - // Check boundaries - elm_sp.getSelectBounds(low, high); - verify_val(low[0], 3, "DataSpace::getSelectBounds", __LINE__, __FILE__); - verify_val(high[0], 97, "DataSpace::getSelectBounds", __LINE__, __FILE__); - - // Close element space - elm_sp.close(); - - // Close resources - sid1.close(); - dset3.close(); - dset1.close(); - file1.close(); - - // Free memory buffers - HDfree(wbuf); - HDfree(rbuf); - HDfree(dwbuf); - HDfree(drbuf); - - PASSED(); - } // end try - catch (Exception E) { - issue_fail_msg("test_reference_region_1D()", __LINE__, __FILE__, E.getCDetailMsg()); - } - -} /* test_reference_region_1D() */ - - /**************************************************************** ** ** test_reference_compat(): Test basic object reference functionality. @@ -858,10 +346,7 @@ void test_reference(void) // Output message about test being performed MESSAGE(5, ("Testing References\n")); - test_reference_params(); // Test basic parameters of reference functionality test_reference_obj(); // Test basic object reference functionality - test_reference_group(); // Test group reference functionality - test_reference_region_1D(); // Test 1-D reference functionality test_reference_compat(); // Tests deprecated reference routines (not yet) } // test_reference() @@ -878,6 +363,5 @@ extern "C" void cleanup_reference(void) { HDremove(FILE1.c_str()); - HDremove(FILE2.c_str()); } -- cgit v0.12 From 4182c81addaaac3e4234369dc5a0089fb93756d9 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 18 Sep 2013 22:08:28 -0500 Subject: [svn-r24163] Purpose: More on HDFFV-7520 and HDFFV-533 Description: - Improved the changes in revisions r22836 and r23438, mainly on the wrappers of reference, dereference, get region, and set/getcomment. - Added more tests. Platforms tested: Linux/32 2.6 (jam) SunOS 5.11 (emu) Linux/ppc64 (ostrich) --- c++/src/H5Attribute.cpp | 1 + c++/src/H5CommonFG.cpp | 131 ----------- c++/src/H5CommonFG.h | 12 - c++/src/H5DataSet.cpp | 48 +--- c++/src/H5DataSet.h | 8 +- c++/src/H5DataSpace.cpp | 2 +- c++/src/H5DataType.cpp | 13 +- c++/src/H5DataType.h | 8 +- c++/src/H5File.h | 3 - c++/src/H5Group.cpp | 17 +- c++/src/H5Group.h | 10 +- c++/src/H5IdComponent.cpp | 2 +- c++/src/H5Location.cpp | 420 ++++++++++++++++++++++++----------- c++/src/H5Location.h | 51 +++-- c++/src/H5Object.cpp | 1 - c++/src/H5PropList.cpp | 5 +- c++/test/trefer.cpp | 548 ++++++++++++++++++++++++++++++++++++++++++++-- 17 files changed, 905 insertions(+), 375 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index d684b8f..a98a970 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -44,6 +44,7 @@ namespace H5 { #endif // H5_NO_STD #endif +class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate //-------------------------------------------------------------------------- // Function: Attribute default constructor ///\brief Default constructor: Creates a stub attribute diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index d6fe5dc..3bf4b4f 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -460,137 +460,6 @@ H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const } //-------------------------------------------------------------------------- -// Function: CommonFG::setComment -///\brief Sets or resets the comment for an object specified by its name. -///\param name - IN: Name of the object -///\param comment - IN: New comment -///\exception H5::FileIException or H5::GroupIException -///\par Description -/// If \a comment is an empty string or a null pointer, the comment -/// message is removed from the object. -/// Comments should be relatively short, null-terminated, ASCII -/// strings. They can be attached to any object that has an -/// object header, e.g., data sets, groups, named data types, -/// and data spaces, but not symbolic links. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void CommonFG::setComment( const char* name, const char* comment ) const -{ - herr_t ret_value = H5Oset_comment_by_name( getLocId(), name, comment, H5P_DEFAULT ); - if( ret_value < 0 ) - throwException("setComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name and \a comment. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void CommonFG::setComment( const H5std_string& name, const H5std_string& comment ) const -{ - setComment( name.c_str(), comment.c_str() ); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::removeComment -///\brief Removes the comment from an object specified by its name. -///\param name - IN: Name of the object -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - May 2005 -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void CommonFG::removeComment(const char* name) const -{ - herr_t ret_value = H5Oset_comment_by_name(getLocId(), name, NULL, H5P_DEFAULT); - if( ret_value < 0 ) - throwException("removeComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::removeComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - May 2005 -//-------------------------------------------------------------------------- -void CommonFG::removeComment(const H5std_string& name) const -{ - removeComment (name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::getComment -///\brief Retrieves comment for the specified object and its comment's -/// length. -///\param name - IN: Name of the object -///\param bufsize - IN: Length of the comment to retrieve -///\return Comment string -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const -{ - // bufsize is default to 256 - // temporary variable - hid_t loc_id = getLocId(); // temporary variable - - // temporary C-string for the object's comment; bufsize already including - // null character - char* comment_C = new char[bufsize]; - ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); - - // if the actual length of the comment is longer than bufsize and bufsize - // was the default value, i.e., not given by the user, then call - // H5Oget_comment_by_name again with the correct value. - // If the call to H5Oget_comment_by_name returned an error, skip this block - // and throw an exception below. - if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) - { - size_t new_size = ret_value; - delete []comment_C; - comment_C = new char[new_size]; // new_size including null terminator - ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); - } - - // if H5Oget_comment_by_name returns SUCCEED, return the string comment, - // otherwise, throw an exception - if( ret_value < 0 ) { - delete []comment_C; - throwException("getComment", "H5Oget_comment_by_name failed"); - } - - H5std_string comment = H5std_string(comment_C); - delete []comment_C; - return (comment); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::getComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string CommonFG::getComment( const H5std_string& name, size_t bufsize ) const -{ - return( getComment( name.c_str(), bufsize )); -} - -//-------------------------------------------------------------------------- // Function: CommonFG::mount ///\brief Mounts the file \a child onto this group. ///\param name - IN: Name of the group diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 22e193a..b02b05b 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -49,18 +49,6 @@ class H5_DLLCPP CommonFG { DataSet openDataSet(const char* name) const; DataSet openDataSet(const H5std_string& name) const; - // Retrieves comment for the HDF5 object specified by its name. - H5std_string getComment(const char* name, size_t bufsize=256) const; - H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; - - // Removes the comment for the HDF5 object specified by its name. - void removeComment(const char* name) const; - void removeComment(const H5std_string& name) const; - - // Sets the comment for an HDF5 object specified by its name. - void setComment(const char* name, const char* comment) const; - void setComment(const H5std_string& name, const H5std_string& comment) const; - // Returns the value of a symbolic link. H5std_string getLinkval(const char* link_name, size_t size=0) const; H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const; diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 3e3893c..1765ca9 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -79,57 +79,29 @@ DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(origi //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a +///\brief Given a reference, ref, to an hdf5 location, creates a /// DataSet object -///\param obj - IN: Dataset reference object is in or location of +///\param loc - IN: Dataset reference object is in or location of /// object that the dataset is located within. ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type - default to H5R_OBJECT ///\exception H5::DataSetIException ///\par Description -/// \c obj can be DataSet, Group, H5File, or named DataType, that +/// \c loc can be DataSet, Group, H5File, or named DataType, that /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() +DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object() { - try { - id = p_dereference(obj.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by object", - deref_error.getDetailMsg()); - } + H5Location::dereference(loc, ref, ref_type, plist); } //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a -/// DataSet object -///\param h5file - IN: Location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// Jul, 2008 -// Added for application convenience. -//-------------------------------------------------------------------------- -DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() -{ - try { - id = p_dereference(h5file.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by HDF5 file", - deref_error.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a +///\brief Given a reference, ref, to an hdf5 attribute, creates a /// DataSet object ///\param attr - IN: Specifying location where the referenced object is in ///\param ref - IN: Reference pointer @@ -140,12 +112,12 @@ DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : Abstrac // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() +DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object() { - try { - id = p_dereference(attr.getId(), ref, ref_type); + try { + id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by attribute", + throw ReferenceException("DataSet constructor - by dereferenced", deref_error.getDetailMsg()); } } diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index bc80046..e2fe702 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -76,16 +76,12 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSet"); } // Creates a dataset by way of dereference. - DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // Default constructor. DataSet(); diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 2e2bb35..059c812 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -446,7 +446,7 @@ void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const } //-------------------------------------------------------------------------- -// Function: DataSpace::H5Sselect_elements +// Function: DataSpace::selectElements ///\brief Selects array elements to be included in the selection for /// this dataspace. ///\param op - IN: Operator specifying how the new selection is to be diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 8a62471..9e9433f 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -100,7 +100,7 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() + /* DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() { try { id = p_dereference(obj.getId(), ref, ref_type); @@ -109,6 +109,7 @@ DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Obje deref_error.getDetailMsg()); } } + */ //-------------------------------------------------------------------------- // Function: DataType overload constructor - dereference @@ -123,14 +124,16 @@ DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Obje // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() +DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() { - try { + H5Location::dereference(loc, ref, ref_type, plist); + /* try { id = p_dereference(h5file.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("DataType constructor - located by an H5File", deref_error.getDetailMsg()); } + */ } //-------------------------------------------------------------------------- @@ -146,10 +149,10 @@ DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Obj // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() +DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() { try { - id = p_dereference(attr.getId(), ref, ref_type); + id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException deref_error) { throw ReferenceException("DataType constructor - located by an Attribute", deref_error.getDetailMsg()); diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 6e56622..e4254b0 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -30,9 +30,8 @@ class H5_DLLCPP DataType : public H5Object { DataType( const DataType& original ); // Creates a datatype by way of dereference. - DataType(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataType(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataType(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // Closes this datatype. virtual void close(); @@ -101,9 +100,6 @@ class H5_DLLCPP DataType : public H5Object { // Checks whether this datatype is a variable-length string. bool isVariableStr() const; - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataType"); } diff --git a/c++/src/H5File.h b/c++/src/H5File.h index f906de6..2abffea 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -61,9 +61,6 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { // and datatypes) in the same file. void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Returns the pointer to the file handle of the low-level file driver. void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; void getVFDHandle(void **file_handle) const; diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index eff7e50..3150025 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -99,14 +99,18 @@ Group::Group(const hid_t existing_id) : H5Object() /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() + /* Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() + */ +Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() { - try { - id = p_dereference(obj.getId(), ref, ref_type); + H5Location::dereference(loc, ref, ref_type, plist); + /* try { + id = p_dereference(loc.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("Group constructor - located by an H5Object", deref_error.getDetailMsg()); } + */ } //-------------------------------------------------------------------------- @@ -118,7 +122,7 @@ Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() + /* Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() { try { id = p_dereference(h5file.getId(), ref, ref_type); @@ -127,6 +131,7 @@ Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() deref_error.getDetailMsg()); } } + */ //-------------------------------------------------------------------------- // Function: Group overload constructor - dereference @@ -137,10 +142,10 @@ Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() +Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() { try { - id = p_dereference(attr.getId(), ref, ref_type); + id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException deref_error) { throw ReferenceException("Group constructor - located by an Attribute", deref_error.getDetailMsg()); diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 3b53293..4003c21 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -26,9 +26,6 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Close this group. virtual void close(); - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("Group"); } @@ -39,9 +36,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { virtual hid_t getLocId() const; // Creates a group by way of dereference. - Group(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - Group(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + /* Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + */ + Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // default constructor Group(); diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 4a997ab..f902116 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -269,7 +269,7 @@ IdComponent::IdComponent() {} // Description: // This function is protected so that the user applications can // only have access to its code via allowable classes, namely, -// H5File and H5Object subclasses. +// Attribute and H5Location subclasses. // Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string IdComponent::p_get_file_name() const diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index fcf7ff4..d4c97fa 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -55,17 +55,17 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, } //-------------------------------------------------------------------------- -// Function: H5Location default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location default constructor (protected) +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location() : IdComponent(0) {} //-------------------------------------------------------------------------- -// Function: H5Location overloaded constructor (protected) -// Purpose Creates an H5Location object using the id of an existing HDF5 -// object. -// Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location overloaded constructor (protected) +// Purpose Creates an H5Location object using the id of an existing HDF5 +// object. +// Parameters object_id - IN: Id of an existing HDF5 object +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} @@ -78,6 +78,30 @@ H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} //-------------------------------------------------------------------------- H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {} +//-------------------------------------------------------------------------- +// Function: H5Location constructor +///\brief Dereferences into an HDF5 object, given an HDF5 location. +///\param loc - IN: H5Location instance to copy +///\param ref - IN: Name of the object to be referenced +///\param ref_type - IN: Dataspace with selection +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- + // Dereferences into an HDF5 object, given an HDF5 location. + /* H5Location::H5Location(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) +{ + hid_t temp_id; + try { + temp_id = p_dereference(loc.getId(), ref, ref_type, plist); + } + catch (ReferenceException deref_error) { + throw ReferenceException("H5Location constructor - by dereferenced", + deref_error.getDetailMsg()); + } + setId(temp_id); +} + */ + + #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- @@ -342,7 +366,7 @@ void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& new /// which can be either of these values: /// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file /// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::FileIException +///\exception H5::Exception ///\par Description /// This location is used to identify the file to be flushed. // Programmer Binh-Minh Ribler - 2012 @@ -355,7 +379,7 @@ void H5Location::flush(H5F_scope_t scope) const herr_t ret_value = H5Fflush(getId(), scope); if( ret_value < 0 ) { - throw FileIException(inMemFunc("flush"), "H5Fflush failed"); + throw Exception(inMemFunc("flush"), "H5Fflush failed"); } } @@ -376,17 +400,147 @@ H5std_string H5Location::getFileName() const } } +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief Sets or resets the comment for an object specified by its name. +///\param name - IN: Name of the object +///\param comment - IN: New comment +///\exception H5::Exception +///\par Description +/// If \a comment is an empty string or a null pointer, the comment +/// message is removed from the object. +/// Comments should be relatively short, null-terminated, ASCII +/// strings. They can be attached to any object that has an +/// object header, e.g., data sets, groups, named data types, +/// and data spaces, but not symbolic links. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// Modification +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void H5Location::setComment(const char* name, const char* comment) const +{ + herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT); + if( ret_value < 0 ) + throw Exception("setComment", "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name and \a comment. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const +{ + setComment(name.c_str(), comment.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeComment +///\brief Removes the comment from an object specified by its name. +///\param name - IN: Name of the object +///\exception H5::Exception +// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void H5Location::removeComment(const char* name) const +{ + herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT); + if( ret_value < 0 ) + throw Exception("removeComment", "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +void H5Location::removeComment(const H5std_string& name) const +{ + removeComment (name.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getComment +///\brief Retrieves comment for the specified object and its comment's +/// length. +///\param name - IN: Name of the object +///\param bufsize - IN: Length of the comment to retrieve +///\return Comment string +///\exception H5::Exception +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +H5std_string H5Location::getComment(const char* name, size_t bufsize) const +{ + // bufsize is default to 256 + // temporary variable + hid_t loc_id = getId(); // temporary variable + + // temporary C-string for the object's comment; bufsize already including + // null character + char* comment_C = new char[bufsize]; + ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); + + // if the actual length of the comment is longer than bufsize and bufsize + // was the default value, i.e., not given by the user, then call + // H5Oget_comment_by_name again with the correct value. + // If the call to H5Oget_comment_by_name returned an error, skip this block + // and throw an exception below. + if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) + { + size_t new_size = ret_value; + delete []comment_C; + comment_C = new char[new_size]; // new_size including null terminator + ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); + } + + // if H5Oget_comment_by_name returns SUCCEED, return the string comment, + // otherwise, throw an exception + if (ret_value < 0) { + delete []comment_C; + throw Exception("getComment", "H5Oget_comment_by_name failed"); + } + + H5std_string comment = H5std_string(comment_C); + delete []comment_C; + return (comment); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +H5std_string H5Location::getComment(const H5std_string& name, size_t bufsize) const +{ + return(getComment(name.c_str(), bufsize)); +} #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. +// Function: H5Location::p_reference (protected) +// Purpose Creates a reference to an HDF5 object or a dataset region. // Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 +// name - IN: Name of the object to be referenced +// dataspace - IN: Dataspace with selection +// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION +// Exception H5::IdComponentException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const { @@ -400,17 +554,18 @@ void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_ty #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: +// Function: H5Location::reference +///\brief Creates a reference to an HDF5 object or a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: /// \li \c H5R_OBJECT - Reference is an object reference. /// \li \c H5R_DATASET_REGION - Reference is a dataset region /// reference. - this is the default -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +///\exception H5::ReferenceException +///\notes This method is more suitable for a dataset region reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const { @@ -423,23 +578,25 @@ void H5Location::reference(void* ref, const char* name, const DataSpace& dataspa } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it only creates -/// a reference to an HDF5 object, not to a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c char pointer -///\exception H5::ReferenceException -///\par Description -// This function passes H5R_OBJECT and -1 to the protected -// function for it to pass to the C API H5Rcreate -// to create a reference to the named object. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +/// reference. - this is the default +///\exception H5::ReferenceException +///\notes This method is more suitable for a dataset region reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const char* name) const +void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const { try { - p_reference(ref, name, -1, H5R_OBJECT); + p_reference(ref, name.c_str(), dataspace.getId(), ref_type); } catch (ReferenceException E) { throw ReferenceException("H5Location::reference", E.getDetailMsg()); @@ -447,17 +604,45 @@ void H5Location::reference(void* ref, const char* name) const } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it does not take +/// a DataSpace object and the reference type must be specified. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +///\exception H5::ReferenceException +///\notes This method is more suitable for an object reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const H5std_string& name) const +void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const { - reference(ref, name.c_str()); + try { + p_reference(ref, name, -1, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::reference", E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for the object's name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c H5std_string +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +///\notes This method is more suitable for an object reference. +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const +{ + reference(ref, name.c_str(), ref_type); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -475,10 +660,16 @@ void H5Location::reference(void* ref, const H5std_string& name) const // May 2008 - BMR // Moved from IdComponent. //-------------------------------------------------------------------------- -hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type) +hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist) { + hid_t plist_id; + if (p_valid_id(plist.getId())) + plist_id = plist.getId(); + else + plist_id = H5P_DEFAULT; + hid_t temp_id; - temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref); + temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref); if (temp_id < 0) { throw ReferenceException("", "H5Rdereference failed"); @@ -496,16 +687,16 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type) +void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) { hid_t temp_id; try { - temp_id = p_dereference(obj.getId(), ref, ref_type); + temp_id = p_dereference(loc.getId(), ref, ref_type, plist); } catch (ReferenceException E) { throw ReferenceException("H5Location::dereference - located by object", E.getDetailMsg()); @@ -515,45 +706,21 @@ void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type //-------------------------------------------------------------------------- // Function: H5Location::dereference -///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. -///\param h5file - IN: HDF5 file specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May, 2008 -// Corrected missing parameters. - BMR -//-------------------------------------------------------------------------- -void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - try { - temp_id = p_dereference(h5file.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Location::dereference - located by file", E.getDetailMsg()); - } - p_setId(temp_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::dereference ///\brief Dereferences a reference into an HDF5 object, given an attribute. ///\param attr - IN: Attribute specifying the location of the referenced object ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) +void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) { hid_t temp_id; try { - temp_id = p_dereference(attr.getId(), ref, ref_type); + temp_id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException E) { throw ReferenceException("H5Location::dereference - located by attribute", E.getDetailMsg()); @@ -593,20 +760,20 @@ H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_UNKNOWN \tFailure occurs (-1) -// H5G_GROUP \tObject is a group. -// H5G_DATASET \tObject is a dataset. -// H5G_TYPE Object \tis a named datatype. -// H5G_LINK \tObject is a symbolic link. -// H5G_UDLINK \tObject is a user-defined link. -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5G_UNKNOWN \tFailure occurs (-1) +// H5G_GROUP \tObject is a group. +// H5G_DATASET \tObject is a dataset. +// H5G_TYPE Object \tis a named datatype. +// H5G_LINK \tObject is a symbolic link. +// H5G_UDLINK \tObject is a user-defined link. +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const { @@ -622,20 +789,20 @@ H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- -// Function: H5Location::getRefObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\return An object type, which can be one of the following: -/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) -/// \li \c H5O_TYPE_GROUP - Object is a group -/// \li \c H5O_TYPE_DATASET - Object is a dataset -/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype -/// \li \c H5O_TYPE_NTYPES - Number of different object types -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRefObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref - IN: Reference to query +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. +///\return An object type, which can be one of the following: +/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) +/// \li \c H5O_TYPE_GROUP - Object is a group +/// \li \c H5O_TYPE_DATASET - Object is a dataset +/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +/// \li \c H5O_TYPE_NTYPES - Number of different object types +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const { @@ -649,19 +816,19 @@ H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_ref_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_ref_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: // H5O_TYPE_UNKNOWN - Unknown object type (-1) // H5O_TYPE_GROUP - Object is a group // H5O_TYPE_DATASET - Object is a dataset // H5O_TYPE_NAMED_DATATYPE - Object is a named datatype // H5O_TYPE_NTYPES - Number of object types -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const { @@ -677,24 +844,29 @@ H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const //-------------------------------------------------------------------------- -// Function: H5Location::p_get_region (protected) -// Purpose Retrieves a dataspace with the region pointed to selected. -// Parameters -// ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -// ref - IN: Reference to get region of -// Return Dataspace id -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRegion +///\brief Retrieves a dataspace with the region pointed to selected. +///\param ref - IN: Reference to get region of +///\param ref_type - IN: Type of reference to get region of - default +// to H5R_DATASET_REGION +///\return DataSpace object +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const +DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const { hid_t space_id = H5Rget_region(getId(), ref_type, ref); if (space_id < 0) { throw ReferenceException("", "H5Rget_region failed"); } - return(space_id); + try { + DataSpace dataspace(space_id); + return(dataspace); + } + catch (DataSpaceIException E) { + throw ReferenceException("H5Location::getRegion", E.getDetailMsg()); + } } diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 1f54439..996cc21 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -36,12 +36,12 @@ typedef void (*attr_operator_t)( H5Location& loc/*in*/, class UserData4Aiterate { // user data for attribute iteration public: - attr_operator_t op; - void* opData; - H5Location* location; + attr_operator_t op; + void* opData; + H5Location* location; }; -// An H5Location can be a file, group, dataset, named datatype, or attribute. +// An H5Location can be a file, group, dataset, or committed datatype. class H5_DLLCPP H5Location : public IdComponent { public: @@ -85,29 +85,47 @@ class H5_DLLCPP H5Location : public IdComponent { bool attrExists(const char* name) const; bool attrExists(const H5std_string& name) const; + // Renames the named attribute to a new name. + void renameAttr(const char* oldname, const char* newname) const; + void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + // Removes the named attribute from this location. void removeAttr(const char* name) const; void removeAttr(const H5std_string& name) const; - // Renames the named attribute to a new name. - void renameAttr(const char* oldname, const char* newname) const; - void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + // Sets the comment for an HDF5 object specified by its name. + void setComment(const char* name, const char* comment) const; + void setComment(const H5std_string& name, const H5std_string& comment) const; + + // Retrieves comment for the HDF5 object specified by its name. + H5std_string getComment(const char* name, size_t bufsize=256) const; + H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; + + // Removes the comment for the HDF5 object specified by its name. + void removeComment(const char* name) const; + void removeComment(const H5std_string& name) const; // Creates a reference to a named object or to a dataset region // in this object. + void reference(void* ref, const char* name, + H5R_type_t ref_type = H5R_OBJECT) const; + void reference(void* ref, const H5std_string& name, + H5R_type_t ref_type = H5R_DATASET_REGION) const; void reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const char* name) const; - void reference(void* ref, const H5std_string& name) const; + void reference(void* ref, const H5std_string& name, const DataSpace& dataspace, + H5R_type_t ref_type = H5R_DATASET_REGION) const; // Open a referenced object whose location is specified by either // a file, an HDF5 object, or an attribute. - void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - ///\brief Returns an identifier. (pure virtual) - virtual hid_t getId() const = 0; + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + + ///\brief Returns an identifier. (pure virtual) + virtual hid_t getId() const = 0; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -124,7 +142,7 @@ class H5_DLLCPP H5Location : public IdComponent { void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; // Dereferences a ref into an HDF5 id. - hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type); + hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist); #ifndef H5_NO_DEPRECATED_SYMBOLS // Retrieves the type of object that an object reference points to. @@ -134,9 +152,6 @@ class H5_DLLCPP H5Location : public IdComponent { // Retrieves the type of object that an object reference points to. H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; - // Retrieves a dataspace with the region pointed to selected. - hid_t p_get_region(void *ref, H5R_type_t ref_type) const; - // Noop destructor. virtual ~H5Location(); diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index b596092..1d96f2e 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -52,7 +52,6 @@ H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {} - //-------------------------------------------------------------------------- // Function: H5Object copy constructor ///\brief Copy constructor: makes a copy of the original H5Object diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index c14d74f..e070406 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -39,7 +39,7 @@ namespace H5 { //-------------------------------------------------------------------------- ///\brief Constant for default property. //-------------------------------------------------------------------------- -const PropList PropList::DEFAULT( H5P_DEFAULT ); +const PropList PropList::DEFAULT; //-------------------------------------------------------------------------- // Function Default constructor @@ -644,6 +644,9 @@ void PropList::removeProp(const H5std_string& name) const //-------------------------------------------------------------------------- bool PropList::operator==(const PropList& rhs) const { + fprintf(stderr, "operator==\n"); +H5Eprint2(H5E_DEFAULT, stderr); + htri_t ret_value = H5Pequal(id, rhs.getId()); if( ret_value > 0 ) return true; diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index ce18e58..6acf8a9 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -27,13 +27,6 @@ #endif #include -#ifndef H5_NO_NAMESPACE -#ifndef H5_NO_STD - using std::cerr; - using std::endl; -#endif // H5_NO_STD -#endif - #include "H5Cpp.h" // C++ API header file #ifndef H5_NO_NAMESPACE @@ -44,11 +37,10 @@ const H5std_string FILE1("trefer1.h5"); const H5std_string FILE2("trefer2.h5"); -const H5std_string FILE3("trefer3.h5"); -const H5std_string DSET_DEFAULT_NAME("default"); // Dataset 1 const H5std_string DSET1_NAME("Dataset1"); +const H5std_string DSET2_NAME("Dataset2"); const int DSET1_LEN = 8; const H5std_string MEMBER1( "a_name" ); @@ -56,15 +48,15 @@ const H5std_string MEMBER2( "b_name" ); const H5std_string MEMBER3( "c_name" ); // 1-D dataset with fixed dimensions -const H5std_string SPACE1_NAME("Space1"); const int SPACE1_RANK = 1; const int SPACE1_DIM1 = 4; -// 2-D dataset with fixed dimensions -const H5std_string SPACE2_NAME("Space2"); +/* Larger 1-D dataset with fixed dimensions */ +const int SPACE3_RANK = 1; +const int SPACE3_DIM1 = 100; -// Larger 1-D dataset with fixed dimensions -const H5std_string SPACE3_NAME("Space3"); +/* Element selection information */ +const int POINT1_NPOINTS = 10; // Compound datatype typedef struct s1_t { @@ -75,8 +67,122 @@ typedef struct s1_t { /**************************************************************** ** -** test_reference_obj(): Test basic object reference functionality. -** Tests references to various kinds of objects +** test_reference_params(): Test basic H5R (reference) parameters +** for correct processing +** +****************************************************************/ +static void +test_reference_params(void) +{ + const char *write_comment = "Foo!"; /* Comments for group */ + + // Output message about test being performed + SUBTEST("Object Reference Parameters"); + + H5File* file1 = NULL; + try { + hobj_ref_t *wbuf, // buffer to write to disk + *rbuf, // buffer read from disk + *tbuf; // temp. buffer read from disk + + // Allocate write & read buffers + int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t)); + wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + + // Create file FILE1 + file1 = new H5File (FILE1, H5F_ACC_TRUNC); + + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a group + Group group = file1->createGroup("Group1"); + + // Set group's comment + group.setComment(".", write_comment); + + // Create a dataset (inside /Group1) + DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); + + unsigned *tu32; // Temporary pointer to uint32 data + int i; + for (tu32=(unsigned *)wbuf, i=0; icreateDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); + + /* Test parameters to H5Location::reference */ + try { + file1->reference(NULL, "/Group1/Dataset1"); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], NULL); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], ""); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION); + } catch (ReferenceException E) {} // We expect this to fail + + // Close resources + dataset.close(); + file1->close(); + // Let sid1 go out of scope + + // Free memory buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCDetailMsg()); + } + + if(file1) + delete file1; +} /* test_reference_param() */ + +/**************************************************************** +** +** test_reference_obj(): Test basic object reference functions +** to various kinds of objects ** ****************************************************************/ static void test_reference_obj(void) @@ -321,6 +427,412 @@ static void test_reference_obj(void) delete file1; } // test_reference_obj() + +/**************************************************************** +** +** test_reference_group(): Test object reference functionality +** Tests for correct behavior of various routines on +** dereferenced group +** +****************************************************************/ +#define GROUPNAME "/group" +#define GROUPNAME2 "group2" +#define GROUPNAME3 "group3" +#define DSETNAME "/dset" +#define DSETNAME2 "dset2" +#define NAME_SIZE 16 + +static void +test_reference_group(void) +{ + hobj_ref_t wref; /* Reference to write */ + hobj_ref_t rref; /* Reference to read */ + int i; // counting variables + const H5std_string write_comment="Foo!"; // Comments for group + + // Output message about test being performed + SUBTEST("Object Reference to Group"); + + H5File* file1 = NULL; + try { + // Create file with a group and a dataset containing an object reference to the group + + // Create file FILE1 + file1 = new H5File (FILE1, H5F_ACC_TRUNC); + + // Create scalar dataspace + DataSpace sid1; + + // Create a group + Group group = file1->createGroup(GROUPNAME); + + /* Create nested groups */ + Group group2 = group.createGroup(GROUPNAME2); + group2.close(); + group2 = group.createGroup(GROUPNAME3); + group2.close(); + + // Create bottom dataset + DataSet dset1 = group.createDataSet(DSETNAME2, PredType::NATIVE_INT, sid1); + dset1.close(); + + // Close group 1 + group.close(); + + // Create dataset + DataSet dset2 = file1->createDataSet(DSETNAME, PredType::STD_REF_OBJ, sid1); + + file1->reference(&wref, GROUPNAME); + + // Write selection to disk + dset2.write(&wref, PredType::STD_REF_OBJ); + + // Close resources + dset2.close(); + sid1.close(); + file1->close(); + + /* + * Re-open the file and test deferencing group + */ + + // Re-open file + file1->openFile(FILE1, H5F_ACC_RDWR); + + // Re-open dataset + dset1 = file1->openDataSet(DSETNAME); + + // Read in the reference + dset1.read(&rref, PredType::STD_REF_OBJ); + + // Dereference to get the group + Group refgroup(dset1, &rref); + + // Dereference group object the other way + group.dereference(dset1, &rref); + + /* + * Various queries on the group opened + */ + + // Check number of objects in the group dereferenced by constructor + hsize_t nobjs = refgroup.getNumObjs(); + verify_val(nobjs, 3, "H5Group::getNumObjs", __LINE__, __FILE__); + + // Check number of objects in the group dereferenced by ::reference + nobjs = group.getNumObjs(); + verify_val(nobjs, 3, "H5Group::getNumObjs", __LINE__, __FILE__); + + // Check getting file name given the group dereferenced via constructor + H5std_string fname = refgroup.getFileName(); + verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__); + + // Check getting file name given the group dereferenced by ::reference + fname = group.getFileName(); + verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__); + + // Unlink one of the objects in the dereferenced group, and re-check + refgroup.unlink(GROUPNAME2); + nobjs = refgroup.getNumObjs(); + verify_val(nobjs, 2, "H5Group::getNumObjs", __LINE__, __FILE__); + + // Close resources + group.close(); + refgroup.close(); + dset1.close(); + file1->close(); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_group()", __LINE__, __FILE__, E.getCDetailMsg()); + } + + if(file1) + delete file1; +} /* test_reference_group() */ + +/**************************************************************** +** +** test_reference_region_1D(): Test 1-D reference functionality +** Tests 1-D references to various kinds of objects +** +****************************************************************/ +static void +test_reference_region_1D(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dset1, /* Dataset ID */ + dset3; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid3; /* Dataspace ID #3 */ + hid_t dapl_id; /* Dataset access property list */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims3[] = {SPACE3_DIM1}; + hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t * coords; /* Coordinate buffer */ + hsize_t low[SPACE3_RANK]; /* Selection bounds */ + hsize_t high[SPACE3_RANK]; /* Selection bounds */ + uint8_t *tu8; /* Temporary pointer to uint8 data */ + H5O_type_t obj_type; /* Object type */ + int i; /* counting variables */ + herr_t ret; /* Generic return value */ + + // Output message about test being performed + SUBTEST("1-D Dataset Region Reference Functions"); + + try { + hdset_reg_ref_t *wbuf, // buffer to write to disk + *rbuf, // buffer read from disk + *tbuf; // temp. buffer read from disk + uint8_t *dwbuf, // Buffer for writing numeric data to disk + *drbuf; // Buffer for reading numeric data from disk + + // Allocate write & read buffers + wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); + rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); + dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); + drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); + + // Create file FILE1 + H5File file1(FILE2, H5F_ACC_TRUNC); + + // Create dataspace for datasets + hsize_t dims3[] = {SPACE3_DIM1}; + DataSpace sid3(SPACE3_RANK, dims3); + + // Create dataset access property list + PropList dapl(H5P_DATASET_ACCESS); + + // Create a dataset + DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3); + + uint8_t *tu8; // Temporary pointer to uint8 data + for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) + *tu8++ = i * 3; // from C test + + // Write selection to disk + dset3.write(dwbuf, PredType::STD_U8LE); + + // Close Dataset + dset3.close(); + + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a dataset (inside /Group1) + DataSet dset1 = file1.createDataSet(DSET1_NAME, PredType::STD_REF_DSETREG, sid1); + + /* Create references */ + + /* Select 15 2x1 hyperslabs for first reference */ + start[0] = 2; + stride[0] = 5; + count[0] = 15; + block[0] = 2; + + // Select a hyperslab region to add to the current selected region + sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); + + // Get and verify the number of elements in a dataspace selection + hssize_t nelms = sid3.getSelectNpoints(); + verify_val(nelms, 30, "DataSet::getRefObjType", __LINE__, __FILE__); + + // Store first dataset region + file1.reference(&wbuf[0], "/Dataset2", sid3); + + // Get and verify object type + H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION); + verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + + /* Select sequence of ten points for second reference */ + coord1[0][0] = 16; + coord1[1][0] = 22; + coord1[2][0] = 38; + coord1[3][0] = 41; + coord1[4][0] = 52; + coord1[5][0] = 63; + coord1[6][0] = 70; + coord1[7][0] = 89; + coord1[8][0] = 97; + coord1[9][0] = 3; + + // Selects array elements to be included in the selection for sid3 + sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1); + + // Get and verify the number of elements in a dataspace selection + nelms = sid3.getSelectNpoints(); + verify_val(nelms, 10, "DataSet::getRefObjType", __LINE__, __FILE__); + + // Store first dataset region + file1.reference(&wbuf[1], "/Dataset2", sid3); + + // Write selection to disk + dset1.write(wbuf, PredType::STD_REF_DSETREG); + + // Close disk dataspace, dataset, and file + sid1.close(); + dset1.close(); + sid3.close(); + file1.close(); + + // Re-open the file + file1.openFile(FILE2, H5F_ACC_RDWR); + + // Open the dataset + dset1 = file1.openDataSet("/Dataset1"); + + // Read selection from disk + dset1.read(rbuf, PredType::STD_REF_DSETREG); + + // Dereference dataset object by ctor, from the location where + // 'dset1' is located + dset3.dereference(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); + + /* DataSet adset3(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); + */ + + // Get and verify object type + obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION); + verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + + // Check information in the referenced dataset, i.e., adset3 + + // Get dataspace of adset3 the verify number of elements + sid1 = dset3.getSpace(); + nelms = sid1.getSimpleExtentNpoints(); + verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + + // Read from disk + dset3.read(drbuf, PredType::STD_U8LE); + + for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++) + verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + + // Get the referenced region and verify values + + // Get region + DataSpace reg_sp = dset1.getRegion(&rbuf[0]); + + // Get and verify number of elements in a dataspace selection + nelms = reg_sp.getSelectNpoints(); + verify_val((long)nelms, 30, "DataSpace::getSelectNpoints", __LINE__, __FILE__); + + // Get and verify number of hyperslab blocks + nelms = reg_sp.getSelectHyperNblocks(); + verify_val((long)nelms, 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__); + + /* Allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2); + + // Get the list of hyperslab blocks currently selected + reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords); + + // Verify values in the list + verify_val(coords[0], 2, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[1], 3, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[2], 7, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[3], 8, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[4], 12, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[5], 13, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[6], 17, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[7], 18, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[8], 22, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[9], 23, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[10], 27, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[11], 28, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[12], 32, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[13], 33, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[14], 37, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[15], 38, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[16], 42, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[17], 43, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[18], 47, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[19], 48, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[20], 52, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[21], 53, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[22], 57, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[23], 58, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[24], 62, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[25], 63, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[26], 67, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[27], 68, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[28], 72, "Hyperslab Coordinates", __LINE__, __FILE__); + verify_val(coords[29], 73, "Hyperslab Coordinates", __LINE__, __FILE__); + + HDfree(coords); + + // Check boundaries + reg_sp.getSelectBounds(low, high); + verify_val(low[0], 2, "DataSpace::getSelectBounds", __LINE__, __FILE__); + verify_val(high[0], 73, "DataSpace::getSelectBounds", __LINE__, __FILE__); + + /* Close region space */ + reg_sp.close(); + + // Get the referenced region and verify values + + // Get region + DataSpace elm_sp = dset1.getRegion(&rbuf[1]); + + // Get and verify number of element points in the current selection + hssize_t nelmspts = elm_sp.getSelectElemNpoints(); + verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__); + + /* Allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)); + + // Get the list of element points currently selected + elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords); + + // Verify points + verify_val(coords[0], coord1[0][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[1], coord1[1][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[2], coord1[2][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[3], coord1[3][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[4], coord1[4][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[5], coord1[5][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[6], coord1[6][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[7], coord1[7][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[8], coord1[8][0], "Element Coordinates", __LINE__, __FILE__); + verify_val(coords[9], coord1[9][0], "Element Coordinates", __LINE__, __FILE__); + + HDfree(coords); + + // Check boundaries + elm_sp.getSelectBounds(low, high); + verify_val(low[0], 3, "DataSpace::getSelectBounds", __LINE__, __FILE__); + verify_val(high[0], 97, "DataSpace::getSelectBounds", __LINE__, __FILE__); + + // Close element space + elm_sp.close(); + + // Close resources + sid1.close(); + dset3.close(); + dset1.close(); + file1.close(); + + // Free memory buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_region_1D()", __LINE__, __FILE__, E.getCDetailMsg()); + } + +} /* test_reference_region_1D() */ + + /**************************************************************** ** ** test_reference_compat(): Test basic object reference functionality. @@ -346,7 +858,10 @@ void test_reference(void) // Output message about test being performed MESSAGE(5, ("Testing References\n")); + test_reference_params(); // Test basic parameters of reference functionality test_reference_obj(); // Test basic object reference functionality + test_reference_group(); // Test group reference functionality + test_reference_region_1D(); // Test 1-D reference functionality test_reference_compat(); // Tests deprecated reference routines (not yet) } // test_reference() @@ -363,5 +878,6 @@ extern "C" void cleanup_reference(void) { HDremove(FILE1.c_str()); + HDremove(FILE2.c_str()); } -- cgit v0.12 From 0653325f0d4a92164842bb30b797f130e44cbc68 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 19 Sep 2013 11:38:08 -0500 Subject: [svn-r24167] HDFFV-8513, HDFFV-8522 Plugin testing in h5repack, h5dump. Add more usage info for UserMacros. Add new option information about the Plugin default path. Tested: local linux, jam --- UserMacros.cmake | 5 +++ config/cmake/ConfigureChecks.cmake | 8 ++-- config/cmake/H5pubconf.h.in | 2 +- config/cmake/UserMacros/Windows_MT.cmake | 2 + configure | 64 ++++++++++++++++---------------- configure.ac | 42 ++++++++++----------- release_docs/INSTALL_CMake.txt | 23 +++++++++++- release_docs/RELEASE.txt | 16 ++++---- src/H5PL.c | 6 ++- src/H5Z.c | 4 -- src/H5config.h.in | 2 +- test/testfiles/error_test_1 | 3 ++ tools/h5dump/errfiles/filter_fail.err | 3 ++ tools/h5repack/h5repack_main.c | 37 +++++++++++------- 14 files changed, 130 insertions(+), 87 deletions(-) diff --git a/UserMacros.cmake b/UserMacros.cmake index d7d3ef9..4c680ed 100644 --- a/UserMacros.cmake +++ b/UserMacros.cmake @@ -3,6 +3,8 @@ ######################################################## #----------------------------------------------------------------------------- +#------------------- E X A M P L E B E G I N-------------------------------- +#----------------------------------------------------------------------------- # Option to Build with User Defined Values #----------------------------------------------------------------------------- MACRO (MACRO_USER_DEFINED_LIBS) @@ -14,4 +16,7 @@ OPTION (BUILD_USER_DEFINED_LIBS "Build With User Defined Values" OFF) IF (BUILD_USER_DEFINED_LIBS) MACRO_USER_DEFINED_LIBS () ENDIF (BUILD_USER_DEFINED_LIBS) +#----------------------------------------------------------------------------- +#------------------- E X A M P L E E N D ----------------------------------- +#----------------------------------------------------------------------------- \ No newline at end of file diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index e495d9b..58c790d 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -152,13 +152,13 @@ ENDIF (WIN32) # SET (H5_DEFAULT_VFD H5FD_SEC2) -IF (NOT DEFINED "H5_DEFAULT_PLUGIN") +IF (NOT DEFINED "H5_DEFAULT_PLUGINDIR") IF (WINDOWS) - SET (H5_DEFAULT_PLUGIN "%ALLUSERSPROFILE%/hdf5/lib/plugin") + SET (H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin") ELSE (WINDOWS) - SET (H5_DEFAULT_PLUGIN "/usr/local/hdf5/lib/plugin") + SET (H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin") ENDIF (WINDOWS) -ENDIF (NOT DEFINED "H5_DEFAULT_PLUGIN") +ENDIF (NOT DEFINED "H5_DEFAULT_PLUGINDIR") IF (WINDOWS) SET (H5_HAVE_WINDOWS 1) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 2160ee8..ede2ffd 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -55,7 +55,7 @@ #cmakedefine H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM @H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM@ /* Define the default plugins path to compile */ -#cmakedefine H5_DEFAULT_PLUGIN "@H5_DEFAULT_PLUGIN@" +#cmakedefine H5_DEFAULT_PLUGINDIR "@H5_DEFAULT_PLUGINDIR@" /* Define the default virtual file driver to compile */ #cmakedefine H5_DEFAULT_VFD @H5_DEFAULT_VFD@ diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index 9be5404..175c420 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -4,6 +4,8 @@ # To use this option, copy both the macro and option code # into the root UserMacros.cmake file. +# OR add an include to the root UserMacros.cmake file: +# INCLUDE(path_to_file/WINDOWS_MT.cmake) #----------------------------------------------------------------------------- # Option to Build with Static CRT libraries on Windows diff --git a/configure b/configure index f8c182f..1628989 100755 --- a/configure +++ b/configure @@ -923,8 +923,8 @@ with_mpe enable_mpi_size enable_filters with_default_vfd -with_default_plugin enable_direct_vfd +with_default_plugindir enable_dconv_exception enable_dconv_accuracy enable_hl @@ -1670,7 +1670,7 @@ Optional Packages: --with-mpe=DIR Use MPE instrumentation [default=no] --with-default-vfd=driver Specify default file driver [default=sec2] - --with-default-plugin=location + --with-default-plugindir=location Specify default location for plugins [default="/usr/local/hdf5/lib/plugin"] --with-default-api-version=(v16|v18|v110) @@ -29287,36 +29287,6 @@ _ACEOF fi ## ---------------------------------------------------------------------- -## Enable custom plugin default path for library. It requires SHARED support. -## -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Custom Plugin Default Path definition" >&5 -$as_echo_n "checking for Custom Plugin Default Path definition... " >&6; } - -# Check whether --with-default-plugin was given. -if test "${with_default_plugin+set}" = set; then : - withval=$with_default_plugin; -else - withval="/usr/local/hdf5/lib/plugin" -fi - - -if test "X$withval" = "X"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5 -$as_echo "default" >&6; } - default_plugin="/usr/local/hdf5/lib/plugin" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 -$as_echo "$withval" >&6; } - default_plugin=$withval -fi - - -cat >>confdefs.h <<_ACEOF -#define DEFAULT_PLUGIN "$default_plugin" -_ACEOF - - -## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## @@ -29420,6 +29390,36 @@ fi ## ---------------------------------------------------------------------- +## Enable custom plugin default path for library. It requires SHARED support. +## +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for custom plugin default path definition" >&5 +$as_echo_n "checking for custom plugin default path definition... " >&6; } + +# Check whether --with-default-plugindir was given. +if test "${with_default_plugindir+set}" = set; then : + withval=$with_default_plugindir; +else + withval="/usr/local/hdf5/lib/plugin" +fi + + +if test "X$withval" = "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5 +$as_echo "default" >&6; } + default_plugindir="/usr/local/hdf5/lib/plugin" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 +$as_echo "$withval" >&6; } + default_plugindir=$withval +fi + + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_PLUGINDIR "$default_plugindir" +_ACEOF + + +## ---------------------------------------------------------------------- ## Decide whether the presence of user's exception handling functions is ## checked and data conversion exceptions are returned. This is mainly ## for the speed optimization of hard conversions. Soft conversions can diff --git a/configure.ac b/configure.ac index be0d635..9eee22d 100644 --- a/configure.ac +++ b/configure.ac @@ -3055,27 +3055,6 @@ if test "X$default_vfd" = "Xyes"; then fi ## ---------------------------------------------------------------------- -## Enable custom plugin default path for library. It requires SHARED support. -## -AC_MSG_CHECKING([for Custom Plugin Default Path definition]) -AC_ARG_WITH([default-plugin], - [AS_HELP_STRING([--with-default-plugin=location], - [Specify default location for plugins - [default="/usr/local/hdf5/lib/plugin"]])],, - withval="/usr/local/hdf5/lib/plugin") - -if test "X$withval" = "X"; then - AC_MSG_RESULT([default]) - default_plugin="/usr/local/hdf5/lib/plugin" -else - AC_MSG_RESULT([$withval]) - default_plugin=$withval -fi - -AC_DEFINE_UNQUOTED([DEFAULT_PLUGIN], ["$default_plugin"], - [Define the default plugins path to compile]) - -## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## @@ -3118,6 +3097,27 @@ fi AM_CONDITIONAL([DIRECT_VFD_CONDITIONAL], [test "X$DIRECT_VFD" = "Xyes"]) ## ---------------------------------------------------------------------- +## Enable custom plugin default path for library. It requires SHARED support. +## +AC_MSG_CHECKING([for custom plugin default path definition]) +AC_ARG_WITH([default-plugindir], + [AS_HELP_STRING([--with-default-plugindir=location], + [Specify default location for plugins + [default="/usr/local/hdf5/lib/plugin"]])],, + withval="/usr/local/hdf5/lib/plugin") + +if test "X$withval" = "X"; then + AC_MSG_RESULT([default]) + default_plugindir="/usr/local/hdf5/lib/plugin" +else + AC_MSG_RESULT([$withval]) + default_plugindir=$withval +fi + +AC_DEFINE_UNQUOTED([DEFAULT_PLUGINDIR], ["$default_plugindir"], + [Define the default plugins path to compile]) + +## ---------------------------------------------------------------------- ## Decide whether the presence of user's exception handling functions is ## checked and data conversion exceptions are returned. This is mainly ## for the speed optimization of hard conversions. Soft conversions can diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 5594610..80a13f7 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -8,7 +8,8 @@ Section I: Quick Step Building HDF5 Libraries with CMake Section II: Preconditions Section III: Building HDF5 C/C++ Libraries with CMake Section IV: All Options for HDF5 C/C++ Libraries with CMake -Section V: APPENDIX +Section V: User Defined Options for HDF5 Libraries with CMake +Section VI: APPENDIX ************************************************************************ @@ -445,11 +446,29 @@ HDF5_USE_FILTER_SCALEOFFSET "Use the SCALEOFFSET Filter" ON HDF5_USE_FILTER_SHUFFLE "Use the SHUFFLE Filter" ON IF (HDF5_ENABLE_SZIP_SUPPORT) HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF +IF (WINDOWS) + H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin" +ELSE (WINDOWS) + H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin" +ENDIF (WINDOWS) ======================================================================== -V. APPENDIX +V. User Defined Options for HDF5 Libraries with CMake +======================================================================== + +Support for User Defined macros and options has been added. The file +UserMacros.cmake has an example of the technique. In the folder, +config/cmake/UserMacros, is an implementation for Windows Visual Studio +users for linking libraries to the static CRT - Windows_MT.cmake. + +Copy the contents of the file, both macro and option, into the +UserMacros.cmake file. Then enable the option to the CMake configuration, +build and test process. + +======================================================================== +VI. APPENDIX ======================================================================== Below are examples of the ctest scripts used by The HDF Group. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 9a27d02..92a6ce4 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -43,7 +43,7 @@ New Features ------------- - New configuration option added to change the default plugin path. configure option is --with-default-plugin=location - cmake option is -DH5_DEFAULT_PLUGIN:PATH=location + cmake option is -DH5_DEFAULT_PLUGINDIR:PATH=location HDFFV-8513. (ADB 2013/09/04) - CMake minimum is now 2.8.10. (ADB 2013/01/14) - A new tool, cmakehdf5, which is a build command script similar to @@ -1218,7 +1218,7 @@ Platform C F90/ F90 C++ zlib SZIP Solaris2.11 32-bit n y/y n y y y Solaris2.11 64-bit n y/n n y y y Windows 7 y y/y n y y y -Windows 7 x64 y y/y n y y y +Windows 7 x64 y y/y n y y y Windows 7 Cygwin n y/n n y y y Windows 7 x64 Cygwin n y/n n y y y Windows 8 y y/y n y y y @@ -1298,14 +1298,14 @@ The following platforms are not supported but have been tested for this release. GNU Fortran (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) (cmake and autotools) - SUSE 12.3 3.4.6-2.10-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux - gcc (SUSE Linux) 4.7.1 - GNU Fortran (SUSE Linux) 4.7.1 + SUSE 12.3 3.7.10-1.1-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux + gcc (SUSE Linux) 4.7.2 + GNU Fortran (SUSE Linux) 4.7.2 (cmake and autotools) - SUSE 12.3 3.4.6-2.10-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux - gcc (SUSE Linux) 4.7.1 - GNU Fortran (SUSE Linux) 4.7.1 + SUSE 12.3 3.7.10-1.1-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux + gcc (SUSE Linux) 4.7.2 + GNU Fortran (SUSE Linux) 4.7.2 (cmake and autotools) Ubuntu 13.04 3.8.0-26-generic #38-Ubuntu SMP i686 GNU/Linux diff --git a/src/H5PL.c b/src/H5PL.c index 1c4b355..21bc0f2 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -85,7 +85,7 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); typedef const void *(*H5PL_get_plugin_info_t)(void); #endif /* H5_HAVE_WIN32_API */ -#define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGIN +#define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGINDIR /* Special symbol to indicate no plugin loading */ #define H5PL_NO_PLUGIN "::" @@ -273,6 +273,10 @@ H5PL_load(H5PL_type_t type, int id) FUNC_ENTER_NOAPI(NULL) + /* Check for "no plugins" indicated" */ + if(H5PL_no_plugin_g) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) + /* Initialize the location paths for dynamic libraries, if they aren't * already set up. */ diff --git a/src/H5Z.c b/src/H5Z.c index d415060..901b506 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -1326,9 +1326,6 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, hbool_t issue_error = FALSE; /* Check for "no plugins" indicated" */ - if(H5PL_no_plugin()) - issue_error = TRUE; - else { const H5Z_class2_t *filter_info; /* Try loading the filter */ @@ -1343,7 +1340,6 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, } /* end if */ else issue_error = TRUE; - } /* end else */ /* Check for error */ if(issue_error) { diff --git a/src/H5config.h.in b/src/H5config.h.in index a86970a..02bafd8 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -18,7 +18,7 @@ #undef CXX_HAVE_OFFSETOF /* Define the default plugins path to compile */ -#undef DEFAULT_PLUGIN +#undef DEFAULT_PLUGINDIR /* Define the default virtual file driver to compile */ #undef DEFAULT_VFD diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index b322460..ddc995e 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -56,5 +56,8 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #004: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered major: Data filters minor: Read failed + #005: (file name) line (number) in H5PL_load(): required dynamically loaded plugin filter '305' is not available + major: Plugin for dynamically loaded library + minor: Unable to load metadata into cache All error API tests passed. diff --git a/tools/h5dump/errfiles/filter_fail.err b/tools/h5dump/errfiles/filter_fail.err index 8f0f990..db21044 100644 --- a/tools/h5dump/errfiles/filter_fail.err +++ b/tools/h5dump/errfiles/filter_fail.err @@ -14,6 +14,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #004: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered major: Data filters minor: Read failed + #005: (file name) line (number) in H5PL_load(): required dynamically loaded plugin filter '312' is not available + major: Plugin for dynamically loaded library + minor: Unable to load metadata into cache h5dump error: unable to print data H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): #000: (file name) line (number) in h5tools_dump_simple_dset(): H5Dread failed diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 4c512a4..7d92e4b 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -32,19 +32,30 @@ const char *outfile = NULL; * parameters. */ static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:T:"; -static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", - no_arg, 'V' }, { "verbose", no_arg, 'v' }, - { "filter", require_arg, 'f' }, { "layout", require_arg, 'l' }, { - "minimum", require_arg, 'm' }, { "file", require_arg, 'e' }, { - "native", no_arg, 'n' }, { "latest", no_arg, 'L' }, { "compact", - require_arg, 'c' }, { "indexed", require_arg, 'd' }, { "ssize", - require_arg, 's' }, { "ublock", require_arg, 'u' }, { "block", - require_arg, 'b' }, { "metadata_block_size", require_arg, 'M' }, - { "threshold", require_arg, 't' }, { "alignment", require_arg, 'a' }, { - "infile", require_arg, 'i' }, /* -i for backward compability */ - { "outfile", require_arg, 'o' }, /* -o for backward compability */ - { "fs_strategy", require_arg, 'S' }, - { "fs_threshold", require_arg, 'T' }, { NULL, 0, '\0' } }; +static struct long_options l_opts[] = { + { "help", no_arg, 'h' }, + { "version", no_arg, 'V' }, + { "verbose", no_arg, 'v' }, + { "filter", require_arg, 'f' }, + { "layout", require_arg, 'l' }, + { "minimum", require_arg, 'm' }, + { "file", require_arg, 'e' }, + { "native", no_arg, 'n' }, + { "latest", no_arg, 'L' }, + { "compact", require_arg, 'c' }, + { "indexed", require_arg, 'd' }, + { "ssize", require_arg, 's' }, + { "ublock", require_arg, 'u' }, + { "block", require_arg, 'b' }, + { "metadata_block_size", require_arg, 'M' }, + { "threshold", require_arg, 't' }, + { "alignment", require_arg, 'a' }, + { "infile", require_arg, 'i' }, /* -i for backward compability */ + { "outfile", require_arg, 'o' }, /* -o for backward compability */ + { "fs_strategy", require_arg, 'S' }, + { "fs_threshold", require_arg, 'T' }, + { NULL, 0, '\0' } +}; /*------------------------------------------------------------------------- * Function: usage -- cgit v0.12 From be3a33155025d6ef2d57533b60b96c888ab314a6 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Thu, 19 Sep 2013 13:57:41 -0500 Subject: [svn-r24171] Purpose: Fix problem with gcc 4.8 Description: With optimization enabled, gcc 4.8 inserts garbage into the padding bytes of floating point types when assigning from a literal constant. This caused problems when H5detect.c scanned the bits in floating point types to determine their properties. Modified H5detect.c to scan for padding before further analyzing the type, and to ignore all information in the padding areas. Also removed code that temporarily disabled optimization. Tested: jam, koala, ostrich, platypus (h5committest) --- config/gnu-flags | 5 -- release_docs/RELEASE.txt | 3 + src/CMakeLists.txt | 7 +- src/H5detect.c | 215 ++++++++++++++++++++++++++--------------------- src/Makefile.am | 1 - src/Makefile.in | 24 +----- 6 files changed, 128 insertions(+), 127 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index 57fc23a..b965bf0 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -156,11 +156,6 @@ case "$cc_vendor-$cc_version" in gcc-3.*) PROD_CFLAGS="-O3" ;; - gcc-4.8.*) - # temp patch: when GCC 4.8.x is used for Linux, dt_arith fails if -O* - # is used. Remove any -O* flags. (AKC HDFFV-8500) - PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O[0-3]*//'`" - ;; gcc-4.*) PROD_CFLAGS="-O3" ;; diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 92a6ce4..cd694a6 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -677,6 +677,9 @@ Bug Fixes since HDF5-1.8.0 release Configuration ------------- + - Modified H5detect.c to scan floating point types for padding bits before + analyzing the type further. This should fix problems with gcc 4.8 + (NAF - 2013/09/19 - HDFFV-8523/HDFFV-8500) - Fixed Makefile issue in which "-Wl," was not properly specified prior to -rpath when building parallel fortran libraries with an Intel compiler. (MAM - 2012/03/26) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8e7a3bf..718a41f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -773,13 +773,8 @@ INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}) # Setup the H5Detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- -IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - SET (LOCAL_OPT_FLAG "-O0") -ELSE (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - SET (LOCAL_OPT_FLAG " ") -ENDIF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) ADD_EXECUTABLE (H5detect ${HDF5_SRC_DIR}/H5detect.c) -TARGET_C_PROPERTIES (H5detect ${LOCAL_OPT_FLAG} " ") +TARGET_C_PROPERTIES (H5detect " " " ") IF (MSVC) TARGET_LINK_LIBRARIES (H5detect "ws2_32.lib") ENDIF (MSVC) diff --git a/src/H5detect.c b/src/H5detect.c index caed569..be661ea 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -118,10 +118,12 @@ static volatile int nd_g = 0, na_g = 0; static void print_results(int nd, detected_t *d, int na, malign_t *m); static void iprint(detected_t *); -static int byte_cmp(int, const void *, const void *); -static int bit_cmp(int, int *, volatile void *, volatile void *); +static int byte_cmp(int, const void *, const void *, const unsigned char *); +static int bit_cmp(int, int *, volatile void *, volatile void *, + const unsigned char *); static void fix_order(int, int, int *, const char **); -static int imp_bit(int, int *, volatile void *, volatile void *); +static int imp_bit(int, int *, volatile void *, volatile void *, + const unsigned char *); static unsigned long find_bias(int, int, int *, void *); static void precision (detected_t*); static void print_header(void); @@ -298,71 +300,88 @@ precision (detected_t *d) * *------------------------------------------------------------------------- */ -#define DETECT_F(TYPE,VAR,INFO) { \ - volatile TYPE _v1, _v2, _v3; \ - unsigned char _buf1[sizeof(TYPE)], _buf3[sizeof(TYPE)]; \ - int _i, _j, _last = (-1); \ - char *_mesg; \ - \ - HDmemset(&INFO, 0, sizeof(INFO)); \ - INFO.varname = #VAR; \ - INFO.size = sizeof(TYPE); \ - \ - /* Completely initialize temporary variables, in case the bits used in */ \ - /* the type take less space than the number of bits used to store the type */ \ - HDmemset(&_v3, 0, sizeof(TYPE)); \ - HDmemset(&_v2, 0, sizeof(TYPE)); \ - HDmemset(&_v1, 0, sizeof(TYPE)); \ - \ - /* Byte Order */ \ - for(_i = 0, _v1 = 0.0, _v2 = 1.0; _i < (int)sizeof(TYPE); _i++) { \ - _v3 = _v1; \ - _v1 += _v2; \ - _v2 /= 256.0; \ - HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ - HDmemcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \ - _j = byte_cmp(sizeof(TYPE), &_buf3, &_buf1); \ - if(_j >= 0) { \ - INFO.perm[_i] = _j; \ - _last = _i; \ - } \ - } \ - fix_order(sizeof(TYPE), _last, INFO.perm, (const char**)&_mesg); \ +#define DETECT_F(TYPE,VAR,INFO) { \ + volatile TYPE _v1, _v2, _v3; \ + unsigned char _buf1[sizeof(TYPE)], _buf3[sizeof(TYPE)]; \ + unsigned char _pad_mask[sizeof(TYPE)]; \ + unsigned char _byte_mask; \ + int _i, _j, _last = (-1); \ + char *_mesg; \ \ - if(!HDstrcmp(_mesg, "VAX")) \ - INFO.is_vax = TRUE; \ - \ - /* Implicit mantissa bit */ \ - _v1 = 0.5; \ - _v2 = 1.0; \ - INFO.imp = imp_bit (sizeof(TYPE), INFO.perm, &_v1, &_v2); \ - \ - /* Sign bit */ \ - _v1 = 1.0; \ - _v2 = -1.0; \ - INFO.sign = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2); \ - \ - /* Mantissa */ \ - INFO.mpos = 0; \ - \ - _v1 = 1.0; \ - _v2 = 1.5; \ - INFO.msize = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2); \ - INFO.msize += 1 + (INFO.imp?0:1) - INFO.mpos; \ - \ - /* Exponent */ \ - INFO.epos = INFO.mpos + INFO.msize; \ - \ - INFO.esize = INFO.sign - INFO.epos; \ - \ - _v1 = 1.0; \ - INFO.bias = find_bias (INFO.epos, INFO.esize, INFO.perm, &_v1); \ - precision (&(INFO)); \ - ALIGNMENT(TYPE, INFO); \ - if(!HDstrcmp(INFO.varname, "FLOAT") || !HDstrcmp(INFO.varname, "DOUBLE") || \ - !HDstrcmp(INFO.varname, "LDOUBLE")) { \ - COMP_ALIGNMENT(TYPE,INFO.comp_align); \ - } \ + HDmemset(&INFO, 0, sizeof(INFO)); \ + INFO.varname = #VAR; \ + INFO.size = sizeof(TYPE); \ + \ + /* Initialize padding mask */ \ + HDmemset(_pad_mask, 0, sizeof(_pad_mask)); \ + \ + /* Padding bits. Set a variable to 4.0, then flip each bit and see if \ + * the modified variable is equal ("==") to the original. Build a \ + * padding bitmask to indicate which bits in the type are padding (i.e. \ + * have no effect on the value and should be ignored by subsequent \ + * steps). This is necessary because padding bits can change arbitrarily \ + * and interfere with detection of the various properties below unless we \ + * know to ignore them. */ \ + _v1 = 4.0; \ + HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ + for(_i = 0; _i < (int)sizeof(TYPE); _i++) \ + for(_byte_mask = (unsigned char)1; _byte_mask; _byte_mask <<= 1) { \ + _buf1[_i] ^= _byte_mask; \ + HDmemcpy((void *)&_v2, (const void *)_buf1, sizeof(TYPE)); \ + if(_v1 != _v2) \ + _pad_mask[_i] |= _byte_mask; \ + _buf1[_i] ^= _byte_mask; \ + } /* enf for */ \ + \ + /* Byte Order */ \ + for(_i = 0, _v1 = 0.0, _v2 = 1.0; _i < (int)sizeof(TYPE); _i++) { \ + _v3 = _v1; \ + _v1 += _v2; \ + _v2 /= 256.0; \ + HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ + HDmemcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \ + _j = byte_cmp(sizeof(TYPE), _buf3, _buf1, _pad_mask); \ + if(_j >= 0) { \ + INFO.perm[_i] = _j; \ + _last = _i; \ + } \ + } \ + fix_order(sizeof(TYPE), _last, INFO.perm, (const char**)&_mesg); \ + \ + if(!HDstrcmp(_mesg, "VAX")) \ + INFO.is_vax = TRUE; \ + \ + /* Implicit mantissa bit */ \ + _v1 = 0.5; \ + _v2 = 1.0; \ + INFO.imp = imp_bit (sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ + \ + /* Sign bit */ \ + _v1 = 1.0; \ + _v2 = -1.0; \ + INFO.sign = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ + \ + /* Mantissa */ \ + INFO.mpos = 0; \ + \ + _v1 = 1.0; \ + _v2 = 1.5; \ + INFO.msize = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ + INFO.msize += 1 + (INFO.imp?0:1) - INFO.mpos; \ + \ + /* Exponent */ \ + INFO.epos = INFO.mpos + INFO.msize; \ + \ + INFO.esize = INFO.sign - INFO.epos; \ + \ + _v1 = 1.0; \ + INFO.bias = find_bias (INFO.epos, INFO.esize, INFO.perm, &_v1); \ + precision (&(INFO)); \ + ALIGNMENT(TYPE, INFO); \ + if(!HDstrcmp(INFO.varname, "FLOAT") || !HDstrcmp(INFO.varname, "DOUBLE") || \ + !HDstrcmp(INFO.varname, "LDOUBLE")) { \ + COMP_ALIGNMENT(TYPE,INFO.comp_align); \ + } \ } @@ -887,7 +906,8 @@ iprint(detected_t *d) * * Purpose: Compares two chunks of memory A and B and returns the * byte index into those arrays of the first byte that - * differs between A and B. + * differs between A and B. Ignores differences where the + * corresponding bit in pad_mask is set to 0. * * Return: Success: Index of differing byte. * @@ -902,13 +922,16 @@ iprint(detected_t *d) *------------------------------------------------------------------------- */ static int -byte_cmp(int n, const void *_a, const void *_b) +byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) { - int i; - const unsigned char *a = (const unsigned char *) _a; - const unsigned char *b = (const unsigned char *) _b; + int i; + const unsigned char *a = (const unsigned char *) _a; + const unsigned char *b = (const unsigned char *) _b; + + for(i = 0; i < n; i++) + if((a[i] & pad_mask[i]) != (b[i] & pad_mask[i])) + return i; - for (i = 0; i < n; i++) if (a[i] != b[i]) return i; return -1; } @@ -919,7 +942,8 @@ byte_cmp(int n, const void *_a, const void *_b) * Purpose: Compares two bit vectors and returns the index for the * first bit that differs between the two vectors. The * size of the vector is NBYTES. PERM is a mapping from - * actual order to little endian. + * actual order to little endian. Ignores differences where + * the corresponding bit in pad_mask is set to 0. * * Return: Success: Index of first differing bit. * @@ -934,22 +958,24 @@ byte_cmp(int n, const void *_a, const void *_b) *------------------------------------------------------------------------- */ static int -bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b) +bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b, + const unsigned char *pad_mask) { - int i, j; - volatile unsigned char *a = (volatile unsigned char *) _a; - volatile unsigned char *b = (volatile unsigned char *) _b; - unsigned char aa, bb; + int i, j; + volatile unsigned char *a = (volatile unsigned char *) _a; + volatile unsigned char *b = (volatile unsigned char *) _b; + unsigned char aa, bb; for (i = 0; i < nbytes; i++) { - HDassert(perm[i] < nbytes); - if ((aa = a[perm[i]]) != (bb = b[perm[i]])) { - for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { - if ((aa & 1) != (bb & 1)) return i * 8 + j; - } - fprintf(stderr, "INTERNAL ERROR"); - HDabort(); - } + HDassert(perm[i] < nbytes); + if ((aa = a[perm[i]] & pad_mask[perm[i]]) + != (bb = b[perm[i]] & pad_mask[perm[i]])) { + for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { + if ((aa & 1) != (bb & 1)) return i * 8 + j; + } + fprintf(stderr, "INTERNAL ERROR"); + HDabort(); + } } return -1; } @@ -1058,18 +1084,19 @@ fix_order(int n, int last, int *perm, const char **mesg) *------------------------------------------------------------------------- */ static int -imp_bit(int n, int *perm, volatile void *_a, volatile void *_b) +imp_bit(int n, int *perm, volatile void *_a, volatile void *_b, + const unsigned char *pad_mask) { - volatile unsigned char *a = (volatile unsigned char *) _a; - volatile unsigned char *b = (volatile unsigned char *) _b; - int changed, major, minor; - int msmb; /*most significant mantissa bit */ + volatile unsigned char *a = (volatile unsigned char *) _a; + volatile unsigned char *b = (volatile unsigned char *) _b; + int changed, major, minor; + int msmb; /*most significant mantissa bit */ /* * Look for the least significant bit that has changed between - * A and B. This is the least significant bit of the exponent. + * A and B. This is the least significant bit of the exponent. */ - changed = bit_cmp(n, perm, a, b); + changed = bit_cmp(n, perm, a, b, pad_mask); HDassert(changed >= 0); /* diff --git a/src/Makefile.am b/src/Makefile.am index 2d7640e..f63a36e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,7 +27,6 @@ include $(top_srcdir)/config/lt_vers.am # a long time to compile it with any optimization on. H5detect is used # to generate H5Tinit.c once. So, optimization is not critical. noinst_PROGRAMS = H5detect H5make_libsettings -H5detect_CFLAGS = $(AM_CFLAGS) -g -O0 # Our main target, the HDF5 library lib_LTLIBRARIES=libhdf5.la diff --git a/src/Makefile.in b/src/Makefile.in index f215b74..b31a9ae 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -182,11 +182,8 @@ libhdf5_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(libhdf5_la_LDFLAGS) $(LDFLAGS) -o $@ PROGRAMS = $(noinst_PROGRAMS) H5detect_SOURCES = H5detect.c -H5detect_OBJECTS = H5detect-H5detect.$(OBJEXT) +H5detect_OBJECTS = H5detect.$(OBJEXT) H5detect_LDADD = $(LDADD) -H5detect_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(H5detect_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ H5make_libsettings_SOURCES = H5make_libsettings.c H5make_libsettings_OBJECTS = H5make_libsettings.$(OBJEXT) H5make_libsettings_LDADD = $(LDADD) @@ -524,7 +521,6 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog LT_VERS_INTERFACE = 6 LT_VERS_REVISION = 154 LT_VERS_AGE = 0 -H5detect_CFLAGS = $(AM_CFLAGS) -g -O0 # Our main target, the HDF5 library lib_LTLIBRARIES = libhdf5.la @@ -744,7 +740,7 @@ clean-noinstPROGRAMS: rm -f $$list H5detect$(EXEEXT): $(H5detect_OBJECTS) $(H5detect_DEPENDENCIES) $(EXTRA_H5detect_DEPENDENCIES) @rm -f H5detect$(EXEEXT) - $(AM_V_CCLD)$(H5detect_LINK) $(H5detect_OBJECTS) $(H5detect_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(H5detect_OBJECTS) $(H5detect_LDADD) $(LIBS) H5make_libsettings$(EXEEXT): $(H5make_libsettings_OBJECTS) $(H5make_libsettings_DEPENDENCIES) $(EXTRA_H5make_libsettings_DEPENDENCIES) @rm -f H5make_libsettings$(EXEEXT) $(AM_V_CCLD)$(LINK) $(H5make_libsettings_OBJECTS) $(H5make_libsettings_LDADD) $(LIBS) @@ -1013,7 +1009,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ztrans.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5checksum.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5dbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5detect-H5detect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5detect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5lib_settings.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5make_libsettings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5system.Plo@am__quote@ @@ -1041,20 +1037,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -H5detect-H5detect.o: H5detect.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -MT H5detect-H5detect.o -MD -MP -MF $(DEPDIR)/H5detect-H5detect.Tpo -c -o H5detect-H5detect.o `test -f 'H5detect.c' || echo '$(srcdir)/'`H5detect.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='H5detect.c' object='H5detect-H5detect.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -c -o H5detect-H5detect.o `test -f 'H5detect.c' || echo '$(srcdir)/'`H5detect.c - -H5detect-H5detect.obj: H5detect.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -MT H5detect-H5detect.obj -MD -MP -MF $(DEPDIR)/H5detect-H5detect.Tpo -c -o H5detect-H5detect.obj `if test -f 'H5detect.c'; then $(CYGPATH_W) 'H5detect.c'; else $(CYGPATH_W) '$(srcdir)/H5detect.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='H5detect.c' object='H5detect-H5detect.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -c -o H5detect-H5detect.obj `if test -f 'H5detect.c'; then $(CYGPATH_W) 'H5detect.c'; else $(CYGPATH_W) '$(srcdir)/H5detect.c'; fi` - mostlyclean-libtool: -rm -f *.lo -- cgit v0.12 From c965b5503b845c92fd8807dec81a21504dfc0b06 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 19 Sep 2013 14:42:45 -0500 Subject: [svn-r24172] Position trunk/1.8 vars in similar location for comparison. --- tools/h5dump/h5dump_ddl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 6aaa499..d714f39 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1154,6 +1154,9 @@ dump_fcpl(hid_t fid) 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_file_space_type_t fs_strategy; /* file space strategy */ + hsize_t fs_threshold; /* free-space section threshold */ + H5F_info2_t finfo; /* file information */ #ifdef SHOW_FILE_DRIVER hid_t fapl; /* file access property list ID */ hid_t fdriver; /* file driver */ @@ -1162,9 +1165,6 @@ dump_fcpl(hid_t fid) 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 */ - H5F_file_space_type_t fs_strategy; /* file space strategy */ - hsize_t fs_threshold; /* free-space section threshold */ - H5F_info2_t finfo; /* file information */ fcpl=H5Fget_create_plist(fid); H5Fget_info2(fid, &finfo); -- cgit v0.12 From 10a843ff7fab2e14ac2451b0ef15134126ff462d Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Fri, 20 Sep 2013 07:16:23 -0500 Subject: [svn-r24174] Purpose: Add examples Description: Added tutorial examples that Barbara made following the C tutorial examples. They will be configured for daily test. Platforms tested: Linux/32 2.6 (jam) - tested by running a script that compiled them with h5c++ and executing the examples; output are checked manually --- c++/examples/h5tutr_cmprss.cpp | 162 ++++++++++++++++++++++++++++++++++ c++/examples/h5tutr_crtatt.cpp | 104 ++++++++++++++++++++++ c++/examples/h5tutr_crtdat.cpp | 91 +++++++++++++++++++ c++/examples/h5tutr_crtgrp.cpp | 69 +++++++++++++++ c++/examples/h5tutr_crtgrpar.cpp | 92 +++++++++++++++++++ c++/examples/h5tutr_crtgrpd.cpp | 141 +++++++++++++++++++++++++++++ c++/examples/h5tutr_extend.cpp | 176 +++++++++++++++++++++++++++++++++++++ c++/examples/h5tutr_rdwt.cpp | 84 ++++++++++++++++++ c++/examples/h5tutr_subset.cpp | 185 +++++++++++++++++++++++++++++++++++++++ 9 files changed, 1104 insertions(+) create mode 100644 c++/examples/h5tutr_cmprss.cpp create mode 100644 c++/examples/h5tutr_crtatt.cpp create mode 100644 c++/examples/h5tutr_crtdat.cpp create mode 100644 c++/examples/h5tutr_crtgrp.cpp create mode 100644 c++/examples/h5tutr_crtgrpar.cpp create mode 100644 c++/examples/h5tutr_crtgrpd.cpp create mode 100644 c++/examples/h5tutr_extend.cpp create mode 100644 c++/examples/h5tutr_rdwt.cpp create mode 100644 c++/examples/h5tutr_subset.cpp diff --git a/c++/examples/h5tutr_cmprss.cpp b/c++/examples/h5tutr_cmprss.cpp new file mode 100644 index 0000000..7db73c4 --- /dev/null +++ b/c++/examples/h5tutr_cmprss.cpp @@ -0,0 +1,162 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create a compressed dataset. + * It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("cmprss.h5"); +const H5std_string DATASET_NAME("Compressed_Data"); +const int DIM0 = 100; +const int DIM1 = 20; + +int main (void) +{ + hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions + hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions + int i,j, buf[DIM0][DIM1]; + + // Try block to detect exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create the data space for the dataset. + DataSpace *dataspace = new DataSpace(2, dims); + + // Modify dataset creation property to enable chunking + DSetCreatPropList *plist = new DSetCreatPropList; + plist->setChunk(2, chunk_dims); + + // Set ZLIB (DEFLATE) Compression using level 6. + // To use SZIP compression comment out this line. + plist->setDeflate(6); + + // Uncomment these lines to set SZIP Compression + // unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK; + // unsigned szip_pixels_per_block = 16; + // plist->setSzip(szip_options_mask, szip_pixels_per_block); + + // Create the dataset. + DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME, + PredType::STD_I32BE, *dataspace, *plist) ); + + for (i = 0; i< DIM0; i++) + for (j=0; jwrite(buf, PredType::NATIVE_INT); + + // Close objects and file. Either approach will close the HDF5 item. + delete dataspace; + delete dataset; + delete plist; + file.close(); + + // ----------------------------------------------- + // Re-open the file and dataset, retrieve filter + // information for dataset and read the data back. + // ----------------------------------------------- + + int rbuf[DIM0][DIM1]; + int numfilt; + size_t nelmts={1}, namelen={1}; + unsigned flags, filter_info, cd_values[1], idx; + char name[1]; + H5Z_filter_t filter_type; + + // Open the file and the dataset in the file. + file.openFile(FILE_NAME, H5F_ACC_RDONLY); + dataset = new DataSet(file.openDataSet( DATASET_NAME)); + + // Get the create property list of the dataset. + plist = new DSetCreatPropList(dataset->getCreatePlist ()); + + // Get the number of filters associated with the dataset. + numfilt = plist->getNfilters(); + cout << "Number of filters associated with dataset: " << numfilt << endl; + + for (idx=0; idx < numfilt; idx++) { + nelmts = 0; + + filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info); + + cout << "Filter Type: "; + + switch (filter_type) { + case H5Z_FILTER_DEFLATE: + cout << "H5Z_FILTER_DEFLATE" << endl; + break; + case H5Z_FILTER_SZIP: + cout << "H5Z_FILTER_SZIP" << endl; + break; + default: + cout << "Other filter type included." << endl; + } + } + + // Read data. + dataset->read(rbuf, PredType::NATIVE_INT); + + delete plist; + delete dataset; + file.close(); // can be skipped + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch(DataSetIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSpace operations + catch(DataSpaceIException error) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp new file mode 100644 index 0000000..3d5b558 --- /dev/null +++ b/c++/examples/h5tutr_crtatt.cpp @@ -0,0 +1,104 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create an attribute attached to a + * dataset. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#endif + +const H5std_string FILE_NAME( "dset.h5" ); +const H5std_string DATASET_NAME( "dset" ); +const H5std_string ATTR_NAME( "Units" ); + +const int DIM1 = 2; + +int main (void) +{ + int attr_data[2] = { 100, 200}; + hsize_t dims[1] = { DIM1 }; + + + // Try block to detect exceptions raised by any of the calls inside it + try + { + + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + + Exception::dontPrint(); + + // Open an existing file and dataset. + + H5File file( FILE_NAME, H5F_ACC_RDWR ); + DataSet dataset = file.openDataSet( DATASET_NAME ); + + // Create the data space for the attribute. + + DataSpace attr_dataspace = DataSpace (1, dims ); + + // Create a dataset attribute. + + Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE, + attr_dataspace); + + // Write the attribute data. + + attribute.write( PredType::NATIVE_INT, attr_data); + + } // end of try block + + + // catch failure caused by the H5File operations + catch( DataSpaceIException error ) + { + error.printError(); + return -1; + } + + + // catch failure caused by the H5File operations + catch( AttributeIException error ) + { + error.printError(); + return -1; + } + + + // catch failure caused by the H5File operations + catch( FileIException error ) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch( DataSetIException error ) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp new file mode 100644 index 0000000..592cc0c --- /dev/null +++ b/c++/examples/h5tutr_crtdat.cpp @@ -0,0 +1,91 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create a dataset that is a 4 x 6 + * array. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#endif + +const H5std_string FILE_NAME("dset.h5"); +const H5std_string DATASET_NAME("dset"); +const int NX = 4; // dataset dimensions +const int NY = 6; +const int RANK = 2; + +int main (void) +{ + + // Try block to detect exceptions raised by any of the calls inside it + try + { + + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + + Exception::dontPrint(); + + // Create a new file using the default property lists. + + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create the data space for the dataset. + + hsize_t dims[2]; // dataset dimensions + dims[0] = NX; + dims[1] = NY; + DataSpace dataspace(RANK, dims); + + // Define the datatype to be used + //IntType datatype(PredType::STD_I32BE); + + // Create the dataset. + + DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace); + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch(DataSetIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSpace operations + catch(DataSpaceIException error) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + diff --git a/c++/examples/h5tutr_crtgrp.cpp b/c++/examples/h5tutr_crtgrp.cpp new file mode 100644 index 0000000..bbafd10 --- /dev/null +++ b/c++/examples/h5tutr_crtgrp.cpp @@ -0,0 +1,69 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create and close a group. + * It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("group.h5"); + +int main(void) +{ + // Try block to detect exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Create a new file using default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create a group named "/MygGroup" in the file + Group group(file.createGroup("/MyGroup")); + + // File and group will be closed as their instances go out of scope. + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + // catch failure caused by the Group operations + catch(GroupIException error) + { + error.printError(); + return -1; + } + + return 0; +} diff --git a/c++/examples/h5tutr_crtgrpar.cpp b/c++/examples/h5tutr_crtgrpar.cpp new file mode 100644 index 0000000..d58dff6 --- /dev/null +++ b/c++/examples/h5tutr_crtgrpar.cpp @@ -0,0 +1,92 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates the creation of groups using absolute and + * relative names. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("groups.h5"); + +int main(void) +{ + + // Try block to detect exceptions raised by any of the calls inside it + try + { + + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately. + + Exception::dontPrint(); + + // Create a new file using default properties. + + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create group "MyGroup" in the root group using an absolute name. + + Group group1(file.createGroup( "/MyGroup")); + + // Create group "Group_A" in group "MyGroup" using an + // absolute name. + + Group group2(file.createGroup("/MyGroup/Group_A")); + + // Create group "Group_B" in group "MyGroup" using a + // relative name. + + Group group3(group1.createGroup ("Group_B")); + + // Close the groups and file. + + group1.close(); + group2.close(); + group3.close(); + file.close(); + + } // end of try block + + // catch failure caused by the File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the Group operations + catch(GroupIException error) + { + error.printError(); + return -1; + } + + return 0; +} + + diff --git a/c++/examples/h5tutr_crtgrpd.cpp b/c++/examples/h5tutr_crtgrpd.cpp new file mode 100644 index 0000000..fdb9108 --- /dev/null +++ b/c++/examples/h5tutr_crtgrpd.cpp @@ -0,0 +1,141 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create a dataset in a group. + * It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("groups.h5"); +const H5std_string DATASET_NAME1("/MyGroup/dset1"); +const H5std_string DATASET_NAME2("dset2"); +const int RANK = 2; +const int D1DIM1 = 3; +const int D1DIM2 = 3; +const int D2DIM1 = 2; +const int D2DIM2 = 10; + +int main(void) +{ + int dset1_data[D1DIM1][D1DIM2], dset2_data[D2DIM1][D2DIM2]; // data buffers + int i, j; + + // Try block to catch exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Initialize the first dataset. + for (i = 0; i < D1DIM1; i++) + for (j = 0; j < D1DIM2; j++) + dset1_data[i][j] = j + 1; + + // Initialize the second dataset. + for (i = 0; i < D2DIM1; i++) + for (j = 0; j < D2DIM2; j++) + dset2_data[i][j] = j + 1; + + // Open an existing file and dataset. + H5File file(FILE_NAME, H5F_ACC_RDWR); + + // Create the data space for the first dataset. Note the use of + // pointer for the instance 'dataspace'. It can be deleted and + // used again later for another data space. An HDF5 identifier is + // closed by the destructor or the method 'close()'. + hsize_t dims[RANK]; // dataset dimensions + dims[0] = D1DIM1; + dims[1] = D1DIM2; + DataSpace *dataspace = new DataSpace (RANK, dims); + + // Create the dataset in group "MyGroup". Same note as for the + // dataspace above. + DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1, + PredType::STD_I32BE, *dataspace)); + + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset->write(dset1_data, PredType::NATIVE_INT); + + // Close the current dataset and data space. + delete dataset; + delete dataspace; + + // Create the data space for the second dataset. + dims[0] = D2DIM1; + dims[1] = D2DIM2; + dataspace = new DataSpace (RANK, dims); + + // Create group "Group_A" in group "MyGroup". + Group group(file.openGroup("/MyGroup/Group_A")); + + // Create the second dataset in group "Group_A". + dataset = new DataSet (group.createDataSet(DATASET_NAME2, + PredType::STD_I32BE, *dataspace)); + + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset->write(dset2_data, PredType::NATIVE_INT); + + // Close all objects. + delete dataspace; + delete dataset; + group.close(); + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + // catch failure caused by the DataSet operations + catch(DataSetIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSpace operations + catch(DataSpaceIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the Group operations + catch(GroupIException error) + { + error.printError(); + return -1; + } + + return 0; +} diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp new file mode 100644 index 0000000..6437fb8 --- /dev/null +++ b/c++/examples/h5tutr_extend.cpp @@ -0,0 +1,176 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to create a dataset that is a 4 x 6 + * array. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("extend.h5"); +const H5std_string DATASETNAME("ExtendibleArray"); + +int main (void) +{ + + hsize_t dims[2] = {3,3}; // dataset dimensions at creation + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={2, 5}; + + int data[3][3] = { {1, 1, 1}, // data to write + {1, 1, 1}, + {1, 1, 1} }; + + // Variables used in extending and writing to the extended portion of dataset + + hsize_t size[2]; + hsize_t offset[2]; + hsize_t dimsext[2] = {7, 3}; // extend dimensions + int dataext[7][3] = { {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4} }; + + // Try block to detect exceptions raised by any of the calls inside it + try + { + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create the data space for the dataset. Note the use of pointer + // for the instance 'dataspace'. It can be deleted and used again + // later for another dataspace. An HDF5 identifier can be closed + // by the destructor or the method 'close()'. + DataSpace *dataspace = new DataSpace (2, dims, maxdims); + + // Modify dataset creation property to enable chunking + DSetCreatPropList prop; + prop.setChunk(2, chunk_dims); + + // Create the chunked dataset. Note the use of pointer. + DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME, + PredType::STD_I32BE, *dataspace, prop) ); + + // Write data to dataset. + dataset->write(data, PredType::NATIVE_INT); + + // Extend the dataset. Dataset becomes 10 x 3. + size[0] = dims[0] + dimsext[0]; + size[1] = dims[1]; + dataset->extend(size); + + // Select a hyperslab in extended portion of the dataset. + DataSpace *filespace = new DataSpace(dataset->getSpace ()); + offset[0] = 3; + offset[1] = 0; + filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset); + + // Define memory space. + DataSpace *memspace = new DataSpace(2, dimsext, NULL); + + // Write data to the extended portion of the dataset. + dataset->write(dataext, PredType::NATIVE_INT, *memspace, *filespace); + + // Close all objects and file. + prop.close(); + delete filespace; + delete memspace; + delete dataspace; + delete dataset; + file.close(); + + // --------------------------------------- + // Re-open the file and read the data back + // --------------------------------------- + + int rdata[10][3]; + int i,j, rank, rank_chunk; + hsize_t chunk_dimsr[2], dimsr[2]; + + file.openFile(FILE_NAME, H5F_ACC_RDONLY); + + dataset = new DataSet(file.openDataSet( DATASETNAME)); + + filespace = new DataSpace(dataset->getSpace()); + + prop = dataset->getCreatePlist(); + rank = filespace->getSimpleExtentNdims(); + herr_t status_n = filespace->getSimpleExtentDims(dimsr); + + if (H5D_CHUNKED == prop.getLayout()) + rank_chunk = prop.getChunk(rank, chunk_dimsr); + + memspace = new DataSpace(rank, dimsr, NULL); + dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace); + + cout << endl; + for (j = 0; j < dimsr[0]; j++) { + for (i = 0; i < dimsr[1]; i++) + cout << " " << rdata[j][i]; + cout << endl; + } + + // Close all objects and file. + prop.close(); + delete filespace; + delete memspace; + delete dataset; + file.close(); + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch(DataSetIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSpace operations + catch(DataSpaceIException error) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp new file mode 100644 index 0000000..a0c1996 --- /dev/null +++ b/c++/examples/h5tutr_rdwt.cpp @@ -0,0 +1,84 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to write to and read from an existing + * dataset. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#endif + +const H5std_string FILE_NAME( "dset.h5" ); +const H5std_string DATASET_NAME( "dset" ); +const int DIM0 = 4; // dataset dimensions +const int DIM1 = 6; + +int main (void) +{ + + // Data initialization. + + int i, j; + int data[DIM0][DIM1]; // buffer for data to write + + for (j = 0; j < DIM0; j++) + for (i = 0; i < DIM1; i++) + data[j][i] = i * 6 + j + 1; + + // Try block to detect exceptions raised by any of the calls inside it + try + { + + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + + Exception::dontPrint(); + + // Open an existing file and dataset. + + H5File file( FILE_NAME, H5F_ACC_RDWR ); + DataSet dataset = file.openDataSet( DATASET_NAME ); + + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + + dataset.write( data, PredType::NATIVE_INT ); + + } // end of try block + + // catch failure caused by the H5File operations + catch( FileIException error ) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch( DataSetIException error ) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp new file mode 100644 index 0000000..76e63fd --- /dev/null +++ b/c++/examples/h5tutr_subset.cpp @@ -0,0 +1,185 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This example illustrates how to read/write a subset of data (a slab) + * from/to a dataset in an HDF5 file. It is used in the HDF5 Tutorial. + */ + +#include +#include + +#include "H5Cpp.h" + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#ifndef H5_NO_STD + using std::cout; + using std::endl; +#endif // H5_NO_STD +#endif + +const H5std_string FILE_NAME("subset.h5"); +const H5std_string DATASET_NAME("IntArray"); + +const int RANK = 2; +const int DIM0_SUB = 3; // subset dimensions +const int DIM1_SUB = 4; +const int DIM0 = 8; // size of dataset +const int DIM1 = 10; + +int main (void) +{ + int i,j; + int data[DIM0][DIM1], sdata[DIM0_SUB][DIM1_SUB], rdata[DIM0][DIM1]; + + // Try block to detect exceptions raised by any of the calls inside it + try + { + + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + + Exception::dontPrint(); + + // --------------------------------------------------- + // Create a new file using the default property lists. + // Then create a dataset and write data to it. + // Close the file and dataset. + // --------------------------------------------------- + + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + hsize_t dims[2]; + dims[0] = DIM0; + dims[1] = DIM1; + DataSpace dataspace = DataSpace (RANK, dims); + + DataSet dataset(file.createDataSet( DATASET_NAME, + PredType::STD_I32BE, dataspace) ); + + + for (j = 0; j < DIM0; j++) { + for (i = 0; i < DIM1; i++) + if (i< (DIM1/2)) + data[j][i] = 1; + else + data[j][i] = 2; + } + + dataset.write(data, PredType::NATIVE_INT); + + cout << endl << "Data Written to File:" << endl; + for (j = 0; j < DIM0; j++) { + for (i = 0; i < DIM1; i++) + cout << " " << data[j][i]; + cout << endl; + } + + dataspace.close(); + dataset.close(); + file.close(); + + // --------------------------------------------------- + // Reopen the file and dataset and write a subset of + // values to the dataset. + // --------------------------------------------------- + + hsize_t offset[2], count[2], stride[2], block[2]; + hsize_t dimsm[2]; + + file.openFile(FILE_NAME, H5F_ACC_RDWR); + dataset = file.openDataSet(DATASET_NAME); + + // Specify size and shape of subset to write. + + offset[0] = 1; + offset[1] = 2; + + count[0] = DIM0_SUB; + count[1] = DIM1_SUB; + + stride[0] = 1; + stride[1] = 1; + + block[0] = 1; + block[1] = 1; + + // Define Memory Dataspace. Get file dataspace and select + // a subset from the file dataspace. + + dimsm[0] = DIM0_SUB; + dimsm[1] = DIM1_SUB; + + DataSpace memspace(RANK, dimsm, NULL); + + dataspace = dataset.getSpace(); + dataspace.selectHyperslab(H5S_SELECT_SET, count, offset, stride, block); + + // Write a subset of data to the dataset, then read the + // entire dataset back from the file. + + cout << endl << "Write subset to file specifying: " << endl; + cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl; + for (j = 0; j < DIM0_SUB; j++) { + for (i = 0; i < DIM1_SUB; i++) + sdata[j][i] = 5; + } + + dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace); + dataset.read(rdata, PredType::NATIVE_INT); + + + cout << endl << "Data in File after Subset is Written:" << endl; + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) + cout << " " << rdata[i][j]; + cout << endl; + } + cout << endl; + + // It is not necessary to close these objects because close() will + // be called when the object instances are going out of scope. + dataspace.close(); + memspace.close(); + dataset.close(); + file.close(); + + } // end of try block + + // catch failure caused by the H5File operations + catch(FileIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSet operations + catch(DataSetIException error) + { + error.printError(); + return -1; + } + + // catch failure caused by the DataSpace operations + catch(DataSpaceIException error) + { + error.printError(); + return -1; + } + + return 0; // successfully terminated +} + -- cgit v0.12 From d56742478306b9e536b5ed3e87fd0048525ec98b Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Fri, 20 Sep 2013 08:23:24 -0500 Subject: [svn-r24175] Description: Added the tutorial examples ./c++/examples/h5tutr_cmprss.cpp ./c++/examples/h5tutr_crtatt.cpp ./c++/examples/h5tutr_crtdat.cpp ./c++/examples/h5tutr_crtgrpar.cpp ./c++/examples/h5tutr_crtgrp.cpp ./c++/examples/h5tutr_crtgrpd.cpp ./c++/examples/h5tutr_extend.cpp ./c++/examples/h5tutr_rdwt.cpp ./c++/examples/h5tutr_subset.cpp Verified with bin/chkmanifest --- MANIFEST | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MANIFEST b/MANIFEST index b67c6bb..83851b9 100644 --- a/MANIFEST +++ b/MANIFEST @@ -402,6 +402,15 @@ ./c++/examples/expected.out ./c++/examples/extend_ds.cpp ./c++/examples/h5group.cpp +./c++/examples/h5tutr_cmprss.cpp +./c++/examples/h5tutr_crtatt.cpp +./c++/examples/h5tutr_crtdat.cpp +./c++/examples/h5tutr_crtgrpar.cpp +./c++/examples/h5tutr_crtgrp.cpp +./c++/examples/h5tutr_crtgrpd.cpp +./c++/examples/h5tutr_extend.cpp +./c++/examples/h5tutr_rdwt.cpp +./c++/examples/h5tutr_subset.cpp ./c++/examples/readdata.cpp ./c++/examples/testh5c++.sh.in ./c++/examples/writedata.cpp -- cgit v0.12 From 1b22cc435e999e7f1415f17b4408e2fa16bc73a5 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Fri, 20 Sep 2013 13:53:21 -0500 Subject: [svn-r24178] Back out the changes that cause daily test to fail r24163 --- c++/src/H5Attribute.cpp | 1 - c++/src/H5CommonFG.cpp | 131 +++++++++++ c++/src/H5CommonFG.h | 12 + c++/src/H5DataSet.cpp | 48 +++- c++/src/H5DataSet.h | 8 +- c++/src/H5DataSpace.cpp | 2 +- c++/src/H5DataType.cpp | 13 +- c++/src/H5DataType.h | 8 +- c++/src/H5File.h | 3 + c++/src/H5Group.cpp | 17 +- c++/src/H5Group.h | 10 +- c++/src/H5IdComponent.cpp | 2 +- c++/src/H5Location.cpp | 420 +++++++++++------------------------ c++/src/H5Location.h | 51 ++--- c++/src/H5Object.cpp | 1 + c++/src/H5PropList.cpp | 5 +- c++/test/trefer.cpp | 548 ++-------------------------------------------- 17 files changed, 375 insertions(+), 905 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index a98a970..d684b8f 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -44,7 +44,6 @@ namespace H5 { #endif // H5_NO_STD #endif -class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate //-------------------------------------------------------------------------- // Function: Attribute default constructor ///\brief Default constructor: Creates a stub attribute diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 3bf4b4f..d6fe5dc 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -460,6 +460,137 @@ H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const } //-------------------------------------------------------------------------- +// Function: CommonFG::setComment +///\brief Sets or resets the comment for an object specified by its name. +///\param name - IN: Name of the object +///\param comment - IN: New comment +///\exception H5::FileIException or H5::GroupIException +///\par Description +/// If \a comment is an empty string or a null pointer, the comment +/// message is removed from the object. +/// Comments should be relatively short, null-terminated, ASCII +/// strings. They can be attached to any object that has an +/// object header, e.g., data sets, groups, named data types, +/// and data spaces, but not symbolic links. +// Programmer Binh-Minh Ribler - 2000 +// Modification +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void CommonFG::setComment( const char* name, const char* comment ) const +{ + herr_t ret_value = H5Oset_comment_by_name( getLocId(), name, comment, H5P_DEFAULT ); + if( ret_value < 0 ) + throwException("setComment", "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name and \a comment. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void CommonFG::setComment( const H5std_string& name, const H5std_string& comment ) const +{ + setComment( name.c_str(), comment.c_str() ); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::removeComment +///\brief Removes the comment from an object specified by its name. +///\param name - IN: Name of the object +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - May 2005 +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void CommonFG::removeComment(const char* name) const +{ + herr_t ret_value = H5Oset_comment_by_name(getLocId(), name, NULL, H5P_DEFAULT); + if( ret_value < 0 ) + throwException("removeComment", "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::removeComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - May 2005 +//-------------------------------------------------------------------------- +void CommonFG::removeComment(const H5std_string& name) const +{ + removeComment (name.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::getComment +///\brief Retrieves comment for the specified object and its comment's +/// length. +///\param name - IN: Name of the object +///\param bufsize - IN: Length of the comment to retrieve +///\return Comment string +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - 2000 +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const +{ + // bufsize is default to 256 + // temporary variable + hid_t loc_id = getLocId(); // temporary variable + + // temporary C-string for the object's comment; bufsize already including + // null character + char* comment_C = new char[bufsize]; + ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); + + // if the actual length of the comment is longer than bufsize and bufsize + // was the default value, i.e., not given by the user, then call + // H5Oget_comment_by_name again with the correct value. + // If the call to H5Oget_comment_by_name returned an error, skip this block + // and throw an exception below. + if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) + { + size_t new_size = ret_value; + delete []comment_C; + comment_C = new char[new_size]; // new_size including null terminator + ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); + } + + // if H5Oget_comment_by_name returns SUCCEED, return the string comment, + // otherwise, throw an exception + if( ret_value < 0 ) { + delete []comment_C; + throwException("getComment", "H5Oget_comment_by_name failed"); + } + + H5std_string comment = H5std_string(comment_C); + delete []comment_C; + return (comment); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::getComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +H5std_string CommonFG::getComment( const H5std_string& name, size_t bufsize ) const +{ + return( getComment( name.c_str(), bufsize )); +} + +//-------------------------------------------------------------------------- // Function: CommonFG::mount ///\brief Mounts the file \a child onto this group. ///\param name - IN: Name of the group diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index b02b05b..22e193a 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -49,6 +49,18 @@ class H5_DLLCPP CommonFG { DataSet openDataSet(const char* name) const; DataSet openDataSet(const H5std_string& name) const; + // Retrieves comment for the HDF5 object specified by its name. + H5std_string getComment(const char* name, size_t bufsize=256) const; + H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; + + // Removes the comment for the HDF5 object specified by its name. + void removeComment(const char* name) const; + void removeComment(const H5std_string& name) const; + + // Sets the comment for an HDF5 object specified by its name. + void setComment(const char* name, const char* comment) const; + void setComment(const H5std_string& name, const H5std_string& comment) const; + // Returns the value of a symbolic link. H5std_string getLinkval(const char* link_name, size_t size=0) const; H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const; diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 1765ca9..3e3893c 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -79,29 +79,57 @@ DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(origi //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 location, creates a +///\brief Given a reference, ref, to an hdf5 dataset, creates a /// DataSet object -///\param loc - IN: Dataset reference object is in or location of +///\param obj - IN: Dataset reference object is in or location of /// object that the dataset is located within. ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type - default to H5R_OBJECT ///\exception H5::DataSetIException ///\par Description -/// \c loc can be DataSet, Group, H5File, or named DataType, that +/// \c obj can be DataSet, Group, H5File, or named DataType, that /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object() +DataSet::DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() { - H5Location::dereference(loc, ref, ref_type, plist); + try { + id = p_dereference(obj.getId(), ref, ref_type); + } catch (ReferenceException deref_error) { + throw ReferenceException("DataSet constructor - located by object", + deref_error.getDetailMsg()); + } } //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 attribute, creates a +///\brief Given a reference, ref, to an hdf5 dataset, creates a +/// DataSet object +///\param h5file - IN: Location referenced object is in +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type - default to H5R_OBJECT +///\exception H5::DataSetIException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// Jul, 2008 +// Added for application convenience. +//-------------------------------------------------------------------------- +DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() +{ + try { + id = p_dereference(h5file.getId(), ref, ref_type); + } catch (ReferenceException deref_error) { + throw ReferenceException("DataSet constructor - located by HDF5 file", + deref_error.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: DataSet overload constructor - dereference +///\brief Given a reference, ref, to an hdf5 dataset, creates a /// DataSet object ///\param attr - IN: Specifying location where the referenced object is in ///\param ref - IN: Reference pointer @@ -112,12 +140,12 @@ DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, co // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object() +DataSet::DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() { - try { - id = p_dereference(attr.getId(), ref, ref_type, plist); + try { + id = p_dereference(attr.getId(), ref, ref_type); } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - by dereferenced", + throw ReferenceException("DataSet constructor - located by attribute", deref_error.getDetailMsg()); } } diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index e2fe702..bc80046 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -76,12 +76,16 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSet"); } // Creates a dataset by way of dereference. - DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); // Default constructor. DataSet(); diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 059c812..2e2bb35 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -446,7 +446,7 @@ void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const } //-------------------------------------------------------------------------- -// Function: DataSpace::selectElements +// Function: DataSpace::H5Sselect_elements ///\brief Selects array elements to be included in the selection for /// this dataspace. ///\param op - IN: Operator specifying how the new selection is to be diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 9e9433f..8a62471 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -100,7 +100,7 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- - /* DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() +DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() { try { id = p_dereference(obj.getId(), ref, ref_type); @@ -109,7 +109,6 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() deref_error.getDetailMsg()); } } - */ //-------------------------------------------------------------------------- // Function: DataType overload constructor - dereference @@ -124,16 +123,14 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() +DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() { - H5Location::dereference(loc, ref, ref_type, plist); - /* try { + try { id = p_dereference(h5file.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("DataType constructor - located by an H5File", deref_error.getDetailMsg()); } - */ } //-------------------------------------------------------------------------- @@ -149,10 +146,10 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() +DataType::DataType(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() { try { - id = p_dereference(attr.getId(), ref, ref_type, plist); + id = p_dereference(attr.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("DataType constructor - located by an Attribute", deref_error.getDetailMsg()); diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index e4254b0..6e56622 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -30,8 +30,9 @@ class H5_DLLCPP DataType : public H5Object { DataType( const DataType& original ); // Creates a datatype by way of dereference. - DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataType(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataType(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataType(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); // Closes this datatype. virtual void close(); @@ -100,6 +101,9 @@ class H5_DLLCPP DataType : public H5Object { // Checks whether this datatype is a variable-length string. bool isVariableStr() const; + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataType"); } diff --git a/c++/src/H5File.h b/c++/src/H5File.h index 2abffea..f906de6 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -61,6 +61,9 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { // and datatypes) in the same file. void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + // Returns the pointer to the file handle of the low-level file driver. void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; void getVFDHandle(void **file_handle) const; diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 3150025..eff7e50 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -99,18 +99,14 @@ Group::Group(const hid_t existing_id) : H5Object() /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- - /* Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() - */ -Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() +Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() { - H5Location::dereference(loc, ref, ref_type, plist); - /* try { - id = p_dereference(loc.getId(), ref, ref_type); + try { + id = p_dereference(obj.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("Group constructor - located by an H5Object", deref_error.getDetailMsg()); } - */ } //-------------------------------------------------------------------------- @@ -122,7 +118,7 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- - /* Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() +Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() { try { id = p_dereference(h5file.getId(), ref, ref_type); @@ -131,7 +127,6 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const deref_error.getDetailMsg()); } } - */ //-------------------------------------------------------------------------- // Function: Group overload constructor - dereference @@ -142,10 +137,10 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object() +Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() { try { - id = p_dereference(attr.getId(), ref, ref_type, plist); + id = p_dereference(attr.getId(), ref, ref_type); } catch (ReferenceException deref_error) { throw ReferenceException("Group constructor - located by an Attribute", deref_error.getDetailMsg()); diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 4003c21..3b53293 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -26,6 +26,9 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Close this group. virtual void close(); + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("Group"); } @@ -36,10 +39,9 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { virtual hid_t getLocId() const; // Creates a group by way of dereference. - Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - /* Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - */ - Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + Group(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + Group(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); // default constructor Group(); diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index f902116..4a997ab 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -269,7 +269,7 @@ IdComponent::IdComponent() {} // Description: // This function is protected so that the user applications can // only have access to its code via allowable classes, namely, -// Attribute and H5Location subclasses. +// H5File and H5Object subclasses. // Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string IdComponent::p_get_file_name() const diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index d4c97fa..fcf7ff4 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -55,17 +55,17 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, } //-------------------------------------------------------------------------- -// Function: H5Location default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location default constructor (protected) +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location() : IdComponent(0) {} //-------------------------------------------------------------------------- -// Function: H5Location overloaded constructor (protected) -// Purpose Creates an H5Location object using the id of an existing HDF5 -// object. -// Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location overloaded constructor (protected) +// Purpose Creates an H5Location object using the id of an existing HDF5 +// object. +// Parameters object_id - IN: Id of an existing HDF5 object +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} @@ -78,30 +78,6 @@ H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} //-------------------------------------------------------------------------- H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {} -//-------------------------------------------------------------------------- -// Function: H5Location constructor -///\brief Dereferences into an HDF5 object, given an HDF5 location. -///\param loc - IN: H5Location instance to copy -///\param ref - IN: Name of the object to be referenced -///\param ref_type - IN: Dataspace with selection -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- - // Dereferences into an HDF5 object, given an HDF5 location. - /* H5Location::H5Location(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) -{ - hid_t temp_id; - try { - temp_id = p_dereference(loc.getId(), ref, ref_type, plist); - } - catch (ReferenceException deref_error) { - throw ReferenceException("H5Location constructor - by dereferenced", - deref_error.getDetailMsg()); - } - setId(temp_id); -} - */ - - #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- @@ -366,7 +342,7 @@ void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& new /// which can be either of these values: /// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file /// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::Exception +///\exception H5::FileIException ///\par Description /// This location is used to identify the file to be flushed. // Programmer Binh-Minh Ribler - 2012 @@ -379,7 +355,7 @@ void H5Location::flush(H5F_scope_t scope) const herr_t ret_value = H5Fflush(getId(), scope); if( ret_value < 0 ) { - throw Exception(inMemFunc("flush"), "H5Fflush failed"); + throw FileIException(inMemFunc("flush"), "H5Fflush failed"); } } @@ -400,147 +376,17 @@ H5std_string H5Location::getFileName() const } } -//-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief Sets or resets the comment for an object specified by its name. -///\param name - IN: Name of the object -///\param comment - IN: New comment -///\exception H5::Exception -///\par Description -/// If \a comment is an empty string or a null pointer, the comment -/// message is removed from the object. -/// Comments should be relatively short, null-terminated, ASCII -/// strings. They can be attached to any object that has an -/// object header, e.g., data sets, groups, named data types, -/// and data spaces, but not symbolic links. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -// Modification -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void H5Location::setComment(const char* name, const char* comment) const -{ - herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT); - if( ret_value < 0 ) - throw Exception("setComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name and \a comment. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -//-------------------------------------------------------------------------- -void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const -{ - setComment(name.c_str(), comment.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::removeComment -///\brief Removes the comment from an object specified by its name. -///\param name - IN: Name of the object -///\exception H5::Exception -// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void H5Location::removeComment(const char* name) const -{ - herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT); - if( ret_value < 0 ) - throw Exception("removeComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::removeComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) -//-------------------------------------------------------------------------- -void H5Location::removeComment(const H5std_string& name) const -{ - removeComment (name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getComment -///\brief Retrieves comment for the specified object and its comment's -/// length. -///\param name - IN: Name of the object -///\param bufsize - IN: Length of the comment to retrieve -///\return Comment string -///\exception H5::Exception -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -H5std_string H5Location::getComment(const char* name, size_t bufsize) const -{ - // bufsize is default to 256 - // temporary variable - hid_t loc_id = getId(); // temporary variable - - // temporary C-string for the object's comment; bufsize already including - // null character - char* comment_C = new char[bufsize]; - ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); - - // if the actual length of the comment is longer than bufsize and bufsize - // was the default value, i.e., not given by the user, then call - // H5Oget_comment_by_name again with the correct value. - // If the call to H5Oget_comment_by_name returned an error, skip this block - // and throw an exception below. - if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) - { - size_t new_size = ret_value; - delete []comment_C; - comment_C = new char[new_size]; // new_size including null terminator - ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); - } - - // if H5Oget_comment_by_name returns SUCCEED, return the string comment, - // otherwise, throw an exception - if (ret_value < 0) { - delete []comment_C; - throw Exception("getComment", "H5Oget_comment_by_name failed"); - } - - H5std_string comment = H5std_string(comment_C); - delete []comment_C; - return (comment); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -//-------------------------------------------------------------------------- -H5std_string H5Location::getComment(const H5std_string& name, size_t bufsize) const -{ - return(getComment(name.c_str(), bufsize)); -} #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. +// Function: H5Location::p_reference (protected) +// Purpose Creates a reference to an HDF5 object or a dataset region. // Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 +// name - IN: Name of the object to be referenced +// dataspace - IN: Dataspace with selection +// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION +// Exception H5::IdComponentException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const { @@ -554,18 +400,17 @@ void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_ty #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: +// Function: H5Location::reference +///\brief Creates a reference to an HDF5 object or a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: /// \li \c H5R_OBJECT - Reference is an object reference. /// \li \c H5R_DATASET_REGION - Reference is a dataset region /// reference. - this is the default -///\exception H5::ReferenceException -///\notes This method is more suitable for a dataset region reference. -// Programmer Binh-Minh Ribler - May, 2004 +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const { @@ -578,49 +423,23 @@ void H5Location::reference(void* ref, const char* name, const DataSpace& dataspa } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference. - this is the default -///\exception H5::ReferenceException -///\notes This method is more suitable for a dataset region reference. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const -{ - try { - p_reference(ref, name.c_str(), dataspace.getId(), ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Location::reference", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it does not take -/// a DataSpace object and the reference type must be specified. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -///\exception H5::ReferenceException -///\notes This method is more suitable for an object reference. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it only creates +/// a reference to an HDF5 object, not to a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c char pointer +///\exception H5::ReferenceException +///\par Description +// This function passes H5R_OBJECT and -1 to the protected +// function for it to pass to the C API H5Rcreate +// to create a reference to the named object. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const +void H5Location::reference(void* ref, const char* name) const { try { - p_reference(ref, name, -1, ref_type); + p_reference(ref, name, -1, H5R_OBJECT); } catch (ReferenceException E) { throw ReferenceException("H5Location::reference", E.getDetailMsg()); @@ -628,21 +447,17 @@ void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) con } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -///\notes This method is more suitable for an object reference. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for the object's name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c H5std_string +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const +void H5Location::reference(void* ref, const H5std_string& name) const { - reference(ref, name.c_str(), ref_type); + reference(ref, name.c_str()); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -660,16 +475,10 @@ void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_t // May 2008 - BMR // Moved from IdComponent. //-------------------------------------------------------------------------- -hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist) +hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type) { - hid_t plist_id; - if (p_valid_id(plist.getId())) - plist_id = plist.getId(); - else - plist_id = H5P_DEFAULT; - hid_t temp_id; - temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref); + temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref); if (temp_id < 0) { throw ReferenceException("", "H5Rdereference failed"); @@ -687,16 +496,16 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) +void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type) { hid_t temp_id; try { - temp_id = p_dereference(loc.getId(), ref, ref_type, plist); + temp_id = p_dereference(obj.getId(), ref, ref_type); } catch (ReferenceException E) { throw ReferenceException("H5Location::dereference - located by object", E.getDetailMsg()); @@ -706,21 +515,45 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t //-------------------------------------------------------------------------- // Function: H5Location::dereference +///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. +///\param h5file - IN: HDF5 file specifying the location of the referenced object +///\param ref - IN: Reference pointer +///\param ref_type - IN: Reference type +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - Oct, 2006 +// Modification +// May, 2008 +// Corrected missing parameters. - BMR +//-------------------------------------------------------------------------- +void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) +{ + hid_t temp_id; + try { + temp_id = p_dereference(h5file.getId(), ref, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException("H5Location::dereference - located by file", E.getDetailMsg()); + } + p_setId(temp_id); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::dereference ///\brief Dereferences a reference into an HDF5 object, given an attribute. ///\param attr - IN: Attribute specifying the location of the referenced object ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) +void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) { hid_t temp_id; try { - temp_id = p_dereference(attr.getId(), ref, ref_type, plist); + temp_id = p_dereference(attr.getId(), ref, ref_type); } catch (ReferenceException E) { throw ReferenceException("H5Location::dereference - located by attribute", E.getDetailMsg()); @@ -760,20 +593,20 @@ H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_UNKNOWN \tFailure occurs (-1) -// H5G_GROUP \tObject is a group. -// H5G_DATASET \tObject is a dataset. -// H5G_TYPE Object \tis a named datatype. -// H5G_LINK \tObject is a symbolic link. -// H5G_UDLINK \tObject is a user-defined link. -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5G_UNKNOWN \tFailure occurs (-1) +// H5G_GROUP \tObject is a group. +// H5G_DATASET \tObject is a dataset. +// H5G_TYPE Object \tis a named datatype. +// H5G_LINK \tObject is a symbolic link. +// H5G_UDLINK \tObject is a user-defined link. +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const { @@ -789,20 +622,20 @@ H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- -// Function: H5Location::getRefObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\return An object type, which can be one of the following: -/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) -/// \li \c H5O_TYPE_GROUP - Object is a group -/// \li \c H5O_TYPE_DATASET - Object is a dataset -/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype -/// \li \c H5O_TYPE_NTYPES - Number of different object types -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRefObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref - IN: Reference to query +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. +///\return An object type, which can be one of the following: +/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) +/// \li \c H5O_TYPE_GROUP - Object is a group +/// \li \c H5O_TYPE_DATASET - Object is a dataset +/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +/// \li \c H5O_TYPE_NTYPES - Number of different object types +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const { @@ -816,19 +649,19 @@ H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_ref_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_ref_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: // H5O_TYPE_UNKNOWN - Unknown object type (-1) // H5O_TYPE_GROUP - Object is a group // H5O_TYPE_DATASET - Object is a dataset // H5O_TYPE_NAMED_DATATYPE - Object is a named datatype // H5O_TYPE_NTYPES - Number of object types -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const { @@ -844,29 +677,24 @@ H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const //-------------------------------------------------------------------------- -// Function: H5Location::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -///\return DataSpace object -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::p_get_region (protected) +// Purpose Retrieves a dataspace with the region pointed to selected. +// Parameters +// ref_type - IN: Type of reference to get region of - default +// to H5R_DATASET_REGION +// ref - IN: Reference to get region of +// Return Dataspace id +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const +hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const { hid_t space_id = H5Rget_region(getId(), ref_type, ref); if (space_id < 0) { throw ReferenceException("", "H5Rget_region failed"); } - try { - DataSpace dataspace(space_id); - return(dataspace); - } - catch (DataSpaceIException E) { - throw ReferenceException("H5Location::getRegion", E.getDetailMsg()); - } + return(space_id); } diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 996cc21..1f54439 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -36,12 +36,12 @@ typedef void (*attr_operator_t)( H5Location& loc/*in*/, class UserData4Aiterate { // user data for attribute iteration public: - attr_operator_t op; - void* opData; - H5Location* location; + attr_operator_t op; + void* opData; + H5Location* location; }; -// An H5Location can be a file, group, dataset, or committed datatype. +// An H5Location can be a file, group, dataset, named datatype, or attribute. class H5_DLLCPP H5Location : public IdComponent { public: @@ -85,47 +85,29 @@ class H5_DLLCPP H5Location : public IdComponent { bool attrExists(const char* name) const; bool attrExists(const H5std_string& name) const; - // Renames the named attribute to a new name. - void renameAttr(const char* oldname, const char* newname) const; - void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; - // Removes the named attribute from this location. void removeAttr(const char* name) const; void removeAttr(const H5std_string& name) const; - // Sets the comment for an HDF5 object specified by its name. - void setComment(const char* name, const char* comment) const; - void setComment(const H5std_string& name, const H5std_string& comment) const; - - // Retrieves comment for the HDF5 object specified by its name. - H5std_string getComment(const char* name, size_t bufsize=256) const; - H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; - - // Removes the comment for the HDF5 object specified by its name. - void removeComment(const char* name) const; - void removeComment(const H5std_string& name) const; + // Renames the named attribute to a new name. + void renameAttr(const char* oldname, const char* newname) const; + void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; // Creates a reference to a named object or to a dataset region // in this object. - void reference(void* ref, const char* name, - H5R_type_t ref_type = H5R_OBJECT) const; - void reference(void* ref, const H5std_string& name, - H5R_type_t ref_type = H5R_DATASET_REGION) const; void reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const H5std_string& name, const DataSpace& dataspace, - H5R_type_t ref_type = H5R_DATASET_REGION) const; + void reference(void* ref, const char* name) const; + void reference(void* ref, const H5std_string& name) const; // Open a referenced object whose location is specified by either // a file, an HDF5 object, or an attribute. - void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - - ///\brief Returns an identifier. (pure virtual) - virtual hid_t getId() const = 0; + ///\brief Returns an identifier. (pure virtual) + virtual hid_t getId() const = 0; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -142,7 +124,7 @@ class H5_DLLCPP H5Location : public IdComponent { void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; // Dereferences a ref into an HDF5 id. - hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist); + hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type); #ifndef H5_NO_DEPRECATED_SYMBOLS // Retrieves the type of object that an object reference points to. @@ -152,6 +134,9 @@ class H5_DLLCPP H5Location : public IdComponent { // Retrieves the type of object that an object reference points to. H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; + // Retrieves a dataspace with the region pointed to selected. + hid_t p_get_region(void *ref, H5R_type_t ref_type) const; + // Noop destructor. virtual ~H5Location(); diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 1d96f2e..b596092 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -52,6 +52,7 @@ H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {} + //-------------------------------------------------------------------------- // Function: H5Object copy constructor ///\brief Copy constructor: makes a copy of the original H5Object diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index e070406..c14d74f 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -39,7 +39,7 @@ namespace H5 { //-------------------------------------------------------------------------- ///\brief Constant for default property. //-------------------------------------------------------------------------- -const PropList PropList::DEFAULT; +const PropList PropList::DEFAULT( H5P_DEFAULT ); //-------------------------------------------------------------------------- // Function Default constructor @@ -644,9 +644,6 @@ void PropList::removeProp(const H5std_string& name) const //-------------------------------------------------------------------------- bool PropList::operator==(const PropList& rhs) const { - fprintf(stderr, "operator==\n"); -H5Eprint2(H5E_DEFAULT, stderr); - htri_t ret_value = H5Pequal(id, rhs.getId()); if( ret_value > 0 ) return true; diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 6acf8a9..ce18e58 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -27,6 +27,13 @@ #endif #include +#ifndef H5_NO_NAMESPACE +#ifndef H5_NO_STD + using std::cerr; + using std::endl; +#endif // H5_NO_STD +#endif + #include "H5Cpp.h" // C++ API header file #ifndef H5_NO_NAMESPACE @@ -37,10 +44,11 @@ const H5std_string FILE1("trefer1.h5"); const H5std_string FILE2("trefer2.h5"); +const H5std_string FILE3("trefer3.h5"); +const H5std_string DSET_DEFAULT_NAME("default"); // Dataset 1 const H5std_string DSET1_NAME("Dataset1"); -const H5std_string DSET2_NAME("Dataset2"); const int DSET1_LEN = 8; const H5std_string MEMBER1( "a_name" ); @@ -48,15 +56,15 @@ const H5std_string MEMBER2( "b_name" ); const H5std_string MEMBER3( "c_name" ); // 1-D dataset with fixed dimensions +const H5std_string SPACE1_NAME("Space1"); const int SPACE1_RANK = 1; const int SPACE1_DIM1 = 4; -/* Larger 1-D dataset with fixed dimensions */ -const int SPACE3_RANK = 1; -const int SPACE3_DIM1 = 100; +// 2-D dataset with fixed dimensions +const H5std_string SPACE2_NAME("Space2"); -/* Element selection information */ -const int POINT1_NPOINTS = 10; +// Larger 1-D dataset with fixed dimensions +const H5std_string SPACE3_NAME("Space3"); // Compound datatype typedef struct s1_t { @@ -67,122 +75,8 @@ typedef struct s1_t { /**************************************************************** ** -** test_reference_params(): Test basic H5R (reference) parameters -** for correct processing -** -****************************************************************/ -static void -test_reference_params(void) -{ - const char *write_comment = "Foo!"; /* Comments for group */ - - // Output message about test being performed - SUBTEST("Object Reference Parameters"); - - H5File* file1 = NULL; - try { - hobj_ref_t *wbuf, // buffer to write to disk - *rbuf, // buffer read from disk - *tbuf; // temp. buffer read from disk - - // Allocate write & read buffers - int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t)); - wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); - rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); - tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); - - // Create file FILE1 - file1 = new H5File (FILE1, H5F_ACC_TRUNC); - - // Create dataspace for datasets - hsize_t dims1[] = {SPACE1_DIM1}; - DataSpace sid1(SPACE1_RANK, dims1); - - // Create a group - Group group = file1->createGroup("Group1"); - - // Set group's comment - group.setComment(".", write_comment); - - // Create a dataset (inside /Group1) - DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); - - unsigned *tu32; // Temporary pointer to uint32 data - int i; - for (tu32=(unsigned *)wbuf, i=0; icreateDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); - - /* Test parameters to H5Location::reference */ - try { - file1->reference(NULL, "/Group1/Dataset1"); - } catch (ReferenceException E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], NULL); - } catch (ReferenceException E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], ""); - } catch (ReferenceException E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE); - } catch (ReferenceException E) {} // We expect this to fail - try { - file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION); - } catch (ReferenceException E) {} // We expect this to fail - - // Close resources - dataset.close(); - file1->close(); - // Let sid1 go out of scope - - // Free memory buffers - HDfree(wbuf); - HDfree(rbuf); - HDfree(tbuf); - - PASSED(); - } // end try - catch (Exception E) { - issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCDetailMsg()); - } - - if(file1) - delete file1; -} /* test_reference_param() */ - -/**************************************************************** -** -** test_reference_obj(): Test basic object reference functions -** to various kinds of objects +** test_reference_obj(): Test basic object reference functionality. +** Tests references to various kinds of objects ** ****************************************************************/ static void test_reference_obj(void) @@ -427,412 +321,6 @@ static void test_reference_obj(void) delete file1; } // test_reference_obj() - -/**************************************************************** -** -** test_reference_group(): Test object reference functionality -** Tests for correct behavior of various routines on -** dereferenced group -** -****************************************************************/ -#define GROUPNAME "/group" -#define GROUPNAME2 "group2" -#define GROUPNAME3 "group3" -#define DSETNAME "/dset" -#define DSETNAME2 "dset2" -#define NAME_SIZE 16 - -static void -test_reference_group(void) -{ - hobj_ref_t wref; /* Reference to write */ - hobj_ref_t rref; /* Reference to read */ - int i; // counting variables - const H5std_string write_comment="Foo!"; // Comments for group - - // Output message about test being performed - SUBTEST("Object Reference to Group"); - - H5File* file1 = NULL; - try { - // Create file with a group and a dataset containing an object reference to the group - - // Create file FILE1 - file1 = new H5File (FILE1, H5F_ACC_TRUNC); - - // Create scalar dataspace - DataSpace sid1; - - // Create a group - Group group = file1->createGroup(GROUPNAME); - - /* Create nested groups */ - Group group2 = group.createGroup(GROUPNAME2); - group2.close(); - group2 = group.createGroup(GROUPNAME3); - group2.close(); - - // Create bottom dataset - DataSet dset1 = group.createDataSet(DSETNAME2, PredType::NATIVE_INT, sid1); - dset1.close(); - - // Close group 1 - group.close(); - - // Create dataset - DataSet dset2 = file1->createDataSet(DSETNAME, PredType::STD_REF_OBJ, sid1); - - file1->reference(&wref, GROUPNAME); - - // Write selection to disk - dset2.write(&wref, PredType::STD_REF_OBJ); - - // Close resources - dset2.close(); - sid1.close(); - file1->close(); - - /* - * Re-open the file and test deferencing group - */ - - // Re-open file - file1->openFile(FILE1, H5F_ACC_RDWR); - - // Re-open dataset - dset1 = file1->openDataSet(DSETNAME); - - // Read in the reference - dset1.read(&rref, PredType::STD_REF_OBJ); - - // Dereference to get the group - Group refgroup(dset1, &rref); - - // Dereference group object the other way - group.dereference(dset1, &rref); - - /* - * Various queries on the group opened - */ - - // Check number of objects in the group dereferenced by constructor - hsize_t nobjs = refgroup.getNumObjs(); - verify_val(nobjs, 3, "H5Group::getNumObjs", __LINE__, __FILE__); - - // Check number of objects in the group dereferenced by ::reference - nobjs = group.getNumObjs(); - verify_val(nobjs, 3, "H5Group::getNumObjs", __LINE__, __FILE__); - - // Check getting file name given the group dereferenced via constructor - H5std_string fname = refgroup.getFileName(); - verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__); - - // Check getting file name given the group dereferenced by ::reference - fname = group.getFileName(); - verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__); - - // Unlink one of the objects in the dereferenced group, and re-check - refgroup.unlink(GROUPNAME2); - nobjs = refgroup.getNumObjs(); - verify_val(nobjs, 2, "H5Group::getNumObjs", __LINE__, __FILE__); - - // Close resources - group.close(); - refgroup.close(); - dset1.close(); - file1->close(); - - PASSED(); - } // end try - catch (Exception E) { - issue_fail_msg("test_reference_group()", __LINE__, __FILE__, E.getCDetailMsg()); - } - - if(file1) - delete file1; -} /* test_reference_group() */ - -/**************************************************************** -** -** test_reference_region_1D(): Test 1-D reference functionality -** Tests 1-D references to various kinds of objects -** -****************************************************************/ -static void -test_reference_region_1D(void) -{ - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ - dset3; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ - sid3; /* Dataspace ID #3 */ - hid_t dapl_id; /* Dataset access property list */ - hsize_t dims1[] = {SPACE1_DIM1}, - dims3[] = {SPACE3_DIM1}; - hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ - hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ - hsize_t * coords; /* Coordinate buffer */ - hsize_t low[SPACE3_RANK]; /* Selection bounds */ - hsize_t high[SPACE3_RANK]; /* Selection bounds */ - uint8_t *tu8; /* Temporary pointer to uint8 data */ - H5O_type_t obj_type; /* Object type */ - int i; /* counting variables */ - herr_t ret; /* Generic return value */ - - // Output message about test being performed - SUBTEST("1-D Dataset Region Reference Functions"); - - try { - hdset_reg_ref_t *wbuf, // buffer to write to disk - *rbuf, // buffer read from disk - *tbuf; // temp. buffer read from disk - uint8_t *dwbuf, // Buffer for writing numeric data to disk - *drbuf; // Buffer for reading numeric data from disk - - // Allocate write & read buffers - wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); - rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); - dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); - drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); - - // Create file FILE1 - H5File file1(FILE2, H5F_ACC_TRUNC); - - // Create dataspace for datasets - hsize_t dims3[] = {SPACE3_DIM1}; - DataSpace sid3(SPACE3_RANK, dims3); - - // Create dataset access property list - PropList dapl(H5P_DATASET_ACCESS); - - // Create a dataset - DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3); - - uint8_t *tu8; // Temporary pointer to uint8 data - for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) - *tu8++ = i * 3; // from C test - - // Write selection to disk - dset3.write(dwbuf, PredType::STD_U8LE); - - // Close Dataset - dset3.close(); - - // Create dataspace for datasets - hsize_t dims1[] = {SPACE1_DIM1}; - DataSpace sid1(SPACE1_RANK, dims1); - - // Create a dataset (inside /Group1) - DataSet dset1 = file1.createDataSet(DSET1_NAME, PredType::STD_REF_DSETREG, sid1); - - /* Create references */ - - /* Select 15 2x1 hyperslabs for first reference */ - start[0] = 2; - stride[0] = 5; - count[0] = 15; - block[0] = 2; - - // Select a hyperslab region to add to the current selected region - sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); - - // Get and verify the number of elements in a dataspace selection - hssize_t nelms = sid3.getSelectNpoints(); - verify_val(nelms, 30, "DataSet::getRefObjType", __LINE__, __FILE__); - - // Store first dataset region - file1.reference(&wbuf[0], "/Dataset2", sid3); - - // Get and verify object type - H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION); - verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); - - /* Select sequence of ten points for second reference */ - coord1[0][0] = 16; - coord1[1][0] = 22; - coord1[2][0] = 38; - coord1[3][0] = 41; - coord1[4][0] = 52; - coord1[5][0] = 63; - coord1[6][0] = 70; - coord1[7][0] = 89; - coord1[8][0] = 97; - coord1[9][0] = 3; - - // Selects array elements to be included in the selection for sid3 - sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1); - - // Get and verify the number of elements in a dataspace selection - nelms = sid3.getSelectNpoints(); - verify_val(nelms, 10, "DataSet::getRefObjType", __LINE__, __FILE__); - - // Store first dataset region - file1.reference(&wbuf[1], "/Dataset2", sid3); - - // Write selection to disk - dset1.write(wbuf, PredType::STD_REF_DSETREG); - - // Close disk dataspace, dataset, and file - sid1.close(); - dset1.close(); - sid3.close(); - file1.close(); - - // Re-open the file - file1.openFile(FILE2, H5F_ACC_RDWR); - - // Open the dataset - dset1 = file1.openDataSet("/Dataset1"); - - // Read selection from disk - dset1.read(rbuf, PredType::STD_REF_DSETREG); - - // Dereference dataset object by ctor, from the location where - // 'dset1' is located - dset3.dereference(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); - - /* DataSet adset3(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); - */ - - // Get and verify object type - obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION); - verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); - - // Check information in the referenced dataset, i.e., adset3 - - // Get dataspace of adset3 the verify number of elements - sid1 = dset3.getSpace(); - nelms = sid1.getSimpleExtentNpoints(); - verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - - // Read from disk - dset3.read(drbuf, PredType::STD_U8LE); - - for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++) - verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - - // Get the referenced region and verify values - - // Get region - DataSpace reg_sp = dset1.getRegion(&rbuf[0]); - - // Get and verify number of elements in a dataspace selection - nelms = reg_sp.getSelectNpoints(); - verify_val((long)nelms, 30, "DataSpace::getSelectNpoints", __LINE__, __FILE__); - - // Get and verify number of hyperslab blocks - nelms = reg_sp.getSelectHyperNblocks(); - verify_val((long)nelms, 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__); - - /* Allocate space for the hyperslab blocks */ - coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2); - - // Get the list of hyperslab blocks currently selected - reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords); - - // Verify values in the list - verify_val(coords[0], 2, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[1], 3, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[2], 7, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[3], 8, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[4], 12, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[5], 13, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[6], 17, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[7], 18, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[8], 22, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[9], 23, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[10], 27, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[11], 28, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[12], 32, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[13], 33, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[14], 37, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[15], 38, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[16], 42, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[17], 43, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[18], 47, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[19], 48, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[20], 52, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[21], 53, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[22], 57, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[23], 58, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[24], 62, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[25], 63, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[26], 67, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[27], 68, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[28], 72, "Hyperslab Coordinates", __LINE__, __FILE__); - verify_val(coords[29], 73, "Hyperslab Coordinates", __LINE__, __FILE__); - - HDfree(coords); - - // Check boundaries - reg_sp.getSelectBounds(low, high); - verify_val(low[0], 2, "DataSpace::getSelectBounds", __LINE__, __FILE__); - verify_val(high[0], 73, "DataSpace::getSelectBounds", __LINE__, __FILE__); - - /* Close region space */ - reg_sp.close(); - - // Get the referenced region and verify values - - // Get region - DataSpace elm_sp = dset1.getRegion(&rbuf[1]); - - // Get and verify number of element points in the current selection - hssize_t nelmspts = elm_sp.getSelectElemNpoints(); - verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__); - - /* Allocate space for the hyperslab blocks */ - coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)); - - // Get the list of element points currently selected - elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords); - - // Verify points - verify_val(coords[0], coord1[0][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[1], coord1[1][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[2], coord1[2][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[3], coord1[3][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[4], coord1[4][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[5], coord1[5][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[6], coord1[6][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[7], coord1[7][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[8], coord1[8][0], "Element Coordinates", __LINE__, __FILE__); - verify_val(coords[9], coord1[9][0], "Element Coordinates", __LINE__, __FILE__); - - HDfree(coords); - - // Check boundaries - elm_sp.getSelectBounds(low, high); - verify_val(low[0], 3, "DataSpace::getSelectBounds", __LINE__, __FILE__); - verify_val(high[0], 97, "DataSpace::getSelectBounds", __LINE__, __FILE__); - - // Close element space - elm_sp.close(); - - // Close resources - sid1.close(); - dset3.close(); - dset1.close(); - file1.close(); - - // Free memory buffers - HDfree(wbuf); - HDfree(rbuf); - HDfree(dwbuf); - HDfree(drbuf); - - PASSED(); - } // end try - catch (Exception E) { - issue_fail_msg("test_reference_region_1D()", __LINE__, __FILE__, E.getCDetailMsg()); - } - -} /* test_reference_region_1D() */ - - /**************************************************************** ** ** test_reference_compat(): Test basic object reference functionality. @@ -858,10 +346,7 @@ void test_reference(void) // Output message about test being performed MESSAGE(5, ("Testing References\n")); - test_reference_params(); // Test basic parameters of reference functionality test_reference_obj(); // Test basic object reference functionality - test_reference_group(); // Test group reference functionality - test_reference_region_1D(); // Test 1-D reference functionality test_reference_compat(); // Tests deprecated reference routines (not yet) } // test_reference() @@ -878,6 +363,5 @@ extern "C" void cleanup_reference(void) { HDremove(FILE1.c_str()); - HDremove(FILE2.c_str()); } -- cgit v0.12 From 5b4202c4725972fb87d7e7160b45c01b26d9736b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 20 Sep 2013 15:34:36 -0500 Subject: [svn-r24179] HDFFV-8321:Add note about changing FFLAGS to FCFLAGS in configure. --- release_docs/RELEASE.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cd694a6..51b4ce9 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -45,6 +45,7 @@ New Features configure option is --with-default-plugin=location cmake option is -DH5_DEFAULT_PLUGINDIR:PATH=location HDFFV-8513. (ADB 2013/09/04) + - Rename FFLAGS to FCFLAGS in configure (ADB 2013/08/13) - CMake minimum is now 2.8.10. (ADB 2013/01/14) - A new tool, cmakehdf5, which is a build command script similar to buildhdf5 is added and is available in the bin directory. -- cgit v0.12 From f9a758f442bcbf7f09ef5b1699dd6e187f059ee2 Mon Sep 17 00:00:00 2001 From: HDF Tester Date: Sun, 22 Sep 2013 04:17:20 -0500 Subject: [svn-r24186] Snapshot version 1.9 release 164 --- README.txt | 2 +- c++/src/Makefile.in | 2 +- config/lt_vers.am | 2 +- configure | 22 +++++++++++----------- configure.ac | 2 +- fortran/src/Makefile.in | 2 +- hl/c++/src/Makefile.in | 2 +- hl/fortran/src/Makefile.in | 2 +- hl/src/Makefile.in | 2 +- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- src/Makefile.in | 2 +- vms/src/h5pubconf.h | 6 +++--- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/README.txt b/README.txt index 986a09e..1e823fd 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.164 currently under development +HDF5 version 1.9.165 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index f601487..ec28e82 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -467,7 +467,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 # Include src directory diff --git a/config/lt_vers.am b/config/lt_vers.am index 8d9927b..0f47d62 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index 1628989..492a3cd 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.164. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.165. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.164' -PACKAGE_STRING='HDF5 1.9.164' +PACKAGE_VERSION='1.9.165' +PACKAGE_STRING='HDF5 1.9.165' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1489,7 +1489,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.164 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.165 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1559,7 +1559,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.164:";; + short | recursive ) echo "Configuration of HDF5 1.9.165:";; esac cat <<\_ACEOF @@ -1758,7 +1758,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.164 +HDF5 configure 1.9.165 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2852,7 +2852,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.164, which was +It was created by HDF5 $as_me 1.9.165, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3684,7 +3684,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.164' + VERSION='1.9.165' cat >>confdefs.h <<_ACEOF @@ -31659,7 +31659,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.164 +HDF5 config.lt 1.9.165 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -33793,7 +33793,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.164, which was +This file was extended by HDF5 $as_me 1.9.165, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33859,7 +33859,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.164 +HDF5 config.status 1.9.165 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 9eee22d..4675a90 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.164], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.165], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index e826a35..0b68688 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -518,7 +518,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 102fe39..65a1a5f 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -458,7 +458,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index c69b952..514335b 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -474,7 +474,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 27b278e..ca9b17f 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -457,7 +457,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 # This library is our main target. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 51b4ce9..cb70793 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.164 currently under development +HDF5 version 1.9.165 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index 3d77ed7..2db01e6 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 164 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 165 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.164" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.165" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index b31a9ae..b830acc 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -519,7 +519,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 154 +LT_VERS_REVISION = 155 LT_VERS_AGE = 0 # Our main target, the HDF5 library diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 471b2ed..3b56fc4 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -511,7 +511,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.164" +#define H5_PACKAGE_STRING "HDF5 1.9.165" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -520,7 +520,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.164" +#define H5_PACKAGE_VERSION "1.9.165" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -683,7 +683,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.164" +#define H5_VERSION "1.9.165" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12 From f8fb310610ca222ca44fabf4311e3af24d660b9d Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sun, 22 Sep 2013 19:39:44 -0500 Subject: [svn-r24188] Purpose: Fixed bug introduced in r24163 Description: - The failure in daily test was caused by missing initialization of member "id" in a few constructors. This is now fixed. - Added two overloaded H5Location::setComment - Improved some error reporting in H5Location - Improved error reporting in tests Platforms tested: Linux/32 2.6 (jam) SunOS 5.11 (emu) Linux/64 2.6 (koala)/PGI compilers --- c++/src/H5Attribute.cpp | 1 + c++/src/H5CommonFG.cpp | 131 --------- c++/src/H5CommonFG.h | 12 - c++/src/H5DataSet.cpp | 52 +--- c++/src/H5DataSet.h | 8 +- c++/src/H5DataSpace.cpp | 2 +- c++/src/H5DataType.cpp | 59 ++-- c++/src/H5DataType.h | 8 +- c++/src/H5File.cpp | 4 +- c++/src/H5File.h | 3 - c++/src/H5Group.cpp | 37 +-- c++/src/H5Group.h | 10 +- c++/src/H5IdComponent.cpp | 7 +- c++/src/H5Location.cpp | 459 +++++++++++++++++++++---------- c++/src/H5Location.h | 53 ++-- c++/src/H5Object.cpp | 1 - c++/src/H5PropList.cpp | 5 +- c++/test/dsets.cpp | 2 +- c++/test/h5cpputil.cpp | 24 ++ c++/test/h5cpputil.h | 2 + c++/test/trefer.cpp | 676 ++++++++++++++++++++++++++++++++++++++-------- 21 files changed, 996 insertions(+), 560 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index d684b8f..a98a970 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -44,6 +44,7 @@ namespace H5 { #endif // H5_NO_STD #endif +class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate //-------------------------------------------------------------------------- // Function: Attribute default constructor ///\brief Default constructor: Creates a stub attribute diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index d6fe5dc..3bf4b4f 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -460,137 +460,6 @@ H5std_string CommonFG::getLinkval( const H5std_string& name, size_t size ) const } //-------------------------------------------------------------------------- -// Function: CommonFG::setComment -///\brief Sets or resets the comment for an object specified by its name. -///\param name - IN: Name of the object -///\param comment - IN: New comment -///\exception H5::FileIException or H5::GroupIException -///\par Description -/// If \a comment is an empty string or a null pointer, the comment -/// message is removed from the object. -/// Comments should be relatively short, null-terminated, ASCII -/// strings. They can be attached to any object that has an -/// object header, e.g., data sets, groups, named data types, -/// and data spaces, but not symbolic links. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void CommonFG::setComment( const char* name, const char* comment ) const -{ - herr_t ret_value = H5Oset_comment_by_name( getLocId(), name, comment, H5P_DEFAULT ); - if( ret_value < 0 ) - throwException("setComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name and \a comment. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void CommonFG::setComment( const H5std_string& name, const H5std_string& comment ) const -{ - setComment( name.c_str(), comment.c_str() ); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::removeComment -///\brief Removes the comment from an object specified by its name. -///\param name - IN: Name of the object -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - May 2005 -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void CommonFG::removeComment(const char* name) const -{ - herr_t ret_value = H5Oset_comment_by_name(getLocId(), name, NULL, H5P_DEFAULT); - if( ret_value < 0 ) - throwException("removeComment", "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::removeComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - May 2005 -//-------------------------------------------------------------------------- -void CommonFG::removeComment(const H5std_string& name) const -{ - removeComment (name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::getComment -///\brief Retrieves comment for the specified object and its comment's -/// length. -///\param name - IN: Name of the object -///\param bufsize - IN: Length of the comment to retrieve -///\return Comment string -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const -{ - // bufsize is default to 256 - // temporary variable - hid_t loc_id = getLocId(); // temporary variable - - // temporary C-string for the object's comment; bufsize already including - // null character - char* comment_C = new char[bufsize]; - ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); - - // if the actual length of the comment is longer than bufsize and bufsize - // was the default value, i.e., not given by the user, then call - // H5Oget_comment_by_name again with the correct value. - // If the call to H5Oget_comment_by_name returned an error, skip this block - // and throw an exception below. - if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) - { - size_t new_size = ret_value; - delete []comment_C; - comment_C = new char[new_size]; // new_size including null terminator - ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); - } - - // if H5Oget_comment_by_name returns SUCCEED, return the string comment, - // otherwise, throw an exception - if( ret_value < 0 ) { - delete []comment_C; - throwException("getComment", "H5Oget_comment_by_name failed"); - } - - H5std_string comment = H5std_string(comment_C); - delete []comment_C; - return (comment); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::getComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string CommonFG::getComment( const H5std_string& name, size_t bufsize ) const -{ - return( getComment( name.c_str(), bufsize )); -} - -//-------------------------------------------------------------------------- // Function: CommonFG::mount ///\brief Mounts the file \a child onto this group. ///\param name - IN: Name of the group diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 22e193a..b02b05b 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -49,18 +49,6 @@ class H5_DLLCPP CommonFG { DataSet openDataSet(const char* name) const; DataSet openDataSet(const H5std_string& name) const; - // Retrieves comment for the HDF5 object specified by its name. - H5std_string getComment(const char* name, size_t bufsize=256) const; - H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; - - // Removes the comment for the HDF5 object specified by its name. - void removeComment(const char* name) const; - void removeComment(const H5std_string& name) const; - - // Sets the comment for an HDF5 object specified by its name. - void setComment(const char* name, const char* comment) const; - void setComment(const H5std_string& name, const H5std_string& comment) const; - // Returns the value of a symbolic link. H5std_string getLinkval(const char* link_name, size_t size=0) const; H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const; diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 3e3893c..0722ef9 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -79,57 +79,29 @@ DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(origi //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a +///\brief Given a reference, ref, to an hdf5 location, creates a /// DataSet object -///\param obj - IN: Dataset reference object is in or location of +///\param loc - IN: Dataset reference object is in or location of /// object that the dataset is located within. ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type - default to H5R_OBJECT ///\exception H5::DataSetIException ///\par Description -/// \c obj can be DataSet, Group, H5File, or named DataType, that +/// \c loc can be DataSet, Group, H5File, or named DataType, that /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 // Modification // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() +DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object(), id(0) { - try { - id = p_dereference(obj.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by object", - deref_error.getDetailMsg()); - } + id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereferenced"); } //-------------------------------------------------------------------------- // Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a -/// DataSet object -///\param h5file - IN: Location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\exception H5::DataSetIException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// Jul, 2008 -// Added for application convenience. -//-------------------------------------------------------------------------- -DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() -{ - try { - id = p_dereference(h5file.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by HDF5 file", - deref_error.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 dataset, creates a +///\brief Given a reference, ref, to an hdf5 attribute, creates a /// DataSet object ///\param attr - IN: Specifying location where the referenced object is in ///\param ref - IN: Reference pointer @@ -140,14 +112,9 @@ DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : Abstrac // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object() +DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object(), id(0) { - try { - id = p_dereference(attr.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataSet constructor - located by attribute", - deref_error.getDetailMsg()); - } + id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); } //-------------------------------------------------------------------------- @@ -751,9 +718,6 @@ void DataSet::p_setId(const hid_t new_id) } // reset object's id to the given id id = new_id; - - // increment the reference counter of the new id - //incRefCount(); } #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index bc80046..e2fe702 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -76,16 +76,12 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSet"); } // Creates a dataset by way of dereference. - DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // Default constructor. DataSet(); diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 2e2bb35..059c812 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -446,7 +446,7 @@ void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const } //-------------------------------------------------------------------------- -// Function: DataSpace::H5Sselect_elements +// Function: DataSpace::selectElements ///\brief Selects array elements to be included in the selection for /// this dataspace. ///\param op - IN: Operator specifying how the new selection is to be diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 8a62471..be05623 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -49,6 +49,13 @@ namespace H5 { #endif //-------------------------------------------------------------------------- +// Function: DataType default constructor +///\brief Default constructor: Creates a stub datatype +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +DataType::DataType() : H5Object(), id(0) {} + +//-------------------------------------------------------------------------- // Function: DataType overloaded constructor ///\brief Creates a datatype using an existing datatype's id ///\param existing_id - IN: Id of the existing datatype @@ -88,32 +95,6 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() // Function: DataType overload constructor - dereference ///\brief Given a reference, ref, to an hdf5 group, creates a /// DataType object -///\param obj - IN: Specifying location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\exception H5::ReferenceException -///\par Description -/// \c obj can be DataSet, Group, or named DataType, that -/// is a datatype that has been named by DataType::commit. -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// Jul, 2008 -// Added for application convenience. -//-------------------------------------------------------------------------- -DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() -{ - try { - id = p_dereference(obj.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataType constructor - located by an H5Object", - deref_error.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 group, creates a -/// DataType object ///\param h5file - IN: Location referenced object is in ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type - default to H5R_OBJECT @@ -123,14 +104,11 @@ DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Obje // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() +DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { - try { - id = p_dereference(h5file.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataType constructor - located by an H5File", - deref_error.getDetailMsg()); - } + /* H5Location::dereference(loc, ref, ref_type, plist); + */ + id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); } //-------------------------------------------------------------------------- @@ -146,24 +124,19 @@ DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Obj // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() +DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { - try { - id = p_dereference(attr.getId(), ref, ref_type); + id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); + /* try { + id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException deref_error) { throw ReferenceException("DataType constructor - located by an Attribute", deref_error.getDetailMsg()); } + */ } //-------------------------------------------------------------------------- -// Function: DataType default constructor -///\brief Default constructor: Creates a stub datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataType::DataType() : H5Object(), id(0) {} - -//-------------------------------------------------------------------------- // Function: DataType copy constructor ///\brief Copy constructor: makes a copy of the original DataType object. // Programmer Binh-Minh Ribler - 2000 diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 6e56622..e4254b0 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -30,9 +30,8 @@ class H5_DLLCPP DataType : public H5Object { DataType( const DataType& original ); // Creates a datatype by way of dereference. - DataType(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataType(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - DataType(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // Closes this datatype. virtual void close(); @@ -101,9 +100,6 @@ class H5_DLLCPP DataType : public H5Object { // Checks whether this datatype is a variable-length string. bool isVariableStr() const; - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataType"); } diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 65191ae..77dd7be 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -82,7 +82,7 @@ H5File::H5File() : H5Location(), id(0) {} // to catch then re-throw it. -BMR 2013/03/21 // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0) +H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(0) { try { p_get_file(name, flags, create_plist, access_plist); @@ -107,7 +107,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c // to catch then re-throw it. -BMR 2013/03/21 // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0) +H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(0) { try { p_get_file(name.c_str(), flags, create_plist, access_plist); diff --git a/c++/src/H5File.h b/c++/src/H5File.h index f906de6..2abffea 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -61,9 +61,6 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { // and datatypes) in the same file. void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Returns the pointer to the file handle of the low-level file driver. void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; void getVFDHandle(void **file_handle) const; diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index eff7e50..6299ea3 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -99,33 +99,11 @@ Group::Group(const hid_t existing_id) : H5Object() /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object() +Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { - try { - id = p_dereference(obj.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("Group constructor - located by an H5Object", - deref_error.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: Group overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 group, creates a Group object -///\param h5file - IN: Location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -//-------------------------------------------------------------------------- -Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() -{ - try { - id = p_dereference(h5file.getId(), ref, ref_type); - } catch (ReferenceException deref_error) { - throw ReferenceException("Group constructor - located by an H5File", - deref_error.getDetailMsg()); - } + /* H5Location::dereference(loc, ref, ref_type, plist); + */ + id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); } //-------------------------------------------------------------------------- @@ -137,14 +115,17 @@ Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object() ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object() +Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { + id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); +/* try { - id = p_dereference(attr.getId(), ref, ref_type); + id = p_dereference(attr.getId(), ref, ref_type, plist); } catch (ReferenceException deref_error) { throw ReferenceException("Group constructor - located by an Attribute", deref_error.getDetailMsg()); } +*/ } //-------------------------------------------------------------------------- diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 3b53293..4003c21 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -26,9 +26,6 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Close this group. virtual void close(); - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - ///\brief Returns this class name. virtual H5std_string fromClass () const { return("Group"); } @@ -39,9 +36,10 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { virtual hid_t getLocId() const; // Creates a group by way of dereference. - Group(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - Group(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + /* Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + */ + Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // default constructor Group(); diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 4a997ab..c60d05c 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -144,6 +144,8 @@ int IdComponent::getCounter() const //-------------------------------------------------------------------------- H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id) { + if (obj_id == 0) + return H5I_BADID; // invalid H5I_type_t id_type = H5Iget_type(obj_id); if (id_type <= H5I_BADID || id_type >= H5I_NTYPES) return H5I_BADID; // invalid @@ -269,7 +271,7 @@ IdComponent::IdComponent() {} // Description: // This function is protected so that the user applications can // only have access to its code via allowable classes, namely, -// H5File and H5Object subclasses. +// Attribute and H5Location subclasses. // Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string IdComponent::p_get_file_name() const @@ -314,6 +316,9 @@ H5std_string IdComponent::p_get_file_name() const //-------------------------------------------------------------------------- bool IdComponent::p_valid_id(const hid_t obj_id) { + if (obj_id == 0) + return false; + H5I_type_t id_type = H5Iget_type(obj_id); if (id_type <= H5I_BADID || id_type >= H5I_NTYPES) return false; diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index fcf7ff4..22db85c 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -55,17 +55,17 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, } //-------------------------------------------------------------------------- -// Function: H5Location default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location default constructor (protected) +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5Location::H5Location() : IdComponent(0) {} +H5Location::H5Location() : IdComponent() {} //-------------------------------------------------------------------------- -// Function: H5Location overloaded constructor (protected) -// Purpose Creates an H5Location object using the id of an existing HDF5 -// object. -// Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 +// Function: H5Location overloaded constructor (protected) +// Purpose Creates an H5Location object using the id of an existing HDF5 +// object. +// Parameters object_id - IN: Id of an existing HDF5 object +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {} @@ -342,7 +342,7 @@ void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& new /// which can be either of these values: /// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file /// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::FileIException +///\exception H5::Exception ///\par Description /// This location is used to identify the file to be flushed. // Programmer Binh-Minh Ribler - 2012 @@ -355,7 +355,7 @@ void H5Location::flush(H5F_scope_t scope) const herr_t ret_value = H5Fflush(getId(), scope); if( ret_value < 0 ) { - throw FileIException(inMemFunc("flush"), "H5Fflush failed"); + throw Exception(inMemFunc("flush"), "H5Fflush failed"); } } @@ -376,41 +376,199 @@ H5std_string H5Location::getFileName() const } } +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief Sets or resets the comment for an object specified by its name. +///\param name - IN: Name of the object +///\param comment - IN: New comment +///\exception H5::Exception +///\par Description +/// If \a comment is an empty string or a null pointer, the comment +/// message is removed from the object. +/// Comments should be relatively short, null-terminated, ASCII +/// strings. They can be attached to any object that has an +/// object header, e.g., data sets, groups, named data types, +/// and data spaces, but not symbolic links. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// Modification +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void H5Location::setComment(const char* name, const char* comment) const +{ + herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT); + if( ret_value < 0 ) + throw Exception(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name and \a comment. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const +{ + setComment(name.c_str(), comment.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it doesn't take +/// an object name. +// Programmer Binh-Minh Ribler - Sep 2013 +// Modification +//-------------------------------------------------------------------------- +void H5Location::setComment(const char* comment) const +{ + herr_t ret_value = H5Oset_comment_by_name(getId(), ".", comment, H5P_DEFAULT); + if( ret_value < 0 ) + throw Exception(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::setComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a comment. +// Programmer Binh-Minh Ribler - Sep 2013 +//-------------------------------------------------------------------------- +void H5Location::setComment(const H5std_string& comment) const +{ + setComment(comment.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeComment +///\brief Removes the comment from an object specified by its name. +///\param name - IN: Name of the object +///\exception H5::Exception +// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +void H5Location::removeComment(const char* name) const +{ + herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT); + if( ret_value < 0 ) + throw Exception(inMemFunc("removeComment"), "H5Oset_comment_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::removeComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +void H5Location::removeComment(const H5std_string& name) const +{ + removeComment (name.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getComment +///\brief Retrieves comment for the specified object and its comment's +/// length. +///\param name - IN: Name of the object +///\param bufsize - IN: Length of the comment to retrieve +///\return Comment string +///\exception H5::Exception +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +// 2007: QAK modified to use H5O APIs; however the first parameter is +// no longer just file or group, this function should be moved +// to another class to accommodate attribute, dataset, and named +// datatype. - BMR +//-------------------------------------------------------------------------- +H5std_string H5Location::getComment(const char* name, size_t bufsize) const +{ + // bufsize is default to 256 + // temporary variable + hid_t loc_id = getId(); // temporary variable + + // temporary C-string for the object's comment; bufsize already including + // null character + char* comment_C = new char[bufsize]; + ssize_t ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, bufsize, H5P_DEFAULT); + + // if the actual length of the comment is longer than bufsize and bufsize + // was the default value, i.e., not given by the user, then call + // H5Oget_comment_by_name again with the correct value. + // If the call to H5Oget_comment_by_name returned an error, skip this block + // and throw an exception below. + if (ret_value >= 0 && (size_t)ret_value > bufsize && bufsize == 256) + { + size_t new_size = ret_value; + delete []comment_C; + comment_C = new char[new_size]; // new_size including null terminator + ret_value = H5Oget_comment_by_name(loc_id, name, comment_C, new_size, H5P_DEFAULT); + } + + // if H5Oget_comment_by_name returns SUCCEED, return the string comment, + // otherwise, throw an exception + if (ret_value < 0) { + delete []comment_C; + throw Exception(inMemFunc("getComment"), "H5Oget_comment_by_name failed"); + } + + H5std_string comment = H5std_string(comment_C); + delete []comment_C; + return (comment); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getComment +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) +//-------------------------------------------------------------------------- +H5std_string H5Location::getComment(const H5std_string& name, size_t bufsize) const +{ + return(getComment(name.c_str(), bufsize)); +} #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. +// Function: H5Location::p_reference (protected) +// Purpose Creates a reference to an HDF5 object or a dataset region. // Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::IdComponentException -// Programmer Binh-Minh Ribler - May, 2004 +// name - IN: Name of the object to be referenced +// dataspace - IN: Dataspace with selection +// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION +// Exception H5::IdComponentException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const { herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); if (ret_value < 0) { - throw ReferenceException("", "H5Rcreate failed"); + throw ReferenceException(inMemFunc("reference"), "H5Rcreate failed"); } } #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: +// Function: H5Location::reference +///\brief Creates a reference to an HDF5 object or a dataset region. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: /// \li \c H5R_OBJECT - Reference is an object reference. /// \li \c H5R_DATASET_REGION - Reference is a dataset region /// reference. - this is the default -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +///\exception H5::ReferenceException +///\notes This method is more suitable for a dataset region reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const { @@ -418,46 +576,76 @@ void H5Location::reference(void* ref, const char* name, const DataSpace& dataspa p_reference(ref, name, dataspace.getId(), ref_type); } catch (ReferenceException E) { - throw ReferenceException("H5Location::reference", E.getDetailMsg()); + throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); } } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it only creates -/// a reference to an HDF5 object, not to a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c char pointer -///\exception H5::ReferenceException -///\par Description -// This function passes H5R_OBJECT and -1 to the protected -// function for it to pass to the C API H5Rcreate -// to create a reference to the named object. -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for \a name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param dataspace - IN: Dataspace with selection +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +/// reference. - this is the default +///\exception H5::ReferenceException +///\notes This method is more suitable for a dataset region reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const char* name) const +void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const { try { - p_reference(ref, name, -1, H5R_OBJECT); + p_reference(ref, name.c_str(), dataspace.getId(), ref_type); } catch (ReferenceException E) { - throw ReferenceException("H5Location::reference", E.getDetailMsg()); + throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); } } //-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it does not take +/// a DataSpace object and the reference type must be specified. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +///\exception H5::ReferenceException +///\notes This method is more suitable for an object reference. +// Programmer Binh-Minh Ribler - May, 2004 +//-------------------------------------------------------------------------- +void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const +{ + try { + p_reference(ref, name, -1, ref_type); + } + catch (ReferenceException E) { + throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); + } +} + +//-------------------------------------------------------------------------- +// Function: H5Location::reference +///\brief This is an overloaded function, provided for your convenience. +/// It differs from the above function in that it takes an +/// \c H5std_string for the object's name. +///\param ref - IN: Reference pointer +///\param name - IN: Name of the object to be referenced - \c H5std_string +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region +///\notes This method is more suitable for an object reference. +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -void H5Location::reference(void* ref, const H5std_string& name) const +void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const { - reference(ref, name.c_str()); + reference(ref, name.c_str(), ref_type); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -475,16 +663,20 @@ void H5Location::reference(void* ref, const H5std_string& name) const // May 2008 - BMR // Moved from IdComponent. //-------------------------------------------------------------------------- -hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type) +hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func) { - hid_t temp_id; - temp_id = H5Rdereference2(loc_id, H5P_DEFAULT, ref_type, ref); + hid_t plist_id; + if (p_valid_id(plist.getId())) + plist_id = plist.getId(); + else + plist_id = H5P_DEFAULT; + + hid_t temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref); if (temp_id < 0) { - throw ReferenceException("", "H5Rdereference failed"); + throw ReferenceException(inMemFunc(from_func), "H5Rdereference failed"); } - // No failure, set id to the object return(temp_id); } #endif // DOXYGEN_SHOULD_SKIP_THIS @@ -496,45 +688,14 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// May, 2008 -// Corrected missing parameters. - BMR -//-------------------------------------------------------------------------- -void H5Location::dereference(H5Object& obj, const void* ref, H5R_type_t ref_type) -{ - hid_t temp_id; - try { - temp_id = p_dereference(obj.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Location::dereference - located by object", E.getDetailMsg()); - } - p_setId(temp_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::dereference -///\brief Dereferences a reference into an HDF5 object, given an HDF5 file. -///\param h5file - IN: HDF5 file specifying the location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_type) +void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) { - hid_t temp_id; - try { - temp_id = p_dereference(h5file.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Location::dereference - located by file", E.getDetailMsg()); - } - p_setId(temp_id); + p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference")); } //-------------------------------------------------------------------------- @@ -544,21 +705,14 @@ void H5Location::dereference(H5File& h5file, const void* ref, H5R_type_t ref_typ ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 +// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // May, 2008 // Corrected missing parameters. - BMR //-------------------------------------------------------------------------- -void H5Location::dereference(Attribute& attr, const void* ref, H5R_type_t ref_type) +void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) { - hid_t temp_id; - try { - temp_id = p_dereference(attr.getId(), ref, ref_type); - } - catch (ReferenceException E) { - throw ReferenceException("H5Location::dereference - located by attribute", E.getDetailMsg()); - } - p_setId(temp_id); + p_setId(p_dereference(attr.getId(), ref, ref_type, plist, "dereference")); } #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -587,26 +741,26 @@ H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const return(p_get_obj_type(ref, ref_type)); } catch (ReferenceException E) { - throw ReferenceException("H5Location::getObjType", E.getDetailMsg()); + throw ReferenceException(inMemFunc("getObjType"), E.getDetailMsg()); } } #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_UNKNOWN \tFailure occurs (-1) -// H5G_GROUP \tObject is a group. -// H5G_DATASET \tObject is a dataset. -// H5G_TYPE Object \tis a named datatype. -// H5G_LINK \tObject is a symbolic link. -// H5G_UDLINK \tObject is a user-defined link. -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: +// H5G_UNKNOWN \tFailure occurs (-1) +// H5G_GROUP \tObject is a group. +// H5G_DATASET \tObject is a dataset. +// H5G_TYPE Object \tis a named datatype. +// H5G_LINK \tObject is a symbolic link. +// H5G_UDLINK \tObject is a user-defined link. +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const { @@ -614,7 +768,7 @@ H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const if (obj_type == H5G_UNKNOWN) { - throw ReferenceException("", "H5Rget_obj_type1 failed"); + throw ReferenceException(inMemFunc("getObjType"), "H5Rget_obj_type1 failed"); } return(obj_type); } @@ -622,20 +776,20 @@ H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- -// Function: H5Location::getRefObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\return An object type, which can be one of the following: -/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) -/// \li \c H5O_TYPE_GROUP - Object is a group -/// \li \c H5O_TYPE_DATASET - Object is a dataset -/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype -/// \li \c H5O_TYPE_NTYPES - Number of different object types -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRefObjType +///\brief Retrieves the type of object that an object reference points to. +///\param ref - IN: Reference to query +///\param ref_type - IN: Type of reference to query, valid values are: +/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. +///\return An object type, which can be one of the following: +/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) +/// \li \c H5O_TYPE_GROUP - Object is a group +/// \li \c H5O_TYPE_DATASET - Object is a dataset +/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype +/// \li \c H5O_TYPE_NTYPES - Number of different object types +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const { @@ -643,25 +797,25 @@ H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const return(p_get_ref_obj_type(ref, ref_type)); } catch (ReferenceException E) { - throw ReferenceException("H5Location::getRefObjType", E.getDetailMsg()); + throw ReferenceException(inMemFunc("getRefObjType"), E.getDetailMsg()); } } #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::p_get_ref_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. +// Function: H5Location::p_get_ref_obj_type (protected) +// Purpose Retrieves the type of object that an object reference points to. // Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: +// ref - IN: Reference to query +// ref_type - IN: Type of reference to query +// Return An object type, which can be one of the following: // H5O_TYPE_UNKNOWN - Unknown object type (-1) // H5O_TYPE_GROUP - Object is a group // H5O_TYPE_DATASET - Object is a dataset // H5O_TYPE_NAMED_DATATYPE - Object is a named datatype // H5O_TYPE_NTYPES - Number of object types -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const { @@ -670,31 +824,36 @@ H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES) { - throw ReferenceException("", "H5Rget_obj_type2 failed"); + throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 failed"); } return(obj_type); } //-------------------------------------------------------------------------- -// Function: H5Location::p_get_region (protected) -// Purpose Retrieves a dataspace with the region pointed to selected. -// Parameters -// ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -// ref - IN: Reference to get region of -// Return Dataspace id -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 +// Function: H5Location::getRegion +///\brief Retrieves a dataspace with the region pointed to selected. +///\param ref - IN: Reference to get region of +///\param ref_type - IN: Type of reference to get region of - default +// to H5R_DATASET_REGION +///\return DataSpace object +///\exception H5::ReferenceException +// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -hid_t H5Location::p_get_region(void *ref, H5R_type_t ref_type) const +DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const { hid_t space_id = H5Rget_region(getId(), ref_type, ref); if (space_id < 0) { - throw ReferenceException("", "H5Rget_region failed"); + throw ReferenceException(inMemFunc("getRegion"), "H5Rget_region failed"); + } + try { + DataSpace dataspace(space_id); + return(dataspace); + } + catch (DataSpaceIException E) { + throw ReferenceException(inMemFunc("getRegion"), E.getDetailMsg()); } - return(space_id); } diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 1f54439..50278db 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -36,12 +36,12 @@ typedef void (*attr_operator_t)( H5Location& loc/*in*/, class UserData4Aiterate { // user data for attribute iteration public: - attr_operator_t op; - void* opData; - H5Location* location; + attr_operator_t op; + void* opData; + H5Location* location; }; -// An H5Location can be a file, group, dataset, named datatype, or attribute. +// An H5Location can be a file, group, dataset, or committed datatype. class H5_DLLCPP H5Location : public IdComponent { public: @@ -85,29 +85,49 @@ class H5_DLLCPP H5Location : public IdComponent { bool attrExists(const char* name) const; bool attrExists(const H5std_string& name) const; + // Renames the named attribute to a new name. + void renameAttr(const char* oldname, const char* newname) const; + void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + // Removes the named attribute from this location. void removeAttr(const char* name) const; void removeAttr(const H5std_string& name) const; - // Renames the named attribute to a new name. - void renameAttr(const char* oldname, const char* newname) const; - void renameAttr(const H5std_string& oldname, const H5std_string& newname) const; + // Sets the comment for an HDF5 object specified by its name. + void setComment(const char* name, const char* comment) const; + void setComment(const H5std_string& name, const H5std_string& comment) const; + void setComment(const char* comment) const; + void setComment(const H5std_string& comment) const; + + // Retrieves comment for the HDF5 object specified by its name. + H5std_string getComment(const char* name, size_t bufsize=256) const; + H5std_string getComment(const H5std_string& name, size_t bufsize=256) const; + + // Removes the comment for the HDF5 object specified by its name. + void removeComment(const char* name) const; + void removeComment(const H5std_string& name) const; // Creates a reference to a named object or to a dataset region // in this object. + void reference(void* ref, const char* name, + H5R_type_t ref_type = H5R_OBJECT) const; + void reference(void* ref, const H5std_string& name, + H5R_type_t ref_type = H5R_DATASET_REGION) const; void reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; - void reference(void* ref, const char* name) const; - void reference(void* ref, const H5std_string& name) const; + void reference(void* ref, const H5std_string& name, const DataSpace& dataspace, + H5R_type_t ref_type = H5R_DATASET_REGION) const; // Open a referenced object whose location is specified by either // a file, an HDF5 object, or an attribute. - void dereference(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT); - void dereference(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT); + void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); + void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); - ///\brief Returns an identifier. (pure virtual) - virtual hid_t getId() const = 0; + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + + ///\brief Returns an identifier. (pure virtual) + virtual hid_t getId() const = 0; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -124,7 +144,7 @@ class H5_DLLCPP H5Location : public IdComponent { void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; // Dereferences a ref into an HDF5 id. - hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type); + hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func); #ifndef H5_NO_DEPRECATED_SYMBOLS // Retrieves the type of object that an object reference points to. @@ -134,9 +154,6 @@ class H5_DLLCPP H5Location : public IdComponent { // Retrieves the type of object that an object reference points to. H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; - // Retrieves a dataspace with the region pointed to selected. - hid_t p_get_region(void *ref, H5R_type_t ref_type) const; - // Noop destructor. virtual ~H5Location(); diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index b596092..1d96f2e 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -52,7 +52,6 @@ H5Object::H5Object() : H5Location() {} //-------------------------------------------------------------------------- H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {} - //-------------------------------------------------------------------------- // Function: H5Object copy constructor ///\brief Copy constructor: makes a copy of the original H5Object diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index c14d74f..9476d46 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -39,7 +39,7 @@ namespace H5 { //-------------------------------------------------------------------------- ///\brief Constant for default property. //-------------------------------------------------------------------------- -const PropList PropList::DEFAULT( H5P_DEFAULT ); +const PropList PropList::DEFAULT; //-------------------------------------------------------------------------- // Function Default constructor @@ -74,6 +74,9 @@ PropList::PropList(const PropList& original) : IdComponent(original) //-------------------------------------------------------------------------- PropList::PropList( const hid_t plist_id ) : IdComponent() { + if (plist_id == 0) + id = H5P_DEFAULT; + H5I_type_t id_type = H5Iget_type(plist_id); switch (id_type) { case H5I_GENPROP_CLS: diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 58436f1..811d8c7 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1058,7 +1058,7 @@ void test_dset() // Cause the library to emit initial messages Group grp = file.createGroup( "emit diagnostics", 0); - grp.setComment( ".", "Causes diagnostic messages to be emitted"); + grp.setComment("Causes diagnostic messages to be emitted"); nerrors += test_create(file)<0 ?1:0; nerrors += test_simple_io(file)<0 ?1:0; diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index c6a7a2a..cd85b6e 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -107,6 +107,30 @@ void issue_fail_msg(const char* where, int line, const char* file_name, } /*------------------------------------------------------------------------- + * Function: issue_fail_msg + * + * Purpose: Displays that a function has failed with its location. + * + * Return: None + * + * Programmer: Binh-Minh Ribler (copied and modified macro CHECK from C) + * Monday, December 20, 2004 + * + *------------------------------------------------------------------------- + */ +void issue_fail_msg(const char* where, int line, const char* file_name, + const char* func_name, const char* message) +{ + //if (GetTestVerbosity()>=VERBO_HI) + { + cerr << endl; + cerr << ">>> FAILED in " << where << ": " << func_name << endl << + " at line " << line << " in " << file_name << endl << + " C library detail: " << message << endl << endl; + } +} + +/*------------------------------------------------------------------------- * Function: check_values * * Purpose: Checks a read value against the written value. If they are diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 02f3d0d..e6aba79 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -42,6 +42,8 @@ int check_values (hsize_t i, hsize_t j, int apoint, int acheck); int test_report (int, const H5std_string&); void issue_fail_msg(const char* where, int line, const char* file_name, const char* message=""); +void issue_fail_msg(const char* where, int line, const char* file_name, + const char* func_name, const char* message); class InvalidActionException : public Exception { public: diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index ce18e58..36c2ee4 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -27,13 +27,6 @@ #endif #include -#ifndef H5_NO_NAMESPACE -#ifndef H5_NO_STD - using std::cerr; - using std::endl; -#endif // H5_NO_STD -#endif - #include "H5Cpp.h" // C++ API header file #ifndef H5_NO_NAMESPACE @@ -44,27 +37,25 @@ const H5std_string FILE1("trefer1.h5"); const H5std_string FILE2("trefer2.h5"); -const H5std_string FILE3("trefer3.h5"); -const H5std_string DSET_DEFAULT_NAME("default"); // Dataset 1 const H5std_string DSET1_NAME("Dataset1"); -const int DSET1_LEN = 8; +const H5std_string DSET2_NAME("Dataset2"); const H5std_string MEMBER1( "a_name" ); const H5std_string MEMBER2( "b_name" ); const H5std_string MEMBER3( "c_name" ); // 1-D dataset with fixed dimensions -const H5std_string SPACE1_NAME("Space1"); const int SPACE1_RANK = 1; const int SPACE1_DIM1 = 4; -// 2-D dataset with fixed dimensions -const H5std_string SPACE2_NAME("Space2"); +/* Larger 1-D dataset with fixed dimensions */ +const int SPACE3_RANK = 1; +const int SPACE3_DIM1 = 100; -// Larger 1-D dataset with fixed dimensions -const H5std_string SPACE3_NAME("Space3"); +/* Element selection information */ +const int POINT1_NPOINTS = 10; // Compound datatype typedef struct s1_t { @@ -75,8 +66,123 @@ typedef struct s1_t { /**************************************************************** ** -** test_reference_obj(): Test basic object reference functionality. -** Tests references to various kinds of objects +** test_reference_params(): Test basic H5R (reference) parameters +** for correct processing +** +****************************************************************/ +static void +test_reference_params(void) +{ + const char *write_comment = "Foo!"; /* Comments for group */ + + // Output message about test being performed + SUBTEST("Object Reference Parameters"); + + H5File* file1 = NULL; + try { + hobj_ref_t *wbuf, // buffer to write to disk + *rbuf, // buffer read from disk + *tbuf; // temp. buffer read from disk + + // Allocate write & read buffers + int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t)); + wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1); + + // Create file FILE1 + file1 = new H5File (FILE1, H5F_ACC_TRUNC); + + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a group + Group group = file1->createGroup("Group1"); + + // Set group's comment + group.setComment(".", write_comment); + + // Create a dataset (inside /Group1) + DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); + + unsigned *tu32; // Temporary pointer to uint32 data + int i; + for (tu32=(unsigned *)wbuf, i=0; icreateDataSet("Dataset3", PredType::STD_REF_OBJ, sid1); + + /* Test parameters to H5Location::reference */ + try { + file1->reference(NULL, "/Group1/Dataset1"); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], NULL); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], ""); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE); + } catch (ReferenceException E) {} // We expect this to fail + try { + file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION); + } catch (ReferenceException E) {} // We expect this to fail + + // Close resources + dataset.close(); + file1->close(); + // Let sid1 go out of scope + + // Free memory buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_param()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); + } + + if(file1) + delete file1; +} /* test_reference_param() */ + +/**************************************************************** +** +** test_reference_obj(): Test basic object reference functions +** to various kinds of objects ** ****************************************************************/ static void test_reference_obj(void) @@ -106,8 +212,11 @@ static void test_reference_obj(void) hsize_t dims1[] = {SPACE1_DIM1}; DataSpace sid1(SPACE1_RANK, dims1); + // Create dataset access property list + PropList dapl(H5P_DATASET_ACCESS); + // Create a group - Group group = file1->createGroup("Group1", (size_t)-1); + Group group = file1->createGroup("Group1"); // Set group's comment group.setComment(".", write_comment); @@ -116,7 +225,7 @@ static void test_reference_obj(void) DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1); unsigned *tu32; // Temporary pointer to uint32 data - for (tu32=(unsigned *)wbuf, i=0; ireference(&wbuf[0], "/Group1/Dataset1"); H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); // Create reference to dataset and test getRefObjType file1->reference(&wbuf[1], "/Group1/Dataset2"); refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); // Create reference to group file1->reference(&wbuf[2], "/Group1"); refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType",__LINE__,__FILE__); // Create reference to named datatype file1->reference(&wbuf[3], "/Group1/Datatype1"); refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT); - verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType", __LINE__, __FILE__); + verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType",__LINE__,__FILE__); // Write selection to disk dataset.write(wbuf, PredType::STD_REF_OBJ); @@ -188,18 +297,18 @@ static void test_reference_obj(void) // Dereference dataset object by ctor, from the location where // 'dataset' is located - DataSet dset2(dataset, &rbuf[0]); + DataSet dset2(dataset, &rbuf[0], H5R_OBJECT, dapl); // Check information in the referenced dataset sid1 = dset2.getSpace(); hssize_t n_elements = sid1.getSimpleExtentNpoints(); - verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); + verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); // Read from disk dset2.read(tbuf, PredType::NATIVE_UINT); - for(tu32=(unsigned *)tbuf,i=0; iclose(); - // Free memory buffers + // Free allocated buffers HDfree(wbuf); HDfree(rbuf); HDfree(tbuf); @@ -314,13 +356,431 @@ static void test_reference_obj(void) PASSED(); } // end try catch (Exception E) { - issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_reference_obj()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); } if(file1) delete file1; } // test_reference_obj() + +/**************************************************************** +** +** test_reference_group(): Test object reference functionality +** Tests for correct behavior of various routines on +** dereferenced group +** +****************************************************************/ +#define GROUPNAME "/group" +#define GROUPNAME2 "group2" +#define GROUPNAME3 "group3" +#define DSETNAME "/dset" +#define DSETNAME2 "dset2" +#define NAME_SIZE 16 + +static void +test_reference_group(void) +{ + hobj_ref_t wref; /* Reference to write */ + hobj_ref_t rref; /* Reference to read */ + const H5std_string write_comment="Foo!"; // Comments for group + + // Output message about test being performed + SUBTEST("Object Reference to Group"); + + H5File* file1 = NULL; + try { + /* + * Create file with a group and a dataset containing an object + * reference to the group + */ + + // Create file FILE1 + file1 = new H5File (FILE1, H5F_ACC_TRUNC); + + // Create scalar dataspace + DataSpace sid1; + + // Create a group + Group group = file1->createGroup(GROUPNAME); + + /* Create nested groups */ + Group group2 = group.createGroup(GROUPNAME2); + group2.close(); + group2 = group.createGroup(GROUPNAME3); + group2.close(); + + // Create bottom dataset + DataSet dset1 = group.createDataSet(DSETNAME2, PredType::NATIVE_INT, sid1); + dset1.close(); + + // Close group 1 + group.close(); + + // Create dataset + DataSet dset2 = file1->createDataSet(DSETNAME, PredType::STD_REF_OBJ, sid1); + + file1->reference(&wref, GROUPNAME); + + // Write selection to disk + dset2.write(&wref, PredType::STD_REF_OBJ); + + // Close resources + dset2.close(); + sid1.close(); + file1->close(); + + /* + * Re-open the file and test deferencing group + */ + + // Re-open file + file1->openFile(FILE1, H5F_ACC_RDWR); + + // Re-open dataset + dset1 = file1->openDataSet(DSETNAME); + + // Read in the reference + dset1.read(&rref, PredType::STD_REF_OBJ); + + // Dereference to get the group + Group refgroup(dset1, &rref); + + // Dereference group object the other way + group.dereference(dset1, &rref); + + /* + * Various queries on the group opened + */ + + // Check number of objects in the group dereferenced by constructor + hsize_t nobjs = refgroup.getNumObjs(); + verify_val(nobjs, 3, "H5Group::getNumObjs",__LINE__,__FILE__); + + // Check number of objects in the group dereferenced by ::reference + nobjs = group.getNumObjs(); + verify_val(nobjs, 3, "H5Group::getNumObjs",__LINE__,__FILE__); + + // Check getting file name given the group dereferenced via constructor + H5std_string fname = refgroup.getFileName(); + verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); + + // Check getting file name given the group dereferenced by ::reference + fname = group.getFileName(); + verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); + + // Unlink one of the objects in the dereferenced group, and re-check + refgroup.unlink(GROUPNAME2); + nobjs = refgroup.getNumObjs(); + verify_val(nobjs, 2, "H5Group::getNumObjs",__LINE__,__FILE__); + + // Close resources + group.close(); + refgroup.close(); + dset1.close(); + file1->close(); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_group()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); + } + + if(file1) + delete file1; +} /* test_reference_group() */ + +/**************************************************************** +** +** test_reference_region_1D(): Test 1-D reference functionality +** Tests 1-D references to various kinds of objects +** +****************************************************************/ +static void +test_reference_region_1D(void) +{ + hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t * coords; /* Coordinate buffer */ + hsize_t low[SPACE3_RANK]; /* Selection bounds */ + hsize_t high[SPACE3_RANK]; /* Selection bounds */ + int i; /* counting variables */ + + // Output message about test being performed + SUBTEST("1-D Dataset Region Reference Functions"); + + try { + 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 + + // Allocate write & read buffers + wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); + rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); + dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); + drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); + + // Create file FILE1 + H5File file1(FILE2, H5F_ACC_TRUNC); + + // Create dataspace for datasets + hsize_t dims3[] = {SPACE3_DIM1}; + DataSpace sid3(SPACE3_RANK, dims3); + + // Create dataset access property list + PropList dapl(H5P_DATASET_ACCESS); + + // Create a dataset + DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3); + + uint8_t *tu8; // Temporary pointer to uint8 data + for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++) + *tu8++ = i * 3; // from C test + + // Write selection to disk + dset3.write(dwbuf, PredType::STD_U8LE); + + // Close Dataset + dset3.close(); + + // Create dataspace for datasets + hsize_t dims1[] = {SPACE1_DIM1}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a dataset + DataSet dset1 = file1.createDataSet(DSET1_NAME, PredType::STD_REF_DSETREG, sid1); + + /* + * Create references and prepare for testing + */ + + /* Select 15 2x1 hyperslabs for first reference */ + start[0] = 2; + stride[0] = 5; + count[0] = 15; + block[0] = 2; + + // Select a hyperslab region to add to the current selected region + sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); + + // Get and verify the number of elements in a dataspace selection + hssize_t nelms = sid3.getSelectNpoints(); + verify_val(nelms, 30, "DataSet::getRefObjType",__LINE__,__FILE__); + + // Store first dataset region + file1.reference(&wbuf[0], "/Dataset2", sid3); + + // Get and verify object type + H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION); + verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); + + /* Select sequence of ten points for second reference */ + coord1[0][0] = 16; + coord1[1][0] = 22; + coord1[2][0] = 38; + coord1[3][0] = 41; + coord1[4][0] = 52; + coord1[5][0] = 63; + coord1[6][0] = 70; + coord1[7][0] = 89; + coord1[8][0] = 97; + coord1[9][0] = 3; + + // Selects array elements to be included in the selection for sid3 + sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1); + + // Get and verify the number of elements in a dataspace selection + nelms = sid3.getSelectNpoints(); + verify_val(nelms, 10, "DataSet::getRefObjType",__LINE__,__FILE__); + + // Store first dataset region + file1.reference(&wbuf[1], "/Dataset2", sid3); + + // Write selection to disk + dset1.write(wbuf, PredType::STD_REF_DSETREG); + + // Close disk dataspace, dataset, and file + sid1.close(); + dset1.close(); + sid3.close(); + file1.close(); + + /* + * Testing various dereference functions + */ + + // Re-open the file + file1.openFile(FILE2, H5F_ACC_RDWR); + + // Open the dataset + dset1 = file1.openDataSet("/Dataset1"); + + // Read selection from disk + dset1.read(rbuf, PredType::STD_REF_DSETREG); + + { // Test DataSet::dereference + dset3.dereference(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); + + // Get and verify object type + obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION); + verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__); + + // Get dataspace of dset3 the verify number of elements + sid1 = dset3.getSpace(); + nelms = sid1.getSimpleExtentNpoints(); + verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + } // End of test DataSet::dereference + + { // Test DataSet constructor -by dereference + // Dereference dataset object by ctor, from the location where + // 'dset1' is located + DataSet newds(dset1, &rbuf[0], H5R_DATASET_REGION, dapl); + + // Get dataspace of newds then verify number of elements + sid1 = newds.getSpace(); + nelms = sid1.getSimpleExtentNpoints(); + verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + + // Close objects for this mini test + newds.close(); + sid1.close(); + } // End of test DataSet constructor -by dereference + + // Read from disk + dset3.read(drbuf, PredType::STD_U8LE); + + for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++) + verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__); + + /* + * Test getting the referenced region + */ + + // Get region + DataSpace reg_sp = dset1.getRegion(&rbuf[0]); + + // Get and verify number of elements in a dataspace selection + nelms = reg_sp.getSelectNpoints(); + verify_val((long)nelms, 30, "DataSpace::getSelectNpoints",__LINE__,__FILE__); + + // Get and verify number of hyperslab blocks + nelms = reg_sp.getSelectHyperNblocks(); + verify_val((long)nelms, 15, "DataSpace::getSelectNpoints",__LINE__,__FILE__); + + /* Allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2); + + // Get the list of hyperslab blocks currently selected + reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords); + + // Verify values in the list + verify_val(coords[0], 2, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[1], 3, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[2], 7, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[3], 8, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[4], 12, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[5], 13, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[6], 17, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[7], 18, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[8], 22, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[9], 23, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[10], 27, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[11], 28, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[12], 32, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[13], 33, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[14], 37, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[15], 38, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[16], 42, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[17], 43, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[18], 47, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[19], 48, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[20], 52, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[21], 53, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[22], 57, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[23], 58, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[24], 62, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[25], 63, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[26], 67, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[27], 68, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[28], 72, "Hyperslab Coordinates",__LINE__,__FILE__); + verify_val(coords[29], 73, "Hyperslab Coordinates",__LINE__,__FILE__); + + HDfree(coords); + + // Check boundaries + reg_sp.getSelectBounds(low, high); + verify_val(low[0], 2, "DataSpace::getSelectBounds",__LINE__,__FILE__); + verify_val(high[0], 73, "DataSpace::getSelectBounds",__LINE__,__FILE__); + + /* Close region space */ + reg_sp.close(); + + /* + * Another test on getting the referenced region + */ + + // Get region + DataSpace elm_sp = dset1.getRegion(&rbuf[1]); + + // Get and verify number of element points in the current selection + hssize_t nelmspts = elm_sp.getSelectElemNpoints(); + verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints",__LINE__,__FILE__); + + /* Allocate space for the hyperslab blocks */ + coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t)); + + // Get the list of element points currently selected + elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords); + + // Verify points + verify_val(coords[0], coord1[0][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[1], coord1[1][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[2], coord1[2][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[3], coord1[3][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[4], coord1[4][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[5], coord1[5][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[6], coord1[6][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[7], coord1[7][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[8], coord1[8][0], "Element Coordinates",__LINE__,__FILE__); + verify_val(coords[9], coord1[9][0], "Element Coordinates",__LINE__,__FILE__); + + HDfree(coords); + + // Check boundaries + elm_sp.getSelectBounds(low, high); + verify_val(low[0], 3, "DataSpace::getSelectBounds",__LINE__,__FILE__); + verify_val(high[0], 97, "DataSpace::getSelectBounds",__LINE__,__FILE__); + + // Close element space + elm_sp.close(); + + // Close resources + sid1.close(); + dset3.close(); + dset1.close(); + file1.close(); + + // Free memory buffers + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); + + PASSED(); + } // end try + catch (Exception E) { + issue_fail_msg("test_reference_region_1D()",__LINE__,__FILE__, + E.getCFuncName(), E.getCDetailMsg()); + } +} /* test_reference_region_1D() */ + + /**************************************************************** ** ** test_reference_compat(): Test basic object reference functionality. @@ -346,7 +806,10 @@ void test_reference(void) // Output message about test being performed MESSAGE(5, ("Testing References\n")); + test_reference_params(); // Test basic parameters of reference functionality test_reference_obj(); // Test basic object reference functionality + test_reference_group(); // Test group reference functionality + test_reference_region_1D(); // Test 1-D reference functionality test_reference_compat(); // Tests deprecated reference routines (not yet) } // test_reference() @@ -363,5 +826,6 @@ extern "C" void cleanup_reference(void) { HDremove(FILE1.c_str()); + HDremove(FILE2.c_str()); } -- cgit v0.12 From 94b55940ea800a861817a3b02575e5a180db62c8 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sun, 22 Sep 2013 23:04:26 -0500 Subject: [svn-r24189] Purpose: Fixed bug HDFFV-1060 Description: Changed header guards from single underscore to double underscore. Platforms tested: Linux/32 2.6 (jam) - very minor Linux/64 2.6 (koala)/PGI compilers --- c++/src/H5AbstractDs.h | 6 +++--- c++/src/H5ArrayType.h | 6 +++--- c++/src/H5AtomType.h | 6 +++--- c++/src/H5Attribute.h | 6 +++--- c++/src/H5Classes.h | 6 +++--- c++/src/H5CommonFG.h | 6 +++--- c++/src/H5CompType.h | 6 +++--- c++/src/H5Cpp.h | 6 +++--- c++/src/H5CppDoc.h | 6 +++--- c++/src/H5DataSet.h | 6 +++--- c++/src/H5DataSpace.h | 6 +++--- c++/src/H5DataType.h | 6 +++--- c++/src/H5DcreatProp.h | 6 +++--- c++/src/H5DxferProp.h | 6 +++--- c++/src/H5EnumType.h | 6 +++--- c++/src/H5Exception.h | 6 +++--- c++/src/H5FaccProp.h | 6 +++--- c++/src/H5FcreatProp.h | 6 +++--- c++/src/H5File.h | 6 +++--- c++/src/H5FloatType.h | 6 +++--- c++/src/H5Group.h | 6 +++--- c++/src/H5IdComponent.h | 6 +++--- c++/src/H5IntType.h | 6 +++--- c++/src/H5Library.h | 6 +++--- c++/src/H5Location.h | 6 +++--- c++/src/H5Object.h | 6 +++--- c++/src/H5PredType.h | 6 +++--- c++/src/H5PropList.h | 6 +++--- c++/src/H5StrType.h | 6 +++--- c++/src/H5VarLenType.h | 6 +++--- 30 files changed, 90 insertions(+), 90 deletions(-) diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 192f8ce..6635f78 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -19,8 +19,8 @@ // Attribute and DataSet. It also inherits from H5Object and passes down // the services that H5Object provides. -#ifndef _AbstractDs_H -#define _AbstractDs_H +#ifndef __AbstractDs_H +#define __AbstractDs_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -87,4 +87,4 @@ class H5_DLLCPP AbstractDs { #ifndef H5_NO_NAMESPACE } #endif -#endif // _AbstractDs_H +#endif // __AbstractDs_H diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index 7daafed..d2e3c29 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -17,8 +17,8 @@ // Class ArrayType inherits from DataType and provides wrappers for the // HDF5 C's Array Datatypes. -#ifndef _H5ArrayType_H -#define _H5ArrayType_H +#ifndef __H5ArrayType_H +#define __H5ArrayType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -59,4 +59,4 @@ class H5_DLLCPP ArrayType : public DataType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5ArrayType_H diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index 7c9a891..e8d6513 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -19,8 +19,8 @@ // subclasses. It also inherits from DataType and passes down the // services that are common to all the datatypes. -#ifndef _H5AtomType_H -#define _H5AtomType_H +#ifndef __H5AtomType_H +#define __H5AtomType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -80,4 +80,4 @@ class H5_DLLCPP AtomType : public DataType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5AtomType_H diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index dd37a99..2d01205 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Attribute_H -#define _H5Attribute_H +#ifndef __H5Attribute_H +#define __H5Attribute_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -99,4 +99,4 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Attribute_H diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h index c3b61ca..de7cf4a 100644 --- a/c++/src/H5Classes.h +++ b/c++/src/H5Classes.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Classes_H -#define _H5Classes_H +#ifndef __H5Classes_H +#define __H5Classes_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -49,4 +49,4 @@ namespace H5 { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Classes_H diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index b02b05b..1748d1d 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -18,8 +18,8 @@ // common services that are provided by H5File and Group. The file or // group in the context of this class is referred to as 'location'. -#ifndef _CommonFG_H -#define _CommonFG_H +#ifndef __CommonFG_H +#define __CommonFG_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -156,5 +156,5 @@ class H5_DLLCPP CommonFG { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __CommonFG_H diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 9b2b572..16ae839 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -17,8 +17,8 @@ // Class CompType inherits from DataType and provides accesses to a compound // datatype. -#ifndef _H5CompType_H -#define _H5CompType_H +#ifndef __H5CompType_H +#define __H5CompType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -111,4 +111,4 @@ class H5_DLLCPP CompType : public DataType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5CompType_H diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h index ddf4f19..044108b 100644 --- a/c++/src/H5Cpp.h +++ b/c++/src/H5Cpp.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5CPP_H -#define _H5CPP_H +#ifndef __H5Cpp_H +#define __H5Cpp_H #include "H5Include.h" #include "H5Exception.h" @@ -56,4 +56,4 @@ #define HOFFSET(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif -#endif +#endif // __H5Cpp_H diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h index ab3fa79..baeca64 100644 --- a/c++/src/H5CppDoc.h +++ b/c++/src/H5CppDoc.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5CPPDOC_H -#define _H5CPPDOC_H +#ifndef __H5CppDoc_H +#define __H5CppDoc_H //------------------------------------------------------------------------- // The following section will be used to generate the 'Mainpage' @@ -88,4 +88,4 @@ /// This example shows how to work with groups. ///\example h5group.cpp -#endif +#endif // __H5CppDoc_H diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index e2fe702..a3a6a76 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -16,8 +16,8 @@ // Class DataSet inherits from AbstractDs and provides accesses to a dataset. -#ifndef _H5DataSet_H -#define _H5DataSet_H +#ifndef __H5DataSet_H +#define __H5DataSet_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -120,4 +120,4 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5DataSet_H diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index b88144a..1ea7188 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5DataSpace_H -#define _H5DataSpace_H +#ifndef __H5DataSpace_H +#define __H5DataSpace_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -131,4 +131,4 @@ class H5_DLLCPP DataSpace : public IdComponent { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5DataSpace_H diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index e4254b0..104eed4 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5DataType_H -#define _H5DataType_H +#ifndef __H5DataType_H +#define __H5DataType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -129,4 +129,4 @@ class H5_DLLCPP DataType : public H5Object { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5DataType_H diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index ac7664e..385bc61 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5DSCreatPropList_H -#define _H5DSCreatPropList_H +#ifndef __H5DSCreatPropList_H +#define __H5DSCreatPropList_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -123,4 +123,4 @@ class H5_DLLCPP DSetCreatPropList : public PropList { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5DSCreatPropList_H diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index bf481c3..b136ba4 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5DSetMemXferPropList_H -#define _H5DSetMemXferPropList_H +#ifndef __H5DSetMemXferPropList_H +#define __H5DSetMemXferPropList_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -102,5 +102,5 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5DSetMemXferPropList_H diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index 914eb66..71e36c3 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5EnumType_H -#define _H5EnumType_H +#ifndef __H5EnumType_H +#define __H5EnumType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -74,4 +74,4 @@ class H5_DLLCPP EnumType : public DataType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5EnumType_H diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index b4af2ba..8b12abc 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Exception_H -#define _H5Exception_H +#ifndef __H5Exception_H +#define __H5Exception_H #include @@ -161,4 +161,4 @@ class H5_DLLCPP IdComponentException : public Exception { } #endif -#endif // _H5Exception_H +#endif // __H5Exception_H diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 0c2cc21..040b3e9 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5FileAccPropList_H -#define _H5FileAccPropList_H +#ifndef __H5FileAccPropList_H +#define __H5FileAccPropList_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -139,4 +139,4 @@ class H5_DLLCPP FileAccPropList : public PropList { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5FileAccPropList_H diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 61074ea..b11be62 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5FileCreatPropList_H -#define _H5FileCreatPropList_H +#ifndef __H5FileCreatPropList_H +#define __H5FileCreatPropList_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -78,4 +78,4 @@ class H5_DLLCPP FileCreatPropList : public PropList { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5FileCreatPropList_H diff --git a/c++/src/H5File.h b/c++/src/H5File.h index 2abffea..830dda0 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5File_H -#define _H5File_H +#ifndef __H5File_H +#define __H5File_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -112,4 +112,4 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5File_H diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index cbb9541..06148d6 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5FloatType_H -#define _H5FloatType_H +#ifndef __H5FloatType_H +#define __H5FloatType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -71,4 +71,4 @@ class H5_DLLCPP FloatType : public AtomType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5FloatType_H diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 4003c21..a5e324c 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Group_H -#define _H5Group_H +#ifndef __H5Group_H +#define __H5Group_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -68,4 +68,4 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Group_H diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index 17ed552..5a61947 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _IdComponent_H -#define _IdComponent_H +#ifndef __IdComponent_H +#define __IdComponent_H // IdComponent represents an HDF5 object that has an identifier. @@ -98,4 +98,4 @@ class H5_DLLCPP IdComponent { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __IdComponent_H diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index 53864ee..02efb64 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5IntType_H -#define _H5IntType_H +#ifndef __H5IntType_H +#define __H5IntType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -53,4 +53,4 @@ class H5_DLLCPP IntType : public AtomType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5IntType_H diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h index a3e1c99..c92a943 100644 --- a/c++/src/H5Library.h +++ b/c++/src/H5Library.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Library_H -#define _H5Library_H +#ifndef __H5Library_H +#define __H5Library_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -67,4 +67,4 @@ class H5_DLLCPP H5Library { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Library_H diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 50278db..4ea13cd 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Location_H -#define _H5Location_H +#ifndef __H5Location_H +#define __H5Location_H #include "H5Classes.h" // constains forward class declarations @@ -164,4 +164,4 @@ class H5_DLLCPP H5Location : public IdComponent { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Location_H diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 8441491..3f9c343 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5Object_H -#define _H5Object_H +#ifndef __H5Object_H +#define __H5Object_H #include "H5Location.h" #include "H5Classes.h" // constains forward class declarations @@ -61,4 +61,4 @@ class H5_DLLCPP H5Object : public H5Location { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5Object_H diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 5dc5d36..65e1c07 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -19,8 +19,8 @@ // closed by H5Tclose. They are treated as constants. ///////////////////////////////////////////////////////////////////// -#ifndef _H5PredType_H -#define _H5PredType_H +#ifndef __H5PredType_H +#define __H5PredType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -258,4 +258,4 @@ class H5_DLLCPP PredType : public AtomType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5PredType_H diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index a4057d4..b2c50d4 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5PropList_H -#define _H5PropList_H +#ifndef __H5PropList_H +#define __H5PropList_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -121,4 +121,4 @@ class H5_DLLCPP PropList : public IdComponent { #ifndef H5_NO_NAMESPACE } #endif -#endif // _H5PropList_H +#endif // __H5PropList_H diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index be9fed8..251b0b8 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -14,8 +14,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5StrType_H -#define _H5StrType_H +#ifndef __H5StrType_H +#define __H5StrType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -65,4 +65,4 @@ class H5_DLLCPP StrType : public AtomType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5StrType_H diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index 0cee219..caa347a 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -17,8 +17,8 @@ // Class VarLenType inherits from DataType and provides wrappers for // the HDF5 C's Variable-length Datatypes. -#ifndef _H5VarLenType_H -#define _H5VarLenType_H +#ifndef __H5VarLenType_H +#define __H5VarLenType_H #ifndef H5_NO_NAMESPACE namespace H5 { @@ -49,4 +49,4 @@ class H5_DLLCPP VarLenType : public DataType { #ifndef H5_NO_NAMESPACE } #endif -#endif +#endif // __H5VarLenType_H -- cgit v0.12 From b52c12bc1dbada52a1272ecd5949372ae1dbe6f8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 23 Sep 2013 14:10:53 -0500 Subject: [svn-r24190] remove comment that caused linux build warnings and correct use of cmakedefine vs define in template. Tested: local linux --- config/cmake/ConfigureChecks.cmake | 4 +- config/cmake/H5pubconf.h.in | 78 +++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 58c790d..98ecdaa 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -565,7 +565,9 @@ IF (NOT APPLE) IF (NOT H5_SIZEOF_SSIZE_T) SET (H5_SIZEOF_SSIZE_T 0) ENDIF (NOT H5_SIZEOF_SSIZE_T) - H5_CHECK_TYPE_SIZE (ptrdiff_t H5_SIZEOF_PTRDIFF_T) + IF (NOT WINDOWS) + H5_CHECK_TYPE_SIZE (ptrdiff_t H5_SIZEOF_PTRDIFF_T) + ENDIF (NOT WINDOWS) ENDIF (NOT APPLE) H5_CHECK_TYPE_SIZE (off_t H5_SIZEOF_OFF_T) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index ede2ffd..9d86931 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -575,62 +575,62 @@ #cmakedefine H5_PRINTF_LL_WIDTH @H5_PRINTF_LL_WIDTH@ /* The size of `char', as computed by sizeof. */ -#define H5_SIZEOF_CHAR @H5_SIZEOF_CHAR@ +#cmakedefine H5_SIZEOF_CHAR @H5_SIZEOF_CHAR@ /* The size of `double', as computed by sizeof. */ -#define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ +#cmakedefine H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ /* The size of `float', as computed by sizeof. */ -#define H5_SIZEOF_FLOAT @H5_SIZEOF_FLOAT@ +#cmakedefine H5_SIZEOF_FLOAT @H5_SIZEOF_FLOAT@ /* The size of `int', as computed by sizeof. */ -#define H5_SIZEOF_INT @H5_SIZEOF_INT@ +#cmakedefine H5_SIZEOF_INT @H5_SIZEOF_INT@ /* The size of `int16_t', as computed by sizeof. */ -#define H5_SIZEOF_INT16_T @H5_SIZEOF_INT16_T@ +#cmakedefine H5_SIZEOF_INT16_T @H5_SIZEOF_INT16_T@ /* The size of `int32_t', as computed by sizeof. */ -#define H5_SIZEOF_INT32_T @H5_SIZEOF_INT32_T@ +#cmakedefine H5_SIZEOF_INT32_T @H5_SIZEOF_INT32_T@ /* The size of `int64_t', as computed by sizeof. */ -#define H5_SIZEOF_INT64_T @H5_SIZEOF_INT64_T@ +#cmakedefine H5_SIZEOF_INT64_T @H5_SIZEOF_INT64_T@ /* The size of `int8_t', as computed by sizeof. */ -#define H5_SIZEOF_INT8_T @H5_SIZEOF_INT8_T@ +#cmakedefine H5_SIZEOF_INT8_T @H5_SIZEOF_INT8_T@ /* The size of `int_fast16_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST16_T @H5_SIZEOF_INT_FAST16_T@ +#cmakedefine H5_SIZEOF_INT_FAST16_T @H5_SIZEOF_INT_FAST16_T@ /* The size of `int_fast32_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST32_T @H5_SIZEOF_INT_FAST32_T@ +#cmakedefine H5_SIZEOF_INT_FAST32_T @H5_SIZEOF_INT_FAST32_T@ /* The size of `int_fast64_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST64_T @H5_SIZEOF_INT_FAST64_T@ +#cmakedefine H5_SIZEOF_INT_FAST64_T @H5_SIZEOF_INT_FAST64_T@ /* The size of `int_fast8_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST8_T @H5_SIZEOF_INT_FAST8_T@ +#cmakedefine H5_SIZEOF_INT_FAST8_T @H5_SIZEOF_INT_FAST8_T@ /* The size of `int_least16_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST16_T @H5_SIZEOF_INT_LEAST16_T@ +#cmakedefine H5_SIZEOF_INT_LEAST16_T @H5_SIZEOF_INT_LEAST16_T@ /* The size of `int_least32_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST32_T @H5_SIZEOF_INT_LEAST32_T@ +#cmakedefine H5_SIZEOF_INT_LEAST32_T @H5_SIZEOF_INT_LEAST32_T@ /* The size of `int_least64_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST64_T @H5_SIZEOF_INT_LEAST64_T@ +#cmakedefine H5_SIZEOF_INT_LEAST64_T @H5_SIZEOF_INT_LEAST64_T@ /* The size of `int_least8_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST8_T @H5_SIZEOF_INT_LEAST8_T@ +#cmakedefine H5_SIZEOF_INT_LEAST8_T @H5_SIZEOF_INT_LEAST8_T@ #if !defined(__APPLE__) /* The size of `size_t', as computed by sizeof. */ -#define H5_SIZEOF_SIZE_T @H5_SIZEOF_SIZE_T@ +#cmakedefine H5_SIZEOF_SIZE_T @H5_SIZEOF_SIZE_T@ /* The size of `ssize_t', as computed by sizeof. */ -#define H5_SIZEOF_SSIZE_T @H5_SIZEOF_SSIZE_T@ +#cmakedefine H5_SIZEOF_SSIZE_T @H5_SIZEOF_SSIZE_T@ /* The size of `long', as computed by sizeof. */ -#define H5_SIZEOF_LONG @H5_SIZEOF_LONG@ +#cmakedefine H5_SIZEOF_LONG @H5_SIZEOF_LONG@ #else # if defined(__LP64__) && __LP64__ @@ -646,69 +646,69 @@ #endif /* The size of `long double', as computed by sizeof. */ -#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ +#cmakedefine H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ /* Define size of long long and/or __int64 bit integer type only if the type exists. */ #if !defined(__APPLE__) - #define H5_SIZEOF_LONG_LONG @H5_SIZEOF_LONG_LONG@ + #cmakedefine H5_SIZEOF_LONG_LONG @H5_SIZEOF_LONG_LONG@ #else #define H5_SIZEOF_LONG_LONG 8 #endif /* The size of `off64_t', as computed by sizeof. */ -#define H5_SIZEOF_OFF64_T @H5_SIZEOF_OFF64_T@ +#cmakedefine H5_SIZEOF_OFF64_T @H5_SIZEOF_OFF64_T@ /* The size of `off_t', as computed by sizeof. */ -#define H5_SIZEOF_OFF_T @H5_SIZEOF_OFF_T@ +#cmakedefine H5_SIZEOF_OFF_T @H5_SIZEOF_OFF_T@ /* The size of `ptrdiff_t', as computed by sizeof. */ -/* #define H5_SIZEOF_PTRDIFF_T @H5_SIZEOF_PTRDIFF_T@ */ +#cmakedefine H5_SIZEOF_PTRDIFF_T @H5_SIZEOF_PTRDIFF_T@ /* The size of `short', as computed by sizeof. */ -#define H5_SIZEOF_SHORT @H5_SIZEOF_SHORT@ +#cmakedefine H5_SIZEOF_SHORT @H5_SIZEOF_SHORT@ /* The size of `uint16_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT16_T @H5_SIZEOF_UINT16_T@ +#cmakedefine H5_SIZEOF_UINT16_T @H5_SIZEOF_UINT16_T@ /* The size of `uint32_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT32_T @H5_SIZEOF_UINT32_T@ +#cmakedefine H5_SIZEOF_UINT32_T @H5_SIZEOF_UINT32_T@ /* The size of `uint64_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT64_T @H5_SIZEOF_UINT64_T@ +#cmakedefine H5_SIZEOF_UINT64_T @H5_SIZEOF_UINT64_T@ /* The size of `uint8_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT8_T @H5_SIZEOF_UINT8_T@ +#cmakedefine H5_SIZEOF_UINT8_T @H5_SIZEOF_UINT8_T@ /* The size of `uint_fast16_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST16_T @H5_SIZEOF_UINT_FAST16_T@ +#cmakedefine H5_SIZEOF_UINT_FAST16_T @H5_SIZEOF_UINT_FAST16_T@ /* The size of `uint_fast32_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST32_T @H5_SIZEOF_UINT_FAST32_T@ +#cmakedefine H5_SIZEOF_UINT_FAST32_T @H5_SIZEOF_UINT_FAST32_T@ /* The size of `uint_fast64_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST64_T @H5_SIZEOF_UINT_FAST64_T@ +#cmakedefine H5_SIZEOF_UINT_FAST64_T @H5_SIZEOF_UINT_FAST64_T@ /* The size of `uint_fast8_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST8_T @H5_SIZEOF_UINT_FAST8_T@ +#cmakedefine H5_SIZEOF_UINT_FAST8_T @H5_SIZEOF_UINT_FAST8_T@ /* The size of `uint_least16_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST16_T @H5_SIZEOF_UINT_LEAST16_T@ +#cmakedefine H5_SIZEOF_UINT_LEAST16_T @H5_SIZEOF_UINT_LEAST16_T@ /* The size of `uint_least32_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST32_T @H5_SIZEOF_UINT_LEAST32_T@ +#cmakedefine H5_SIZEOF_UINT_LEAST32_T @H5_SIZEOF_UINT_LEAST32_T@ /* The size of `uint_least64_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST64_T @H5_SIZEOF_UINT_LEAST64_T@ +#cmakedefine H5_SIZEOF_UINT_LEAST64_T @H5_SIZEOF_UINT_LEAST64_T@ /* The size of `uint_least8_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST8_T @H5_SIZEOF_UINT_LEAST8_T@ +#cmakedefine H5_SIZEOF_UINT_LEAST8_T @H5_SIZEOF_UINT_LEAST8_T@ /* The size of `unsigned', as computed by sizeof. */ -#define H5_SIZEOF_UNSIGNED @H5_SIZEOF_UNSIGNED@ +#cmakedefine H5_SIZEOF_UNSIGNED @H5_SIZEOF_UNSIGNED@ /* The size of `__int64', as computed by sizeof. */ -#define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ +#cmakedefine H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ /* Define to 1 if you have the ANSI C header files. */ #cmakedefine H5_STDC_HEADERS @H5_STDC_HEADERS@ -- cgit v0.12 From c19d87b1fc55a3c89bbcea6d940e4b50a4961ef4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 23 Sep 2013 17:09:30 -0500 Subject: [svn-r24192] Correct test and usage of defines for cmake configure --- config/cmake/ConfigureChecks.cmake | 6 +++++- config/cmake/H5pubconf.h.in | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 98ecdaa..769483e 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -1071,7 +1071,11 @@ H5ConversionTests (H5_ULONG_TO_FLOAT_ACCURATE "Checking IF accurately converting # 64-bit machines, where the short program below tests if round-up is # correctly handled. # -H5ConversionTests (H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE "Checking IF accurately converting unsigned long long to floating-point values") +IF (CMAKE_SYSTEM MATCHES "solaris2.*") + H5ConversionTests (H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE "Checking IF accurately converting unsigned long long to floating-point values") +ELSE (CMAKE_SYSTEM MATCHES "solaris2.*") + SET(H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE 1) +ENDIF (CMAKE_SYSTEM MATCHES "solaris2.*") # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can accurately convert # 'float' or 'double' to 'unsigned long long' values. diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 9d86931..bef9d77 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -708,7 +708,7 @@ #cmakedefine H5_SIZEOF_UNSIGNED @H5_SIZEOF_UNSIGNED@ /* The size of `__int64', as computed by sizeof. */ -#cmakedefine H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ +#define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ /* Define to 1 if you have the ANSI C header files. */ #cmakedefine H5_STDC_HEADERS @H5_STDC_HEADERS@ -- cgit v0.12 From ab239810e1ae81f390a91dfbb3e5d68934efee55 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Mon, 23 Sep 2013 20:14:24 -0500 Subject: [svn-r24194] Don't add hdf5 library dependencies to lib files when --disable-sharedlib-rpath configure option is invoked. Fix for HDFFV-8276. Tested with h5committest and on hdf-duck. --- Makefile.in | 1 + c++/Makefile.in | 1 + c++/examples/Makefile.in | 1 + c++/src/Makefile.am | 5 ++++- c++/src/Makefile.in | 9 ++++++--- c++/test/Makefile.in | 1 + configure | 21 +++++++++++++++++++++ configure.ac | 7 +++++++ examples/Makefile.in | 1 + fortran/Makefile.in | 1 + fortran/examples/Makefile.in | 1 + fortran/src/Makefile.am | 5 ++++- fortran/src/Makefile.in | 9 ++++++--- fortran/test/Makefile.in | 1 + fortran/testpar/Makefile.in | 1 + hl/Makefile.in | 1 + hl/c++/Makefile.in | 1 + hl/c++/examples/Makefile.in | 1 + hl/c++/src/Makefile.am | 5 ++++- hl/c++/src/Makefile.in | 9 ++++++--- hl/c++/test/Makefile.in | 1 + hl/examples/Makefile.in | 1 + hl/fortran/Makefile.in | 1 + hl/fortran/examples/Makefile.in | 1 + hl/fortran/src/Makefile.am | 5 ++++- hl/fortran/src/Makefile.in | 9 ++++++--- hl/fortran/test/Makefile.in | 1 + hl/src/Makefile.am | 5 ++++- hl/src/Makefile.in | 9 ++++++--- hl/test/Makefile.in | 1 + hl/tools/Makefile.in | 1 + hl/tools/gif2h5/Makefile.in | 1 + perform/Makefile.in | 1 + src/Makefile.in | 1 + test/Makefile.in | 1 + testpar/Makefile.in | 1 + tools/Makefile.in | 1 + tools/h5copy/Makefile.in | 1 + tools/h5diff/Makefile.in | 1 + tools/h5dump/Makefile.in | 1 + tools/h5import/Makefile.in | 1 + tools/h5jam/Makefile.in | 1 + tools/h5ls/Makefile.in | 1 + tools/h5repack/Makefile.in | 1 + tools/h5stat/Makefile.in | 1 + tools/lib/Makefile.in | 1 + tools/misc/Makefile.in | 1 + 47 files changed, 113 insertions(+), 20 deletions(-) diff --git a/Makefile.in b/Makefile.in index a53e904..0c6890b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -290,6 +290,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/c++/Makefile.in b/c++/Makefile.in index 232299d..492970b 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -255,6 +255,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index e8aa093..78b1e58 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -222,6 +222,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index ec942fd..759b4a7 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -47,8 +47,11 @@ libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp H5Library.cpp \ H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \ H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp -# HDF5 C++ library depends on HDF5 Library. +# HDF5 C++ library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +if LT_ADD_LIBHDF5_DEPENDENCY libhdf5_cpp_la_LIBADD=$(LIBHDF5) +endif # Public headers include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \ diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index ec28e82..4cb0ac1 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -118,7 +118,8 @@ am__uninstall_files_from_dir = { \ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5_cpp_la_DEPENDENCIES = $(LIBHDF5) +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_cpp_la_DEPENDENCIES = \ +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@ $(LIBHDF5) am_libhdf5_cpp_la_OBJECTS = H5Exception.lo H5IdComponent.lo \ H5Library.lo H5Attribute.lo H5Location.lo H5Object.lo \ H5PropList.lo H5FaccProp.lo H5FcreatProp.lo H5DcreatProp.lo \ @@ -297,6 +298,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -490,8 +492,9 @@ libhdf5_cpp_la_SOURCES = H5Exception.cpp H5IdComponent.cpp H5Library.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp -# HDF5 C++ library depends on HDF5 Library. -libhdf5_cpp_la_LIBADD = $(LIBHDF5) +# HDF5 C++ library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_cpp_la_LIBADD = $(LIBHDF5) # Public headers include_HEADERS = H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \ diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index ef1455c..3c4c645 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -258,6 +258,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/configure b/configure index 492a3cd..e101990 100755 --- a/configure +++ b/configure @@ -690,6 +690,9 @@ LL_PATH USE_FILTER_SZIP USE_FILTER_DEFLATE AM_MAKEFLAGS +LT_ADD_LIBHDF5_DEPENDENCY +LT_ADD_LIBHDF5_DEPENDENCY_FALSE +LT_ADD_LIBHDF5_DEPENDENCY_TRUE LT_STATIC_EXEC USE_PLUGINS_CONDITIONAL_FALSE USE_PLUGINS_CONDITIONAL_TRUE @@ -22096,6 +22099,20 @@ $as_echo "error" >&6; } as_fn_error $? "\'$enableval\' is not a valid rpath type" "$LINENO" 5 ;; esac +## ---------------------------------------------------------------------- +## When sharedlib-rpath is disabled, setting runpath_var to "" above, don't +## add libhdf5 as a dependency for the other hdf5 libs, either. This keeps +## the rpath to libhdf5 out of the lib files as well as the executables. + if test "X$runpath_var" != X; then + LT_ADD_LIBHDF5_DEPENDENCY_TRUE= + LT_ADD_LIBHDF5_DEPENDENCY_FALSE='#' +else + LT_ADD_LIBHDF5_DEPENDENCY_TRUE='#' + LT_ADD_LIBHDF5_DEPENDENCY_FALSE= +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking make" >&5 $as_echo_n "checking make... " >&6; } @@ -33363,6 +33380,10 @@ if test -z "${USE_PLUGINS_CONDITIONAL_TRUE}" && test -z "${USE_PLUGINS_CONDITION as_fn_error $? "conditional \"USE_PLUGINS_CONDITIONAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${LT_ADD_LIBHDF5_DEPENDENCY_TRUE}" && test -z "${LT_ADD_LIBHDF5_DEPENDENCY_FALSE}"; then + as_fn_error $? "conditional \"LT_ADD_LIBHDF5_DEPENDENCY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${BUILD_SHARED_SZIP_CONDITIONAL_TRUE}" && test -z "${BUILD_SHARED_SZIP_CONDITIONAL_FALSE}"; then as_fn_error $? "conditional \"BUILD_SHARED_SZIP_CONDITIONAL\" was never defined. diff --git a/configure.ac b/configure.ac index 4675a90..cfc7d7c 100644 --- a/configure.ac +++ b/configure.ac @@ -1092,6 +1092,13 @@ case "X-$RPATH" in AC_MSG_ERROR([\'$enableval\' is not a valid rpath type]) ;; esac +## ---------------------------------------------------------------------- +## When sharedlib-rpath is disabled, setting runpath_var to "" above, don't +## add libhdf5 as a dependency for the other hdf5 libs, either. This keeps +## the rpath to libhdf5 out of the lib files as well as the executables. +AM_CONDITIONAL([LT_ADD_LIBHDF5_DEPENDENCY], [test "X$runpath_var" != X]) + +AC_SUBST([LT_ADD_LIBHDF5_DEPENDENCY]) AC_MSG_CHECKING([make]) diff --git a/examples/Makefile.in b/examples/Makefile.in index 064cb84..a564dd4 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -222,6 +222,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/fortran/Makefile.in b/fortran/Makefile.in index acab031..4196fe2 100644 --- a/fortran/Makefile.in +++ b/fortran/Makefile.in @@ -259,6 +259,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index 93a2af1..1cc0825 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -230,6 +230,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 12c38e2..2d597c6 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -79,8 +79,11 @@ libhdf5_fortran_la_SOURCES=H5f90global.f90 \ H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 $(PARALLEL_COND_SRC) -# HDF5 Fortran library depends on HDF5 Library. +# HDF5 Fortran library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +if LT_ADD_LIBHDF5_DEPENDENCY libhdf5_fortran_la_LIBADD=$(LIBHDF5) +endif # h5fc is generated during configure. # Remove it only when distclean. diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 0b68688..d2cb3e0 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -120,7 +120,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5_fortran_la_DEPENDENCIES = $(LIBHDF5) +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_fortran_la_DEPENDENCIES = \ +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@ $(LIBHDF5) am__libhdf5_fortran_la_SOURCES_DIST = H5f90global.f90 \ H5fortran_types.f90 H5_ff$(F_STATUS).f90 H5_ff.f90 H5Aff.f90 \ H5Dff.f90 H5Eff.f90 H5Fff.f90 H5Gff.f90 H5Iff.f90 H5Lff.f90 \ @@ -348,6 +349,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -561,8 +563,9 @@ libhdf5_fortran_la_SOURCES = H5f90global.f90 \ H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 $(PARALLEL_COND_SRC) -# HDF5 Fortran library depends on HDF5 Library. -libhdf5_fortran_la_LIBADD = $(LIBHDF5) +# HDF5 Fortran library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_fortran_la_LIBADD = $(LIBHDF5) # h5fc is generated during configure. # Remove it only when distclean. diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index 6c226bc..9f8b6d0 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -333,6 +333,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in index 9a93367..1903529 100644 --- a/fortran/testpar/Makefile.in +++ b/fortran/testpar/Makefile.in @@ -257,6 +257,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/Makefile.in b/hl/Makefile.in index 786bfba..6ca962b 100644 --- a/hl/Makefile.in +++ b/hl/Makefile.in @@ -259,6 +259,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in index 60baefe..210fcc5 100644 --- a/hl/c++/Makefile.in +++ b/hl/c++/Makefile.in @@ -255,6 +255,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in index 8297d0a..1e66687 100644 --- a/hl/c++/examples/Makefile.in +++ b/hl/c++/examples/Makefile.in @@ -221,6 +221,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/c++/src/Makefile.am b/hl/c++/src/Makefile.am index d2794c9..7961747 100644 --- a/hl/c++/src/Makefile.am +++ b/hl/c++/src/Makefile.am @@ -40,8 +40,11 @@ endif # At the moment, only the H5PT Packet Table has a C++ API. libhdf5_hl_cpp_la_SOURCES=H5PacketTable.cpp -# HDF5 HL C++ library depends on HDF5 HL Library and HDF5 C++ Library. +# HDF5 HL C++ library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +if LT_ADD_LIBHDF5_DEPENDENCY libhdf5_hl_cpp_la_LIBADD=$(LIBH5_HL) $(LIBH5CPP) +endif # Public headers include_HEADERS=H5PacketTable.h diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 65a1a5f..39daa9a 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -116,7 +116,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5_hl_cpp_la_DEPENDENCIES = $(LIBH5_HL) $(LIBH5CPP) +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_hl_cpp_la_DEPENDENCIES = \ +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@ $(LIBH5_HL) $(LIBH5CPP) am_libhdf5_hl_cpp_la_OBJECTS = H5PacketTable.lo libhdf5_hl_cpp_la_OBJECTS = $(am_libhdf5_hl_cpp_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -288,6 +289,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -474,8 +476,9 @@ libhdf5_hl_cpp_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISIO # At the moment, only the H5PT Packet Table has a C++ API. libhdf5_hl_cpp_la_SOURCES = H5PacketTable.cpp -# HDF5 HL C++ library depends on HDF5 HL Library and HDF5 C++ Library. -libhdf5_hl_cpp_la_LIBADD = $(LIBH5_HL) $(LIBH5CPP) +# HDF5 HL C++ library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_hl_cpp_la_LIBADD = $(LIBH5_HL) $(LIBH5CPP) # Public headers include_HEADERS = H5PacketTable.h diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in index f8ad89b..c873d32 100644 --- a/hl/c++/test/Makefile.in +++ b/hl/c++/test/Makefile.in @@ -254,6 +254,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in index 2713377..ee4d885 100644 --- a/hl/examples/Makefile.in +++ b/hl/examples/Makefile.in @@ -221,6 +221,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in index 8b7f728..8cb74cd 100644 --- a/hl/fortran/Makefile.in +++ b/hl/fortran/Makefile.in @@ -259,6 +259,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in index 9f08f21..8413c2d 100644 --- a/hl/fortran/examples/Makefile.in +++ b/hl/fortran/examples/Makefile.in @@ -222,6 +222,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am index 9835196..edc5895 100644 --- a/hl/fortran/src/Makefile.am +++ b/hl/fortran/src/Makefile.am @@ -49,8 +49,11 @@ endif libhdf5hl_fortran_la_SOURCES=H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \ H5DSff.f90 H5LTff.f90 H5IMff.f90 H5TBff.f90 -# HDF5 HL Fortran library depends on HDF5 HL Library and HDF5 Fortran Library. +# HDF5 HL Fortran library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +if LT_ADD_LIBHDF5_DEPENDENCY libhdf5hl_fortran_la_LIBADD=$(LIBH5_HL) $(LIBH5F) +endif # Fortran module files can have different extensions and different names # (e.g., different capitalizations) on different platforms. Write rules diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 514335b..577c524 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -116,7 +116,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5hl_fortran_la_DEPENDENCIES = $(LIBH5_HL) $(LIBH5F) +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5hl_fortran_la_DEPENDENCIES = \ +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@ $(LIBH5_HL) $(LIBH5F) am_libhdf5hl_fortran_la_OBJECTS = H5DSfc.lo H5LTfc.lo H5IMfc.lo \ H5IMcc.lo H5TBfc.lo H5DSff.lo H5LTff.lo H5IMff.lo H5TBff.lo libhdf5hl_fortran_la_OBJECTS = $(am_libhdf5hl_fortran_la_OBJECTS) @@ -304,6 +305,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -496,8 +498,9 @@ libhdf5hl_fortran_la_SOURCES = H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \ H5DSff.f90 H5LTff.f90 H5IMff.f90 H5TBff.f90 -# HDF5 HL Fortran library depends on HDF5 HL Library and HDF5 Fortran Library. -libhdf5hl_fortran_la_LIBADD = $(LIBH5_HL) $(LIBH5F) +# HDF5 HL Fortran library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5hl_fortran_la_LIBADD = $(LIBH5_HL) $(LIBH5F) # 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., diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in index 2acee8c..5d576d0 100644 --- a/hl/fortran/test/Makefile.in +++ b/hl/fortran/test/Makefile.in @@ -268,6 +268,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/src/Makefile.am b/hl/src/Makefile.am index 1e781a9..34245ee 100644 --- a/hl/src/Makefile.am +++ b/hl/src/Makefile.am @@ -33,8 +33,11 @@ libhdf5_hl_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$( # List sources to include in the HDF5 HL Library. libhdf5_hl_la_SOURCES=H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c -# HDF5 HL library depends on HDF5 Library. +# HDF5 HL library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +if LT_ADD_LIBHDF5_DEPENDENCY libhdf5_hl_la_LIBADD=$(LIBHDF5) +endif # Public header files (to be installed) include_HEADERS=hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index ca9b17f..ddf684a 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -113,7 +113,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5_hl_la_DEPENDENCIES = $(LIBHDF5) +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_hl_la_DEPENDENCIES = \ +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@ $(LIBHDF5) am_libhdf5_hl_la_OBJECTS = H5DO.lo H5DS.lo H5IM.lo H5LT.lo \ H5LTanalyze.lo H5LTparse.lo H5PT.lo H5TB.lo libhdf5_hl_la_OBJECTS = $(am_libhdf5_hl_la_OBJECTS) @@ -287,6 +288,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -469,8 +471,9 @@ libhdf5_hl_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$ # List sources to include in the HDF5 HL Library. libhdf5_hl_la_SOURCES = H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c -# HDF5 HL library depends on HDF5 Library. -libhdf5_hl_la_LIBADD = $(LIBHDF5) +# HDF5 HL library depends on HDF5 Library. However, only add the dependency +# if --enable-sharedlib-rpath is yes. +@LT_ADD_LIBHDF5_DEPENDENCY_TRUE@libhdf5_hl_la_LIBADD = $(LIBHDF5) # Public header files (to be installed) include_HEADERS = hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in index 30b329e..5639844 100644 --- a/hl/test/Makefile.in +++ b/hl/test/Makefile.in @@ -295,6 +295,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in index eca7b8f..7d887f5 100644 --- a/hl/tools/Makefile.in +++ b/hl/tools/Makefile.in @@ -256,6 +256,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in index 3d7e7fe..e587f5f 100644 --- a/hl/tools/gif2h5/Makefile.in +++ b/hl/tools/gif2h5/Makefile.in @@ -270,6 +270,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/perform/Makefile.in b/perform/Makefile.in index 4cc5b2b..091f4f1 100644 --- a/perform/Makefile.in +++ b/perform/Makefile.in @@ -296,6 +296,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/src/Makefile.in b/src/Makefile.in index b830acc..43cb4e8 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -349,6 +349,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/test/Makefile.in b/test/Makefile.in index e9e2faa..69fb437 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -688,6 +688,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/testpar/Makefile.in b/testpar/Makefile.in index 2fbf5fc..6ddfef2 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -283,6 +283,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/Makefile.in b/tools/Makefile.in index 4af6d74..5b9568a 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -256,6 +256,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in index 3278f80..b922c9b 100644 --- a/tools/h5copy/Makefile.in +++ b/tools/h5copy/Makefile.in @@ -262,6 +262,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 9b46f4e..1b732b0 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -269,6 +269,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 4741683..21a622d 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -268,6 +268,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index 9ad2341..bfb777a 100644 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -262,6 +262,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index fd170fd..7256d6e 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -276,6 +276,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index 1861b03..d67249f 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -256,6 +256,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index aa51cd1..fc37649 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -312,6 +312,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in index ec77732..d2c26a2 100644 --- a/tools/h5stat/Makefile.in +++ b/tools/h5stat/Makefile.in @@ -291,6 +291,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 743e158..6f7f3b9 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -254,6 +254,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in index 3320276..47bf60d 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -316,6 +316,7 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -- cgit v0.12 From 91df66782ea03416f4dae1a8171ede49fb016725 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 23 Sep 2013 21:12:40 -0500 Subject: [svn-r24195] Description: - Improved format/comments in tutorial examples - Added them to Makefile.* and run-c++-ex.sh.in Platforms tested: Linux/32 2.6 (jam) Linux/64 2.6 (koala)/PGI compilers --- c++/examples/Makefile.am | 20 ++++++++++++++++++-- c++/examples/Makefile.in | 21 +++++++++++++++++++-- c++/examples/h5tutr_crtatt.cpp | 9 --------- c++/examples/h5tutr_crtdat.cpp | 9 --------- c++/examples/h5tutr_extend.cpp | 24 ++++++++++++------------ c++/examples/h5tutr_rdwt.cpp | 5 ----- c++/examples/h5tutr_subset.cpp | 2 -- c++/examples/run-c++-ex.sh.in | 31 +++++++++++++++++++++++++++++++ c++/src/H5Exception.cpp | 4 +++- 9 files changed, 83 insertions(+), 42 deletions(-) diff --git a/c++/examples/Makefile.am b/c++/examples/Makefile.am index cd9a9f6..f479776 100644 --- a/c++/examples/Makefile.am +++ b/c++/examples/Makefile.am @@ -23,12 +23,18 @@ include $(top_srcdir)/config/commence.am # These are the programs that 'make all' or 'make prog' will build and # which 'make check' will run. List them in the order they should be run. -EXAMPLE_PROG=create readdata writedata compound extend_ds chunks h5group +EXAMPLE_PROG=create readdata writedata compound extend_ds chunks h5group \ + h5tutr_cmprss h5tutr_crtatt h5tutr_crtdat h5tutr_crtgrpar \ + h5tutr_crtgrp h5tutr_crtgrpd h5tutr_extend h5tutr_rdwt \ + h5tutr_subset TEST_SCRIPT=testh5c++.sh # These are the example files to be installed INSTALL_FILES=create.cpp readdata.cpp writedata.cpp compound.cpp \ - extend_ds.cpp chunks.cpp h5group.cpp + extend_ds.cpp chunks.cpp h5group.cpp \ + h5tutr_cmprss.cpp h5tutr_crtatt.cpp h5tutr_crtdat.cpp \ + h5tutr_crtgrpar.cpp h5tutr_crtgrp.cpp h5tutr_crtgrpd.cpp \ + h5tutr_extend.cpp h5tutr_rdwt.cpp h5tutr_subset.cpp INSTALL_SCRIPT_FILES = run-c++-ex.sh # Some of the examples depend on files created by running other examples @@ -58,5 +64,15 @@ extend_ds: $(srcdir)/extend_ds.cpp chunks: $(srcdir)/chunks.cpp h5group: $(srcdir)/h5group.cpp +h5tutr_cmprss: $(srcdir)/h5tutr_cmprss.cpp +h5tutr_crtatt: $(srcdir)/h5tutr_crtatt.cpp +h5tutr_crtdat: $(srcdir)/h5tutr_crtdat.cpp +h5tutr_crtgrpar: $(srcdir)/h5tutr_crtgrpar.cpp +h5tutr_crtgrp: $(srcdir)/h5tutr_crtgrp.cpp +h5tutr_crtgrpd: $(srcdir)/h5tutr_crtgrpd.cpp +h5tutr_extend: $(srcdir)/h5tutr_extend.cpp +h5tutr_rdwt: $(srcdir)/h5tutr_rdwt.cpp +h5tutr_subset: $(srcdir)/h5tutr_subset.cpp + include $(top_srcdir)/config/examples.am include $(top_srcdir)/config/conclude.am diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index 78b1e58..f392787 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -392,12 +392,19 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 # These are the programs that 'make all' or 'make prog' will build and # which 'make check' will run. List them in the order they should be run. -EXAMPLE_PROG = create readdata writedata compound extend_ds chunks h5group +EXAMPLE_PROG = create readdata writedata compound extend_ds chunks h5group \ + h5tutr_cmprss h5tutr_crtatt h5tutr_crtdat h5tutr_crtgrpar \ + h5tutr_crtgrp h5tutr_crtgrpd h5tutr_extend h5tutr_rdwt \ + h5tutr_subset + TEST_SCRIPT = testh5c++.sh # These are the example files to be installed INSTALL_FILES = create.cpp readdata.cpp writedata.cpp compound.cpp \ - extend_ds.cpp chunks.cpp h5group.cpp + extend_ds.cpp chunks.cpp h5group.cpp \ + h5tutr_cmprss.cpp h5tutr_crtatt.cpp h5tutr_crtdat.cpp \ + h5tutr_crtgrpar.cpp h5tutr_crtgrp.cpp h5tutr_crtgrpd.cpp \ + h5tutr_extend.cpp h5tutr_rdwt.cpp h5tutr_subset.cpp INSTALL_SCRIPT_FILES = run-c++-ex.sh @@ -669,6 +676,16 @@ extend_ds: $(srcdir)/extend_ds.cpp chunks: $(srcdir)/chunks.cpp h5group: $(srcdir)/h5group.cpp +h5tutr_cmprss: $(srcdir)/h5tutr_cmprss.cpp +h5tutr_crtatt: $(srcdir)/h5tutr_crtatt.cpp +h5tutr_crtdat: $(srcdir)/h5tutr_crtdat.cpp +h5tutr_crtgrpar: $(srcdir)/h5tutr_crtgrpar.cpp +h5tutr_crtgrp: $(srcdir)/h5tutr_crtgrp.cpp +h5tutr_crtgrpd: $(srcdir)/h5tutr_crtgrpd.cpp +h5tutr_extend: $(srcdir)/h5tutr_extend.cpp +h5tutr_rdwt: $(srcdir)/h5tutr_rdwt.cpp +h5tutr_subset: $(srcdir)/h5tutr_subset.cpp + # How to create EXAMPLEDIR if it doesn't already exist $(EXAMPLEDIR): -$(top_srcdir)/bin/mkdirs $@ diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp index 3d5b558..651dc69 100644 --- a/c++/examples/h5tutr_crtatt.cpp +++ b/c++/examples/h5tutr_crtatt.cpp @@ -42,33 +42,26 @@ int main (void) // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can // handle the errors appropriately - Exception::dontPrint(); // Open an existing file and dataset. - H5File file( FILE_NAME, H5F_ACC_RDWR ); DataSet dataset = file.openDataSet( DATASET_NAME ); // Create the data space for the attribute. - DataSpace attr_dataspace = DataSpace (1, dims ); // Create a dataset attribute. - Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE, attr_dataspace); // Write the attribute data. - attribute.write( PredType::NATIVE_INT, attr_data); } // end of try block - // catch failure caused by the H5File operations catch( DataSpaceIException error ) { @@ -76,7 +69,6 @@ int main (void) return -1; } - // catch failure caused by the H5File operations catch( AttributeIException error ) { @@ -84,7 +76,6 @@ int main (void) return -1; } - // catch failure caused by the H5File operations catch( FileIException error ) { diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp index 592cc0c..d7f887e 100644 --- a/c++/examples/h5tutr_crtdat.cpp +++ b/c++/examples/h5tutr_crtdat.cpp @@ -35,32 +35,23 @@ const int RANK = 2; int main (void) { - // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can // handle the errors appropriately - Exception::dontPrint(); // Create a new file using the default property lists. - H5File file(FILE_NAME, H5F_ACC_TRUNC); // Create the data space for the dataset. - hsize_t dims[2]; // dataset dimensions dims[0] = NX; dims[1] = NY; DataSpace dataspace(RANK, dims); - // Define the datatype to be used - //IntType datatype(PredType::STD_I32BE); - // Create the dataset. - DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace); } // end of try block diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp index 6437fb8..c3a18d7 100644 --- a/c++/examples/h5tutr_extend.cpp +++ b/c++/examples/h5tutr_extend.cpp @@ -36,21 +36,19 @@ const H5std_string DATASETNAME("ExtendibleArray"); int main (void) { - - hsize_t dims[2] = {3,3}; // dataset dimensions at creation - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] ={2, 5}; - + hsize_t dims[2] = {3,3}; // dataset dimensions at creation + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={2, 5}; int data[3][3] = { {1, 1, 1}, // data to write {1, 1, 1}, {1, 1, 1} }; // Variables used in extending and writing to the extended portion of dataset - hsize_t size[2]; - hsize_t offset[2]; - hsize_t dimsext[2] = {7, 3}; // extend dimensions - int dataext[7][3] = { {2, 3, 4}, + hsize_t size[2]; + hsize_t offset[2]; + hsize_t dimsext[2] = {7, 3}; // extend dimensions + int dataext[7][3] = { {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, @@ -118,13 +116,15 @@ int main (void) int i,j, rank, rank_chunk; hsize_t chunk_dimsr[2], dimsr[2]; + // Open the file and dataset. file.openFile(FILE_NAME, H5F_ACC_RDONLY); - dataset = new DataSet(file.openDataSet( DATASETNAME)); - - filespace = new DataSpace(dataset->getSpace()); + // Get the dataset's dataspace and creation property list. + filespace = new DataSpace(dataset->getSpace()); prop = dataset->getCreatePlist(); + + // Get information to obtain memory dataspace. rank = filespace->getSimpleExtentNdims(); herr_t status_n = filespace->getSimpleExtentDims(dimsr); diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp index a0c1996..e6e45b7 100644 --- a/c++/examples/h5tutr_rdwt.cpp +++ b/c++/examples/h5tutr_rdwt.cpp @@ -47,20 +47,16 @@ int main (void) // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can // handle the errors appropriately - Exception::dontPrint(); // Open an existing file and dataset. - H5File file( FILE_NAME, H5F_ACC_RDWR ); DataSet dataset = file.openDataSet( DATASET_NAME ); // Write the data to the dataset using default memory space, file // space, and transfer properties. - dataset.write( data, PredType::NATIVE_INT ); } // end of try block @@ -81,4 +77,3 @@ int main (void) return 0; // successfully terminated } - diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp index 76e63fd..77174ab 100644 --- a/c++/examples/h5tutr_subset.cpp +++ b/c++/examples/h5tutr_subset.cpp @@ -48,10 +48,8 @@ int main (void) // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can // handle the errors appropriately - Exception::dontPrint(); // --------------------------------------------------- diff --git a/c++/examples/run-c++-ex.sh.in b/c++/examples/run-c++-ex.sh.in index 6b33577..77ac36a 100644 --- a/c++/examples/run-c++-ex.sh.in +++ b/c++/examples/run-c++-ex.sh.in @@ -64,6 +64,10 @@ RunTest() # Run tests if [ $? -eq 0 ] then + echo "*************************************************" + echo "** Run C++ API Examples **" + echo "** **" + echo "*************************************************" if (RunTest create &&\ rm create &&\ RunTest readdata &&\ @@ -82,6 +86,33 @@ then else EXIT_VALUE=${EXIT_FAILURE} fi + echo + echo "***************************************************" + echo "** Run Tutorial Examples **" + echo "** **" + echo "***************************************************" + if (RunTest h5tutr_crtdat &&\ + rm h5tutr_crtdat &&\ + RunTest h5tutr_rdwt &&\ + rm h5tutr_rdwt &&\ + RunTest h5tutr_crtatt &&\ + rm h5tutr_crtatt &&\ + RunTest h5tutr_crtgrp &&\ + rm h5tutr_crtgrp &&\ + RunTest h5tutr_crtgrpar &&\ + rm h5tutr_crtgrpar &&\ + RunTest h5tutr_crtgrpd &&\ + rm h5tutr_crtgrpd &&\ + RunTest h5tutr_extend &&\ + rm h5tutr_extend &&\ + RunTest h5tutr_subset &&\ + rm h5tutr_subset &&\ + RunTest h5tutr_cmprss &&\ + rm h5tutr_cmprss ); then + EXIT_VALUE=${EXIT_SUCCESS} + else + EXIT_VALUE=${EXIT_FAILURE} + fi fi # Cleanup diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 8513372..ac1f506 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -330,7 +330,9 @@ FileIException::FileIException():Exception(){} ///\param func_name - IN: Name of the function where failure occurs ///\param message - IN: Message on the failure //-------------------------------------------------------------------------- -FileIException::FileIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {} +FileIException::FileIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) { + fprintf(stderr, "FileIException::FileIException is thrown, <%s> <%s>\n", func_name.c_str(), message.c_str()); + } //-------------------------------------------------------------------------- // Function: FileIException destructor ///\brief Noop destructor. -- cgit v0.12 From b3f9cb87869edeca285c6245840f37343483aa89 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Tue, 24 Sep 2013 20:27:32 -0500 Subject: [svn-r24197] revert a changed committed by mistake, printf statement --- c++/src/H5Exception.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index ac1f506..8513372 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -330,9 +330,7 @@ FileIException::FileIException():Exception(){} ///\param func_name - IN: Name of the function where failure occurs ///\param message - IN: Message on the failure //-------------------------------------------------------------------------- -FileIException::FileIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) { - fprintf(stderr, "FileIException::FileIException is thrown, <%s> <%s>\n", func_name.c_str(), message.c_str()); - } +FileIException::FileIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {} //-------------------------------------------------------------------------- // Function: FileIException destructor ///\brief Noop destructor. -- cgit v0.12 From b232b752a0b3ac4f648da7c2f6a39b7bbe6f4f8c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 25 Sep 2013 15:03:59 -0500 Subject: [svn-r24198] Change Internal CDash site. --- CTestConfig.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 5d8f25c..92bd300 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -9,8 +9,8 @@ SET (CTEST_NIGHTLY_START_TIME "18:00:00 CST") SET (CTEST_DROP_METHOD "http") IF (CDASH_LOCAL) - SET (CTEST_DROP_SITE "nei.hdfgroup.uiuc.edu") - SET (CTEST_DROP_LOCATION "/cdash/submit.php?project=HDF5+Trunk") + SET (CTEST_DROP_SITE "72.36.68.252") + SET (CTEST_DROP_LOCATION "/submit.php?project=HDF5Trunk") ELSE (CDASH_LOCAL) SET (CTEST_DROP_SITE "cdash.hdfgroup.uiuc.edu") SET (CTEST_DROP_LOCATION "/submit.php?project=HDF5+Trunk") -- cgit v0.12 From ae927c6070d1ca5ffd3bf27c553156b51e6ec6e4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 25 Sep 2013 15:20:39 -0500 Subject: [svn-r24200] Updated cygwin versions --- release_docs/RELEASE.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cb70793..e1b6554 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1175,13 +1175,13 @@ Supported Platforms Windows 7 Visual Studio 2008 w/ Intel Fortran 11 (cmake) Visual Studio 2010 w/ Intel Fortran 12 (cmake) Visual Studio 2012 w/ Intel Fortran 13 (cmake) - Cygwin(CYGWIN_NT-6.1 1.7.15(0.260/5/3) gcc(4.5.3) compiler and gfortran) + Cygwin(CYGWIN_NT-6.1 1.7.25(0.270/5/3) gcc(4.7.3) compiler and gfortran) (cmake and autotools) Windows 7 x64 Visual Studio 2008 w/ Intel Fortran 11 (cmake) Visual Studio 2010 w/ Intel Fortran 12 (cmake) Visual Studio 2012 w/ Intel Fortran 13 (cmake) - Cygwin(CYGWIN_NT-6.1 1.7.15(0.260/5/3) gcc(4.5.3) compiler and gfortran) + Cygwin(CYGWIN_NT-6.1 1.7.25(0.270/5/3) gcc(4.8.1) compiler and gfortran) (cmake and autotools) Windows 8 Visual Studio 2012 w/ Intel Fortran 13 (cmake) -- cgit v0.12 From ebc0b44fe18a40b7f31bdde45ec9f16edd4f658a Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 26 Sep 2013 01:51:10 -0500 Subject: [svn-r24202] Bug fix: HDFFV-8271 Big.c error in address generated by random number. Description: There is a bug in the current big.c tests. In a nut-shell, the writing part randomly picks 50 locations and write 4KB from that location. Random location range is from byte 0 to end of dataset. There is the problem--if the random location is greater than (end of dataset - 4KB), then error. Solution: Adjust the random number to be at least 4KB less than the end of the dataset. That allows it write 4KB more from the generated starting position. Tested: h5comittest plus jam serial build and test. --- test/big.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/big.c b/test/big.c index 5a70c26..831a2ed 100644 --- a/test/big.c +++ b/test/big.c @@ -435,7 +435,8 @@ writer (char* filename, hid_t fapl, fsizes_t testsize, int wrt_n) hs_size[0] = WRT_SIZE; if ((mem_space = H5Screate_simple (1, hs_size, hs_size)) < 0) goto error; for (i=0; i