[svn-r27887] Description:

Merge changes from trunk to the branch.

Tested on:
    MacOSX/64 10.10.5 (amazon) w/serial & parallel
    (h5committest not required on this branch)
This commit is contained in:
Quincey Koziol 2015-09-26 20:39:06 -05:00
commit 6f1dda474c
11 changed files with 275 additions and 174 deletions

View File

@ -212,6 +212,10 @@ if (NOT HDF5_INSTALL_DATA_DIR)
endif (NOT WIN32)
endif (NOT HDF5_INSTALL_DATA_DIR)
if(DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}")
set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH})
endif(DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}")
#-----------------------------------------------------------------------------
# parse the full version number from H5public.h and include in H5_VERS_INFO
#-----------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash
#
# Copyright by The HDF Group.
# All rights reserved.
@ -60,7 +60,7 @@
#
# This script takes two potential options:
#
# -p, --production
# -p
#
# When this is selected, the autotools versions are set to the paths
# and versions used by The HDF Group to produce the released versions
@ -70,7 +70,7 @@
# to have recent versions of the autotools this option will probably
# be removed.
#
# -v, --verbose
# -v
#
# This emits some extra information, mainly tool versions.
@ -89,33 +89,19 @@ verbose=false
optspec=":hpv-"
while getopts "$optspec" optchar; do
case "${optchar}" in
-)
case "${OPTARG}" in
production)
echo "Setting production mode..."
echo
production=true
;;
verbose)
echo "Setting verbosity: high"
echo
verbose=true
;;
*)
if [ "$OPTERR" = 1 ] && [ "${optspec:0:1}" != ":" ]; then
echo "Unknown option --${OPTARG}" >&2
fi
;;
esac;;
h)
echo "usage: $0 [-p|--production]"
echo "usage: $0 [OPTIONS]"
echo
echo " -h Print this help message."
echo
echo " -p Used by THG to ensure that particular versions"
echo " of the autotools are used and hard-codes"
echo " autotools paths to THG machines. Not for"
echo " non-HDF-Group users!"
echo
echo " NOTE: Each autotool can be set via an environment variable."
echo " -v Show more verbose output."
echo
echo " NOTE: Each tool can be set via an environment variable."
echo " These are documented inside this autogen.sh script."
echo
exit 0
@ -396,15 +382,37 @@ bin/make_overflow src/H5overflow.txt || exit 1
# to install a later version of bison. See the OS X note at the top
# of this script.
echo
echo "Running flex/bison:"
cd hl/src
echo "Generating H5LT parser code (requires yacc/bison):"
echo "Generate hl/src/H5LTparse.c from hl/src/H5LTparse.y"
# HDF5_BISON is set via the environment or 'which bison', above
if test -z ${HDF5_BISON}; then
echo
echo "*************************"
echo " ERROR - bison not found"
echo "*************************"
echo "bison is required to generate parser code in H5LT"
echo
exit 127
fi
cd hl/src
if [ "$verbose" = true ] ; then
${HDF5_BISON} --version
fi
${HDF5_BISON} -pH5LTyy -o H5LTparse.c -d H5LTparse.y
echo
echo "Generating H5LT lexer code (requires lex/flex):"
echo "Generate hl/src/H5LTanalyze.c from hl/src/H5LTanalyze.l"
# HDF5_FLEX is set via the environment or 'which flex', above
if test -z ${HDF5_FLEX}; then
echo
echo "************************"
echo " ERROR - flex not found"
echo "************************"
echo "flex is required to generate lexer code in H5LT"
echo
exit 127
fi
if [ "$verbose" = true ] ; then
${HDF5_FLEX} --version
fi

View File

