diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 47f3de94..6a21561d 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -169,7 +169,8 @@ rule check-icu-config ( ) if [ check-icu-config ] { - BOOST_REGEX_ICU_OPTS = "BOOST_HAS_ICU=1" ; + BOOST_REGEX_ICU_OPTS = "freebsd:/usr/local/include" ; + BOOST_REGEX_ICU_OPTS += "BOOST_HAS_ICU=1" ; if $(ICU_PATH) { @@ -259,3 +260,4 @@ boost-install boost_regex ; + diff --git a/include/boost/regex/concepts.hpp b/include/boost/regex/concepts.hpp index 99c6eea5..0a22aebd 100644 --- a/include/boost/regex/concepts.hpp +++ b/include/boost/regex/concepts.hpp @@ -87,12 +87,12 @@ struct regex_traits_architype public: regex_traits_architype(); typedef charT char_type; - typedef std::size_t size_type; + // typedef std::size_t size_type; typedef std::vector string_type; typedef copy_constructible_archetype > locale_type; typedef bitmask_archetype char_class_type; - static size_type length(const char_type* ) { return 0; } + static std::size_t length(const char_type* ) { return 0; } charT translate(charT ) const { return charT(); } charT translate_nocase(charT ) const { return static_object::get(); } @@ -163,21 +163,21 @@ struct RegexTraitsConcept RegexTraitsConcept(); // required typedefs: typedef typename traits::char_type char_type; - typedef typename traits::size_type size_type; + // typedef typename traits::size_type size_type; typedef typename traits::string_type string_type; typedef typename traits::locale_type locale_type; typedef typename traits::char_class_type char_class_type; void constraints() { - function_requires >(); + //function_requires >(); function_requires >(); function_requires >(); function_requires >(); function_requires >(); function_requires >(); - size_type n = traits::length(m_pointer); + std::size_t n = traits::length(m_pointer); ignore_unused_variable_warning(n); char_type c = m_ctraits.translate(m_char); diff --git a/include/boost/regex/icu.hpp b/include/boost/regex/icu.hpp index 53941b64..7af1d678 100644 --- a/include/boost/regex/icu.hpp +++ b/include/boost/regex/icu.hpp @@ -355,7 +355,7 @@ inline u32regex make_u32regex(const wchar_t* p, boost::regex_constants::syntax_o return re_detail::do_make_u32regex(p, p + std::wcslen(p), opt, static_cast const*>(0)); } #endif -#ifndef U_WCHAR_IS_UTF16 +#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) inline u32regex make_u32regex(const UChar* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl) { return re_detail::do_make_u32regex(p, p + u_strlen(p), opt, static_cast const*>(0)); @@ -455,7 +455,7 @@ inline bool u32regex_match(const UChar* p, { return re_detail::do_regex_match(p, p+u_strlen(p), m, e, flags, static_cast const*>(0)); } -#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) +#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) && !defined(BOOST_NO_WREGEX) inline bool u32regex_match(const wchar_t* p, match_results& m, const u32regex& e, @@ -519,7 +519,7 @@ inline bool u32regex_match(const UChar* p, match_results m; return re_detail::do_regex_match(p, p+u_strlen(p), m, e, flags, static_cast const*>(0)); } -#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) +#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) && !defined(BOOST_NO_WREGEX) inline bool u32regex_match(const wchar_t* p, const u32regex& e, match_flag_type flags = match_default) @@ -640,7 +640,7 @@ inline bool u32regex_search(const UChar* p, { return re_detail::do_regex_search(p, p+u_strlen(p), m, e, flags, p, static_cast const*>(0)); } -#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) +#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) && !defined(BOOST_NO_WREGEX) inline bool u32regex_search(const wchar_t* p, match_results& m, const u32regex& e, @@ -701,7 +701,7 @@ inline bool u32regex_search(const UChar* p, match_results m; return re_detail::do_regex_search(p, p+u_strlen(p), m, e, flags, p, static_cast const*>(0)); } -#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) +#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) && !defined(BOOST_NO_WREGEX) inline bool u32regex_search(const wchar_t* p, const u32regex& e, match_flag_type flags = match_default) diff --git a/include/boost/regex/v4/basic_regex.hpp b/include/boost/regex/v4/basic_regex.hpp index 2a8c0c6c..018a30f9 100644 --- a/include/boost/regex/v4/basic_regex.hpp +++ b/include/boost/regex/v4/basic_regex.hpp @@ -191,7 +191,7 @@ class basic_regex : public regbase { public: // typedefs: - typedef typename traits::size_type traits_size_type; + typedef std::size_t traits_size_type; typedef typename traits::string_type traits_string_type; typedef charT char_type; typedef traits traits_type; diff --git a/include/boost/regex/v4/basic_regex_creator.hpp b/include/boost/regex/v4/basic_regex_creator.hpp index 35de0cef..9f2cbeec 100644 --- a/include/boost/regex/v4/basic_regex_creator.hpp +++ b/include/boost/regex/v4/basic_regex_creator.hpp @@ -236,7 +236,7 @@ protected: m_traits; // convenience reference to traits class re_syntax_base* m_last_state; // the last state we added bool m_icase; // true for case insensitive matches - unsigned m_repeater_id; // the id of the next repeater + unsigned m_repeater_id; // the state_id of the next repeater bool m_has_backrefs; // true if there are actually any backrefs unsigned m_backrefs; // bitmask of permitted backrefs boost::uintmax_t m_bad_repeats; // bitmask of repeats we can't deduce a startmap for; @@ -718,8 +718,8 @@ void basic_regex_creator::fixup_pointers(re_syntax_base* state) case syntax_element_char_rep: case syntax_element_short_set_rep: case syntax_element_long_set_rep: - // set the id of this repeat: - static_cast(state)->id = m_repeater_id++; + // set the state_id of this repeat: + static_cast(state)->state_id = m_repeater_id++; // fall through: case syntax_element_alt: std::memset(static_cast(state)->_map, 0, sizeof(static_cast(state)->_map)); @@ -1194,11 +1194,11 @@ bool basic_regex_creator::is_bad_repeat(re_syntax_base* pt) case syntax_element_short_set_rep: case syntax_element_long_set_rep: { - unsigned id = static_cast(pt)->id; - if(id > sizeof(m_bad_repeats) * CHAR_BIT) + unsigned state_id = static_cast(pt)->state_id; + if(state_id > sizeof(m_bad_repeats) * CHAR_BIT) return true; // run out of bits, assume we can't traverse this one. static const boost::uintmax_t one = 1uL; - return m_bad_repeats & (one << id); + return m_bad_repeats & (one << state_id); } default: return false; @@ -1216,10 +1216,10 @@ void basic_regex_creator::set_bad_repeat(re_syntax_base* pt) case syntax_element_short_set_rep: case syntax_element_long_set_rep: { - unsigned id = static_cast(pt)->id; + unsigned state_id = static_cast(pt)->state_id; static const boost::uintmax_t one = 1uL; - if(id <= sizeof(m_bad_repeats) * CHAR_BIT) - m_bad_repeats |= (one << id); + if(state_id <= sizeof(m_bad_repeats) * CHAR_BIT) + m_bad_repeats |= (one << state_id); } default: break; diff --git a/include/boost/regex/v4/cpp_regex_traits.hpp b/include/boost/regex/v4/cpp_regex_traits.hpp index 58c82540..89fe49d8 100644 --- a/include/boost/regex/v4/cpp_regex_traits.hpp +++ b/include/boost/regex/v4/cpp_regex_traits.hpp @@ -799,9 +799,9 @@ typename cpp_regex_traits_implementation::char_class_type if(pos != m_custom_class_names.end()) return pos->second; } - std::size_t id = 1 + re_detail::get_default_class_id(p1, p2); - BOOST_ASSERT(id < sizeof(masks) / sizeof(masks[0])); - return masks[id]; + std::size_t state_id = 1 + re_detail::get_default_class_id(p1, p2); + BOOST_ASSERT(state_id < sizeof(masks) / sizeof(masks[0])); + return masks[state_id]; } #ifdef BOOST_REGEX_BUGGY_CTYPE_FACET diff --git a/include/boost/regex/v4/perl_matcher.hpp b/include/boost/regex/v4/perl_matcher.hpp index 547cb24a..a6e31f77 100644 --- a/include/boost/regex/v4/perl_matcher.hpp +++ b/include/boost/regex/v4/perl_matcher.hpp @@ -248,7 +248,7 @@ class repeater_count { repeater_count** stack; repeater_count* next; - int id; + int state_id; std::size_t count; // the number of iterations so far BidiIterator start_pos; // where the last repeat started public: @@ -256,22 +256,22 @@ public: { stack = s; next = 0; - id = -1; + state_id = -1; count = 0; } repeater_count(int i, repeater_count** s, BidiIterator start) : start_pos(start) { - id = i; + state_id = i; stack = s; next = *stack; *stack = this; - if(id > next->id) + if(state_id > next->state_id) count = 0; else { repeater_count* p = next; - while(p->id != id) + while(p->state_id != state_id) p = p->next; count = p->count; start_pos = p->start_pos; @@ -282,7 +282,7 @@ public: *stack = next; } std::size_t get_count() { return count; } - int get_id() { return id; } + int get_id() { return state_id; } std::size_t operator++() { return ++count; } bool check_null_repeat(const BidiIterator& pos, std::size_t max) { @@ -331,7 +331,7 @@ public: typedef typename traits::char_type char_type; typedef perl_matcher self_type; typedef bool (self_type::*matcher_proc_type)(void); - typedef typename traits::size_type traits_size_type; + typedef std::size_t traits_size_type; typedef typename is_byte::width_type width_type; typedef typename regex_iterator_traits::difference_type difference_type; @@ -487,7 +487,7 @@ private: void push_assertion(const re_syntax_base* ps, bool positive); void push_alt(const re_syntax_base* ps); void push_repeater_count(int i, repeater_count** s); - void push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int id); + void push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int state_id); void push_non_greedy_repeat(const re_syntax_base* ps); diff --git a/include/boost/regex/v4/perl_matcher_non_recursive.hpp b/include/boost/regex/v4/perl_matcher_non_recursive.hpp index e6bf1bba..10e03477 100644 --- a/include/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -50,13 +50,13 @@ inline void inplace_destroy(T* p) struct saved_state { union{ - unsigned int id; + unsigned int state_id; // this padding ensures correct alignment on 64-bit platforms: std::size_t padding1; std::ptrdiff_t padding2; void* padding3; }; - saved_state(unsigned i) : id(i) {} + saved_state(unsigned i) : state_id(i) {} }; template @@ -298,7 +298,7 @@ inline void perl_matcher::push_repeater_count(i } template -inline void perl_matcher::push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int id) +inline void perl_matcher::push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int state_id) { saved_single_repeat* pmp = static_cast*>(m_backup_state); --pmp; @@ -308,7 +308,7 @@ inline void perl_matcher::push_single_repeat(st pmp = static_cast*>(m_backup_state); --pmp; } - (void) new (pmp)saved_single_repeat(c, r, last_position, id); + (void) new (pmp)saved_single_repeat(c, r, last_position, state_id); m_backup_state = pmp; } @@ -477,11 +477,13 @@ bool perl_matcher::match_rep() take_second = can_start(*position, rep->_map, (unsigned char)mask_skip); } - if(take_first || (next_count->get_id() != rep->id)) + if((m_backup_state->state_id != saved_state_repeater_count) + || (static_cast*>(m_backup_state)->count.get_id() != rep->state_id) + || (next_count->get_id() != rep->state_id)) { // we're moving to a different repeat from the last // one, so set up a counter object: - push_repeater_count(rep->id, &next_count); + push_repeater_count(rep->state_id, &next_count); } // // If we've had at least one repeat already, and the last one @@ -882,7 +884,7 @@ bool perl_matcher::unwind(bool have_match) // do { - unwinder = s_unwind_table[m_backup_state->id]; + unwinder = s_unwind_table[m_backup_state->state_id]; cont = (this->*unwinder)(m_recursive_result); }while(cont); // diff --git a/include/boost/regex/v4/perl_matcher_recursive.hpp b/include/boost/regex/v4/perl_matcher_recursive.hpp index 746d02ab..68e1aac9 100644 --- a/include/boost/regex/v4/perl_matcher_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_recursive.hpp @@ -291,7 +291,7 @@ bool perl_matcher::match_rep() // Always copy the repeat count, so that the state is restored // when we exit this scope: // - repeater_count r(rep->id, &next_count, position); + repeater_count r(rep->state_id, &next_count, position); // // If we've had at least one repeat already, and the last one // matched the NULL string then set the repeat count to diff --git a/include/boost/regex/v4/regex_traits_defaults.hpp b/include/boost/regex/v4/regex_traits_defaults.hpp index 38c12738..42428dd8 100644 --- a/include/boost/regex/v4/regex_traits_defaults.hpp +++ b/include/boost/regex/v4/regex_traits_defaults.hpp @@ -134,8 +134,8 @@ inline bool is_separator(char c) BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name); // -// get the id of a character clasification, the individual -// traits classes then transform that id into a bitmask: +// get the state_id of a character clasification, the individual +// traits classes then transform that state_id into a bitmask: // template struct character_pointer_range diff --git a/include/boost/regex/v4/states.hpp b/include/boost/regex/v4/states.hpp index 74885d2a..44dd2b4a 100644 --- a/include/boost/regex/v4/states.hpp +++ b/include/boost/regex/v4/states.hpp @@ -240,7 +240,7 @@ Repeat a section of the machine struct re_repeat : public re_alt { std::size_t min, max; // min and max allowable repeats - int id; // Unique identifier for this repeat + int state_id; // Unique identifier for this repeat bool leading; // True if this repeat is at the start of the machine (lets us optimize some searches) bool greedy; // True if this is a greedy repeat }; diff --git a/include/boost/regex/v4/u32regex_iterator.hpp b/include/boost/regex/v4/u32regex_iterator.hpp index 9e49c6f3..7e893e69 100644 --- a/include/boost/regex/v4/u32regex_iterator.hpp +++ b/include/boost/regex/v4/u32regex_iterator.hpp @@ -166,7 +166,7 @@ inline u32regex_iterator make_u32regex_iterator(const wchar_t* p return u32regex_iterator(p, p+std::wcslen(p), e, m); } #endif -#ifndef U_WCHAR_IS_UTF16 +#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) inline u32regex_iterator make_u32regex_iterator(const UChar* p, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_iterator(p, p+u_strlen(p), e, m); diff --git a/include/boost/regex/v4/u32regex_token_iterator.hpp b/include/boost/regex/v4/u32regex_token_iterator.hpp index a8d394e4..72669ac4 100644 --- a/include/boost/regex/v4/u32regex_token_iterator.hpp +++ b/include/boost/regex/v4/u32regex_token_iterator.hpp @@ -271,7 +271,7 @@ typedef u32regex_token_iterator utf8regex_token_iterator; typedef u32regex_token_iterator utf16regex_token_iterator; typedef u32regex_token_iterator utf32regex_token_iterator; -// construction from an integral sub_match id: +// construction from an integral sub_match state_id: inline u32regex_token_iterator make_u32regex_token_iterator(const char* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator(p, p+std::strlen(p), e, submatch, m); @@ -282,7 +282,7 @@ inline u32regex_token_iterator make_u32regex_token_iterator(cons return u32regex_token_iterator(p, p+std::wcslen(p), e, submatch, m); } #endif -#ifndef U_WCHAR_IS_UTF16 +#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) inline u32regex_token_iterator make_u32regex_token_iterator(const UChar* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator(p, p+u_strlen(p), e, m); @@ -313,7 +313,7 @@ inline u32regex_token_iterator make_u32regex_token_iterator(cons return u32regex_token_iterator(p, p+std::wcslen(p), e, submatch, m); } #endif -#ifndef U_WCHAR_IS_UTF16 +#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) template inline u32regex_token_iterator make_u32regex_token_iterator(const UChar* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { @@ -333,7 +333,7 @@ inline u32regex_token_iterator make_u32regex_token_iterator(const } #endif // BOOST_MSVC < 1300 -// construction from a vector of sub_match id's: +// construction from a vector of sub_match state_id's: inline u32regex_token_iterator make_u32regex_token_iterator(const char* p, const u32regex& e, const std::vector& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator(p, p+std::strlen(p), e, submatch, m); @@ -344,7 +344,7 @@ inline u32regex_token_iterator make_u32regex_token_iterator(cons return u32regex_token_iterator(p, p+std::wcslen(p), e, submatch, m); } #endif -#ifndef U_WCHAR_IS_UTF16 +#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) inline u32regex_token_iterator make_u32regex_token_iterator(const UChar* p, const u32regex& e, const std::vector& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator(p, p+u_strlen(p), e, m); diff --git a/include/boost/regex/v4/w32_regex_traits.hpp b/include/boost/regex/v4/w32_regex_traits.hpp index 2f64843d..21a9694a 100644 --- a/include/boost/regex/v4/w32_regex_traits.hpp +++ b/include/boost/regex/v4/w32_regex_traits.hpp @@ -76,36 +76,36 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char, lcid_type); #ifndef BOOST_NO_WREGEX BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(wchar_t, lcid_type); #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type id); +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type state_id); #endif #endif BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char, lcid_type); #ifndef BOOST_NO_WREGEX BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(wchar_t, lcid_type); #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type id); +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type state_id); #endif #endif BOOST_REGEX_DECL cat_type BOOST_REGEX_CALL w32_cat_open(const std::string& name); -BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type id, int i, const std::string& def); +BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type state_id, int i, const std::string& def); #ifndef BOOST_NO_WREGEX -BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type id, int i, const std::wstring& def); +BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type state_id, int i, const std::wstring& def); #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T BOOST_REGEX_DECL std::basic_string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::basic_string& def); #endif #endif -BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const char* p1, const char* p2); +BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type state_id, const char* p1, const char* p2); #ifndef BOOST_NO_WREGEX -BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type id, const wchar_t* p1, const wchar_t* p2); +BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type state_id, const wchar_t* p1, const wchar_t* p2); #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL std::basic_string BOOST_REGEX_CALL w32_transform(lcid_type id, const unsigned short* p1, const unsigned short* p2); +BOOST_REGEX_DECL std::basic_string BOOST_REGEX_CALL w32_transform(lcid_type state_id, const unsigned short* p1, const unsigned short* p2); #endif #endif BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type); #ifndef BOOST_NO_WREGEX BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type); #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type id); +BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type state_id); #endif #endif BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type); @@ -116,7 +116,7 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type, boost::uint32_t mask, c #ifndef BOOST_NO_WREGEX BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type, boost::uint32_t mask, wchar_t c); #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, unsigned short c); +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type state_id, boost::uint32_t m, unsigned short c); #endif #endif // @@ -540,9 +540,9 @@ typename w32_regex_traits_implementation::char_class_type if(pos != m_custom_class_names.end()) return pos->second; } - std::size_t id = 1 + re_detail::get_default_class_id(p1, p2); - if(id < sizeof(masks) / sizeof(masks[0])) - return masks[id]; + std::size_t state_id = 1 + re_detail::get_default_class_id(p1, p2); + if(state_id < sizeof(masks) / sizeof(masks[0])) + return masks[state_id]; return masks[0]; } diff --git a/src/usinstances.cpp b/src/usinstances.cpp index e633659e..390cd254 100644 --- a/src/usinstances.cpp +++ b/src/usinstances.cpp @@ -18,46 +18,59 @@ #define BOOST_REGEX_SOURCE +#include +#include +#include + +#if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) \ + && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)) +// +// This is a horrible workaround, but without declaring these symbols extern we get +// duplicate symbol errors when linking if the application is built without +// /Zc:wchar_t +// +#ifdef _CRTIMP2_PURE +# define BOOST_REGEX_STDLIB_DECL _CRTIMP2_PURE +#else +# define BOOST_REGEX_STDLIB_DECL _CRTIMP2 +#endif + +namespace std{ + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +template class BOOST_REGEX_STDLIB_DECL allocator; +template class BOOST_REGEX_STDLIB_DECL _String_val >; +template class BOOST_REGEX_STDLIB_DECL basic_string, + allocator >; +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) +template<> BOOST_REGEX_STDLIB_DECL std::size_t __cdecl char_traits::length(unsigned short const*); +#endif + +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( + const basic_string, allocator >&, + const basic_string, allocator >&); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( + const unsigned short *, + const basic_string, allocator >&); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( + const basic_string, allocator >&, + const unsigned short *); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator<( + const basic_string, allocator >&, + const basic_string, allocator >&); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator>( + const basic_string, allocator >&, + const basic_string, allocator >&); +} +#endif + #include #if !defined(BOOST_NO_WREGEX) && defined(BOOST_REGEX_HAS_OTHER_WCHAR_T) && !defined(BOOST_REGEX_NO_EXTERNAL_TEMPLATES) #define BOOST_REGEX_US_INSTANTIATE -#ifdef _DLL_CPPLIB -#include -#include -#include -// -// This is a horrible workaround, without declaring these symbols extern we get -// duplicate symbol errors when linking if the application is built without -// /Zc:wchar_t -// -namespace std{ -template _CRTIMP2 bool __cdecl operator==( - const basic_string, allocator >&, - const basic_string, allocator >&); -template _CRTIMP2 bool __cdecl operator==( - const unsigned short *, - const basic_string, allocator >&); -template _CRTIMP2 bool __cdecl operator==( - const basic_string, allocator >&, - const unsigned short *); -template _CRTIMP2 bool __cdecl operator<( - const basic_string, allocator >&, - const basic_string, allocator >&); -template _CRTIMP2 bool __cdecl operator>( - const basic_string, allocator >&, - const basic_string, allocator >&); -#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) -template<> _CRTIMP2 std::size_t __cdecl char_traits::length(unsigned short const*); -#endif -#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) -template _CRTIMP2 allocator::allocator(); -#endif -} -#endif - - #include #endif diff --git a/src/wc_regex_traits.cpp b/src/wc_regex_traits.cpp index aee2da18..393b2d7f 100644 --- a/src/wc_regex_traits.cpp +++ b/src/wc_regex_traits.cpp @@ -19,42 +19,57 @@ #define BOOST_REGEX_SOURCE -#include #include - -#ifdef _DLL_CPPLIB #include #include + +#if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) \ + && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)) // -// This is a horrible workaround, without declaring these symbols extern we get +// This is a horrible workaround, but without declaring these symbols extern we get // duplicate symbol errors when linking if the application is built without // /Zc:wchar_t // +#ifdef _CRTIMP2_PURE +# define BOOST_REGEX_STDLIB_DECL _CRTIMP2_PURE +#else +# define BOOST_REGEX_STDLIB_DECL _CRTIMP2 +#endif + namespace std{ -template _CRTIMP2 bool __cdecl operator==( + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +template class BOOST_REGEX_STDLIB_DECL allocator; +template class BOOST_REGEX_STDLIB_DECL _String_val >; +template class BOOST_REGEX_STDLIB_DECL basic_string, + allocator >; +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) +template<> BOOST_REGEX_STDLIB_DECL std::size_t __cdecl char_traits::length(unsigned short const*); +#endif + +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( const basic_string, allocator >&, const basic_string, allocator >&); -template _CRTIMP2 bool __cdecl operator==( +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( const unsigned short *, const basic_string, allocator >&); -template _CRTIMP2 bool __cdecl operator==( +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( const basic_string, allocator >&, const unsigned short *); -template _CRTIMP2 bool __cdecl operator<( +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator<( const basic_string, allocator >&, const basic_string, allocator >&); -template _CRTIMP2 bool __cdecl operator>( +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator>( const basic_string, allocator >&, const basic_string, allocator >&); -#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) -template<> _CRTIMP2 std::size_t __cdecl char_traits::length(unsigned short const*); -#endif -#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) -template _CRTIMP2 allocator::allocator(); -#endif } #endif +#include +#include + #if !BOOST_WORKAROUND(__BORLANDC__, < 0x560) #include diff --git a/test/pathology/bad_expression_test.cpp b/test/pathology/bad_expression_test.cpp index 308df422..34f21c22 100644 --- a/test/pathology/bad_expression_test.cpp +++ b/test/pathology/bad_expression_test.cpp @@ -46,7 +46,7 @@ int test_main( int , char* [] ) bad_text.assign((std::string::size_type)500000, 'a'); e2.assign("aaa*@"); - BOOST_CHECK_THROW(0 == boost::regex_search(bad_text, what, e2), std::runtime_error); + BOOST_CHECK_THROW(boost::regex_search(bad_text, what, e2), std::runtime_error); good_text.assign((std::string::size_type)5000, 'a'); BOOST_CHECK(0 == boost::regex_search(good_text, what, e2)); @@ -54,3 +54,4 @@ int test_main( int , char* [] ) } #include + diff --git a/test/regress/test_tricky_cases.cpp b/test/regress/test_tricky_cases.cpp index a0c1e532..e025dc43 100644 --- a/test/regress/test_tricky_cases.cpp +++ b/test/regress/test_tricky_cases.cpp @@ -377,6 +377,9 @@ void test_tricky_cases3() TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds123456789b", match_default, make_array(0, 34, -2, -2)); TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds12345678", match_default, make_array(-2, -2)); TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds", match_default, make_array(-2, -2)); + TEST_REGEX_SEARCH("^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])){3}$", perl, "1.2.03", match_default, make_array(-2, -2)); + TEST_REGEX_SEARCH("^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])){3,4}$", perl, "1.2.03", match_default, make_array(-2, -2)); + TEST_REGEX_SEARCH("^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])){3,4}?$", perl, "1.2.03", match_default, make_array(-2, -2)); //