Fixed VC7.1-STLport config setup so it works with /Zc:wchar_t

Re-ordered code in static_mutex.hpp to satisfy SGI IRIX.
Added some additional #includes to satisfy SGI Irix.
Fixed strange bug where some non-greedy repeats could repeat more times than permitted.
Fixed return value from basic_regex<>::empty().
Fixed return value from basic_regex<>::expression() and basic_regex<>::size() when the expression is invalid.


[SVN r30604]
This commit is contained in:
John Maddock
2005-08-19 16:10:11 +00:00
parent b16a3f252a
commit 676e58601e
7 changed files with 28 additions and 17 deletions

View File

@ -144,7 +144,7 @@
* of the non-inline functions in the library, so that users can still link to the lib, * of the non-inline functions in the library, so that users can still link to the lib,
* irrespective of whether their own code is built with /Zc:wchar_t. * irrespective of whether their own code is built with /Zc:wchar_t.
*/ */
#if defined(__cplusplus) && (defined(BOOST_MSVC) || defined(__ICL)) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(BOOST_WINDOWS) #if defined(__cplusplus) && (defined(BOOST_MSVC) || defined(__ICL)) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(BOOST_WINDOWS) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
# define BOOST_REGEX_HAS_OTHER_WCHAR_T # define BOOST_REGEX_HAS_OTHER_WCHAR_T
# ifdef BOOST_MSVC # ifdef BOOST_MSVC
# pragma warning(push) # pragma warning(push)

View File

@ -52,8 +52,14 @@ class BOOST_REGEX_DECL scoped_static_mutex_lock
public: public:
scoped_static_mutex_lock(static_mutex& mut, bool lk = true); scoped_static_mutex_lock(static_mutex& mut, bool lk = true);
~scoped_static_mutex_lock(); ~scoped_static_mutex_lock();
operator void const*()const; inline bool locked()const
bool locked()const; {
return m_have_lock;
}
inline operator void const*()const
{
return locked() ? this : 0;
}
void lock(); void lock();
void unlock(); void unlock();
private: private:
@ -61,15 +67,6 @@ private:
bool m_have_lock; bool m_have_lock;
}; };
inline scoped_static_mutex_lock::operator void const*()const
{
return locked() ? this : 0;
}
inline bool scoped_static_mutex_lock::locked()const
{
return m_have_lock;
}
} // namespace boost } // namespace boost
#elif defined(BOOST_HAS_WINTHREADS) #elif defined(BOOST_HAS_WINTHREADS)

View File

@ -49,9 +49,9 @@ struct regex_data
regex_data(const ::boost::shared_ptr< regex_data(const ::boost::shared_ptr<
::boost::regex_traits_wrapper<traits> >& t) ::boost::regex_traits_wrapper<traits> >& t)
: m_ptraits(t) {} : m_ptraits(t), m_expression(0), m_expression_len(0) {}
regex_data() regex_data()
: m_ptraits(new ::boost::regex_traits_wrapper<traits>()) {} : m_ptraits(new ::boost::regex_traits_wrapper<traits>()), m_expression(0), m_expression_len(0) {}
::boost::shared_ptr< ::boost::shared_ptr<
::boost::regex_traits_wrapper<traits> ::boost::regex_traits_wrapper<traits>
@ -375,7 +375,7 @@ public:
// empty: // empty:
bool BOOST_REGEX_CALL empty()const bool BOOST_REGEX_CALL empty()const
{ {
return (m_pimpl.get() ? 0 != m_pimpl->status() : 0); return (m_pimpl.get() ? 0 != m_pimpl->status() : true);
} }
size_type BOOST_REGEX_CALL mark_count()const size_type BOOST_REGEX_CALL mark_count()const

View File

@ -734,6 +734,14 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state)
// Oops error: // Oops error:
if(0 == this->m_pdata->m_status) // update the error code if not already set if(0 == this->m_pdata->m_status) // update the error code if not already set
this->m_pdata->m_status = boost::regex_constants::error_brack; this->m_pdata->m_status = boost::regex_constants::error_brack;
//
// clear the expression, we should be empty:
//
this->m_pdata->m_expression = 0;
this->m_pdata->m_expression_len = 0;
//
// and throw if required:
//
if(0 == (this->flags() & regex_constants::no_except)) if(0 == (this->flags() & regex_constants::no_except))
{ {
std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_brack); std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_brack);

View File

@ -39,6 +39,8 @@
#include <boost/regex/pending/object_cache.hpp> #include <boost/regex/pending/object_cache.hpp>
#endif #endif
#include <istream>
#ifdef BOOST_HAS_ABI_HEADERS #ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX # include BOOST_ABI_PREFIX
#endif #endif

View File

@ -61,6 +61,7 @@ typedef HANDLE _fi_find_handle;
#elif defined(BOOST_REGEX_FI_POSIX_DIR) #elif defined(BOOST_REGEX_FI_POSIX_DIR)
#include <cstddef>
#include <cstdio> #include <cstdio>
#include <cctype> #include <cctype>
#include <iterator> #include <iterator>

View File

@ -517,8 +517,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_rep()
// try and skip the repeat if we can: // try and skip the repeat if we can:
if(take_second) if(take_second)
{ {
// store position in case we fail: if((next_count->get_count() < rep->max) && take_first)
push_non_greedy_repeat(rep->next.p); {
// store position in case we fail:
push_non_greedy_repeat(rep->next.p);
}
pstate = rep->alt.p; pstate = rep->alt.p;
return true; return true;
} }