@ -1,20 +1,48 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
###############################################################################################################
# This script will build and run the examples from a compressed file
# This script will build and run the examples from a folder
# Execute from a command line:
# ctest -S HDF5_Examples.cmake,HDF5Examples -C Release -V -O test.log
# ctest -S HDF5_Examples.cmake,OPTION=VALUE -C Release -V -O test.log
###############################################################################################################
set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@")
set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
set(STATICLIBRARIES "@H5_ENABLE_STATIC_LIB@")
set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG})
set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
set(CTEST_BUILD_CONFIGURATION "Release")
#set(NO_MAC_FORTRAN "true")
#set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON")
set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_ENABLE_F2003:BOOL=ON")
#set(CTEST_USE_TAR_SOURCE "${CTEST_SCRIPT_ARG}")
# handle input parameters to script.
#INSTALLDIR - HDF5 root folder
#CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo
#CTEST_SOURCE_NAME - name of source folder; HDF4Examples
#STATICLIBRARIES - Default is YES
#NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac)
if(DEFINED CTEST_SCRIPT_ARG)
# transform ctest script arguments of the form
# script.ctest,var1=value1,var2=value2
# to variables with the respective names set to the respective values
string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}")
foreach(current_var ${script_args})
if ("${current_var}" MATCHES "^([^=]+)=(.+)$")
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
if(NOT DEFINED INSTALLDIR)
set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@")
endif()
if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
set(CTEST_BUILD_CONFIGURATION "Release")
endif()
if(NOT DEFINED CTEST_SOURCE_NAME)
set(CTEST_SOURCE_NAME "HDF5Examples")
endif()
if(NOT DEFINED STATICLIBRARIES)
set(STATICLIBRARIES "YES")
endif()
#TAR_SOURCE - name of tarfile
#if(NOT DEFINED TAR_SOURCE)
# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.1-Source")
#endif()
###############################################################################################################
# Adjust the following SET Commands as needed
@ -69,11 +97,11 @@ if(CTEST_USE_TAR_SOURCE)
## --------------------------
if(WIN32)
message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]")
execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv)
else(WIN32)
execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv)
else()
message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]")
execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv)
endif(WIN32)
execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv)
endif()
if(NOT rv EQUAL 0)
message(STATUS "extracting... [error-(${rv}) clean up]")

View File

@ -34,10 +34,21 @@ To test the installation with the examples;
Create a directory to run the examples.
Copy HDF5Examples folder to this directory.
Copy HDF5_Examples.cmake to this directory.
Edit HDF5_Examples.cmake line 8 to set INSTALLDIR to where HDF5 is installed.
(The default should be correct unless you installed into a different folder.)
Execute from this directory:
ctest -S HDF5_Examples.cmake,HDF5Examples -C Release -V -O test.log
The default source folder is defined as "HDF5Examples". It can be changed
with the CTEST_SOURCE_NAME script option.
The default installation folder is defined as "@CMAKE_INSTALL_PREFIX@".
It can be changed with the INSTALLDIR script option.
The default ctest configuration is defined as "Release". It can be changed
with the CTEST_BUILD_CONFIGURATION script option. Note that this must
be the same as the value used with the -C command line option.
The default build configuration is defined to build and use static libraries.
Shared libraries can be used with the STATICLIBRARIES script option set to "NO".
Other options can be changed by editing the HDF5_Examples.cmake file.
If the defaults are okay, execute from this directory:
ctest -S HDF5_Examples.cmake -C Release -V -O test.log
If the defaults need change, execute from this directory:
ctest -S HDF5_Examples.cmake,CTEST_SOURCE_NAME=MyExamples,INSTALLDIR=MyLocation -C Release -V -O test.log
When executed, the ctest script will save the results to the log file, test.log, as
indicated by the ctest command. If you wish the to see more build and test information,

View File

