Fixed messed up c_regex_traits from previous commit, fixed Koenig lookup bug caused by presence of boost::re_detail::destroy

[SVN r11249]
This commit is contained in:
John Maddock
2001-09-25 11:48:21 +00:00
parent 007c0da3b2
commit 4922ae784f
9 changed files with 61 additions and 69 deletions

View File

@ -226,8 +226,8 @@ treated as &quot;unknown&quot; graphic characters. </p>
an operating system other than Win32, and is encapsulated by the an operating system other than Win32, and is encapsulated by the
traits class <a href="template_class_ref.htm#regex_char_traits"><i>c_regex_traits</i></a>, traits class <a href="template_class_ref.htm#regex_char_traits"><i>c_regex_traits</i></a>,
Win32 users can force this model to take effect by defining the Win32 users can force this model to take effect by defining the
pre-processor symbol BOOST_REGEX_USE_C_LOCALE. When this model is in pre-processor symbol BOOST_REGEX_USE_C_LOCALE. When this model is
effect there is a single global locale, as set by <i>setlocale</i>. in effect there is a single global locale, as set by <i>setlocale</i>.
All settings are acquired from your run time library, All settings are acquired from your run time library,
consequently Unicode support is dependent upon your run time consequently Unicode support is dependent upon your run time
library implementation. Front end localization requires a POSIX library implementation. Front end localization requires a POSIX
@ -261,11 +261,11 @@ regular expression libraries including version 1 of this library.
</p> </p>
<p>This model is only in effect if the library is built with the <p>This model is only in effect if the library is built with the
pre-processor symbol BOOST_REGEX_USE_CPP_LOCALE defined. When this model pre-processor symbol BOOST_REGEX_USE_CPP_LOCALE defined. When
is in effect each instance of reg_expression&lt;&gt; has its own this model is in effect each instance of reg_expression&lt;&gt;
instance of std::locale, class reg_expression&lt;&gt; also has a has its own instance of std::locale, class reg_expression&lt;&gt;
member function <i>imbue</i> which allows the locale for the also has a member function <i>imbue</i> which allows the locale
expression to be set on a per-instance basis. Front end for the expression to be set on a per-instance basis. Front end
localization requires a POSIX message catalogue, which will be localization requires a POSIX message catalogue, which will be
loaded via the std::messages facet of the expression's locale, loaded via the std::messages facet of the expression's locale,
the traits class exports the symbol: </p> the traits class exports the symbol: </p>
@ -293,9 +293,9 @@ or &quot;POSIX&quot;. </p>
<p>Finally note that if you build the library with a non-default <p>Finally note that if you build the library with a non-default
localization model, then the appropriate pre-processor symbol (BOOST_REGEX_USE_C_LOCALE localization model, then the appropriate pre-processor symbol (BOOST_REGEX_USE_C_LOCALE
or BOOST_REGEX_USE_CPP_LOCALE) must be defined both when you build the or BOOST_REGEX_USE_CPP_LOCALE) must be defined both when you
support library, and when you include &lt;boost/regex.hpp&gt; or build the support library, and when you include &lt;boost/regex.hpp&gt;
&lt;boost/cregex.hpp&gt; in your code. The best way to ensure or &lt;boost/cregex.hpp&gt; in your code. The best way to ensure
this is to add the #define to &lt;boost/regex/detail/regex_options.hpp&gt;. this is to add the #define to &lt;boost/regex/detail/regex_options.hpp&gt;.
</p> </p>
@ -1241,9 +1241,10 @@ regex++ dll's are as follows: <br>
</table> </table>
<p>Note: you can disable automatic library selection by defining <p>Note: you can disable automatic library selection by defining
the symbol BOOST_REGEX_NO_LIB when compiling, this is useful if you the symbol BOOST_REGEX_NO_LIB when compiling, this is useful if
want to statically link even though you're using the dll version you want to statically link even though you're using the dll
of your run time library, or if you need to debug regex++. </p> version of your run time library, or if you need to debug regex++.
</p>
<hr> <hr>
@ -1299,10 +1300,10 @@ Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno,
Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick
Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan
Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, Heiko Schmidt, Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, Heiko Schmidt,
Scobie Smith, Alexander Sokolovsky, Herv<72> Poirier, Marc Recht, Jason Shirk, Scobie Smith, Alexander Sokolovsky, Herv<72> Poirier,
Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward, Lealon Marc Recht, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
Watts, Thomas Witt and Yuval Yosef. I am also grateful to the Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to
manuals supplied with the Henry Spencer, Perl and GNU regular the manuals supplied with the Henry Spencer, Perl and GNU regular
expression libraries - wherever possible I have tried to maintain expression libraries - wherever possible I have tried to maintain
compatibility with these libraries and with the POSIX standard - compatibility with these libraries and with the POSIX standard -
the code however is entirely my own, including any bugs! I can the code however is entirely my own, including any bugs! I can

