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
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
pre-processor symbol BOOST_REGEX_USE_C_LOCALE. When this model is in
effect there is a single global locale, as set by <i>setlocale</i>.
pre-processor symbol BOOST_REGEX_USE_C_LOCALE. When this model is
in effect there is a single global locale, as set by <i>setlocale</i>.
All settings are acquired from your run time library,
consequently Unicode support is dependent upon your run time
library implementation. Front end localization requires a POSIX
@ -261,11 +261,11 @@ regular expression libraries including version 1 of this library.
</p>
<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
is in effect each instance of reg_expression&lt;&gt; has its own
instance of std::locale, class reg_expression&lt;&gt; also has a
member function <i>imbue</i> which allows the locale for the
expression to be set on a per-instance basis. Front end
pre-processor symbol BOOST_REGEX_USE_CPP_LOCALE defined. When
this model is in effect each instance of reg_expression&lt;&gt;
has its own instance of std::locale, class reg_expression&lt;&gt;
also has a member function <i>imbue</i> which allows the locale
for the expression to be set on a per-instance basis. Front end
localization requires a POSIX message catalogue, which will be
loaded via the std::messages facet of the expression's locale,
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
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
support library, and when you include &lt;boost/regex.hpp&gt; or
&lt;boost/cregex.hpp&gt; in your code. The best way to ensure
or BOOST_REGEX_USE_CPP_LOCALE) must be defined both when you
build the support library, and when you include &lt;boost/regex.hpp&gt;
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;.
</p>
@ -1241,9 +1241,10 @@ regex++ dll's are as follows: <br>
</table>
<p>Note: you can disable automatic library selection by defining
the symbol BOOST_REGEX_NO_LIB when compiling, this is useful if you
want to statically link even though you're using the dll version
of your run time library, or if you need to debug regex++. </p>
the symbol BOOST_REGEX_NO_LIB when compiling, this is useful if
you want to statically link even though you're using the dll
version of your run time library, or if you need to debug regex++.
</p>
<hr>
@ -1299,10 +1300,10 @@ Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno,
Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick
Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan
Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, Heiko Schmidt,
Scobie Smith, Alexander Sokolovsky, Herv<72> Poirier, Marc Recht,
Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward, Lealon
Watts, Thomas Witt and Yuval Yosef. I am also grateful to the
manuals supplied with the Henry Spencer, Perl and GNU regular
Jason Shirk, Scobie Smith, Alexander Sokolovsky, Herv<72> Poirier,
Marc Recht, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to
the manuals supplied with the Henry Spencer, Perl and GNU regular
expression libraries - wherever possible I have tried to maintain
compatibility with these libraries and with the POSIX standard -
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(...)
{
::boost::re_detail::destroy(ref);
::boost::re_detail::pointer_destroy(ref);
throw;
}
}
@ -1115,10 +1115,10 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::free()
p2 = p1 + ref->cmatches;
while(p1 != p2)
{
::boost::re_detail::destroy(p1);
::boost::re_detail::pointer_destroy(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));
}
}
@ -1169,10 +1169,10 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_typ
p2 = (sub_match<iterator>*)(newref+1);
while(p2 != p1)
{
::boost::re_detail::destroy(p2);
::boost::re_detail::pointer_destroy(p2);
++p2;
}
::boost::re_detail::destroy(ref);
::boost::re_detail::pointer_destroy(ref);
throw;
}
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);
while(p2 != p1)
{
::boost::re_detail::destroy(p2);
::boost::re_detail::pointer_destroy(p2);
++p2;
}
::boost::re_detail::destroy(ref);
::boost::re_detail::pointer_destroy(ref);
throw;
}
ref = newref;
@ -1316,10 +1316,10 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::cow()
p2 = (sub_match<iterator>*)(newref+1);
while(p2 != p1)
{
::boost::re_detail::destroy(p2);
::boost::re_detail::pointer_destroy(p2);
++p2;
}
::boost::re_detail::destroy(ref);
::boost::re_detail::pointer_destroy(ref);
throw;
}
--(ref->count);
@ -1436,10 +1436,10 @@ match_results<iterator, Allocator>::match_results(const match_results<iterator,
p2 = (sub_match<iterator>*)(this->ref+1);
while(p2 != p1)
{
re_detail::destroy(p2);
re_detail::pointer_destroy(p2);
++p2;
}
re_detail::destroy(this->ref);
re_detail::pointer_destroy(this->ref);
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{
template <class T>
inline void destroy(T* p)
inline void pointer_destroy(T* p)
{ p->~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); }
}} // namespaces

View File

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

View File

@ -215,7 +215,7 @@ void _priv_match_data<iterator, Allocator>::free()
i_alloc temp1(temp_match.allocator());
temp1.deallocate(accumulators, caccumulators);
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());
temp2.deallocate(loop_starts, caccumulators);
}

View File

@ -119,7 +119,7 @@ public:
{
if(m_stack->start == m_stack->end)
pop_aux();
::boost::re_detail::destroy(m_stack->end);
::boost::re_detail::pointer_destroy(m_stack->end);
++(m_stack->end);
}
@ -128,7 +128,7 @@ public:
if(m_stack->start == m_stack->end)
pop_aux();
t = *m_stack->end;
::boost::re_detail::destroy(m_stack->end);
::boost::re_detail::pointer_destroy(m_stack->end);
++(m_stack->end);
}
@ -137,7 +137,7 @@ public:
if(m_stack->end == m_stack->last)
push_aux();
--(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):
//
char_class_none = 0,
char_class_alpha = 0x0100,
char_class_cntrl = 0x0020,
char_class_alpha = 0x0001,
char_class_cntrl = 0x0002,
char_class_digit = 0x0004,
char_class_lower = 0x0002,
char_class_lower = 0x0008,
char_class_punct = 0x0010,
char_class_space = 0x0008,
char_class_upper = 0x0001,
char_class_space = 0x0020,
char_class_upper = 0x0040,
char_class_xdigit = 0x0080,
char_class_blank = 0x0040,
char_class_unicode = 0x8000,
char_class_blank = 0x0100,
char_class_underscore = 0x4000,
char_class_unicode = 0x8000,
char_class_alnum = char_class_alpha | char_class_digit,
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
};
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:
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; }
};
} // namespace re_detail
template<class charT>

View File

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

View File

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