@ -28,8 +28,8 @@ I. Preconditions
the HDF Install Utility (the *.msi file in the binary package for
Windows or the *.sh on Linux). If you are using a Windows platform,
you can obtain a pre-built Windows binary from The HDF Group's website
at www.hdfgroup.org. See Section "III. Common changes to the
HDF518_Examples.cmake file", for the line to change the location.
at www.hdfgroup.org.
========================================================================
@ -37,40 +37,41 @@ II. Building HDF5 Examples with CMake
========================================================================
Files in the HDF5 install directory:
HDF5Examples-0.1.1-Source folder
HDF5Examples folder
HDF518_Examples.cmake
Default installation process:
Create a directory to run the examples, i.e. \test_hdf5.
Copy HDF5Examples-0.1.1-Source folder to this directory.
Copy HDF518_Examples.cmake to this directory.
Edit line 8 of the HDF518_Examples.cmake file and change the INSTALLDIR
to the HDF5 install location.
Copy HDF5Examples folder to this directory.
Copy HDF5_Examples.cmake to this directory.
The default source folder is defined as "HDF5Examples". It can be changed
with the CTEST_SOURCE_NAME script option.
The default installation folder is defined as "@CMAKE_INSTALL_PREFIX@".
It can be changed with the INSTALLDIR script option.
The default ctest configuration is defined as "Release". It can be changed
with the CTEST_BUILD_CONFIGURATION script option. Note that this must
be the same as the value used with the -C command line option.
The default build configuration is defined to build and use static libraries.
Shared libraries can be used with the STATICLIBRARIES script option set to "NO".
Other options can be changed by editing the HDF5_Examples.cmake file.
Execute from this directory:
ctest -S HDF518_Examples.cmake,HDF5Examples-0.1.1-Source -C Release -O test.log
If the defaults are okay, execute from this directory:
ctest -S HDF5_Examples.cmake -C Release -V -O test.log
If the defaults need change, execute from this directory:
ctest -S HDF5_Examples.cmake,CTEST_SOURCE_NAME=MyExamples,INSTALLDIR=MyLocation -C Release -V -O test.log
The script will use the examples folder HDF5Examples-0.1.1-Source,
and create a build directory inside the HDF5Examples-0.1.1-Source directory.
It will then configure, build, and execute the examples. All the log files
will be found under the build\Testing\Temporary directory, check these for
errors.
The amount of script information can be increased by adding -V to the ctest
command. Even more information can be shown by adding -VV instead of -V.
When executed, the ctest script will save the results to the log file, test.log, as
indicated by the ctest command. If you wish the to see more build and test information,
add "-VV" to the ctest command. The output should show;
100% tests passed, 0 tests failed out of 156.
========================================================================
III. Common changes to the HDF518_Examples.cmake file
III. Other changes to the HDF518_Examples.cmake file
========================================================================
Line 8: change the INSTALLDIR to a different HDF5 install location.
Line 10: uncomment to build and test Fortran examples.
Line 14: uncomment to allow Mac machines to build shared examples.
Line 15: uncomment to build and test Fortran examples.
Line 16: comment to NOT build and test Fortran examples with F2003 option.
Line 17: uncomment to use a compressed source file.
Line 43-45: uncomment to use a source tarball or zipfile;
Add script option "TAR_SOURCE=MySource.tar".

View File