View File

@ -1074,7 +1074,7 @@ match_results_base<iterator, Allocator>::match_results_base(const Allocator& a)
} }
catch(...) catch(...)
{ {
::boost::re_detail::destroy(ref); ::boost::re_detail::pointer_destroy(ref);
throw; throw;
} }
} }
@ -1115,10 +1115,10 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::free()
p2 = p1 + ref->cmatches; p2 = p1 + ref->cmatches;
while(p1 != p2) while(p1 != p2)
{ {
::boost::re_detail::destroy(p1); ::boost::re_detail::pointer_destroy(p1);
++p1; ++p1;
} }
::boost::re_detail::destroy(ref); ::boost::re_detail::pointer_destroy(ref);
a.deallocate((char*)(void*)ref, sizeof(sub_match<iterator>) * ref->cmatches + sizeof(c_reference)); a.deallocate((char*)(void*)ref, sizeof(sub_match<iterator>) * ref->cmatches + sizeof(c_reference));
} }
} }
@ -1169,10 +1169,10 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_typ
p2 = (sub_match<iterator>*)(newref+1); p2 = (sub_match<iterator>*)(newref+1);
while(p2 != p1) while(p2 != p1)
{ {
::boost::re_detail::destroy(p2); ::boost::re_detail::pointer_destroy(p2);
++p2; ++p2;
} }
::boost::re_detail::destroy(ref); ::boost::re_detail::pointer_destroy(ref);
throw; throw;
} }
ref = newref; ref = newref;
@ -1211,10 +1211,10 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_typ
p2 = (sub_match<iterator>*)(newref+1); p2 = (sub_match<iterator>*)(newref+1);
while(p2 != p1) while(p2 != p1)
{ {
::boost::re_detail::destroy(p2); ::boost::re_detail::pointer_destroy(p2);
++p2; ++p2;
} }
::boost::re_detail::destroy(ref); ::boost::re_detail::pointer_destroy(ref);
throw; throw;
} }
ref = newref; ref = newref;
@ -1316,10 +1316,10 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::cow()
p2 = (sub_match<iterator>*)(newref+1); p2 = (sub_match<iterator>*)(newref+1);
while(p2 != p1) while(p2 != p1)
{ {
::boost::re_detail::destroy(p2); ::boost::re_detail::pointer_destroy(p2);
++p2; ++p2;
} }
::boost::re_detail::destroy(ref); ::boost::re_detail::pointer_destroy(ref);
throw; throw;
} }
--(ref->count); --(ref->count);
@ -1436,10 +1436,10 @@ match_results<iterator, Allocator>::match_results(const match_results<iterator,
p2 = (sub_match<iterator>*)(this->ref+1); p2 = (sub_match<iterator>*)(this->ref+1);
while(p2 != p1) while(p2 != p1)
{ {
re_detail::destroy(p2); re_detail::pointer_destroy(p2);
++p2; ++p2;
} }
re_detail::destroy(this->ref); re_detail::pointer_destroy(this->ref);
throw; throw;
} }
} }

View File

