forked from boostorg/regex
Apply patches for building regex on WinCE see: http://lists.boost.org/Archives/boost/2007/11/130839.php
[SVN r41327]
This commit is contained in:
@ -32,30 +32,30 @@ int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
|
||||
|
||||
int main()
|
||||
{
|
||||
regex_t re;
|
||||
regex_tA re;
|
||||
int result;
|
||||
result = regcomp(&re, expression, REG_AWK);
|
||||
result = regcompA(&re, expression, REG_AWK);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
regerrorA(result, &re, buf, sizeof(buf));
|
||||
printf(buf);
|
||||
return result;
|
||||
}
|
||||
assert(re.re_nsub == 0);
|
||||
matches[0].rm_so = 0;
|
||||
matches[0].rm_eo = strlen(text);
|
||||
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||
result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
regerrorA(result, &re, buf, sizeof(buf));
|
||||
printf(buf);
|
||||
regfree(&re);
|
||||
regfreeA(&re);
|
||||
return result;
|
||||
}
|
||||
assert(matches[0].rm_so == matches[0].rm_eo == 1);
|
||||
regfree(&re);
|
||||
regfreeA(&re);
|
||||
printf("no errors found\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -33,30 +33,30 @@ int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
|
||||
|
||||
int main()
|
||||
{
|
||||
regex_t re;
|
||||
regex_tA re;
|
||||
int result;
|
||||
result = regcomp(&re, expression, REG_AWK);
|
||||
result = regcompA(&re, expression, REG_AWK);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
regerrorA(result, &re, buf, sizeof(buf));
|
||||
printf(buf);
|
||||
return result;
|
||||
}
|
||||
BOOST_TEST(re.re_nsub == 0);
|
||||
matches[0].rm_so = 0;
|
||||
matches[0].rm_eo = strlen(text);
|
||||
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||
result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
regerrorA(result, &re, buf, sizeof(buf));
|
||||
printf(buf);
|
||||
regfree(&re);
|
||||
regfreeA(&re);
|
||||
return result;
|
||||
}
|
||||
BOOST_TEST(matches[0].rm_so == matches[0].rm_eo == 1);
|
||||
regfree(&re);
|
||||
regfreeA(&re);
|
||||
printf("no errors found\n");
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ namespace std{ using ::setlocale; }
|
||||
|
||||
test_locale::test_locale(const char* c_name, boost::uint32_t lcid)
|
||||
{
|
||||
#ifndef UNDER_CE
|
||||
// store the name:
|
||||
m_old_name = m_name;
|
||||
m_name = c_name;
|
||||
@ -43,6 +44,9 @@ test_locale::test_locale(const char* c_name, boost::uint32_t lcid)
|
||||
s_c_locale = no_test;
|
||||
std::cout << "The global C locale: " << c_name << " is not available and will not be tested." << std::endl;
|
||||
}
|
||||
#else
|
||||
s_c_locale = no_test;
|
||||
#endif
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
// back up the C++ locale and create the new one:
|
||||
m_old_cpp_locale = s_cpp_locale_inst;
|
||||
@ -69,6 +73,7 @@ test_locale::test_locale(const char* c_name, boost::uint32_t lcid)
|
||||
// Start by geting the printable name of the locale.
|
||||
// We use this for debugging purposes only:
|
||||
//
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
boost::scoped_array<char> p;
|
||||
int r = ::GetLocaleInfoA(
|
||||
lcid, // locale identifier
|
||||
@ -83,6 +88,43 @@ test_locale::test_locale(const char* c_name, boost::uint32_t lcid)
|
||||
p.get(), // information buffer
|
||||
r+1 // size of buffer
|
||||
);
|
||||
#else
|
||||
WCHAR code_page_string[7];
|
||||
int r = ::GetLocaleInfoW(
|
||||
lcid,
|
||||
LOCALE_IDEFAULTANSICODEPAGE,
|
||||
code_page_string,
|
||||
7);
|
||||
BOOST_ASSERT(r != 0);
|
||||
|
||||
UINT code_page = static_cast<UINT>(_wtol(code_page_string));
|
||||
|
||||
boost::scoped_array<wchar_t> wp;
|
||||
r = ::GetLocaleInfoW(
|
||||
lcid, // locale identifier
|
||||
LOCALE_SCOUNTRY, // information type
|
||||
0, // information buffer
|
||||
0 // size of buffer
|
||||
);
|
||||
wp.reset(new wchar_t[r+1]);
|
||||
r = ::GetLocaleInfoW(
|
||||
lcid, // locale identifier
|
||||
LOCALE_SCOUNTRY, // information type
|
||||
wp.get(), // information buffer
|
||||
r+1 // size of buffer
|
||||
);
|
||||
|
||||
int name_size = (r+1) * 2;
|
||||
boost::scoped_array<char> p(new char[name_size]);
|
||||
int conv_r = ::WideCharToMultiByte(
|
||||
code_page,
|
||||
0,
|
||||
wp.get(), r,
|
||||
p.get(), name_size,
|
||||
NULL, NULL
|
||||
);
|
||||
BOOST_ASSERT(conv_r != 0);
|
||||
#endif
|
||||
//
|
||||
// now see if locale is installed and behave accordingly:
|
||||
//
|
||||
@ -104,8 +146,10 @@ test_locale::test_locale(const char* c_name, boost::uint32_t lcid)
|
||||
test_locale::~test_locale()
|
||||
{
|
||||
// restore to previous state:
|
||||
#ifndef UNDER_CE
|
||||
std::setlocale(LC_ALL, m_old_c_locale.c_str());
|
||||
s_c_locale = m_old_c_state;
|
||||
#endif
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
s_cpp_locale_inst = m_old_cpp_locale;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user