@ -820,6 +820,11 @@ if (HDF5_GENERATE_HEADERS)
endif (PERL_FOUND)
endif (HDF5_GENERATE_HEADERS)
set (H5_PUBLIC_GENERATED_HEADERS
${HDF5_SRC_DIR}/H5version.h
${HDF5_SRC_DIR}/H5overflow.h
)
#-----------------------------------------------------------------------------
# Setup the H5Detect utility which generates H5Tinit with platform
# specific type checks inside
@ -832,7 +837,7 @@ endif (MSVC OR MINGW)
if (HDF5_GENERATE_HEADERS)
add_dependencies(H5detect generate_precompiled)
else (HDF5_GENERATE_HEADERS)
add_dependencies(H5detect "${HDF5_SRC_DIR}/H5version.h;${HDF5_SRC_DIR}/H5overflow.h")
add_dependencies(H5detect "${H5_PUBLIC_GENERATED_HEADERS}")
endif (HDF5_GENERATE_HEADERS)
set (CMD $<TARGET_FILE:H5detect>)
@ -851,7 +856,7 @@ endif (MSVC OR MINGW)
if (HDF5_GENERATE_HEADERS)
add_dependencies(H5detect generate_precompiled)
else (HDF5_GENERATE_HEADERS)
add_dependencies(H5make_libsettings "${HDF5_SRC_DIR}/H5version.h;${HDF5_SRC_DIR}/H5overflow.h")
add_dependencies(H5make_libsettings "${H5_PUBLIC_GENERATED_HEADERS}")
endif (HDF5_GENERATE_HEADERS)
set (CMD $<TARGET_FILE:H5make_libsettings>)
@ -900,7 +905,7 @@ endif (HDF5_ENABLE_DEBUG_APIS)
set (install_targets ${HDF5_LIB_TARGET})
if (BUILD_SHARED_LIBS)
add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS})
add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ")
target_link_libraries (${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS})
if (NOT WIN32)
@ -945,6 +950,7 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT)
install (
FILES
${H5_PUBLIC_HEADERS}
${H5_PUBLIC_GENERATED_HEADERS}
DESTINATION
${HDF5_INSTALL_INCLUDE_DIR}
COMPONENT

View File

@ -1576,11 +1576,12 @@ done:
herr_t
H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc)
{
H5F_t *f = NULL; /* Fake file structure*/
unsigned char *pp = (*p); /* Local pointer for decoding */
size_t extent_size; /* Size of serialized dataspace extent */
hssize_t sselect_size; /* Signed size of serialized dataspace selection */
size_t select_size; /* Size of serialized dataspace selection */
H5F_t *f = NULL; /* Fake file structure*/
herr_t ret_value = SUCCEED;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@ -1599,27 +1600,28 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc)
/* Verify the size of buffer. If it's not big enough, simply return the
* right size without filling the buffer. */
if(!*p || *nalloc < (extent_size + select_size + 1 + 1 + 1 + 4))
if(!pp || *nalloc < (extent_size + select_size + 1 + 1 + 1 + 4))
*nalloc = extent_size + select_size + 1 + 1 + 1 + 4;
else {
/* Encode the type of the information */
*(*p)++ = H5O_SDSPACE_ID;
*pp++ = H5O_SDSPACE_ID;
/* Encode the version of the dataspace information */
*(*p)++ = H5S_ENCODE_VERSION;
*pp++ = H5S_ENCODE_VERSION;
/* Encode the "size of size" information */
*(*p)++ = (unsigned char)H5F_SIZEOF_SIZE(f);
*pp++ = (unsigned char)H5F_SIZEOF_SIZE(f);
/* Encode size of extent information. Pointer is actually moved in this macro. */
UINT32ENCODE(*p, extent_size);
UINT32ENCODE(pp, extent_size);
/* Encode the extent part of dataspace */
if(H5O_msg_encode(f, H5O_SDSPACE_ID, TRUE, *p, obj) < 0)
if(H5O_msg_encode(f, H5O_SDSPACE_ID, TRUE, pp, obj) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space")
*p += extent_size;
pp += extent_size;
/* Encode the selection part of dataspace. */
*p = pp;
if(H5S_SELECT_SERIALIZE(obj, p) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space")
} /* end else */
@ -1692,38 +1694,39 @@ done:
H5S_t*
H5S_decode(const unsigned char **p)
{
H5S_t *ds;
H5S_extent_t *extent;
size_t extent_size; /* size of the extent message*/
H5F_t *f = NULL; /* Fake file structure*/
H5S_t *ds; /* Decoded dataspace */
H5S_extent_t *extent; /* Entent of decoded dataspace */
const unsigned char *pp = (*p); /* Local pointer for decoding */
size_t extent_size; /* size of the extent message*/
uint8_t sizeof_size; /* 'Size of sizes' for file */
H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Decode the type of the information */
if(*(*p)++ != H5O_SDSPACE_ID)
if(*pp++ != H5O_SDSPACE_ID)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADMESG, NULL, "not an encoded dataspace")
/* Decode the version of the dataspace information */
if(*(*p)++ != H5S_ENCODE_VERSION)
if(*pp++ != H5S_ENCODE_VERSION)
HGOTO_ERROR(H5E_DATASPACE, H5E_VERSION, NULL, "unknown version of encoded dataspace")
/* Decode the "size of size" information */
sizeof_size = *(*p)++;
sizeof_size = *pp++;
/* Allocate "fake" file structure */
if(NULL == (f = H5F_fake_alloc(sizeof_size)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct")
/* Decode size of extent information */
UINT32DECODE(*p, extent_size);
UINT32DECODE(pp, extent_size);
/* Decode the extent part of dataspace */
/* (pass mostly bogus file pointer and bogus DXPL) */
if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, *p))==NULL)
if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, pp))==NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
*p += extent_size;
pp += extent_size;
/* Copy the extent into dataspace structure */
if((ds = H5FL_CALLOC(H5S_t))==NULL)
@ -1739,6 +1742,7 @@ H5S_decode(const unsigned char **p)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection")
/* Decode the select part of dataspace. I believe this part always exists. */
*p = pp;
if(H5S_SELECT_DESERIALIZE(&ds, p) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection")

View File

@ -516,19 +516,25 @@ H5S_all_serial_size (const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5S_all_serialize (const H5S_t *space, uint8_t **p)
H5S_all_serialize(const H5S_t *space, uint8_t **p)
{
uint8_t *pp = (*p); /* Local pointer for decoding */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(space);
HDassert(p);
HDassert(*p);
HDassert(pp);
/* Store the preamble information */
UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */
UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(*p, (uint32_t)0); /* Store the additional information length */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */
UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */
/* Update encoding pointer */
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_all_serialize() */

View File

@ -2014,14 +2014,14 @@ H5S_hyper_serial_size(const H5S_t *space)
PURPOSE
Serialize the current selection into a user-provided buffer.
USAGE
herr_t H5S_hyper_serialize_helper(spans, start, end, rank, buf)
void H5S_hyper_serialize_helper(spans, start, end, rank, buf)
H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to serialize
hssize_t start[]; IN/OUT: Accumulated start points
hssize_t end[]; IN/OUT: Accumulated end points
hsize_t rank; IN: Current rank looking at
uint8 *buf; OUT: Buffer to put serialized selection into
RETURNS
Non-negative on success/Negative on failure
<none>
DESCRIPTION
Serializes the current element selection into a buffer. (Primarily for
storing on disk).
@ -2030,13 +2030,13 @@ H5S_hyper_serial_size(const H5S_t *space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans,
static void
H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **p)
{
H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
uint8_t *pp = (*p); /* Local pointer for decoding */
hsize_t u; /* Index variable */
herr_t ret_value=SUCCEED; /* return value */
FUNC_ENTER_NOAPI_NOINIT
@ -2045,7 +2045,7 @@ H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans,
HDassert(start);
HDassert(end);
HDassert(rank < H5O_LAYOUT_NDIMS);
HDassert(p && *p);
HDassert(p && pp);
/* Walk through the list of spans, recursing or outputing them */
curr=spans->head;
@ -2057,33 +2057,35 @@ H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans,
end[rank]=curr->high;
/* Recurse down to the next dimension */
if(H5S_hyper_serialize_helper(curr->down,start,end,rank+1,p)<0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
*p = pp;
H5S_hyper_serialize_helper(curr->down, start, end, rank = 1, p);
} /* end if */
else {
/* Encode all the previous dimensions starting & ending points */
/* Encode previous starting points */
for(u=0; u<rank; u++)
UINT32ENCODE(*p, (uint32_t)start[u]);
UINT32ENCODE(pp, (uint32_t)start[u]);
/* Encode starting point for this span */
UINT32ENCODE(*p, (uint32_t)curr->low);
UINT32ENCODE(pp, (uint32_t)curr->low);
/* Encode previous ending points */
for(u=0; u<rank; u++)
UINT32ENCODE(*p, (uint32_t)end[u]);
UINT32ENCODE(pp, (uint32_t)end[u]);
/* Encode starting point for this span */
UINT32ENCODE(*p, (uint32_t)curr->high);
UINT32ENCODE(pp, (uint32_t)curr->high);
} /* end else */
/* Advance to next node */
curr=curr->next;
} /* end while */
done:
FUNC_LEAVE_NOAPI(ret_value)
/* Update encoding pointer */
*p = pp;
FUNC_LEAVE_NOAPI_VOID
} /* H5S_hyper_serialize_helper() */
@ -2109,9 +2111,10 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5S_hyper_serialize (const H5S_t *space, uint8_t **p)
H5S_hyper_serialize(const H5S_t *space, uint8_t **p)
{
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
uint8_t *pp = (*p); /* Local pointer for decoding */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
@ -2128,7 +2131,10 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(space);
HDassert(p);
HDassert(pp);
/* Calculate version */
if(space->select.sel_info.hslab->unlim_dim >= 0) {
@ -2139,17 +2145,17 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p)
version = 1;
/* Store the preamble information */
UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(*p, version); /* Store the version number */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(pp, version); /* Store the version number */
if(version >= 2)
*(*p)++ = flags; /* Store the flags */
*pp++ = flags; /* Store the flags */
else
UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */
lenp = *p; /* keep the pointer to the length location for later */
*p += 4; /* skip over space for length */
UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
lenp = pp; /* Keep the pointer to the length location for later */
pp += 4; /* Skip over space for length */
/* Encode number of dimensions */
UINT32ENCODE(*p, (uint32_t)space->extent.rank);
UINT32ENCODE(pp, (uint32_t)space->extent.rank);
len += 4;
/* If there is an unlimited dimension, only encode opt_unlim_diminfo */
@ -2161,10 +2167,10 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p)
/* Iterate over dimensions */
for(i = 0; i < space->extent.rank; i++) {
/* Encode start/stride/block/count */
UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].start);
UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].stride);
UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].count);
UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].block);
UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].start);
UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].stride);
UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].count);
UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].block);
} /* end for */
} /* end if */
/* Check for a "regular" hyperslab selection */
@ -2182,7 +2188,7 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p)
/* Encode number of hyperslabs */
H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
UINT32ENCODE(*p, (uint32_t)block_count);
UINT32ENCODE(pp, (uint32_t)block_count);
len+=4;
/* Now serialize the information for the regular hyperslab */
@ -2205,11 +2211,11 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p)
/* Encode hyperslab starting location */
for(u = 0; u < ndims; u++)
UINT32ENCODE(*p, (uint32_t)offset[u]);
UINT32ENCODE(pp, (uint32_t)offset[u]);
/* Encode hyperslab ending location */
for(u = 0; u < ndims; u++)
UINT32ENCODE(*p, (uint32_t)(offset[u] + (diminfo[u].block - 1)));
UINT32ENCODE(pp, (uint32_t)(offset[u] + (diminfo[u].block - 1)));
/* Move the offset to the next sequence to start */
offset[fast_dim]+=diminfo[fast_dim].stride;
@ -2260,7 +2266,7 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p)
/* Encode number of hyperslabs */
block_count = H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst);
H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t);
UINT32ENCODE(*p, (uint32_t)block_count);
UINT32ENCODE(pp, (uint32_t)block_count);
len+=4;
/* Add 8 bytes times the rank for each hyperslab selected */
@ -2268,12 +2274,16 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p)
len += (uint32_t)(8 * space->extent.rank * block_count);
/* Encode each hyperslab in selection */
*p = pp;
H5S_hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, p);
} /* end else */
/* Encode length */
UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
/* Update encoding pointer */
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_hyper_serialize() */
@ -2306,6 +2316,7 @@ static herr_t
H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t flags,
const uint8_t **p)
{
const uint8_t *pp = (*p); /* Local pointer for decoding */
unsigned rank; /* rank of points */
size_t num_elem=0; /* number of elements in selection */
hsize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */
@ -2326,7 +2337,7 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla
/* Check args */
HDassert(space);
HDassert(p);
HDassert(*p);
HDassert(pp);
/* Deserialize slabs to select */
/* (The header and rank have already beed decoded) */
@ -2340,10 +2351,10 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla
/* Iterate over dimensions */
for(i = 0; i < space->extent.rank; i++) {
/* Decode start/stride/block/count */
UINT64DECODE(*p, start[i]);
UINT64DECODE(*p, stride[i]);
UINT64DECODE(*p, count[i]);
UINT64DECODE(*p, block[i]);
UINT64DECODE(pp, start[i]);
UINT64DECODE(pp, stride[i]);
UINT64DECODE(pp, count[i]);
UINT64DECODE(pp, block[i]);
} /* end for */
/* Select the hyperslab to the current selection */
@ -2352,7 +2363,7 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla
} /* end if */
else {
/* decode the number of points */
UINT32DECODE(*p,num_elem);
UINT32DECODE(pp,num_elem);
/* Set the count & stride for all blocks */
for(tcount=count,tstride=stride,j=0; j<rank; j++,tstride++,tcount++) {
@ -2364,11 +2375,11 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla
for(i=0; i<num_elem; i++) {
/* Decode the starting points */
for(tstart=start,j=0; j<rank; j++,tstart++)
UINT32DECODE(*p, *tstart);
UINT32DECODE(pp, *tstart);
/* Decode the ending points */
for(tend=end,j=0; j<rank; j++,tend++)
UINT32DECODE(*p, *tend);
UINT32DECODE(pp, *tend);
/* Change the ending points into blocks */
for(tblock=block,tstart=start,tend=end,j=0; j<rank; j++,tstart++,tend++,tblock++)
@ -2380,6 +2391,9 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla
} /* end for */
} /* end else */
/* Update decoding pointer */
*p = pp;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_deserialize() */

View File

@ -486,15 +486,23 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
static herr_t
H5S_none_serialize(const H5S_t *space, uint8_t **p)
{
uint8_t *pp = (*p); /* Local pointer for decoding */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(space);
HDassert(p);
HDassert(pp);
/* Store the preamble information */
UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */
UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(*p, (uint32_t)0); /* Store the additional information length */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */
UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */
/* Update encoding pointer */
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_none_serialize() */

View File

@ -827,27 +827,31 @@ static herr_t
H5S_point_serialize (const H5S_t *space, uint8_t **p)
{
H5S_pnt_node_t *curr; /* Point information nodes */
uint8_t *pp = (*p); /* Local pointer for decoding */
uint8_t *lenp; /* pointer to length location for later storage */
uint32_t len=0; /* number of bytes used */
unsigned u; /* local counting variable */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
HDassert(space);
HDassert(p);
HDassert(pp);
/* Store the preamble information */
UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */
UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */
lenp=*p; /* keep the pointer to the length location for later */
*p+=4; /* skip over space for length */
UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */
UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */
lenp = pp; /* Keep the pointer to the length location for later */
pp += 4; /* Skip over space for length */
/* Encode number of dimensions */
UINT32ENCODE(*p, (uint32_t)space->extent.rank);
UINT32ENCODE(pp, (uint32_t)space->extent.rank);
len+=4;
/* Encode number of elements */
UINT32ENCODE(*p, (uint32_t)space->select.num_elem);
UINT32ENCODE(pp, (uint32_t)space->select.num_elem);
len+=4;
/* Encode each point in selection */
@ -858,7 +862,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p)
/* Encode each point */
for(u=0; u<space->extent.rank; u++)
UINT32ENCODE(*p, (uint32_t)curr->pnt[u]);
UINT32ENCODE(pp, (uint32_t)curr->pnt[u]);
curr=curr->next;
} /* end while */
@ -866,6 +870,9 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p)
/* Encode length */
UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
/* Update encoding pointer */
*p = pp;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_serialize() */
@ -898,24 +905,25 @@ static herr_t
H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags,
const uint8_t **p)
{
H5S_seloper_t op=H5S_SELECT_SET; /* Selection operation */
H5S_seloper_t op = H5S_SELECT_SET; /* Selection operation */
hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */
const uint8_t *pp = (*p); /* Local pointer for decoding */
size_t num_elem = 0; /* Number of elements in selection */
unsigned rank; /* Rank of points */
size_t num_elem=0; /* Number of elements in selection */
hsize_t *coord=NULL, *tcoord; /* Pointer to array of elements */
unsigned i, j; /* local counting variables */
herr_t ret_value = SUCCEED; /* return value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
HDassert(space);
HDassert(p);
HDassert(*p);
HDassert(pp);
/* Deserialize points to select */
/* (The header and rank have already beed decoded) */
rank = space->extent.rank; /* Retrieve rank from space */
UINT32DECODE(*p, num_elem); /* decode the number of points */
UINT32DECODE(pp, num_elem); /* decode the number of points */
/* Allocate space for the coordinates */
if(NULL == (coord = (hsize_t *)H5MM_malloc(num_elem * rank * sizeof(hsize_t))))
@ -924,12 +932,15 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_
/* Retrieve the coordinates from the buffer */
for(tcoord = coord, i = 0; i < num_elem; i++)
for(j = 0; j < (unsigned)rank; j++, tcoord++)
UINT32DECODE(*p, *tcoord);
UINT32DECODE(pp, *tcoord);
/* Select points */
if(H5S_select_elements(space, op, num_elem, (const hsize_t *)coord) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
/* Update decoding pointer */
*p = pp;
done:
/* Free the coordinate array if necessary */
if(coord != NULL)