@ -523,7 +523,7 @@ namespace std{
/***************************************************************************** /*****************************************************************************
* *
* helper functions construct/destroy: * helper functions pointer_construct/pointer_destroy:
* *
****************************************************************************/ ****************************************************************************/
@ -531,11 +531,11 @@ namespace std{
namespace boost{ namespace re_detail{ namespace boost{ namespace re_detail{
template <class T> template <class T>
inline void destroy(T* p) inline void pointer_destroy(T* p)
{ p->~T(); } { p->~T(); }
template <class T> template <class T>
inline void construct(T* p, const T& t) inline void pointer_construct(T* p, const T& t)
{ new (p) T(t); } { new (p) T(t); }
}} // namespaces }} // namespaces

View File

@ -104,8 +104,8 @@ void BOOST_REGEX_CALL re_skip_format(const charT*& fmt, const traits_type& trait
template <class T> template <class T>
inline void oi_assign(T* p, T v) inline void oi_assign(T* p, T v)
{ {
::boost::re_detail::destroy(p); ::boost::re_detail::pointer_destroy(p);
construct(p, v); pointer_construct(p, v);
} }
#else #else

View File

@ -215,7 +215,7 @@ void _priv_match_data<iterator, Allocator>::free()
i_alloc temp1(temp_match.allocator()); i_alloc temp1(temp_match.allocator());
temp1.deallocate(accumulators, caccumulators); temp1.deallocate(accumulators, caccumulators);
for(unsigned i = 0; i < caccumulators; ++i) for(unsigned i = 0; i < caccumulators; ++i)
::boost::re_detail::destroy(loop_starts + i); ::boost::re_detail::pointer_destroy(loop_starts + i);
it_alloc temp2(temp_match.allocator()); it_alloc temp2(temp_match.allocator());
temp2.deallocate(loop_starts, caccumulators); temp2.deallocate(loop_starts, caccumulators);
} }

View File

@ -119,7 +119,7 @@ public:
{ {
if(m_stack->start == m_stack->end) if(m_stack->start == m_stack->end)
pop_aux(); pop_aux();
::boost::re_detail::destroy(m_stack->end); ::boost::re_detail::pointer_destroy(m_stack->end);
++(m_stack->end); ++(m_stack->end);
} }
@ -128,7 +128,7 @@ public:
if(m_stack->start == m_stack->end) if(m_stack->start == m_stack->end)
pop_aux(); pop_aux();
t = *m_stack->end; t = *m_stack->end;
::boost::re_detail::destroy(m_stack->end); ::boost::re_detail::pointer_destroy(m_stack->end);
++(m_stack->end); ++(m_stack->end);
} }
@ -137,7 +137,7 @@ public:
if(m_stack->end == m_stack->last) if(m_stack->end == m_stack->last)
push_aux(); push_aux();
--(m_stack->end); --(m_stack->end);
construct(m_stack->end, t); pointer_construct(m_stack->end, t);
} }
}; };

View File

@ -132,17 +132,17 @@ public:
// classes (we will static-assert that later): // classes (we will static-assert that later):
// //
char_class_none = 0, char_class_none = 0,
char_class_alpha = 0x0100, char_class_alpha = 0x0001,
char_class_cntrl = 0x0020, char_class_cntrl = 0x0002,
char_class_digit = 0x0004, char_class_digit = 0x0004,
char_class_lower = 0x0002, char_class_lower = 0x0008,
char_class_punct = 0x0010, char_class_punct = 0x0010,
char_class_space = 0x0008, char_class_space = 0x0020,
char_class_upper = 0x0001, char_class_upper = 0x0040,
char_class_xdigit = 0x0080, char_class_xdigit = 0x0080,
char_class_blank = 0x0040, char_class_blank = 0x0100,
char_class_unicode = 0x8000,
char_class_underscore = 0x4000, char_class_underscore = 0x4000,
char_class_unicode = 0x8000,
char_class_alnum = char_class_alpha | char_class_digit, char_class_alnum = char_class_alpha | char_class_digit,
char_class_graph = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore, char_class_graph = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore,
@ -360,17 +360,6 @@ struct BOOST_REGEX_DECL w32_traits_base : public regex_traits_base
char_class_win = 0x01FF char_class_win = 0x01FF
}; };
BOOST_STATIC_ASSERT(w32_traits_base::char_class_alpha == c_traits_base::char_class_alpha);
BOOST_STATIC_ASSERT(w32_traits_base::char_class_cntrl == c_traits_base::char_class_cntrl);
BOOST_STATIC_ASSERT(w32_traits_base::char_class_digit == c_traits_base::char_class_digit);
BOOST_STATIC_ASSERT(w32_traits_base::char_class_lower == c_traits_base::char_class_lower);
BOOST_STATIC_ASSERT(w32_traits_base::char_class_punct == c_traits_base::char_class_punct);
BOOST_STATIC_ASSERT(w32_traits_base::char_class_space == c_traits_base::char_class_space);
BOOST_STATIC_ASSERT(w32_traits_base::char_class_upper == c_traits_base::char_class_upper);
BOOST_STATIC_ASSERT(w32_traits_base::char_class_xdigit == c_traits_base::char_class_xdigit);
BOOST_STATIC_ASSERT(w32_traits_base::char_class_blank == c_traits_base::char_class_blank);
BOOST_STATIC_ASSERT(w32_traits_base::char_class_underscore == c_traits_base::char_class_underscore);
public: public:
static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s); static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
@ -394,6 +383,7 @@ public:
static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; } static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
}; };
} // namespace re_detail } // namespace re_detail
template<class charT> template<class charT>

