diff options
Diffstat (limited to 'c++/src')
-rw-r--r-- | c++/src/CMakeLists.txt | 37 | ||||
-rw-r--r-- | c++/src/H5Attribute.cpp | 148 | ||||
-rw-r--r-- | c++/src/H5Attribute.h | 8 | ||||
-rw-r--r-- | c++/src/H5CommonFG.cpp | 9 | ||||
-rw-r--r-- | c++/src/H5CompType.cpp | 21 | ||||
-rw-r--r-- | c++/src/H5CompType.h | 3 | ||||
-rw-r--r-- | c++/src/H5DataSet.cpp | 10 | ||||
-rw-r--r-- | c++/src/H5DataType.cpp | 2 | ||||
-rw-r--r-- | c++/src/H5DxferProp.cpp | 127 | ||||
-rw-r--r-- | c++/src/H5DxferProp.h | 13 | ||||
-rw-r--r-- | c++/src/H5EnumType.cpp | 4 | ||||
-rw-r--r-- | c++/src/H5Exception.cpp | 45 | ||||
-rw-r--r-- | c++/src/H5Exception.h | 29 | ||||
-rw-r--r-- | c++/src/H5FaccProp.h | 8 | ||||
-rw-r--r-- | c++/src/H5File.h | 12 | ||||
-rw-r--r-- | c++/src/H5Group.h | 2 | ||||
-rw-r--r-- | c++/src/H5IdComponent.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5Location.cpp | 137 | ||||
-rw-r--r-- | c++/src/H5Location.h | 5 | ||||
-rw-r--r-- | c++/src/H5PropList.cpp | 7 | ||||
-rw-r--r-- | c++/src/Makefile.am | 2 | ||||
-rw-r--r-- | c++/src/Makefile.in | 483 |
22 files changed, 880 insertions, 235 deletions
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index af6283a..7a48260 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -1,24 +1,24 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) PROJECT (HDF5_CPP_SRC) #----------------------------------------------------------------------------- # Shared/Static Libs #----------------------------------------------------------------------------- -IF (BUILD_SHARED_LIBS) - SET (CPP_BUILT_AS_DYNAMIC_LIB 1) -ENDIF (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS) + set (CPP_BUILT_AS_DYNAMIC_LIB 1) +endif (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- # Generate configure file #----------------------------------------------------------------------------- -CONFIGURE_FILE (${HDF5_RESOURCES_DIR}/H5cxx_config.h.in +configure_file (${HDF5_RESOURCES_DIR}/H5cxx_config.h.in ${HDF5_BINARY_DIR}/H5cxx_pubconf.h ) #----------------------------------------------------------------------------- # Define cpp Library #----------------------------------------------------------------------------- -SET (CPP_SRCS +set (CPP_SRCS ${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5AtomType.cpp @@ -48,7 +48,7 @@ SET (CPP_SRCS ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.cpp ) -SET (CPP_HDRS +set (CPP_HDRS ${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5Alltypes.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.h @@ -83,17 +83,20 @@ SET (CPP_HDRS ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h ) -ADD_LIBRARY (${HDF5_CPP_LIB_TARGET} ${LIB_TYPE} ${CPP_SRCS} ${CPP_HDRS}) +add_library (${HDF5_CPP_LIB_TARGET} ${LIB_TYPE} ${CPP_SRCS} ${CPP_HDRS}) TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} " " " ") -TARGET_LINK_LIBRARIES (${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) -SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}") +target_link_libraries (${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) +set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} ${LIB_TYPE}) -SET_TARGET_PROPERTIES (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp) +set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES + FOLDER libraries/cpp + INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +) #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- -INSTALL ( +install ( FILES ${CPP_HDRS} DESTINATION @@ -105,12 +108,12 @@ INSTALL ( #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- -IF (HDF5_EXPORTED_TARGETS) - IF (BUILD_SHARED_LIBS) +if (HDF5_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} cpplibraries) - ENDIF (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS) - INSTALL ( + install ( TARGETS ${HDF5_CPP_LIB_TARGET} EXPORT @@ -119,4 +122,4 @@ IF (HDF5_EXPORTED_TARGETS) ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT cpplibraries RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT cpplibraries ) -ENDIF (HDF5_EXPORTED_TARGETS) +endif (HDF5_EXPORTED_TARGETS) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index a98a970..9554f95 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -299,75 +299,129 @@ H5std_string Attribute::getFileName() const //-------------------------------------------------------------------------- // Function: Attribute::getName ///\brief Gets the name of this attribute, returning its length. -///\param buf_size - IN: Desired length of the name -///\param attr_name - OUT: Buffer for the name string -///\return Length of the attribute name +///\param attr_name - OUT: Buffer for the name string as char* +///\param buf_size - IN: Length of the buffer, default to 0 +///\return Actual length of the attribute name ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Nov, 2001 -//-------------------------------------------------------------------------- -ssize_t Attribute::getName( size_t buf_size, H5std_string& attr_name ) const +///\par Description +/// This function retrieves \a buf_size chars of the attribute's +/// name including null termination. Thus, if the actual length +/// of the name is more than buf_size-1, the retrieved name will +/// be truncated to accommodate the null terminator. +/// To get length of the attribute's name for buffer allocation, +/// an application can call this function passing in NULL for the +/// first argument and ignore the second argument. +// Programmer Binh-Minh Ribler - Mar, 2014 +//-------------------------------------------------------------------------- +ssize_t Attribute::getName(char* attr_name, size_t buf_size) const { - char* name_C = new char[buf_size+1]; // temporary C-string for C API + // H5Aget_name will get buf_size-1 chars of the name to null terminate it + ssize_t name_size = H5Aget_name(id, buf_size, attr_name); - // Calls C routine H5Aget_name to get the name of the attribute - ssize_t name_size = H5Aget_name( id, buf_size, name_C ); + // If H5Aget_name returns a negative value, raise an exception + if (name_size < 0) + { + throw AttributeIException("Attribute::getName", "H5Aget_name failed"); + } + else if (name_size == 0) + { + throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0"); + } - // If H5Aget_name returns a negative value, raise an exception, - if( name_size < 0 ) - { - throw AttributeIException("Attribute::getName", "H5Aget_name failed"); - } - // otherwise, convert the C attribute name and return - attr_name = name_C; - delete []name_C; - return( name_size ); + return(name_size); } //-------------------------------------------------------------------------- // Function: Attribute::getName -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it returns the -/// attribute's name, not the length. +///\brief Returns the name of this attribute as an \a H5std_string. ///\return Name of the attribute -///\param buf_size - IN: Desired length of the name ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 +// Programmer Binh-Minh Ribler - May, 2004 +// Modification +// Mar 2014 - BMR +// Revised to use the modified getName() above //-------------------------------------------------------------------------- -H5std_string Attribute::getName( size_t buf_size ) const +H5std_string Attribute::getName() const { - H5std_string attr_name; - ssize_t name_size = getName( buf_size, attr_name ); - return( attr_name ); - // let caller catch exception if any + H5std_string attr_name(""); // attribute name to return + + // Preliminary call to get the size of the attribute name + ssize_t name_size = H5Aget_name(id, (size_t)0, NULL); + + // If H5Aget_name failed, throw exception + if (name_size < 0) + { + throw AttributeIException("Attribute::getName", "H5Aget_name failed"); + } + else if (name_size == 0) + { + throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0"); + } + // If attribute's name exists, calls C routine again to get it + else if (name_size > 0) + { + char* name_C = new char[name_size+1]; // temporary C-string + HDmemset(name_C, 0, name_size+1); // clear buffer + + // Use overloaded function + name_size = getName(name_C, name_size+1); + + // Convert the C attribute name to return + attr_name = name_C; + + // Clean up resource + delete []name_C; + + } + // Return attribute's name + return(attr_name); } //-------------------------------------------------------------------------- // Function: Attribute::getName -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above functions in that it doesn't take -/// any arguments and returns the attribute's name. -///\return Name of the attribute +///\brief Gets the name of this attribute, returning its length. +///\param attr_name - OUT: Buffer for the name string as \a H5std_string +///\param len - IN: Desired length of the name, default to 0 +///\return Actual length of the attribute name ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - May, 2004 +///\par Description +/// This function retrieves the attribute's name as a string. The +/// buf_size can specify a specific length or default to 0, in +/// which case the entire name will be retrieved. +// Programmer Binh-Minh Ribler - Nov, 2001 +// Modification +// Mar 2014 - BMR +// Revised to allow buf_size to be skipped //-------------------------------------------------------------------------- -H5std_string Attribute::getName() const +ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const { - // Try with 256 characters for the name first, if the name's length - // returned is more than that then, read the name again with the - // appropriate space allocation - char* name_C = new char[256]; // temporary C-string for C API - ssize_t name_size = H5Aget_name(id, 255, name_C); + ssize_t name_size = 0; + + // If no length is provided, get the entire attribute name + if (len == 0) + { + attr_name = getName(); + name_size = attr_name.length(); + } + // If length is provided, get that number of characters in name + else + { + char* name_C = new char[len+1]; // temporary C-string + HDmemset(name_C, 0, len+1); // clear buffer - H5std_string attr_name; - if (name_size >= 256) - name_size = getName(name_size, attr_name); + // Use overloaded function + name_size = getName(name_C, len+1); - // otherwise, convert the C attribute name and return - else - attr_name = name_C; + // Convert the C attribute name to return + attr_name = name_C; + + // Clean up resource + delete []name_C; + } + // Otherwise, keep attr_name intact - delete []name_C; - return( attr_name ); + // Return name size + return(name_size); } //-------------------------------------------------------------------------- diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index dbfbbb2..8332632 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -38,9 +38,9 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent { H5std_string getFileName() const; // Gets the name of this attribute. - ssize_t getName( size_t buf_size, H5std_string& attr_name ) const; - H5std_string getName( size_t buf_size ) const; // returns name, not its length - H5std_string getName() const; // returns name, no argument + ssize_t getName(char* attr_name, size_t buf_size = 0) const; + ssize_t getName(H5std_string& attr_name, size_t buf_size = 0) const; + H5std_string getName() const; // Gets a copy of the dataspace for this attribute. virtual DataSpace getSpace() const; @@ -60,7 +60,7 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent { void write(const DataType& mem_type, const H5std_string& strg ) const; // Flushes all buffers associated with the file specified by this - // attribute to disk + // attribute to disk. void flush( H5F_scope_t scope ) const; ///\brief Returns this class name. diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 3bf4b4f..fc8b08d 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -436,6 +436,7 @@ H5std_string CommonFG::getLinkval( const char* name, size_t size ) const if (val_size > 0) { value_C = new char[val_size+1]; // temporary C-string for C API + HDmemset(value_C, 0, val_size+1); // clear buffer ret_value = H5Lget_val(getLocId(), name, value_C, val_size, H5P_DEFAULT); if( ret_value < 0 ) @@ -881,6 +882,8 @@ H5std_string CommonFG::getObjnameByIdx(hsize_t idx) const // now, allocate C buffer to get the name char* name_C = new char[name_len+1]; + HDmemset(name_C, 0, name_len+1); // clear buffer + name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len+1, H5P_DEFAULT); // clean up and return the string @@ -924,8 +927,10 @@ ssize_t CommonFG::getObjnameByIdx(hsize_t idx, char* name, size_t size) const //-------------------------------------------------------------------------- ssize_t CommonFG::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const { - char* name_C = new char[size]; - ssize_t name_len = getObjnameByIdx(idx, name_C, size); + char* name_C = new char[size+1]; // temporary C-string for object name + HDmemset(name_C, 0, size+1); // clear buffer + + ssize_t name_len = getObjnameByIdx(idx, name_C, size+1); if(name_len < 0) throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index df73d9b..191f004 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -123,7 +123,7 @@ H5std_string CompType::getMemberName( unsigned member_num ) const "H5Tget_member_name returns NULL for member name"); } H5std_string member_name = H5std_string(member_name_C); // convert C string to string - HDfree(member_name_C); // free the C string + H5free_memory(member_name_C); // free the C string return( member_name ); // return the member name string } @@ -451,6 +451,25 @@ void CompType::pack() const } //-------------------------------------------------------------------------- +// Function: CompType::setSize +///\brief Sets the total size for this compound datatype. +///\param size - IN: Size to set +///\exception H5::DataTypeIException +// Note +// H5Tset_size works on atom datatypes and compound datatypes only +// Programmer Binh-Minh Ribler - 2014 +//-------------------------------------------------------------------------- +void CompType::setSize(size_t size) const +{ + // Call C routine H5Tset_size to set the total size + herr_t ret_value = H5Tset_size(id, size); + if (ret_value < 0) + { + throw DataTypeIException("CompType::setSize", "H5Tset_size failed"); + } +} + +//-------------------------------------------------------------------------- // Function: CompType destructor ///\brief Properly terminates access to this compound datatype. // Programmer Binh-Minh Ribler - 2000 diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 3d6a62f..bd6d76c 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -98,6 +98,9 @@ class H5_DLLCPP CompType : public DataType { // Recursively removes padding from within this compound datatype. void pack() const; + // Sets the total size for this compound datatype. + void setSize(size_t size) const; + ///\brief Returns this class name. virtual H5std_string fromClass () const { return("CompType"); } diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 0722ef9..699f982 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -629,7 +629,7 @@ hid_t DataSet::getId() const //-------------------------------------------------------------------------- // Function: DataSet::p_read_fixed_len (private) -// brief Reads a fixed length \a H5std_string from an dataset. +// brief Reads a fixed length \a H5std_string from a dataset. // param mem_type - IN: DataSet datatype (in memory) // param strg - IN: Buffer for read string // exception H5::DataSetIException @@ -643,14 +643,14 @@ void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id // Only allocate for fixed-len string. // Get the size of the dataset's data - size_t attr_size = getInMemDataSize(); + size_t data_size = getInMemDataSize(); // If there is data, allocate buffer and read it. - if (attr_size > 0) + if (data_size > 0) { - char *strg_C = NULL; + char *strg_C = new char [data_size+1]; + HDmemset(strg_C, 0, data_size+1); // clear buffer - strg_C = new char [(size_t)attr_size+1]; herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C); if( ret_value < 0 ) diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 00aa5f4..4c3cc62 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -563,7 +563,7 @@ H5std_string DataType::getTag() const if( tag_Cstr != NULL ) { H5std_string tag = H5std_string(tag_Cstr); // C string to string object - HDfree(tag_Cstr); // free the C string + H5free_memory(tag_Cstr); // free the C string return (tag); // return the tag } else diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index bc3e0af..c58eeda 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -20,6 +20,17 @@ #include "H5IdComponent.h" #include "H5PropList.h" #include "H5DxferProp.h" +#include "H5private.h" // for HDmemset + +#include <iostream> + +#ifndef H5_NO_NAMESPACE +#ifndef H5_NO_STD + using std::cerr; + using std::endl; +#endif // H5_NO_STD +#endif + #ifndef H5_NO_NAMESPACE namespace H5 { @@ -39,6 +50,17 @@ const DSetMemXferPropList DSetMemXferPropList::DEFAULT; DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {} //-------------------------------------------------------------------------- +// Function DSetMemXferPropList constructor +///\brief Creates a dataset transfer property list with transform +/// expression. +// Programmer: Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET_XFER) +{ + setDataTransform(exp); +} + +//-------------------------------------------------------------------------- // Function DSetMemXferPropList copy constructor ///\brief Copy constructor: makes a copy of the original /// DSetMemXferPropList object @@ -175,7 +197,110 @@ void DSetMemXferPropList::getBtreeRatios( double& left, double& middle, double& } //-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setTypeConvCB +// Function: DSetMemXferPropList::setDataTransform +///\brief Sets data transform expression. +///\param expression - IN: null-terminated data transform expression (char*) +///\exception H5::PropListIException +// Programmer: Binh-Minh Ribler - Mar, 2014 +//-------------------------------------------------------------------------- +void DSetMemXferPropList::setDataTransform(const char* expression) const +{ + herr_t ret_value = H5Pset_data_transform( id, expression); + if( ret_value < 0 ) + { + throw PropListIException("DSetMemXferPropList::setDataTransform", + "H5Pset_data_transform failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: DSetMemXferPropList::setDataTransform +///\brief This is an overloaded member function, provided for convenience. +/// It takes a reference to a \c H5std_string for the expression. +///\param expression - IN: H5std_string data transform expression +///\exception H5::PropListIException +// Programmer: Binh-Minh Ribler - Mar, 2014 +//-------------------------------------------------------------------------- +void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const +{ + setDataTransform(expression.c_str()); +} + +//-------------------------------------------------------------------------- +// Function: DSetMemXferPropList::getDataTransform +///\brief Sets data transform expression. +///\param expression - OUT: buffer for data transform expression (char*) +///\param buf_size - IN: size of buffer for expression, including the +/// null terminator +///\exception H5::PropListIException +// Programmer: Binh-Minh Ribler - Mar, 2014 +//-------------------------------------------------------------------------- +ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const +{ + // H5Pget_data_transform will get buf_size characters of the expression + // including the null terminator + ssize_t exp_len; + exp_len = H5Pget_data_transform(id, exp, buf_size); + + // H5Pget_data_transform returns a negative value, raise an exception + if (exp_len < 0) + { + throw PropListIException("DSetMemXferPropList::getDataTransform", + "H5Pget_data_transform failed"); + } + + // H5Pget_data_transform will put a null terminator at the end of the + // expression or at [buf_size-1] if the expression is at least the size + // of the buffer. + + // Return the expression length, which might be different from buf_size + return(exp_len); +} + +//-------------------------------------------------------------------------- +// Function: DSetMemXferPropList::getDataTransform +///\brief This is an overloaded member function, provided for convenience. +/// It takes no parameter and returns a \c H5std_string for the expression. +///\exception H5::PropListIException +// Programmer: Binh-Minh Ribler - Mar, 2014 +//-------------------------------------------------------------------------- +H5std_string DSetMemXferPropList::getDataTransform() const +{ + // Initialize string to "", so that if there is no expression, the returned + // string will be empty + H5std_string expression(""); + + // Preliminary call to get the expression's length + ssize_t exp_len = H5Pget_data_transform(id, NULL, (size_t)0); + + // If H5Pget_data_transform returns a negative value, raise an exception + if (exp_len < 0) + { + throw PropListIException("DSetMemXferPropList::getDataTransform", "H5Pget_data_transform failed"); + } + + // If expression exists, calls C routine again to get it + else if (exp_len > 0) + { + // Temporary buffer for char* expression + char* exp_C = new char[exp_len+1]; + HDmemset(exp_C, 0, exp_len+1); // clear buffer + + // Used overloaded function + exp_len = getDataTransform(exp_C, exp_len+1); + + // Convert the C expression to return + expression = exp_C; + + // Clean up resource + delete []exp_C; + } + // Return the string expression + return(expression); +} + +//-------------------------------------------------------------------------- +// Function: DSetMemXferPropList::getTypeConvCB ///\brief Sets an exception handling callback for datatype conversion /// for a dataset transfer property list. ///\param op - IN: User's function diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index 3c2a616..8149b8e 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -32,6 +32,9 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { // Creates a dataset memory and transfer property list. DSetMemXferPropList(); + // Creates a dataset transform property list. + DSetMemXferPropList(const char* expression); + // Sets type conversion and background buffers. void setBuffer( size_t size, void* tconv, void* bkg ) const; @@ -44,6 +47,16 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { // Gets B-tree split ratios for a dataset transfer property list. void getBtreeRatios( double& left, double& middle, double& right ) const; + // Sets data transform expression. + void setDataTransform(const char* expression) const; + void setDataTransform(const H5std_string& expression) const; + + // Gets data transform expression. + ssize_t getDataTransform(char* exp, size_t buf_size=0) const; + H5std_string getDataTransform() const; + //H5std_string getDataTransform(const size_t buf_size=0) const; + // this will collide with the first one when exp=NULL + // Sets the dataset transfer property list status to TRUE or FALSE. void setPreserve( bool status ) const; diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index ff632af..04bb9e0 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -30,6 +30,7 @@ #include "H5AtomType.h" #include "H5IntType.h" #include "H5EnumType.h" +#include "H5private.h" // for HDmemset #ifndef H5_NO_NAMESPACE namespace H5 { @@ -150,6 +151,7 @@ void EnumType::insert( const H5std_string& name, void *value ) const H5std_string EnumType::nameOf( void *value, size_t size ) const { char* name_C = new char[size+1]; // temporary C-string for C API + HDmemset(name_C, 0, size+1); // clear buffer // Calls C routine H5Tenum_nameof to get the name of the specified enum type herr_t ret_value = H5Tenum_nameof( id, value, name_C, size ); @@ -160,7 +162,7 @@ H5std_string EnumType::nameOf( void *value, size_t size ) const throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed"); } // otherwise, create the string to hold the datatype name and return it - H5std_string name = H5std_string(name_C); + H5std_string name(name_C); delete []name_C; return( name ); } diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 8513372..492abed 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -312,7 +312,7 @@ void Exception::printError( FILE* stream ) const ///\brief Noop destructor // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Exception::~Exception() {} +Exception::~Exception() throw() {} //-------------------------------------------------------------------------- // Subclass: FileIException @@ -335,7 +335,7 @@ FileIException::FileIException(const H5std_string& func_name, const H5std_string // Function: FileIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -FileIException::~FileIException() {} +FileIException::~FileIException() throw() {} //-------------------------------------------------------------------------- // Subclass: GroupIException @@ -358,7 +358,7 @@ GroupIException::GroupIException(const H5std_string& func_name, const H5std_stri // Function: GroupIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -GroupIException::~GroupIException() {} +GroupIException::~GroupIException() throw() {} //-------------------------------------------------------------------------- // Subclass: DataSpaceIException @@ -381,7 +381,7 @@ DataSpaceIException::DataSpaceIException(const H5std_string& func_name, const H5 // Function: DataSpaceIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataSpaceIException::~DataSpaceIException() {} +DataSpaceIException::~DataSpaceIException() throw() {} //-------------------------------------------------------------------------- // Subclass: DataTypeIException @@ -404,7 +404,7 @@ DataTypeIException::DataTypeIException(const H5std_string& func_name, const H5st // Function: DataTypeIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataTypeIException::~DataTypeIException() {} +DataTypeIException::~DataTypeIException() throw() {} //-------------------------------------------------------------------------- // Subclass: PropListIException @@ -427,7 +427,7 @@ PropListIException::PropListIException(const H5std_string& func_name, const H5st // Function: PropListIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -PropListIException::~PropListIException() {} +PropListIException::~PropListIException() throw() {} //-------------------------------------------------------------------------- // Subclass: DataSetIException @@ -450,7 +450,7 @@ DataSetIException::DataSetIException(const H5std_string& func_name, const H5std_ // Function: DataSetIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataSetIException::~DataSetIException() {} +DataSetIException::~DataSetIException() throw() {} //-------------------------------------------------------------------------- // Subclass: AttributeIException @@ -473,7 +473,7 @@ AttributeIException::AttributeIException(const H5std_string& func_name, const H5 // Function: AttributeIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -AttributeIException::~AttributeIException() {} +AttributeIException::~AttributeIException() throw() {} //-------------------------------------------------------------------------- // Subclass: ReferenceException @@ -496,7 +496,7 @@ ReferenceException::ReferenceException(const H5std_string& func_name, const H5st // Function: ReferenceException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -ReferenceException::~ReferenceException() {} +ReferenceException::~ReferenceException() throw() {} //-------------------------------------------------------------------------- // Subclass: LibraryIException @@ -519,7 +519,30 @@ LibraryIException::LibraryIException(const H5std_string& func_name, const H5std_ // Function: LibraryIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -LibraryIException::~LibraryIException() {} +LibraryIException::~LibraryIException() throw() {} + +//-------------------------------------------------------------------------- +// Subclass: LocationException +// Programmer Binh-Minh Ribler - 2014 +//-------------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Function: LocationException default constructor +///\brief Default constructor. +//-------------------------------------------------------------------------- +LocationException::LocationException():Exception(){} +//-------------------------------------------------------------------------- +// Function: LocationException overloaded constructor +///\brief Creates a LocationException with the name of the function, +/// in which the failure occurs, and an optional detailed message. +///\param func_name - IN: Name of the function where failure occurs +///\param message - IN: Message on the failure +//-------------------------------------------------------------------------- +LocationException::LocationException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {} +//-------------------------------------------------------------------------- +// Function: LocationException destructor +///\brief Noop destructor. +//-------------------------------------------------------------------------- +LocationException::~LocationException() throw() {} //-------------------------------------------------------------------------- // Subclass: IdComponentException @@ -542,7 +565,7 @@ IdComponentException::IdComponentException(const H5std_string& func_name, const // Function: IdComponentException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -IdComponentException::~IdComponentException() {} +IdComponentException::~IdComponentException() throw() {} #ifndef H5_NO_NAMESPACE } // end namespace #endif diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 30fe537..7d71022 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -81,7 +81,7 @@ class H5_DLLCPP Exception { Exception( const Exception& orig); // virtual Destructor - virtual ~Exception(); + virtual ~Exception() throw(); protected: // Default value for detail_message @@ -96,70 +96,77 @@ class H5_DLLCPP FileIException : public Exception { public: FileIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); FileIException(); - virtual ~FileIException(); + virtual ~FileIException() throw(); }; class H5_DLLCPP GroupIException : public Exception { public: GroupIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); GroupIException(); - virtual ~GroupIException(); + virtual ~GroupIException() throw(); }; class H5_DLLCPP DataSpaceIException : public Exception { public: DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); DataSpaceIException(); - virtual ~DataSpaceIException(); + virtual ~DataSpaceIException() throw(); }; class H5_DLLCPP DataTypeIException : public Exception { public: DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); DataTypeIException(); - virtual ~DataTypeIException(); + virtual ~DataTypeIException() throw(); }; class H5_DLLCPP PropListIException : public Exception { public: PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); PropListIException(); - virtual ~PropListIException(); + virtual ~PropListIException() throw(); }; class H5_DLLCPP DataSetIException : public Exception { public: DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); DataSetIException(); - virtual ~DataSetIException(); + virtual ~DataSetIException() throw(); }; class H5_DLLCPP AttributeIException : public Exception { public: AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); AttributeIException(); - virtual ~AttributeIException(); + virtual ~AttributeIException() throw(); }; class H5_DLLCPP ReferenceException : public Exception { public: ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); ReferenceException(); - virtual ~ReferenceException(); + virtual ~ReferenceException() throw(); }; class H5_DLLCPP LibraryIException : public Exception { public: LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); LibraryIException(); - virtual ~LibraryIException(); + virtual ~LibraryIException() throw(); +}; + +class H5_DLLCPP LocationException : public Exception { + public: + LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); + LocationException(); + virtual ~LocationException() throw(); }; class H5_DLLCPP IdComponentException : public Exception { public: IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); IdComponentException(); - virtual ~IdComponentException(); + virtual ~IdComponentException() throw(); }; #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 5b56f6e..5dd108f 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -67,14 +67,6 @@ class H5_DLLCPP FileAccPropList : public PropList { void setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const; -#ifdef H5_HAVE_STREAM // for Stream Virtual File Driver - // Modifies this file access property list to use the Stream driver. - void setStream(H5FD_stream_fapl_t &fapl) const; - - // Retrieves the streaming I/O driver settings - H5FD_stream_fapl_t getStream() const; -#endif - // Sets the maximum size of the data sieve buffer. void setSieveBufSize(size_t bufsize) const; diff --git a/c++/src/H5File.h b/c++/src/H5File.h index c035132..847863f 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -78,7 +78,14 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { // Reopens this file. void reOpen(); // added for better name - void reopen(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + void reopen(); // obsolete in favor of reOpen() + + // Gets the file id + virtual hid_t getLocId() const; + +#endif // DOXYGEN_SHOULD_SKIP_THIS ///\brief Returns this class name. virtual H5std_string fromClass () const { return("H5File"); } @@ -86,9 +93,6 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { // Throw file exception. virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const; - // Gets the file id - virtual hid_t getLocId() const; - // Default constructor H5File(); diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 78f5f17..1bd9882 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -42,8 +42,6 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // 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); // default constructor diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index c60d05c..cdf4272 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -25,6 +25,7 @@ #include "H5Library.h" #include "H5IdComponent.h" #include "H5DataSpace.h" +#include "H5private.h" // for HDmemset #ifndef H5_NO_NAMESPACE namespace H5 { @@ -289,6 +290,8 @@ H5std_string IdComponent::p_get_file_name() const // Call H5Fget_name again to get the actual file name char* name_C = new char[name_size+1]; // temporary C-string for C API + HDmemset(name_C, 0, name_size+1); // clear buffer + name_size = H5Fget_name(temp_id, name_C, name_size+1); // Check for failure again diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index b413a17..acd5033 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -32,6 +32,7 @@ #include "H5File.h" #include "H5DataSet.h" #include "H5Attribute.h" +#include "H5private.h" // for HDmemset #ifndef H5_NO_NAMESPACE namespace H5 { @@ -355,7 +356,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 LocationException(inMemFunc("flush"), "H5Fflush failed"); } } @@ -363,7 +364,7 @@ void H5Location::flush(H5F_scope_t scope) const // Function: H5Location::getFileName ///\brief Gets the name of the file, in which this HDF5 object belongs. ///\return File name -///\exception H5::IdComponentException +///\exception H5::LocationException // Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string H5Location::getFileName() const @@ -371,7 +372,7 @@ H5std_string H5Location::getFileName() const try { return(p_get_file_name()); } - catch (IdComponentException E) { + catch (LocationException E) { throw FileIException(inMemFunc("getFileName"), E.getDetailMsg()); } } @@ -381,7 +382,7 @@ H5std_string H5Location::getFileName() const ///\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 +///\exception H5::LocationException ///\par Description /// If \a comment is an empty string or a null pointer, the comment /// message is removed from the object. @@ -400,7 +401,7 @@ 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"); + throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); } //-------------------------------------------------------------------------- @@ -427,7 +428,7 @@ 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"); + throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); } //-------------------------------------------------------------------------- @@ -446,7 +447,7 @@ void H5Location::setComment(const H5std_string& comment) const // Function: H5Location::removeComment ///\brief Removes the comment from an object specified by its name. ///\param name - IN: Name of the object -///\exception H5::Exception +///\exception H5::LocationException // 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 @@ -457,7 +458,7 @@ 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"); + throw LocationException(inMemFunc("removeComment"), "H5Oset_comment_by_name failed"); } //-------------------------------------------------------------------------- @@ -474,52 +475,90 @@ void H5Location::removeComment(const H5std_string& name) const //-------------------------------------------------------------------------- // 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 +///\brief Retrieves the comment for this location, returning its length. +///\param name - IN: Name of the object +///\param buf_size - IN: Length of the comment to retrieve +///\param comment - OUT: Retrieved comment +///\return Actual length of the comment +///\exception H5::LocationException +///\par Description +/// This function retrieves \a buf_size characters of the comment +/// including the null terminator. Thus, if the actual length +/// of the comment is more than buf_size-1, the retrieved comment +/// will be truncated to accommodate the null terminator. +// Programmer Binh-Minh Ribler - Mar 2014 +//-------------------------------------------------------------------------- +ssize_t H5Location::getComment(const char* name, const size_t buf_size, char* comment) const +{ + // H5Oget_comment_by_name will get buf_size chars of the comment including + // the null terminator + ssize_t comment_len; + comment_len = H5Oget_comment_by_name(getId(), name, comment, buf_size, H5P_DEFAULT); + + // If H5Oget_comment_by_name returns a negative value, raise an exception + if (comment_len < 0) + { + throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed"); + } + // If the comment is longer than the provided buffer size, the C library + // will not null terminate it + if (comment_len >= buf_size) + comment[buf_size-1] = '\0'; + + // Return the actual comment length, which might be different from buf_size + return(comment_len); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getComment +///\brief Returns the comment as \a string for this location, +/// returning its length. +///\param name - IN: Name of the object +///\param buf_size - IN: Length of the comment to retrieve, default to 0 ///\return Comment string -///\exception H5::Exception +///\exception H5::LocationException // 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 +H5std_string H5Location::getComment(const char* name, const size_t buf_size) const { - // bufsize is default to 256 - // temporary variable - hid_t loc_id = getId(); // temporary variable + // Initialize string to "", so that if there is no comment, the returned + // string will be empty + H5std_string comment(""); - // 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); + // Preliminary call to get the comment's length + ssize_t comment_len = H5Oget_comment_by_name(getId(), name, NULL, (size_t)0, 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 a negative value, raise an exception + if (comment_len < 0) + { + throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed"); + } - // 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"); - } + // If comment exists, calls C routine again to get it + else if (comment_len > 0) + { + size_t tmp_len = buf_size; - H5std_string comment = H5std_string(comment_C); - delete []comment_C; - return (comment); + // If buffer size is not provided, use comment length + if (tmp_len == 0) + tmp_len = comment_len; + + // Temporary buffer for char* comment + char* comment_C = new char[tmp_len+1]; + HDmemset(comment_C, 0, tmp_len+1); // clear buffer + + // Used overloaded function + ssize_t comment_len = getComment(name, tmp_len+1, comment_C); + + // Convert the C comment to return + comment = comment_C; + + // Clean up resource + delete []comment_C; + } + + // Return the string comment + return(comment); } //-------------------------------------------------------------------------- @@ -529,9 +568,9 @@ H5std_string H5Location::getComment(const char* name, size_t bufsize) const /// \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 +H5std_string H5Location::getComment(const H5std_string& name, const size_t buf_size) const { - return(getComment(name.c_str(), bufsize)); + return(getComment(name.c_str(), buf_size)); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -542,7 +581,7 @@ H5std_string H5Location::getComment(const H5std_string& name, size_t bufsize) co // 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 +// Exception H5::ReferenceException // 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 diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index bbe86fc..05acc7c 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -104,8 +104,9 @@ class H5_DLLCPP H5Location : public IdComponent { 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; + ssize_t getComment(const char* name, const size_t buf_size, char* comment) const; + H5std_string getComment(const char* name, const size_t buf_size=0) const; + H5std_string getComment(const H5std_string& name, const size_t buf_size=0) const; // Removes the comment for the HDF5 object specified by its name. void removeComment(const char* name) const; diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 9476d46..0b740d8 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -390,8 +390,13 @@ void PropList::getProperty(const char* name, void* value) const //-------------------------------------------------------------------------- H5std_string PropList::getProperty(const char* name) const { + // Get property size first size_t size = getPropSize(name); + + // Allocate buffer then get the property char* prop_strg_C = new char[size+1]; // temporary C-string for C API + HDmemset(prop_strg_C, 0, size+1); // clear buffer + herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API // Throw exception if H5Pget returns failure @@ -485,7 +490,7 @@ H5std_string PropList::getClassName() const if (temp_str != NULL) { H5std_string class_name(temp_str); - HDfree(temp_str); + H5free_memory(temp_str); return(class_name); } else diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index 759b4a7..9ff2e66 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -22,7 +22,7 @@ include $(top_srcdir)/config/commence.am include $(top_srcdir)/config/lt_vers.am # Include src directory -INCLUDES=-I$(top_srcdir)/src +AM_CPPFLAGS+=-I$(top_srcdir)/src # This is our main target lib_LTLIBRARIES=libhdf5_cpp.la diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 8f303f3..7344600 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -34,23 +34,51 @@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -69,12 +97,12 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/h5c++.in \ - $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \ - $(top_srcdir)/config/commence.am \ - $(top_srcdir)/config/conclude.am \ - $(top_srcdir)/config/lt_vers.am +DIST_COMMON = $(top_srcdir)/config/commence.am \ + $(top_srcdir)/config/lt_vers.am \ + $(top_srcdir)/config/conclude.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/bin/mkinstalldirs \ + $(srcdir)/h5c++.in $(top_srcdir)/bin/depcomp \ + $(include_HEADERS) $(top_srcdir)/bin/test-driver # Shared C++ libraries aren't universally supported. @CXX_SHARED_CONDITIONAL_FALSE@am__append_1 = -static @@ -179,12 +207,198 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no -am__tty_colors = $(am__tty_colors_dummy) +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red='[0;31m'; \ + grn='[0;32m'; \ + lgn='[1;32m'; \ + blu='[1;34m'; \ + mgn='[0;35m'; \ + brg='[1m'; \ + std='[m'; \ + fi; \ +} +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.sh.log=.log) +SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver +SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ @@ -196,7 +410,9 @@ AMTAR = @AMTAR@ # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ -AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ + +# Include src directory +AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ @@ -256,7 +472,6 @@ FC_VERSION = @FC_VERSION@ FGREP = @FGREP@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ -GPFS = @GPFS@ GREP = @GREP@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ @@ -469,12 +684,9 @@ 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 = 162 +LT_VERS_REVISION = 166 LT_VERS_AGE = 0 -# Include src directory -INCLUDES = -I$(top_srcdir)/src - # This is our main target lib_LTLIBRARIES = libhdf5_cpp.la @@ -535,7 +747,7 @@ TEST_SCRIPT_PARA_CHKSH = $(TEST_SCRIPT_PARA:=.chkexe_) all: all-am .SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj +.SUFFIXES: .cpp .lo .log .o .obj .sh .sh$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/lt_vers.am $(top_srcdir)/config/conclude.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -569,6 +781,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): h5c++: $(top_builddir)/config.status $(srcdir)/h5c++.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ @@ -603,6 +816,7 @@ clean-libLTLIBRARIES: echo rm -f $${locs}; \ rm -f $${locs}; \ } + libhdf5_cpp.la: $(libhdf5_cpp_la_OBJECTS) $(libhdf5_cpp_la_DEPENDENCIES) $(EXTRA_libhdf5_cpp_la_DEPENDENCIES) $(AM_V_CXXLD)$(libhdf5_cpp_la_LINK) -rpath $(libdir) $(libhdf5_cpp_la_OBJECTS) $(libhdf5_cpp_la_LIBADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @@ -723,26 +937,15 @@ uninstall-includeHEADERS: files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -754,15 +957,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -771,9 +970,10 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am -cscopelist: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP)'; \ +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ @@ -789,6 +989,151 @@ cscopelist: $(HEADERS) $(SOURCES) $(LISP) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + else \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 +recheck: all + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +.sh.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.sh$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -847,6 +1192,9 @@ install-strip: "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: @@ -932,20 +1280,21 @@ uninstall-am: uninstall-binSCRIPTS uninstall-includeHEADERS \ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ - clean clean-generic clean-libLTLIBRARIES clean-libtool \ - 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-binSCRIPTS \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ +.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \ + check-am clean clean-generic clean-libLTLIBRARIES \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binSCRIPTS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am \ install-includeHEADERS 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 \ + pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am \ uninstall-binSCRIPTS uninstall-includeHEADERS \ uninstall-libLTLIBRARIES |