forked from boostorg/regex
Updated more license terms.
Added new informational program to try and track down issues with std::collate, and std::ctype. [SVN r26803]
This commit is contained in:
@ -134,7 +134,7 @@ static const error_type error_bad_pattern;
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -134,7 +134,7 @@ static const error_type error_bad_pattern;
|
||||
and its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documentation.
|
||||
Dr John Maddock makes no representations about the suitability of this software
|
||||
John Maddock makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied warranty.</I></P>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
|
@ -1,5 +1,5 @@
|
||||
Copyright (c) 1998-2003
|
||||
Dr John Maddock
|
||||
John Maddock
|
||||
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
|
@ -177,6 +177,9 @@ test-suite regex
|
||||
: : : <test-info>always_show_run_output
|
||||
: regex_dll_config_info ]
|
||||
|
||||
[ run collate_info/collate_info.cpp <template>test <lib>../../test/build/boost_prg_exec_monitor
|
||||
: : : <test-info>always_show_run_output ]
|
||||
|
||||
[ regex-test regex_regress_dll
|
||||
: <template>regression-dll # sources
|
||||
: # requirements
|
||||
|
@ -68,6 +68,7 @@ test-suite regex
|
||||
]
|
||||
|
||||
[ run config_info/regex_config_info.cpp ../build//boost_regex ]
|
||||
[ run collate_info/collate_info.cpp ../build//boost_regex ../../test/build//boost_prg_exec_monitor ]
|
||||
|
||||
[ compile concepts/concept_check.cpp ../build//boost_regex
|
||||
]
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
|
200
test/collate_info/collate_info.cpp
Normal file
200
test/collate_info/collate_info.cpp
Normal file
@ -0,0 +1,200 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2005
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
// most of the workarounds and headers we need are already in here:
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
template <class charT>
|
||||
int make_int(charT c)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
|
||||
int make_int(char c)
|
||||
{
|
||||
return static_cast<unsigned char>(c);
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
void print_string(const std::basic_string<charT>& s)
|
||||
{
|
||||
typedef typename std::basic_string<charT>::size_type size_type;
|
||||
for(size_type i = 0; i < s.size(); ++i)
|
||||
{
|
||||
if((s[i] > ' ') && (s[i] <= 'z'))
|
||||
{
|
||||
std::cout.put(static_cast<unsigned char>(s[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "\\x" << std::hex << make_int(s[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print_c_char(char c)
|
||||
{
|
||||
char buf[50];
|
||||
const char cbuf[2] = { c, 0, };
|
||||
std::strxfrm(buf, cbuf, 50);
|
||||
std::string s(buf);
|
||||
print_string(s);
|
||||
}
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
void print_c_char(wchar_t c)
|
||||
{
|
||||
wchar_t buf[50];
|
||||
const wchar_t cbuf[2] = { c, 0, };
|
||||
std::wcsxfrm(buf, cbuf, 50);
|
||||
std::wstring s(buf);
|
||||
print_string(s);
|
||||
}
|
||||
#endif
|
||||
template <class charT>
|
||||
void print_c_info(charT, const char* name)
|
||||
{
|
||||
std::cout << "Info for " << name << " C API's:" << std::endl;
|
||||
std::cout << " \"a\" : ";
|
||||
print_c_char(charT('a'));
|
||||
std::cout << std::endl;
|
||||
std::cout << " \"A\" : ";
|
||||
print_c_char(charT('A'));
|
||||
std::cout << std::endl;
|
||||
std::cout << " \"z\" : ";
|
||||
print_c_char(charT('z'));
|
||||
std::cout << std::endl;
|
||||
std::cout << " \"Z\" : ";
|
||||
print_c_char(charT('Z'));
|
||||
std::cout << std::endl;
|
||||
std::cout << " \";\" : ";
|
||||
print_c_char(charT(';'));
|
||||
std::cout << std::endl;
|
||||
std::cout << " \"{\" : ";
|
||||
print_c_char(charT('{'));
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
void print_cpp_char(charT c)
|
||||
{
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
std::locale l;
|
||||
const std::collate<charT>& col = BOOST_USE_FACET(std::collate<charT>, l);
|
||||
std::basic_string<charT> result = col.transform(&c, &c+1);
|
||||
print_string(result);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
void print_cpp_info(charT, const char* name)
|
||||
{
|
||||
std::cout << "Info for " << name << " C++ locale API's:" << std::endl;
|
||||
std::cout << " \"a\" : ";
|
||||
print_cpp_char(charT('a'));
|
||||
std::cout << std::endl;
|
||||
std::cout << " \"A\" : ";
|
||||
print_cpp_char(charT('A'));
|
||||
std::cout << std::endl;
|
||||
std::cout << " \"z\" : ";
|
||||
print_cpp_char(charT('z'));
|
||||
std::cout << std::endl;
|
||||
std::cout << " \"Z\" : ";
|
||||
print_cpp_char(charT('Z'));
|
||||
std::cout << std::endl;
|
||||
std::cout << " \";\" : ";
|
||||
print_cpp_char(charT(';'));
|
||||
std::cout << std::endl;
|
||||
std::cout << " \"{\" : ";
|
||||
print_cpp_char(charT('{'));
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
template <class traits>
|
||||
void print_sort_syntax(const traits& pt, const char* name)
|
||||
{
|
||||
std::cout << "Sort Key Syntax for type " << name << ":\n";
|
||||
typedef typename traits::char_type char_type;
|
||||
char_type delim;
|
||||
unsigned result = ::boost::re_detail::find_sort_syntax(&pt, &delim);
|
||||
std::cout << " ";
|
||||
switch(result)
|
||||
{
|
||||
case boost::re_detail::sort_C:
|
||||
std::cout << "sort_C";
|
||||
break;
|
||||
case boost::re_detail::sort_fixed:
|
||||
std::cout << "sort_fixed" << " " << static_cast<int>(delim);
|
||||
break;
|
||||
case boost::re_detail::sort_delim:
|
||||
{
|
||||
std::cout << "sort_delim" << " ";
|
||||
std::basic_string<char_type> s(1, delim);
|
||||
print_string(s);
|
||||
}
|
||||
break;
|
||||
case boost::re_detail::sort_unknown:
|
||||
std::cout << "sort_unknown";
|
||||
break;
|
||||
default:
|
||||
std::cout << "bad_value";
|
||||
break;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
template <class charT>
|
||||
void print_ctype_info(charT, const char* name)
|
||||
{
|
||||
std::locale l;
|
||||
const std::ctype<charT>& ct = BOOST_USE_FACET(std::ctype<charT>, l);
|
||||
typedef typename std::ctype<charT>::mask mask_type;
|
||||
mask_type m = static_cast<mask_type>(std::ctype<charT>::lower | std::ctype<charT>::upper);
|
||||
bool result = ct.is(m, static_cast<charT>('a')) && ct.is(m , static_cast<charT>('A'));
|
||||
std::cout << "Checking std::ctype<" << name << ">::is(mask, c):" << std::endl;
|
||||
#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
|
||||
std::cout << " Boost.Regex believes this facet to be buggy..." << std::endl;
|
||||
#else
|
||||
std::cout << " Boost.Regex believes this facet to be correct..." << std::endl;
|
||||
#endif
|
||||
std::cout << " Actual behavior, appears to be " << (result ? "correct." : "buggy.") << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
int cpp_main(int /*argc*/, char * /*argv*/[])
|
||||
{
|
||||
print_c_info(char(0), "char");
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
print_c_info(wchar_t(0), "wchar_t");
|
||||
#endif
|
||||
print_c_info(char(0), "char");
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
print_c_info(wchar_t(0), "wchar_t");
|
||||
#endif
|
||||
|
||||
print_sort_syntax(boost::c_regex_traits<char>(), "boost::c_regex_traits<char>");
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
print_sort_syntax(boost::c_regex_traits<wchar_t>(), "boost::c_regex_traits<wchar_t>");
|
||||
#endif
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
print_sort_syntax(boost::cpp_regex_traits<char>(), "boost::c_regex_traits<char>");
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
print_sort_syntax(boost::cpp_regex_traits<wchar_t>(), "boost::c_regex_traits<wchar_t>");
|
||||
#endif
|
||||
print_ctype_info(char(0), "char");
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
print_ctype_info(wchar_t(0), "wchar_t");
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
@ -1,9 +1,19 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)\
|
||||
&& !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))\
|
||||
&& !(defined(__GNUC__) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)))
|
||||
&& !(defined(__GNUC__) && (__GNUC__ < 3) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)))
|
||||
|
||||
template <class T1, class T2>
|
||||
void test_less(const T1& t1, const T2& t2)
|
||||
|
@ -1,3 +1,13 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
@ -43,4 +53,4 @@ void test_overloads()
|
||||
BOOST_REGEX_TEST(boost::regex_search(s, sm, e, boost::regex_constants::match_default))
|
||||
BOOST_REGEX_TEST(boost::regex_search(s, e))
|
||||
BOOST_REGEX_TEST(boost::regex_search(s, e, boost::regex_constants::match_default))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user