View File

@ -277,13 +277,13 @@ void BOOST_REGEX_CALL re_update_collate()
{ {
char* p1, *p2, *p3, *p4;; char* p1, *p2, *p3, *p4;;
p1 = buf; p1 = buf;
while(*p1 && std::isspace(*p1))++p1; while(*p1 && std::isspace((unsigned char)*p1))++p1;
p2 = p1; p2 = p1;
while(*p2 && !std::isspace(*p2))++p2; while(*p2 && !std::isspace((unsigned char)*p2))++p2;
p3 = p2; p3 = p2;
while(*p3 && std::isspace(*p3))++p3; while(*p3 && std::isspace((unsigned char)*p3))++p3;
p4 = p3; p4 = p3;
while(*p4 && !std::isspace(*p4))++p4; while(*p4 && !std::isspace((unsigned char)*p4))++p4;
pcoll_names->push_back(collate_name_t(p1, p2, p3, p4)); pcoll_names->push_back(collate_name_t(p1, p2, p3, p4));
++i; ++i;
re_get_message(buf, 256, i); re_get_message(buf, 256, i);
@ -456,21 +456,21 @@ void BOOST_REGEX_CALL c_traits_base::do_update_ctype()
std::memset(class_map, 0, map_size); std::memset(class_map, 0, map_size);
for(i = 0; i < map_size; ++i) for(i = 0; i < map_size; ++i)
{ {
if(std::isalpha((char)i)) if(std::isalpha(i))
class_map[i] |= char_class_alpha; class_map[i] |= char_class_alpha;
if(std::iscntrl((char)i)) if(std::iscntrl(i))
class_map[i] |= char_class_cntrl; class_map[i] |= char_class_cntrl;
if(std::isdigit((char)i)) if(std::isdigit(i))
class_map[i] |= char_class_digit; class_map[i] |= char_class_digit;
if(std::islower((char)i)) if(std::islower(i))
class_map[i] |= char_class_lower; class_map[i] |= char_class_lower;
if(std::isupper((char)i)) if(std::isupper(i))
class_map[i] |= char_class_upper; class_map[i] |= char_class_upper;
if(std::ispunct((char)i)) if(std::ispunct(i))
class_map[i] |= char_class_punct; class_map[i] |= char_class_punct;
if(std::isspace((char)i)) if(std::isspace(i))
class_map[i] |= char_class_space; class_map[i] |= char_class_space;
if(std::isxdigit((char)i)) if(std::isxdigit(i))
class_map[i] |= char_class_xdigit; class_map[i] |= char_class_xdigit;
} }
class_map['_'] |= char_class_underscore; class_map['_'] |= char_class_underscore;

View File

@ -252,8 +252,8 @@ a[[:]:]]b !
a[[:-:]]b ! a[[:-:]]b !
a[[:alph:]] ! a[[:alph:]] !
a[[:alphabet:]] ! a[[:alphabet:]] !
[[:alnum:]]+ -%@a0X- 3 6 [[:alnum:]]+ -%@a0X_- 3 6
[[:alpha:]]+ -%@aX0- 3 5 [[:alpha:]]+ -%@aX_0- 3 5
[[:blank:]]+ "a \tb" 1 4 [[:blank:]]+ "a \tb" 1 4
[[:cntrl:]]+ a\n\tb 1 3 [[:cntrl:]]+ a\n\tb 1 3
[[:digit:]]+ a019b 1 4 [[:digit:]]+ a019b 1 4
@ -879,3 +879,4 @@ a+(?#b+)b+ xaaabbba 1 7