forked from boostorg/regex
regex configuration tweeks, and point release.
[SVN r9225]
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
|
||||
/*
|
||||
* FILE jgrep.cpp
|
||||
* VERSION 3.03
|
||||
* VERSION 3.04
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
/*
|
||||
* FILE jgrep.h
|
||||
* VERSION 3.03
|
||||
* VERSION 3.04
|
||||
*/
|
||||
|
||||
#ifndef _JGREP_H
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
/*
|
||||
* FILE main.cpp
|
||||
* VERSION 3.03
|
||||
* VERSION 3.04
|
||||
*/
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
/*
|
||||
*
|
||||
* FILE parse.cpp
|
||||
* VERSION 3.03
|
||||
* VERSION 3.04
|
||||
*
|
||||
* Input parsing functions for regress.
|
||||
*
|
||||
@ -172,7 +172,7 @@ bool parse_function::operator()(const parse_grep& g)
|
||||
}
|
||||
cout << "Warning: Unknown flag: ";
|
||||
string_type t(i, j);
|
||||
cout << t.c_str();
|
||||
cout << make_narrow(t.c_str());
|
||||
cout << endl;
|
||||
return true;
|
||||
}
|
||||
@ -184,9 +184,9 @@ bool parse_function::operator()(const parse_grep& g)
|
||||
case 1:
|
||||
// set the text to match:
|
||||
search_text = string_type(i, j);
|
||||
jm_trace("Initial search text: " << search_text);
|
||||
jm_trace("Initial search text: " << make_narrow(search_text));
|
||||
expand_escapes(search_text);
|
||||
jm_trace("Search text after escapes expanded: " << search_text);
|
||||
jm_trace("Search text after escapes expanded: " << make_narrow(search_text));
|
||||
break;
|
||||
case 2:
|
||||
// maybe set format string:
|
||||
@ -232,8 +232,8 @@ void parse_input_line(const string_type& s)
|
||||
parse_function op;
|
||||
do_test = false;
|
||||
regex_grep(op, s.begin(), s.end(), parse_expression);
|
||||
jm_trace("expression: " << expression);
|
||||
jm_trace("search string: " << search_text);
|
||||
jm_trace("expression: " << make_narrow(expression));
|
||||
jm_trace("search string: " << make_narrow(search_text));
|
||||
}
|
||||
|
||||
int to_int(string_type::const_iterator i, string_type::const_iterator j)
|
||||
|
@ -16,7 +16,7 @@
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_test.cpp
|
||||
* VERSION 3.03
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Builds regression test program with default
|
||||
* locale and narrow character tests. Also
|
||||
* instantiates all the templates in the library
|
||||
|
@ -16,7 +16,7 @@
|
||||
/*
|
||||
*
|
||||
* FILE regress.cpp
|
||||
* VERSION 3.03
|
||||
* VERSION 3.04
|
||||
*
|
||||
* main() and associated code for regress.
|
||||
*
|
||||
@ -101,7 +101,7 @@ int main(int argc, char * argv[])
|
||||
string_type s;
|
||||
get_line(is, s);
|
||||
++line;
|
||||
jm_trace("Reading test script line " << line << " " << s);
|
||||
jm_trace("Reading test script line " << line << " " << make_narrow(s.c_str()));
|
||||
parse_input_line(s);
|
||||
if(do_test)
|
||||
{
|
||||
@ -117,20 +117,25 @@ int main(int argc, char * argv[])
|
||||
|
||||
#ifdef TEST_UNICODE
|
||||
|
||||
ostream& operator << (ostream& os, const wchar_t* s)
|
||||
std::string make_narrow(const wchar_t* ptr)
|
||||
{
|
||||
while(*s)
|
||||
std::string result;
|
||||
while(*ptr)
|
||||
{
|
||||
os.put((char)*s);
|
||||
++s;
|
||||
if(*ptr & ~0x7F)
|
||||
{
|
||||
char buf[10];
|
||||
std::sprintf(buf, "\\x%.4x", (int)*ptr);
|
||||
result.append(buf);
|
||||
++ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append(1, (char)*ptr);
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
ostream& operator << (ostream& os, const std::wstring& s)
|
||||
{
|
||||
os << s.c_str();
|
||||
return os;
|
||||
return result;
|
||||
}
|
||||
|
||||
istream& get_line(istream& is, nstring_type& s, char delim)
|
||||
|
@ -16,7 +16,7 @@
|
||||
/*
|
||||
*
|
||||
* FILE regress.h
|
||||
* VERSION 3.03
|
||||
* VERSION 3.04
|
||||
*
|
||||
* Function and data declarations for regress.
|
||||
*
|
||||
@ -44,32 +44,38 @@ using std::endl;
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#if defined(TEST_UNICODE)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define char_t wchar_t
|
||||
#else
|
||||
typedef wchar_t char_t;
|
||||
#endif
|
||||
|
||||
#define NO_POSIX_TEST
|
||||
typedef std::basic_string<char_t> string_type;
|
||||
typedef std::basic_string<char> nstring_type;
|
||||
inline istream& get_line(istream& is, nstring_type& s, char delim = '\n');
|
||||
istream& get_line(istream& is, string_type& s, char delim = L'\n');
|
||||
#define BOOST_RE_STR(x) L##x
|
||||
ostream& operator << (ostream& os, const string_type& s);
|
||||
std::string make_narrow(const wchar_t* ptr);
|
||||
//ostream& operator << (ostream& os, const string_type& s);
|
||||
|
||||
#else // TEST_UNICODE
|
||||
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define char_t char
|
||||
#else
|
||||
typedef char char_t;
|
||||
#endif
|
||||
|
||||
typedef std::basic_string<char_t> string_type;
|
||||
inline istream& get_line(istream& is, string_type& s, char delim = '\n');
|
||||
#define BOOST_RE_STR(x) x
|
||||
#define make_narrow(x) x
|
||||
|
||||
#endif
|
||||
#endif // TEST_UNICODE
|
||||
|
||||
ostream& operator << (ostream& os, const wchar_t* s);
|
||||
//ostream& operator << (ostream& os, const wchar_t* s);
|
||||
void parse_input_line(const string_type& s);
|
||||
void expand_escapes(string_type& s);
|
||||
void run_tests();
|
||||
|
@ -16,7 +16,7 @@
|
||||
/*
|
||||
*
|
||||
* FILE tests.cpp
|
||||
* VERSION 3.03
|
||||
* VERSION 3.04
|
||||
*
|
||||
* the actual tests conducted by regress.
|
||||
*
|
||||
@ -213,7 +213,7 @@ void cpp_tests(const reg_expression<C, T, A>& e, bool recurse = true)
|
||||
if(s != merge_string)
|
||||
{
|
||||
begin_error();
|
||||
cout << "merge result mismatch: found \"" << s.c_str() << "\" expected \"" << merge_string.c_str() << "\"" << endl;
|
||||
cout << "merge result mismatch: found \"" << make_narrow(s.c_str()) << "\" expected \"" << make_narrow(merge_string.c_str()) << "\"" << endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -715,8 +715,8 @@ void begin_error()
|
||||
if(line != last_line)
|
||||
{
|
||||
cout << "Error in line " << line << " of file " << file << endl;
|
||||
cout << "Expression: " << expression.c_str() << endl;
|
||||
cout << "Search text: " << search_text.c_str() << endl;
|
||||
cout << "Expression: " << make_narrow(expression.c_str()) << endl;
|
||||
cout << "Search text: " << make_narrow(search_text.c_str()) << endl;
|
||||
cout << "Flags: ";
|
||||
bool started = false;
|
||||
unsigned int id = 0;
|
||||
@ -726,7 +726,7 @@ void begin_error()
|
||||
{
|
||||
if(started)
|
||||
cout << " | ";
|
||||
cout << flag_data[id].name;
|
||||
cout << make_narrow(flag_data[id].name);
|
||||
started = true;
|
||||
}
|
||||
++id;
|
||||
|
@ -16,7 +16,7 @@
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_test.cpp
|
||||
* VERSION 3.03
|
||||
* VERSION 3.04
|
||||
* DESCRIPTION: Builds regression test program with default
|
||||
* locale and wide character tests. Also
|
||||
* instantiates all the templates in the library
|
||||
|
Reference in New Issue
Block a user