commit of split-config, including any changes required to existing libraries (mainly regex).

[SVN r11138]
This commit is contained in:
John Maddock
2001-09-18 11:13:39 +00:00
parent 1be8e9241b
commit 1d473147fd
71 changed files with 2568 additions and 7142 deletions

View File

@ -20,6 +20,8 @@
* DESCRIPTION: Implements the c_regex_traits<charT> traits class
*/
#define BOOST_REGEX_SOURCE
#include <clocale>
#include <cstdio>
#include <list>
@ -33,7 +35,7 @@
#include "primary_transform.hpp"
#ifndef BOOST_RE_NO_CAT
#if defined(BOOST_HAS_NL_TYPES_H)
#include <nl_types.h>
#endif
@ -103,14 +105,14 @@ unsigned int collate_count = 0;
#define BOOST_RE_MESSAGE_BASE 0
#endif
#if !defined(BOOST_RE_NO_CAT)
#if defined(BOOST_HAS_NL_TYPES_H)
nl_catd message_cat = (nl_catd)-1;
#endif
unsigned int message_count = 0;
std::string* mess_locale;
BOOST_RE_IX_DECL char* re_custom_error_messages[] = {
BOOST_REGEX_DECL char* re_custom_error_messages[] = {
0,
0,
0,
@ -152,10 +154,10 @@ enum syntax_map_size
map_size = UCHAR_MAX + 1
};
#ifndef BOOST_RE_NO_WCSTRING
#ifndef BOOST_NO_WREGEX
BOOST_RE_IX_DECL wchar_t re_zero_w;
BOOST_RE_IX_DECL wchar_t re_ten_w;
BOOST_REGEX_DECL wchar_t re_zero_w;
BOOST_REGEX_DECL wchar_t re_ten_w;
unsigned int nlsw_count = 0;
std::string* wlocale_name = 0;
@ -171,10 +173,10 @@ std::list<syntax_map_t>* syntax;
#endif
unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned int id);
unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsigned int id);
template <class charT>
unsigned int BOOST_RE_CALL re_get_message(charT* buf, unsigned int len, unsigned int id)
unsigned int BOOST_REGEX_CALL re_get_message(charT* buf, unsigned int len, unsigned int id)
{
unsigned int size = _re_get_message((char*)0, 0, id);
if(len < size)
@ -185,12 +187,12 @@ unsigned int BOOST_RE_CALL re_get_message(charT* buf, unsigned int len, unsigned
return size;
}
inline unsigned int BOOST_RE_CALL re_get_message(char* buf, unsigned int len, unsigned int id)
inline unsigned int BOOST_REGEX_CALL re_get_message(char* buf, unsigned int len, unsigned int id)
{
return _re_get_message(buf, len, id);
}
void BOOST_RE_CALL re_init_classes()
void BOOST_REGEX_CALL re_init_classes()
{
BOOST_RE_GUARD_STACK
if(classes_count == 0)
@ -208,7 +210,7 @@ void BOOST_RE_CALL re_init_classes()
++classes_count;
}
void BOOST_RE_CALL re_free_classes()
void BOOST_REGEX_CALL re_free_classes()
{
BOOST_RE_GUARD_STACK
if(--classes_count == 0)
@ -218,7 +220,7 @@ void BOOST_RE_CALL re_free_classes()
}
}
void BOOST_RE_CALL re_update_classes()
void BOOST_REGEX_CALL re_update_classes()
{
BOOST_RE_GUARD_STACK
if(*re_cls_name != std::setlocale(LC_CTYPE, 0))
@ -234,7 +236,7 @@ void BOOST_RE_CALL re_update_classes()
}
}
void BOOST_RE_CALL re_init_collate()
void BOOST_REGEX_CALL re_init_collate()
{
BOOST_RE_GUARD_STACK
if(collate_count == 0)
@ -252,7 +254,7 @@ void BOOST_RE_CALL re_init_collate()
++collate_count;
}
void BOOST_RE_CALL re_free_collate()
void BOOST_REGEX_CALL re_free_collate()
{
BOOST_RE_GUARD_STACK
if(--collate_count == 0)
@ -262,7 +264,7 @@ void BOOST_RE_CALL re_free_collate()
}
}
void BOOST_RE_CALL re_update_collate()
void BOOST_REGEX_CALL re_update_collate()
{
BOOST_RE_GUARD_STACK
if(*re_coll_name != std::setlocale(LC_COLLATE, 0))
@ -289,11 +291,11 @@ void BOOST_RE_CALL re_update_collate()
}
}
unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned int id)
unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsigned int id)
{
BOOST_RE_GUARD_STACK
// get the customised message if any:
#if !defined(BOOST_RE_NO_CAT)
#if defined(BOOST_HAS_NL_TYPES_H)
if(message_cat != (nl_catd)-1)
{
const char* m = catgets(message_cat, 0, id, 0);
@ -313,7 +315,7 @@ unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned
return boost::re_detail::re_get_default_message(buf, len, id);
}
void BOOST_RE_CALL re_message_init()
void BOOST_REGEX_CALL re_message_init()
{
BOOST_RE_GUARD_STACK
if(message_count == 0)
@ -323,7 +325,7 @@ void BOOST_RE_CALL re_message_init()
++message_count;
}
void BOOST_RE_CALL re_message_update()
void BOOST_REGEX_CALL re_message_update()
{
BOOST_RE_GUARD_STACK
//
@ -333,7 +335,7 @@ void BOOST_RE_CALL re_message_update()
if(*mess_locale != l)
{
*mess_locale = l;
#if !defined(BOOST_RE_NO_CAT)
#if defined(BOOST_HAS_NL_TYPES_H)
if(message_cat != (nl_catd)-1)
{
catclose(message_cat);
@ -353,13 +355,13 @@ void BOOST_RE_CALL re_message_update()
}
}
void BOOST_RE_CALL re_message_free()
void BOOST_REGEX_CALL re_message_free()
{
BOOST_RE_GUARD_STACK
--message_count;
if(message_count == 0)
{
#if !defined(BOOST_RE_NO_CAT)
#if defined(BOOST_HAS_NL_TYPES_H)
if(message_cat != (nl_catd)-1)
catclose(message_cat);
#endif
@ -376,7 +378,7 @@ void BOOST_RE_CALL re_message_free()
}
const char* BOOST_RE_CALL re_get_error_str(unsigned int id)
const char* BOOST_REGEX_CALL re_get_error_str(unsigned int id)
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -403,12 +405,12 @@ namespace re_detail{
char c_traits_base::regex_message_catalogue[200] = {0};
std::string BOOST_RE_CALL c_traits_base::error_string(unsigned id)
std::string BOOST_REGEX_CALL c_traits_base::error_string(unsigned id)
{
return re_get_error_str(id);
}
void BOOST_RE_CALL c_traits_base::do_update_collate()
void BOOST_REGEX_CALL c_traits_base::do_update_collate()
{
BOOST_RE_GUARD_STACK
re_update_collate();
@ -432,7 +434,7 @@ void BOOST_RE_CALL c_traits_base::do_update_collate()
re_ten = 'a';
}
void BOOST_RE_CALL c_traits_base::do_update_ctype()
void BOOST_REGEX_CALL c_traits_base::do_update_ctype()
{
BOOST_RE_GUARD_STACK
// start by updating the syntax map:
@ -481,7 +483,7 @@ void BOOST_RE_CALL c_traits_base::do_update_ctype()
re_update_classes();
}
boost::uint_fast32_t BOOST_RE_CALL c_traits_base::do_lookup_class(const char* p)
boost::uint_fast32_t BOOST_REGEX_CALL c_traits_base::do_lookup_class(const char* p)
{
BOOST_RE_GUARD_STACK
unsigned int i;
@ -502,7 +504,7 @@ boost::uint_fast32_t BOOST_RE_CALL c_traits_base::do_lookup_class(const char* p)
return 0;
}
bool BOOST_RE_CALL c_traits_base::do_lookup_collate(std::string& buf, const char* p)
bool BOOST_REGEX_CALL c_traits_base::do_lookup_collate(std::string& buf, const char* p)
{
BOOST_RE_GUARD_STACK
std::list<collate_name_t>::iterator first, last;
@ -527,7 +529,7 @@ bool BOOST_RE_CALL c_traits_base::do_lookup_collate(std::string& buf, const char
return result;
}
std::string BOOST_RE_CALL c_traits_base::set_message_catalogue(const std::string& l)
std::string BOOST_REGEX_CALL c_traits_base::set_message_catalogue(const std::string& l)
{
if(sizeof(regex_message_catalogue) <= l.size())
return l;
@ -542,8 +544,8 @@ char c_traits_base::lower_case_map[map_size];
} // namespace re_detail
#ifndef BOOST_RE_NO_WCSTRING
bool BOOST_RE_CALL c_regex_traits<wchar_t>::lookup_collatename(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last)
#ifndef BOOST_NO_WREGEX
bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_collatename(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last)
{
BOOST_RE_GUARD_STACK
std::basic_string<wchar_t> s(first, last);
@ -571,7 +573,7 @@ bool BOOST_RE_CALL c_regex_traits<wchar_t>::lookup_collatename(std::basic_string
c_regex_traits<char> c_regex_traits<char>::i;
void BOOST_RE_CALL c_regex_traits<char>::init()
void BOOST_REGEX_CALL c_regex_traits<char>::init()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -597,7 +599,7 @@ void BOOST_RE_CALL c_regex_traits<char>::init()
++entry_count;
}
void BOOST_RE_CALL c_regex_traits<char>::update()
void BOOST_REGEX_CALL c_regex_traits<char>::update()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -617,7 +619,7 @@ void BOOST_RE_CALL c_regex_traits<char>::update()
sort_type = re_detail::find_sort_syntax(&i, &sort_delim);
}
void BOOST_RE_CALL c_regex_traits<char>::free()
void BOOST_REGEX_CALL c_regex_traits<char>::free()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -638,7 +640,7 @@ void BOOST_RE_CALL c_regex_traits<char>::free()
#endif
}
void BOOST_RE_CALL c_regex_traits<char>::transform(std::string& out, const std::string& in)
void BOOST_REGEX_CALL c_regex_traits<char>::transform(std::string& out, const std::string& in)
{
BOOST_RE_GUARD_STACK
std::size_t n = std::strxfrm(0, in.c_str(), 0);
@ -657,7 +659,7 @@ void BOOST_RE_CALL c_regex_traits<char>::transform(std::string& out, const std::
out = buf.get();
}
void BOOST_RE_CALL c_regex_traits<char>::transform_primary(std::string& out, const std::string& in)
void BOOST_REGEX_CALL c_regex_traits<char>::transform_primary(std::string& out, const std::string& in)
{
transform(out, in);
switch(sort_type)
@ -684,7 +686,7 @@ unsigned c_regex_traits<char>::sort_type;
char c_regex_traits<char>::sort_delim;
int BOOST_RE_CALL c_regex_traits<char>::toi(char c)
int BOOST_REGEX_CALL c_regex_traits<char>::toi(char c)
{
if(is_class(c, char_class_digit))
return c - re_zero;
@ -693,7 +695,7 @@ int BOOST_RE_CALL c_regex_traits<char>::toi(char c)
return -1; // error!!
}
int BOOST_RE_CALL c_regex_traits<char>::toi(const char*& first, const char* last, int radix)
int BOOST_REGEX_CALL c_regex_traits<char>::toi(const char*& first, const char* last, int radix)
{
unsigned int maxval;
if(radix < 0)
@ -723,9 +725,9 @@ int BOOST_RE_CALL c_regex_traits<char>::toi(const char*& first, const char* last
return result;
}
#ifndef BOOST_RE_NO_WCSTRING
#ifndef BOOST_NO_WREGEX
unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::syntax_type(size_type c)
unsigned int BOOST_REGEX_CALL c_regex_traits<wchar_t>::syntax_type(size_type c)
{
BOOST_RE_GUARD_STACK
std::list<syntax_map_t>::const_iterator first, last;
@ -740,7 +742,7 @@ unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::syntax_type(size_type c)
return 0;
}
void BOOST_RE_CALL c_regex_traits<wchar_t>::init()
void BOOST_REGEX_CALL c_regex_traits<wchar_t>::init()
{
BOOST_RE_GUARD_STACK
re_detail::re_init_threads();
@ -765,7 +767,7 @@ void BOOST_RE_CALL c_regex_traits<wchar_t>::init()
++nlsw_count;
}
bool BOOST_RE_CALL c_regex_traits<wchar_t>::do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last)
bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last)
{
BOOST_RE_GUARD_STACK
std::basic_string<wchar_t> s(first, last);
@ -785,7 +787,7 @@ bool BOOST_RE_CALL c_regex_traits<wchar_t>::do_lookup_collate(std::basic_string<
}
void BOOST_RE_CALL c_regex_traits<wchar_t>::update()
void BOOST_REGEX_CALL c_regex_traits<wchar_t>::update()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -836,7 +838,7 @@ void BOOST_RE_CALL c_regex_traits<wchar_t>::update()
}
}
void BOOST_RE_CALL c_regex_traits<wchar_t>::free()
void BOOST_REGEX_CALL c_regex_traits<wchar_t>::free()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -858,11 +860,11 @@ void BOOST_RE_CALL c_regex_traits<wchar_t>::free()
#endif
}
bool BOOST_RE_CALL c_regex_traits<wchar_t>::do_iswclass(wchar_t c, boost::uint_fast32_t f)
bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::do_iswclass(wchar_t c, boost::uint_fast32_t f)
{
BOOST_RE_GUARD_STACK
if((c & ~0xFF) == 0)
return BOOST_RE_MAKE_BOOL(re_detail::wide_unicode_classes[(uchar_type)c] & f);
return BOOST_REGEX_MAKE_BOOL(re_detail::wide_unicode_classes[(uchar_type)c] & f);
if((f & char_class_alpha) && std::iswalpha(c))
return true;
if((f & char_class_cntrl) && std::iswcntrl(c))
@ -884,7 +886,7 @@ bool BOOST_RE_CALL c_regex_traits<wchar_t>::do_iswclass(wchar_t c, boost::uint_f
return false;
}
void BOOST_RE_CALL c_regex_traits<wchar_t>::transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)
void BOOST_REGEX_CALL c_regex_traits<wchar_t>::transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)
{
BOOST_RE_GUARD_STACK
#ifndef BOOST_MSVC
@ -909,7 +911,7 @@ void BOOST_RE_CALL c_regex_traits<wchar_t>::transform(std::basic_string<wchar_t>
out = buf.get();
}
void BOOST_RE_CALL c_regex_traits<wchar_t>::transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)
void BOOST_REGEX_CALL c_regex_traits<wchar_t>::transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)
{
transform(out, in);
switch(sort_type)
@ -937,7 +939,7 @@ unsigned c_regex_traits<wchar_t>::sort_type;
wchar_t c_regex_traits<wchar_t>::sort_delim;
int BOOST_RE_CALL c_regex_traits<wchar_t>::toi(wchar_t c)
int BOOST_REGEX_CALL c_regex_traits<wchar_t>::toi(wchar_t c)
{
if(is_class(c, char_class_digit))
return c - re_zero_w;
@ -946,7 +948,7 @@ int BOOST_RE_CALL c_regex_traits<wchar_t>::toi(wchar_t c)
return -1; // error!!
}
int BOOST_RE_CALL c_regex_traits<wchar_t>::toi(const wchar_t*& first, const wchar_t* last, int radix)
int BOOST_REGEX_CALL c_regex_traits<wchar_t>::toi(const wchar_t*& first, const wchar_t* last, int radix)
{
unsigned int maxval;
if(radix < 0)
@ -976,7 +978,7 @@ int BOOST_RE_CALL c_regex_traits<wchar_t>::toi(const wchar_t*& first, const wcha
return result;
}
boost::uint_fast32_t BOOST_RE_CALL c_regex_traits<wchar_t>::lookup_classname(const wchar_t* first, const wchar_t* last)
boost::uint_fast32_t BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_classname(const wchar_t* first, const wchar_t* last)
{
std::basic_string<wchar_t> s(first, last);
unsigned int len = strnarrow((char*)0, 0, s.c_str());
@ -988,7 +990,7 @@ boost::uint_fast32_t BOOST_RE_CALL c_regex_traits<wchar_t>::lookup_classname(con
c_regex_traits<wchar_t> c_regex_traits<wchar_t>::init_;
unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::strnarrow(char *s1, unsigned int len, const wchar_t *s2)
unsigned int BOOST_REGEX_CALL c_regex_traits<wchar_t>::strnarrow(char *s1, unsigned int len, const wchar_t *s2)
{
BOOST_RE_GUARD_STACK
unsigned int size = std::wcslen(s2) + 1;
@ -997,7 +999,7 @@ unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::strnarrow(char *s1, unsigned
return std::wcstombs(s1, s2, len);
}
unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsigned int len, const char *s2)
unsigned int BOOST_REGEX_CALL c_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsigned int len, const char *s2)
{
BOOST_RE_GUARD_STACK
unsigned int size = std::strlen(s2) + 1;
@ -1008,7 +1010,7 @@ unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsign
return size + 1;
}
#endif // BOOST_RE_NO_WCSTRING
#endif // BOOST_NO_WREGEX
} // namespace boost

View File

@ -22,6 +22,8 @@
*/
#define BOOST_REGEX_SOURCE
#include <clocale>
#include <cstdio>
#include <list>
@ -36,7 +38,7 @@ namespace boost{
//
// these are the POSIX collating names:
//
BOOST_RE_IX_DECL const char* def_coll_names[] = {
BOOST_REGEX_DECL const char* def_coll_names[] = {
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "alert", "backspace", "tab", "newline",
"vertical-tab", "form-feed", "carriage-return", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
"SYN", "ETB", "CAN", "EM", "SUB", "ESC", "IS4", "IS3", "IS2", "IS1", "space", "exclamation-mark",
@ -57,7 +59,7 @@ BOOST_RE_IX_DECL const char* def_coll_names[] = {
// little more - but this will have to do for
// now:
BOOST_RE_IX_DECL const char* def_multi_coll[] = {
BOOST_REGEX_DECL const char* def_multi_coll[] = {
"ae",
"Ae",
"AE",
@ -84,7 +86,7 @@ BOOST_RE_IX_DECL const char* def_multi_coll[] = {
BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf, const char* name)
BOOST_REGEX_DECL bool BOOST_REGEX_CALL re_lookup_def_collate_name(std::string& buf, const char* name)
{
BOOST_RE_GUARD_STACK
unsigned int i = 0;
@ -112,7 +114,7 @@ BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf,
//
// messages:
BOOST_RE_IX_DECL const char * re_default_error_messages[] =
BOOST_REGEX_DECL const char * re_default_error_messages[] =
{ "Success", /* REG_NOERROR */
"No match", /* REG_NOMATCH */
"Invalid regular expression", /* REG_BADPAT */
@ -195,7 +197,7 @@ const mss default_messages[] = {
{ 0, "", },
};
BOOST_RE_IX_DECL unsigned int BOOST_RE_CALL re_get_default_message(char* buf, unsigned int len, unsigned int id)
BOOST_REGEX_DECL unsigned int BOOST_REGEX_CALL re_get_default_message(char* buf, unsigned int len, unsigned int id)
{
BOOST_RE_GUARD_STACK
const mss* pm = default_messages;
@ -255,7 +257,7 @@ const wchar_t combining_ranges[] = { 0x0300, 0x0361,
0xFE20, 0xFE23,
0xffff, 0xffff, };
BOOST_RE_IX_DECL bool BOOST_RE_CALL is_combining(wchar_t c)
BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining(wchar_t c)
{
BOOST_RE_GUARD_STACK
const wchar_t* p = combining_ranges + 1;
@ -266,7 +268,7 @@ BOOST_RE_IX_DECL bool BOOST_RE_CALL is_combining(wchar_t c)
return false;
}
BOOST_RE_IX_DECL unsigned short wide_unicode_classes[] = {
BOOST_REGEX_DECL unsigned short wide_unicode_classes[] = {
c_traits_base::char_class_cntrl, // '' 0
c_traits_base::char_class_cntrl, // '' 1
c_traits_base::char_class_cntrl, // '' 2
@ -526,7 +528,7 @@ BOOST_RE_IX_DECL unsigned short wide_unicode_classes[] = {
c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // '<27>' 255
};
BOOST_RE_IX_DECL wchar_t wide_lower_case_map[] = {
BOOST_REGEX_DECL wchar_t wide_lower_case_map[] = {
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,

View File

@ -19,17 +19,25 @@
* VERSION: 3.12
* DESCRIPTION: Implements the cpp_regex_traits<charT> traits class
*/
#define BOOST_REGEX_SOURCE
#include <boost/regex/config.hpp>
#ifndef BOOST_NO_STD_LOCALE
#include <clocale>
#include <locale>
#include <cstdio>
#include <list>
#include <cctype>
#include <iostream>
#include <boost/regex/regex_traits.hpp>
#include <map>
#include <boost/regex/regex_traits.hpp>
#include <boost/cregex.hpp>
#include "primary_transform.hpp"
#ifndef BOOST_RE_NO_LOCALE_H
# ifdef BOOST_MSVC
# pragma warning(disable:4786)
@ -180,8 +188,8 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
: is(&sbuf)
{
is.imbue(l);
#ifndef BOOST_RE_NO_MESSAGES
const std::messages<char>* pm = &BOOST_RE_USE_FACET(l, std::messages<char>);
#ifndef BOOST_NO_STD_MESSAGES
const std::messages<char>* pm = &BOOST_USE_FACET(std::messages<char>, l);
std::messages<char>::catalog cat = regex_message_catalogue.size() ? pm->open(regex_message_catalogue, l) : -1;
#endif
std::memset(syntax_map, cpp_regex_traits<char>::syntax_char, 256);
@ -199,7 +207,7 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
}
re_get_default_message(a.get(), array_size, i+100);
std::string s = a.get();
#ifndef BOOST_RE_NO_MESSAGES
#ifndef BOOST_NO_STD_MESSAGES
if((int)cat >= 0)
s = pm->get(cat, 0, i+100, s);
#endif
@ -209,7 +217,7 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
}
}
#ifndef BOOST_RE_NO_MESSAGES
#ifndef BOOST_NO_STD_MESSAGES
// load any custom collate names:
std::string c1, c2;
i = 400;
@ -249,7 +257,7 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
*/
std::string m;
std::string s;
#ifndef BOOST_RE_NO_MESSAGES
#ifndef BOOST_NO_STD_MESSAGES
if((int)cat >= 0)
{
for(i = 0; i < re_classes_max; ++i)
@ -270,7 +278,7 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
#endif
}
std::string BOOST_RE_CALL cpp_regex_traits_base::set_message_catalogue(const std::string& l)
std::string BOOST_REGEX_CALL cpp_regex_traits_base::set_message_catalogue(const std::string& l)
{
if(sizeof(regex_message_cat) <= l.size())
return l;
@ -299,9 +307,9 @@ cpp_regex_traits<char>::cpp_regex_traits()
}
for(unsigned int i = 0; i < char_set_size; ++i)
lower_map[i] = static_cast<char>(i);
pctype = &BOOST_RE_USE_FACET(locale_inst, std::ctype<char>);
pctype = &BOOST_USE_FACET(std::ctype<char>, locale_inst);
pctype->tolower(&lower_map[0], &lower_map[char_set_size]);
pcollate = &BOOST_RE_USE_FACET(locale_inst, std::collate<char>);
pcollate = &BOOST_USE_FACET(std::collate<char>, locale_inst);
sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim));
}
@ -311,7 +319,7 @@ cpp_regex_traits<char>::~cpp_regex_traits()
delete[] lower_map;
}
int BOOST_RE_CALL cpp_regex_traits<char>::toi(char c)const
int BOOST_REGEX_CALL cpp_regex_traits<char>::toi(char c)const
{
pmd->sbuf.pubsetbuf(&c, 1);
pmd->is.clear();
@ -325,7 +333,7 @@ int BOOST_RE_CALL cpp_regex_traits<char>::toi(char c)const
return 0;
}
int BOOST_RE_CALL cpp_regex_traits<char>::toi(const char*& first, const char* last, int radix)const
int BOOST_REGEX_CALL cpp_regex_traits<char>::toi(const char*& first, const char* last, int radix)const
{
pmd->sbuf.pubsetbuf((char*)first, last-first);
pmd->is.clear();
@ -342,7 +350,7 @@ int BOOST_RE_CALL cpp_regex_traits<char>::toi(const char*& first, const char* la
return 0;
}
boost::uint_fast32_t BOOST_RE_CALL cpp_regex_traits<char>::lookup_classname(const char* first, const char* last)const
boost::uint_fast32_t BOOST_REGEX_CALL cpp_regex_traits<char>::lookup_classname(const char* first, const char* last)const
{
BOOST_RE_GUARD_STACK
unsigned int i;
@ -360,7 +368,7 @@ boost::uint_fast32_t BOOST_RE_CALL cpp_regex_traits<char>::lookup_classname(cons
return 0;
}
bool BOOST_RE_CALL cpp_regex_traits<char>::lookup_collatename(std::string& s, const char* first, const char* last)const
bool BOOST_REGEX_CALL cpp_regex_traits<char>::lookup_collatename(std::string& s, const char* first, const char* last)const
{
BOOST_RE_GUARD_STACK
std::string name(first, last);
@ -373,7 +381,7 @@ bool BOOST_RE_CALL cpp_regex_traits<char>::lookup_collatename(std::string& s, co
return re_detail::re_lookup_def_collate_name(s, name.c_str());
}
void BOOST_RE_CALL cpp_regex_traits<char>::transform_primary(std::string& out, const std::string& in)const
void BOOST_REGEX_CALL cpp_regex_traits<char>::transform_primary(std::string& out, const std::string& in)const
{
transform(out, in);
switch(sort_type)
@ -398,14 +406,14 @@ void BOOST_RE_CALL cpp_regex_traits<char>::transform_primary(std::string& out, c
}
std::string BOOST_RE_CALL cpp_regex_traits<char>::error_string(unsigned id)const
std::string BOOST_REGEX_CALL cpp_regex_traits<char>::error_string(unsigned id)const
{
if((id <= boost::REG_E_UNKNOWN) && (pmd->error_strings[id].size()))
return pmd->error_strings[id];
return boost::re_detail::re_default_error_messages[id];
}
cpp_regex_traits<char>::locale_type BOOST_RE_CALL cpp_regex_traits<char>::imbue(locale_type l)
cpp_regex_traits<char>::locale_type BOOST_REGEX_CALL cpp_regex_traits<char>::imbue(locale_type l)
{
locale_type old_l(locale_inst);
locale_inst = l;
@ -415,18 +423,18 @@ cpp_regex_traits<char>::locale_type BOOST_RE_CALL cpp_regex_traits<char>::imbue(
psyntax = pmd->syntax_map;
for(unsigned int i = 0; i < char_set_size; ++i)
lower_map[i] = static_cast<char>(i);
pctype = &BOOST_RE_USE_FACET(locale_inst, std::ctype<char>);
pctype = &BOOST_USE_FACET(std::ctype<char>, locale_inst);
pctype->tolower(&lower_map[0], &lower_map[char_set_size]);
pcollate = &BOOST_RE_USE_FACET(locale_inst, std::collate<char>);
pcollate = &BOOST_USE_FACET(std::collate<char>, locale_inst);
sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim));
return old_l;
}
#ifndef BOOST_RE_NO_WCSTRING
#ifndef BOOST_NO_WREGEX
namespace re_detail{
std::string BOOST_RE_CALL to_narrow(const std::basic_string<wchar_t>& is, const std::codecvt<wchar_t, char, std::mbstate_t>& cvt)
std::string BOOST_REGEX_CALL to_narrow(const std::basic_string<wchar_t>& is, const std::codecvt<wchar_t, char, std::mbstate_t>& cvt)
{
BOOST_RE_GUARD_STACK
unsigned int bufsize = is.size() * 2;
@ -434,8 +442,6 @@ std::string BOOST_RE_CALL to_narrow(const std::basic_string<wchar_t>& is, const
// declare buffer first as VC6 workaround for internal compiler error!
char* pc = new char[bufsize];
scoped_array<char> t(pc);
//typedef std::codecvt<wchar_t, char, std::mbstate_t> cvt_type;
//const cvt_type& cvt = BOOST_RE_USE_FACET(l, cvt_type);
#ifdef BOOST_MSVC
std::mbstate_t state = 0;
#else
@ -467,7 +473,7 @@ std::string BOOST_RE_CALL to_narrow(const std::basic_string<wchar_t>& is, const
}
}
std::wstring BOOST_RE_CALL to_wide(const std::string& is, const std::codecvt<wchar_t, char, std::mbstate_t>& cvt)
std::wstring BOOST_REGEX_CALL to_wide(const std::string& is, const std::codecvt<wchar_t, char, std::mbstate_t>& cvt)
{
BOOST_RE_GUARD_STACK
unsigned int bufsize = is.size() + 2;
@ -476,8 +482,6 @@ std::wstring BOOST_RE_CALL to_wide(const std::string& is, const std::codecvt<wch
// declare buffer first as VC6 workaround for internal compiler error!
wchar_t* pc = new wchar_t[bufsize];
scoped_array<wchar_t> t(pc);
//typedef std::codecvt<wchar_t, char, std::mbstate_t> cvt_type;
//const cvt_type& cvt = BOOST_RE_USE_FACET(l, cvt_type);
#ifdef BOOST_MSVC
std::mbstate_t state = 0;
#else
@ -520,7 +524,7 @@ std::wstring BOOST_RE_CALL to_wide(const std::string& is, const std::codecvt<wch
template <>
struct message_data<wchar_t>
{
#ifndef BOOST_RE_NO_MESSAGES
#ifndef BOOST_NO_STD_MESSAGES
typedef std::messages<wchar_t>::string_type string_type;
#else
typedef std::wstring string_type;
@ -555,9 +559,9 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
is.imbue(l);
syntax_map m;
typedef std::codecvt<wchar_t, char, std::mbstate_t> cvt_type;
const cvt_type& cvt = BOOST_RE_USE_FACET(l, cvt_type);
#ifndef BOOST_RE_NO_MESSAGES
const std::messages<wchar_t>& msgs = BOOST_RE_USE_FACET(l, std::messages<wchar_t>);
const cvt_type& cvt = BOOST_USE_FACET(cvt_type, l);
#ifndef BOOST_NO_STD_MESSAGES
const std::messages<wchar_t>& msgs = BOOST_USE_FACET(std::messages<wchar_t>, l);
std::messages<wchar_t>::catalog cat = regex_message_catalogue.size() ? msgs.open(regex_message_catalogue, l) : -1;
#endif
scoped_array<char> a;
@ -576,9 +580,9 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
re_get_default_message(a.get(), array_size, i+100);
std::string ns = a.get();
string_type s = to_wide(ns, cvt);
#ifndef BOOST_RE_NO_MESSAGES
#ifndef BOOST_NO_STD_MESSAGES
if((int)cat >= 0)
s = BOOST_RE_USE_FACET(l, std::messages<wchar_t>).get(cat, 0, i+100, s);
s = BOOST_USE_FACET(std::messages<wchar_t>, l).get(cat, 0, i+100, s);
#endif
for(unsigned int j = 0; j < s.size(); ++j)
{
@ -593,7 +597,7 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
}
}
#ifndef BOOST_RE_NO_MESSAGES
#ifndef BOOST_NO_STD_MESSAGES
// load any custom collate names:
string_type c1, c2;
i = 400;
@ -639,7 +643,7 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
} // namespace re_detail
unsigned int BOOST_RE_CALL cpp_regex_traits<wchar_t>::do_syntax_type(size_type c)const
unsigned int BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::do_syntax_type(size_type c)const
{
std::list<re_detail::message_data<wchar_t>::syntax_map>::const_iterator i, j;
i = pmd->syntax.begin();
@ -653,7 +657,7 @@ unsigned int BOOST_RE_CALL cpp_regex_traits<wchar_t>::do_syntax_type(size_type c
return 0;
}
void BOOST_RE_CALL cpp_regex_traits<wchar_t>::transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const
void BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const
{
transform(out, in);
switch(sort_type)
@ -677,7 +681,7 @@ void BOOST_RE_CALL cpp_regex_traits<wchar_t>::transform_primary(std::basic_strin
}
}
int BOOST_RE_CALL cpp_regex_traits<wchar_t>::toi(wchar_t c)const
int BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::toi(wchar_t c)const
{
pmd->sbuf.pubsetbuf(&c, 1);
pmd->is.clear();
@ -691,7 +695,7 @@ int BOOST_RE_CALL cpp_regex_traits<wchar_t>::toi(wchar_t c)const
return 0;
}
int BOOST_RE_CALL cpp_regex_traits<wchar_t>::toi(const wchar_t*& first, const wchar_t* last, int radix)const
int BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::toi(const wchar_t*& first, const wchar_t* last, int radix)const
{
pmd->sbuf.pubsetbuf((wchar_t*)first, last-first);
pmd->is.clear();
@ -708,7 +712,7 @@ int BOOST_RE_CALL cpp_regex_traits<wchar_t>::toi(const wchar_t*& first, const wc
return 0;
}
boost::uint_fast32_t BOOST_RE_CALL cpp_regex_traits<wchar_t>::lookup_classname(const wchar_t* first, const wchar_t* last)const
boost::uint_fast32_t BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::lookup_classname(const wchar_t* first, const wchar_t* last)const
{
BOOST_RE_GUARD_STACK
unsigned int i;
@ -728,7 +732,7 @@ boost::uint_fast32_t BOOST_RE_CALL cpp_regex_traits<wchar_t>::lookup_classname(c
return 0;
}
bool BOOST_RE_CALL cpp_regex_traits<wchar_t>::lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last)const
bool BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last)const
{
BOOST_RE_GUARD_STACK
std::wstring name(first, last);
@ -745,7 +749,7 @@ bool BOOST_RE_CALL cpp_regex_traits<wchar_t>::lookup_collatename(std::basic_stri
return result;
}
std::string BOOST_RE_CALL cpp_regex_traits<wchar_t>::error_string(unsigned id)const
std::string BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::error_string(unsigned id)const
{
if((id <= boost::REG_E_UNKNOWN) && (pmd->error_strings[id].size()))
return pmd->error_strings[id];
@ -766,11 +770,11 @@ cpp_regex_traits<wchar_t>::cpp_regex_traits()
}
for(unsigned int i = 0; i < char_set_size; ++i)
lower_map[i] = static_cast<wchar_t>(i);
pctype = &BOOST_RE_USE_FACET(locale_inst, std::ctype<wchar_t>);
pctype = &BOOST_USE_FACET(std::ctype<wchar_t>, locale_inst);
pctype->tolower(&lower_map[0], &lower_map[char_set_size]);
pcollate = &BOOST_RE_USE_FACET(locale_inst, std::collate<wchar_t>);
pcollate = &BOOST_USE_FACET(std::collate<wchar_t>, locale_inst);
typedef std::codecvt<wchar_t, char, std::mbstate_t> cvt_t;
pcdv = &BOOST_RE_USE_FACET(locale_inst, cvt_t);
pcdv = &BOOST_USE_FACET(cvt_t, locale_inst);
sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim));
}
@ -780,7 +784,7 @@ cpp_regex_traits<wchar_t>::~cpp_regex_traits()
delete[] lower_map;
}
cpp_regex_traits<wchar_t>::locale_type BOOST_RE_CALL cpp_regex_traits<wchar_t>::imbue(locale_type l)
cpp_regex_traits<wchar_t>::locale_type BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::imbue(locale_type l)
{
locale_type old_l(locale_inst);
locale_inst = l;
@ -790,16 +794,16 @@ cpp_regex_traits<wchar_t>::locale_type BOOST_RE_CALL cpp_regex_traits<wchar_t>::
psyntax = pmd->syntax_;
for(unsigned int i = 0; i < char_set_size; ++i)
lower_map[i] = static_cast<wchar_t>(i);
pctype = &BOOST_RE_USE_FACET(locale_inst, std::ctype<wchar_t>);
pctype = &BOOST_USE_FACET(std::ctype<wchar_t>, locale_inst);
pctype->tolower(&lower_map[0], &lower_map[char_set_size]);
pcollate = &BOOST_RE_USE_FACET(locale_inst, std::collate<wchar_t>);
pcollate = &BOOST_USE_FACET(std::collate<wchar_t>, locale_inst);
typedef std::codecvt<wchar_t, char, std::mbstate_t> cvt_t;
pcdv = &BOOST_RE_USE_FACET(locale_inst, cvt_t);
pcdv = &BOOST_USE_FACET(cvt_t, locale_inst);
sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim));
return old_l;
}
unsigned int BOOST_RE_CALL cpp_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsigned int len, const char *s2)const
unsigned int BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsigned int len, const char *s2)const
{
std::string s(s2);
std::wstring ws = re_detail::to_wide(s2, *pcdv);
@ -808,7 +812,7 @@ unsigned int BOOST_RE_CALL cpp_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsi
return ws.size()+1;
}
#endif // BOOST_RE_NO_WCSTRING
#endif // BOOST_NO_WREGEX
} // namespace boost

View File

@ -19,6 +19,10 @@
* VERSION: 3.12
* DESCRIPTION: Implements high level class boost::RexEx
*/
#define BOOST_REGEX_SOURCE
#include <boost/cregex.hpp>
#include <boost/regex.hpp>
#if !defined(BOOST_RE_NO_STRING_H)

View File

@ -21,6 +21,8 @@
*/
#define BOOST_REGEX_SOURCE
#include <climits>
#include <stdexcept>
#include <boost/regex/detail/fileiter.hpp>
@ -29,11 +31,15 @@
#include <sys/cygwin.h>
#endif
#ifdef BOOST_MSVC
# pragma warning(disable: 4800)
#endif
namespace boost{
namespace re_detail{
// start with the operating system specific stuff:
#if (defined(__BORLANDC__) || defined(FI_WIN32_DIR) || defined(BOOST_MSVC)) && !defined(BOOST_RE_NO_WIN32)
#if (defined(__BORLANDC__) || defined(BOOST_REGEX_FI_WIN32_DIR) || defined(BOOST_MSVC)) && !defined(BOOST_RE_NO_WIN32)
// platform is DOS or Windows
// directories are separated with '\\'
@ -41,7 +47,7 @@ namespace boost{
const char* _fi_sep = "\\";
const char* _fi_sep_alt = "/";
#define FI_TRANSLATE(c) std::tolower(c)
#define BOOST_REGEX_FI_TRANSLATE(c) std::tolower(c)
#else
@ -51,11 +57,11 @@ const char* _fi_sep_alt = "/";
const char* _fi_sep = "/";
const char* _fi_sep_alt = _fi_sep;
#define FI_TRANSLATE(c) c
#define BOOST_REGEX_FI_TRANSLATE(c) c
#endif
#ifdef FI_WIN32_MAP
#ifdef BOOST_REGEX_FI_WIN32_MAP
void mapfile::open(const char* file)
{
@ -679,7 +685,7 @@ void directory_iterator::next()
}
#ifdef FI_POSIX_DIR
#ifdef BOOST_REGEX_FI_POSIX_DIR
struct _fi_priv_data
{
@ -746,7 +752,7 @@ bool iswild(const char* mask, const char* name)
}
// fall through:
default:
if(FI_TRANSLATE(*mask) != FI_TRANSLATE(*name))
if(BOOST_REGEX_FI_TRANSLATE(*mask) != BOOST_REGEX_FI_TRANSLATE(*name))
return false;
++mask;
++name;

View File

@ -20,6 +20,8 @@
* DESCRIPTION: Implements the Posix API wrappers.
*/
#define BOOST_REGEX_SOURCE
#include <cstdio>
#include <boost/regex.hpp>
@ -35,7 +37,7 @@ const char* names[] = {"REG_NOERROR", "REG_NOMATCH", "REG_BADPAT", "REG_ECOLLATE
"REG_ESPACE", "REG_BADRPT", "REG_EMPTY", "REG_E_UNKNOWN"};
} // namespace
BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompA(regex_tA* expression, const char* ptr, int f)
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char* ptr, int f)
{
BOOST_RE_GUARD_STACK
if(expression->re_magic != magic_value)
@ -90,7 +92,7 @@ BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompA(regex_tA* expression, const char* p
}
BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorA(int code, const regex_tA* e, char* buf, unsigned int buf_size)
BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorA(int code, const regex_tA* e, char* buf, unsigned int buf_size)
{
BOOST_RE_GUARD_STACK
unsigned int result = 0;
@ -148,7 +150,7 @@ BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorA(int code, const regex_tA*
return 0;
}
BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecA(const regex_tA* expression, const char* buf, unsigned int n, regmatch_t* array, int eflags)
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, const char* buf, unsigned int n, regmatch_t* array, int eflags)
{
BOOST_RE_GUARD_STACK
bool result = false;
@ -204,7 +206,7 @@ BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecA(const regex_tA* expression, const c
return REG_NOMATCH;
}
BOOST_RE_IX_DECL void BOOST_RE_CCALL regfreeA(regex_tA* expression)
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA* expression)
{
BOOST_RE_GUARD_STACK
if(expression->re_magic == magic_value)

View File

@ -21,6 +21,8 @@
*/
#define BOOST_REGEX_SOURCE
#include <boost/regex.hpp>

View File

@ -21,7 +21,9 @@
*/
#include <boost/regex/detail/regex_config.hpp>
#define BOOST_REGEX_SOURCE
#include <boost/regex/config.hpp>
#include <boost/regex/detail/regex_raw_buffer.hpp>
#include <boost/regex.hpp>
@ -29,7 +31,7 @@
#include <crtdbg.h>
#endif
#ifdef BOOST_RE_DEBUG
#ifdef BOOST_REGEX_DEBUG
#ifndef BOOST_RE_OLD_IOSTREAM
#include <ostream>
#else

View File

@ -20,15 +20,19 @@
* DESCRIPTION: Thread synch helper functions, for regular
* expression library.
*/
#define BOOST_REGEX_SOURCE
#include <boost/regex/detail/regex_synch.hpp>
namespace boost{
namespace re_detail{
void BOOST_RE_CALL re_init_threads()
void BOOST_REGEX_CALL re_init_threads()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
if(p_re_lock == 0)
p_re_lock = new critical_section();
cs_guard g(*p_re_lock);
@ -36,10 +40,10 @@ void BOOST_RE_CALL re_init_threads()
#endif
}
void BOOST_RE_CALL re_free_threads()
void BOOST_REGEX_CALL re_free_threads()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
cs_guard g(*p_re_lock);
--re_lock_count;
if(re_lock_count == 0)
@ -51,11 +55,11 @@ void BOOST_RE_CALL re_free_threads()
#endif
}
#ifdef BOOST_RE_THREADS
#ifdef BOOST_HAS_THREADS
BOOST_RE_IX_DECL critical_section* p_re_lock = 0;
BOOST_REGEX_DECL critical_section* p_re_lock = 0;
BOOST_RE_IX_DECL unsigned int re_lock_count = 0;
BOOST_REGEX_DECL unsigned int re_lock_count = 0;
#endif

View File

@ -20,6 +20,8 @@
* DESCRIPTION: Implements the w32_regex_traits<charT> traits class
*/
#define BOOST_REGEX_SOURCE
#include <clocale>
#include <cstdio>
#include <list>
@ -30,7 +32,7 @@
#include <boost/regex/detail/regex_synch.hpp>
#include <boost/regex/detail/regex_cstring.hpp>
#if defined(_WIN32) && !defined(BOOST_RE_NO_W32)
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
//
// VC6 needs to link to user32.lib:
@ -103,7 +105,7 @@ std::list<collate_name_t>* pcoll_names = 0;
HINSTANCE hresmod = 0;
BOOST_RE_IX_DECL char* re_custom_error_messages[] = {
BOOST_REGEX_DECL char* re_custom_error_messages[] = {
0,
0,
0,
@ -140,10 +142,10 @@ enum syntax_map_size
map_size = UCHAR_MAX + 1
};
#ifndef BOOST_RE_NO_WCSTRING
#ifndef BOOST_NO_WREGEX
BOOST_RE_IX_DECL wchar_t re_zero_w;
BOOST_RE_IX_DECL wchar_t re_ten_w;
BOOST_REGEX_DECL wchar_t re_zero_w;
BOOST_REGEX_DECL wchar_t re_ten_w;
bool isPlatformNT = false;
@ -157,10 +159,10 @@ std::list<syntax_map_t>* syntax;
#endif
unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned int id);
unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsigned int id);
template <class charT>
unsigned int BOOST_RE_CALL get_message(charT* buf, unsigned int len, unsigned int id)
unsigned int BOOST_REGEX_CALL get_message(charT* buf, unsigned int len, unsigned int id)
{
unsigned int size = _re_get_message((char*)0, 0, id);
if(len < size)
@ -171,12 +173,12 @@ unsigned int BOOST_RE_CALL get_message(charT* buf, unsigned int len, unsigned in
return size;
}
inline unsigned int BOOST_RE_CALL get_message(char* buf, unsigned int len, unsigned int id)
inline unsigned int BOOST_REGEX_CALL get_message(char* buf, unsigned int len, unsigned int id)
{
return _re_get_message(buf, len, id);
}
unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned int id)
unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsigned int id)
{
BOOST_RE_GUARD_STACK
// get the customised message if any:
@ -193,7 +195,7 @@ unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned
return boost::re_detail::re_get_default_message(buf, len, id);
}
const char* BOOST_RE_CALL re_get_error_str(unsigned int id)
const char* BOOST_REGEX_CALL re_get_error_str(unsigned int id)
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -221,7 +223,7 @@ namespace re_detail{
char w32_traits_base::regex_message_catalogue[200] = {0};
void BOOST_RE_CALL w32_traits_base::do_init()
void BOOST_REGEX_CALL w32_traits_base::do_init()
{
BOOST_RE_GUARD_STACK
if(is_init == 0)
@ -240,7 +242,7 @@ void BOOST_RE_CALL w32_traits_base::do_init()
re_custom_error_messages[i] = 0;
}
}
#ifndef BOOST_RE_NO_WCSTRING
#ifndef BOOST_NO_WREGEX
//
// wide character strings:
syntax = new std::list<syntax_map_t>();
@ -323,7 +325,7 @@ void BOOST_RE_CALL w32_traits_base::do_init()
}
else
re_ten = 'a';
#ifndef BOOST_RE_NO_WCSTRING
#ifndef BOOST_NO_WREGEX
//
// wide string data:
std::basic_string<wchar_t> ws;
@ -359,11 +361,11 @@ void BOOST_RE_CALL w32_traits_base::do_init()
syntax->push_back(sm);
}
}
#endif // BOOST_RE_NO_WCSTRING
#endif // BOOST_NO_WREGEX
}
}
void BOOST_RE_CALL w32_traits_base::do_free()
void BOOST_REGEX_CALL w32_traits_base::do_free()
{
BOOST_RE_GUARD_STACK
delete[] pclasses;
@ -384,12 +386,12 @@ void BOOST_RE_CALL w32_traits_base::do_free()
}
}
std::string BOOST_RE_CALL w32_traits_base::error_string(unsigned id)
std::string BOOST_REGEX_CALL w32_traits_base::error_string(unsigned id)
{
return re_get_error_str(id);
}
boost::uint_fast32_t BOOST_RE_CALL w32_traits_base::do_lookup_class(const char* p)
boost::uint_fast32_t BOOST_REGEX_CALL w32_traits_base::do_lookup_class(const char* p)
{
BOOST_RE_GUARD_STACK
unsigned int i;
@ -410,7 +412,7 @@ boost::uint_fast32_t BOOST_RE_CALL w32_traits_base::do_lookup_class(const char*
return 0;
}
bool BOOST_RE_CALL w32_traits_base::do_lookup_collate(std::string& buf, const char* p)
bool BOOST_REGEX_CALL w32_traits_base::do_lookup_collate(std::string& buf, const char* p)
{
BOOST_RE_GUARD_STACK
std::list<collate_name_t>::iterator first, last;
@ -435,7 +437,7 @@ bool BOOST_RE_CALL w32_traits_base::do_lookup_collate(std::string& buf, const ch
return result;
}
std::string BOOST_RE_CALL w32_traits_base::set_message_catalogue(const std::string& l)
std::string BOOST_REGEX_CALL w32_traits_base::set_message_catalogue(const std::string& l)
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -456,7 +458,7 @@ char w32_traits_base::lower_case_map[map_size];
w32_regex_traits<char> w32_regex_traits<char>::i;
void BOOST_RE_CALL w32_regex_traits<char>::update()
void BOOST_REGEX_CALL w32_regex_traits<char>::update()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -489,7 +491,7 @@ w32_regex_traits<char>::~w32_regex_traits()
#endif
}
void BOOST_RE_CALL w32_regex_traits<char>::transform(std::string& out, const std::string& in)
void BOOST_REGEX_CALL w32_regex_traits<char>::transform(std::string& out, const std::string& in)
{
BOOST_RE_GUARD_STACK
size_t n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, 0, 0);
@ -508,7 +510,7 @@ void BOOST_RE_CALL w32_regex_traits<char>::transform(std::string& out, const std
out = buf.get();
}
void BOOST_RE_CALL w32_regex_traits<char>::transform_primary(std::string& out, const std::string& in)
void BOOST_REGEX_CALL w32_regex_traits<char>::transform_primary(std::string& out, const std::string& in)
{
transform(out, in);
for(unsigned int i = 0; i < out.size(); ++i)
@ -522,7 +524,7 @@ void BOOST_RE_CALL w32_regex_traits<char>::transform_primary(std::string& out, c
}
int BOOST_RE_CALL w32_regex_traits<char>::toi(char c)
int BOOST_REGEX_CALL w32_regex_traits<char>::toi(char c)
{
if(is_class(c, char_class_digit))
return c - re_zero;
@ -531,7 +533,7 @@ int BOOST_RE_CALL w32_regex_traits<char>::toi(char c)
return -1; // error!!
}
int BOOST_RE_CALL w32_regex_traits<char>::toi(const char*& first, const char* last, int radix)
int BOOST_REGEX_CALL w32_regex_traits<char>::toi(const char*& first, const char* last, int radix)
{
unsigned int maxval;
if(radix < 0)
@ -561,9 +563,9 @@ int BOOST_RE_CALL w32_regex_traits<char>::toi(const char*& first, const char* la
return result;
}
#ifndef BOOST_RE_NO_WCSTRING
#ifndef BOOST_NO_WREGEX
bool BOOST_RE_CALL w32_regex_traits<wchar_t>::lookup_collatename(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last)
bool BOOST_REGEX_CALL w32_regex_traits<wchar_t>::lookup_collatename(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last)
{
BOOST_RE_GUARD_STACK
std::basic_string<wchar_t> s(first, last);
@ -588,7 +590,7 @@ bool BOOST_RE_CALL w32_regex_traits<wchar_t>::lookup_collatename(std::basic_stri
return result;
}
unsigned int BOOST_RE_CALL w32_regex_traits<wchar_t>::syntax_type(size_type c)
unsigned int BOOST_REGEX_CALL w32_regex_traits<wchar_t>::syntax_type(size_type c)
{
BOOST_RE_GUARD_STACK
std::list<syntax_map_t>::const_iterator first, last;
@ -603,7 +605,7 @@ unsigned int BOOST_RE_CALL w32_regex_traits<wchar_t>::syntax_type(size_type c)
return 0;
}
bool BOOST_RE_CALL w32_regex_traits<wchar_t>::do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last)
bool BOOST_REGEX_CALL w32_regex_traits<wchar_t>::do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last)
{
BOOST_RE_GUARD_STACK
std::basic_string<wchar_t> s(first, last);
@ -623,7 +625,7 @@ bool BOOST_RE_CALL w32_regex_traits<wchar_t>::do_lookup_collate(std::basic_strin
}
void BOOST_RE_CALL w32_regex_traits<wchar_t>::update()
void BOOST_REGEX_CALL w32_regex_traits<wchar_t>::update()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -656,22 +658,22 @@ w32_regex_traits<wchar_t>::~w32_regex_traits()
#endif
}
bool BOOST_RE_CALL w32_regex_traits<wchar_t>::do_iswclass(wchar_t c, boost::uint_fast32_t f)
bool BOOST_REGEX_CALL w32_regex_traits<wchar_t>::do_iswclass(wchar_t c, boost::uint_fast32_t f)
{
BOOST_RE_GUARD_STACK
if((c & ~0xFF) == 0)
return BOOST_RE_MAKE_BOOL(re_detail::wide_unicode_classes[(uchar_type)c] & f);
return BOOST_REGEX_MAKE_BOOL(re_detail::wide_unicode_classes[(uchar_type)c] & f);
WORD mask;
if(f & char_class_unicode)
return true;
else if(isPlatformNT && GetStringTypeW(CT_CTYPE1, &c, 1, &mask))
return BOOST_RE_MAKE_BOOL(mask & f &char_class_win);
return BOOST_REGEX_MAKE_BOOL(mask & f &char_class_win);
else if((f & char_class_graph) == char_class_graph)
return true; // all wide characters are considered "graphics"
return false;
}
void BOOST_RE_CALL w32_regex_traits<wchar_t>::transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)
void BOOST_REGEX_CALL w32_regex_traits<wchar_t>::transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)
{
BOOST_RE_GUARD_STACK
scoped_array<char> alt;
@ -714,7 +716,7 @@ void BOOST_RE_CALL w32_regex_traits<wchar_t>::transform(std::basic_string<wchar_
out = buf.get();
}
void BOOST_RE_CALL w32_regex_traits<wchar_t>::transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)
void BOOST_REGEX_CALL w32_regex_traits<wchar_t>::transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)
{
transform(out, in);
for(unsigned int i = 0; i < out.size(); ++i)
@ -728,7 +730,7 @@ void BOOST_RE_CALL w32_regex_traits<wchar_t>::transform_primary(std::basic_strin
}
int BOOST_RE_CALL w32_regex_traits<wchar_t>::toi(wchar_t c)
int BOOST_REGEX_CALL w32_regex_traits<wchar_t>::toi(wchar_t c)
{
if(is_class(c, char_class_digit))
return c - re_zero_w;
@ -737,7 +739,7 @@ int BOOST_RE_CALL w32_regex_traits<wchar_t>::toi(wchar_t c)
return -1; // error!!
}
int BOOST_RE_CALL w32_regex_traits<wchar_t>::toi(const wchar_t*& first, const wchar_t* last, int radix)
int BOOST_REGEX_CALL w32_regex_traits<wchar_t>::toi(const wchar_t*& first, const wchar_t* last, int radix)
{
unsigned int maxval;
if(radix < 0)
@ -767,7 +769,7 @@ int BOOST_RE_CALL w32_regex_traits<wchar_t>::toi(const wchar_t*& first, const wc
return result;
}
boost::uint_fast32_t BOOST_RE_CALL w32_regex_traits<wchar_t>::lookup_classname(const wchar_t* first, const wchar_t* last)
boost::uint_fast32_t BOOST_REGEX_CALL w32_regex_traits<wchar_t>::lookup_classname(const wchar_t* first, const wchar_t* last)
{
std::basic_string<wchar_t> s(first, last);
unsigned int len = strnarrow((char*)0, 0, s.c_str());
@ -777,7 +779,7 @@ boost::uint_fast32_t BOOST_RE_CALL w32_regex_traits<wchar_t>::lookup_classname(c
return len;
}
wchar_t BOOST_RE_CALL w32_regex_traits<wchar_t>::wtolower(wchar_t c)
wchar_t BOOST_REGEX_CALL w32_regex_traits<wchar_t>::wtolower(wchar_t c)
{
BOOST_RE_GUARD_STACK
if(isPlatformNT)
@ -788,7 +790,7 @@ wchar_t BOOST_RE_CALL w32_regex_traits<wchar_t>::wtolower(wchar_t c)
w32_regex_traits<wchar_t> w32_regex_traits<wchar_t>::init_;
unsigned int BOOST_RE_CALL w32_regex_traits<wchar_t>::strnarrow(char *s1, unsigned int len, const wchar_t *s2)
unsigned int BOOST_REGEX_CALL w32_regex_traits<wchar_t>::strnarrow(char *s1, unsigned int len, const wchar_t *s2)
{
BOOST_RE_GUARD_STACK
unsigned int size = WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, 0, 0, 0);
@ -797,7 +799,7 @@ unsigned int BOOST_RE_CALL w32_regex_traits<wchar_t>::strnarrow(char *s1, unsign
return WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, len, 0, 0);
}
unsigned int BOOST_RE_CALL w32_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsigned int len, const char *s2)
unsigned int BOOST_REGEX_CALL w32_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsigned int len, const char *s2)
{
BOOST_RE_GUARD_STACK
unsigned int size = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, s2, -1, s1, 0);
@ -1068,10 +1070,10 @@ unsigned short w32_regex_traits<wchar_t>::wide_unicode_classes[] = {
#endif // BOOST_RE_NO_WCSTRING
#endif // BOOST_NO_WREGEX
} // namespace boost
#endif // #if defined(_WIN32) && !defined(BOOST_RE_NO_W32)
#endif // #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)

View File

@ -20,9 +20,11 @@
* DESCRIPTION: Implements the wide character POSIX API wrappers.
*/
#include <boost/regex/detail/regex_config.hpp>
#define BOOST_REGEX_SOURCE
#ifndef BOOST_RE_NO_WCSTRING
#include <boost/regex/config.hpp>
#ifndef BOOST_NO_WREGEX
#include <boost/regex.hpp>
@ -45,7 +47,7 @@ const wchar_t* wnames[] = {L"REG_NOERROR", L"REG_NOMATCH", L"REG_BADPAT", L"REG_
}
BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompW(regex_tW* expression, const wchar_t* ptr, int f)
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wchar_t* ptr, int f)
{
BOOST_RE_GUARD_STACK
if(expression->re_magic != wmagic_value)
@ -100,7 +102,7 @@ BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompW(regex_tW* expression, const wchar_t
}
BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorW(int code, const regex_tW* e, wchar_t* buf, unsigned int buf_size)
BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorW(int code, const regex_tW* e, wchar_t* buf, unsigned int buf_size)
{
BOOST_RE_GUARD_STACK
unsigned int result = 0;
@ -116,7 +118,7 @@ BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorW(int code, const regex_tW*
}
return result;
}
#if !defined(BOOST_RE_NO_SWPRINTF)
#if !defined(BOOST_NO_SWPRINTF)
if(code == REG_ATOI)
{
wchar_t localbuf[5];
@ -158,7 +160,7 @@ BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorW(int code, const regex_tW*
return 0;
}
BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecW(const regex_tW* expression, const wchar_t* buf, unsigned int n, regmatch_t* array, int eflags)
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, const wchar_t* buf, unsigned int n, regmatch_t* array, int eflags)
{
BOOST_RE_GUARD_STACK
bool result = false;
@ -214,7 +216,7 @@ BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecW(const regex_tW* expression, const w
return REG_NOMATCH;
}
BOOST_RE_IX_DECL void BOOST_RE_CCALL regfreeW(regex_tW* expression)
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW* expression)
{
BOOST_RE_GUARD_STACK
if(expression->re_magic == wmagic_value)