diff --git a/old_include/cregex b/old_include/cregex deleted file mode 100644 index 7a59629d..00000000 --- a/old_include/cregex +++ /dev/null @@ -1,3 +0,0 @@ -#include - - diff --git a/old_include/cregex.h b/old_include/cregex.h deleted file mode 100644 index 1e53ba18..00000000 --- a/old_include/cregex.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * - * Copyright (c) 1998-2000 - * 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) - * - */ - - /* - * FILE cregex.h - * VERSION see - * deprecated regular expression matching algorithms - */ - -#ifndef BOOST_OLD_CREGEX_H -#define BOOST_OLD_CREGEX_H - -#include - -// -// macro defs: -#define JM_STD std -#define JM_CSTD std -#define JM jm - -#ifdef BOOST_RE_OLD_IOSTREAM -#define JM_OLD_IOSTREAM -#endif - -#ifdef __cplusplus - -namespace jm = boost; - -#if !defined(BOOST_RE_NO_USING) -using boost::regex_tA; -using boost::regex_t; -using boost::regoff_t; -using boost::regmatch_t; -using boost::regcompA; -using boost::regerrorA; -using boost::regexecA; -using boost::regfreeA; - -#ifndef BOOST_NO_WREGEX -using boost::regex_tW; -using boost::regcompW; -using boost::regerrorW; -using boost::regexecW; -using boost::regfreeW; -#endif - -using boost::RegEx; -using boost::GrepCallback; -using boost::GrepFileCallback; -using boost::FindFilesCallback; - -using boost::match_flags; -using boost::reg_errcode_t; - -using boost::REG_NOERROR; -using boost::REG_NOMATCH; -using boost::REG_BADPAT; -using boost::REG_ECOLLATE; -using boost::REG_ECTYPE; -using boost::REG_EESCAPE; -using boost::REG_ESUBREG; -using boost::REG_EBRACK; -using boost::REG_EPAREN; -using boost::REG_EBRACE; -using boost::REG_BADBR; -using boost::REG_ERANGE; -using boost::REG_ESPACE; -using boost::REG_BADRPT; -using boost::REG_EEND; -using boost::REG_ESIZE; -using boost::REG_ERPAREN; -using boost::REG_EMPTY; -using boost::REG_E_MEMORY; -using boost::REG_E_UNKNOWN; -using boost::match_default; -using boost::match_not_bol; -using boost::match_not_eol; -using boost::match_not_bob; -using boost::match_not_eob; -using boost::match_not_bow; -using boost::match_not_eow; -using boost::match_not_dot_newline; -using boost::match_not_dot_null; -using boost::match_prev_avail; -using boost::match_init; -using boost::match_any; -using boost::match_not_null; -using boost::match_continuous; -using boost::match_stop; - -using boost::REG_BASIC; -using boost::REG_EXTENDED; -using boost::REG_ICASE; -using boost::REG_NOSUB; -using boost::REG_NEWLINE; -using boost::REG_NOSPEC; -using boost::REG_PEND; -using boost::REG_DUMP; -using boost::REG_NOCOLLATE; - -using boost::REG_ASSERT; -using boost::REG_INVARG; -using boost::REG_ATOI; -using boost::REG_ITOA; - -using boost::REG_NOTBOL; -using boost::REG_NOTEOL; -using boost::REG_STARTEND; - -#endif // BOOST_RE_NO_USING -#endif // __cplusplus - -#ifdef BOOST_RE_USING_HACK -using namespace boost; -#endif - -#endif // include guard - diff --git a/old_include/fileiter.h b/old_include/fileiter.h deleted file mode 100644 index 5eea48a2..00000000 --- a/old_include/fileiter.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Copyright (c) 1998-2000 - * 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) - * - */ - -#ifndef BOOST_FILEITER_H -#define BOOST_FILEITER_H - -#include - -using boost::re_detail::directory_iterator; -using boost::re_detail::file_iterator; -using boost::re_detail::mapfile; - -#endif - diff --git a/old_include/regex b/old_include/regex deleted file mode 100644 index 2709369e..00000000 --- a/old_include/regex +++ /dev/null @@ -1,3 +0,0 @@ -#include - - diff --git a/old_include/regex.h b/old_include/regex.h deleted file mode 100644 index 95b2a76f..00000000 --- a/old_include/regex.h +++ /dev/null @@ -1,436 +0,0 @@ -/* - * - * Copyright (c) 1998-2000 - * 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) - * - */ - - /* - * FILE regex.h - * VERSION see - * deprecated regular expression matching algorithms - */ - -#ifndef BOOST_OLD_REGEX_H -#define BOOST_OLD_REGEX_H - -#include -#include - -namespace boost{ - -namespace deprecated{ -// -// class reg_match: -// old name for match_results, this ones just a thin wrapper: -// -template ::type)> -class reg_match : public boost::match_results -{ - typedef boost::match_results base_type; - typedef boost::re_detail::match_results_base ancestor; -public: - reg_match(const Allocator& a = Allocator()) - : base_type(a){} - - reg_match(const ancestor& m) - : base_type(m){} - - reg_match& operator=(const ancestor& m) - { - // shallow copy - ancestor::operator=(m); - return *this; - } - - reg_match(const base_type& m) - : base_type(m){} - reg_match& operator=(const base_type& m) - { - // deep copy - base_type::operator=(m); - return *this; - } -}; -// -// proc query_match -// returns true if the specified regular expression matches -// at position first. Fills in what matched in m. -// -template -bool query_match(iterator first, iterator last, boost::match_results& m, const reg_expression& e, unsigned flags = match_default) -{ - return regex_search(first, last, m, e, flags | match_continuous); -} - -// -// query_match convenience interfaces: -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING -// -// this isn't really a partial specialisation, but template function -// overloading - if the compiler doesn't support partial specialisation -// then it really won't support this either: -template -inline bool query_match(const charT* str, - boost::match_results& m, - const reg_expression& e, - unsigned flags = match_default) -{ - return query_match(str, str + traits::length(str), m, e, flags); -} - -template -inline bool query_match(const std::basic_string& s, - boost::match_results::const_iterator, Allocator>& m, - const reg_expression& e, - unsigned flags = match_default) -{ - return query_match(s.begin(), s.end(), m, e, flags); -} -#else // partial ordering -inline bool query_match(const char* str, - cmatch& m, - const regex& e, - unsigned flags = match_default) -{ - return query_match(str, str + regex::traits_type::length(str), m, e, flags); -} -#ifndef BOOST_NO_WREGEX -inline bool query_match(const wchar_t* str, - wcmatch& m, - const wregex& e, - unsigned flags = match_default) -{ - return query_match(str, str + wregex::traits_type::length(str), m, e, flags); -} -#endif -inline bool query_match(const std::string& s, - boost::match_results& m, - const regex& e, - unsigned flags = match_default) -{ - return query_match(s.begin(), s.end(), m, e, flags); -} -#if !defined(BOOST_NO_WREGEX) -inline bool query_match(const std::basic_string& s, - boost::match_results::const_iterator, wregex::allocator_type>& m, - const wregex& e, - unsigned flags = match_default) -{ - return query_match(s.begin(), s.end(), m, e, flags); -} -#endif - -#endif - - -template -bool reg_search(iterator first, iterator last, boost::match_results& m, const reg_expression& e, unsigned flags = match_default) -{ - return boost::regex_search(first, last, m, e, flags); -} - -// -// reg_search convenience interfaces: -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING -// -// this isn't really a partial specialisation, but template function -// overloading - if the compiler doesn't support partial specialisation -// then it really won't support this either: -template -inline bool reg_search(const charT* str, - boost::match_results& m, - const reg_expression& e, - unsigned flags = match_default) -{ - return reg_search(str, str + traits::length(str), m, e, flags); -} - -#ifndef BOOST_RE_NO_STRING_H -template -inline bool reg_search(const std::basic_string& s, - boost::match_results::const_iterator, Allocator>& m, - const reg_expression& e, - unsigned flags = match_default) -{ - return reg_search(s.begin(), s.end(), m, e, flags); -} -#endif -#else // partial specialisation -inline bool reg_search(const char* str, - cmatch& m, - const regex& e, - unsigned flags = match_default) -{ - return reg_search(str, str + regex::traits_type::length(str), m, e, flags); -} -#ifndef BOOST_NO_WREGEX -inline bool reg_search(const wchar_t* str, - wcmatch& m, - const wregex& e, - unsigned flags = match_default) -{ - return reg_search(str, str + wregex::traits_type::length(str), m, e, flags); -} -#endif -#ifndef BOOST_RE_NO_STRING_H -inline bool reg_search(const std::string& s, - boost::match_results& m, - const regex& e, - unsigned flags = match_default) -{ - return reg_search(s.begin(), s.end(), m, e, flags); -} -#if !defined(BOOST_NO_WREGEX) -inline bool reg_search(const std::basic_string& s, - boost::match_results::const_iterator, wregex::allocator_type>& m, - const wregex& e, - unsigned flags = match_default) -{ - return reg_search(s.begin(), s.end(), m, e, flags); -} -#endif - -#endif - -#endif - - -// -// reg_grep: -// find all non-overlapping matches within the sequence first last: -// -template -inline unsigned int reg_grep(Predicate foo, iterator first, iterator last, const reg_expression& e, unsigned flags = match_default) -{ - return boost::regex_grep(foo, first, last, e, flags); -} - -// -// reg_grep convenience interfaces: -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING -// -// this isn't really a partial specialisation, but template function -// overloading - if the compiler doesn't support partial specialisation -// then it really won't support this either: -template -inline unsigned int reg_grep(Predicate foo, const charT* str, - const reg_expression& e, - unsigned flags = match_default) -{ - return reg_grep(foo, str, str + traits::length(str), e, flags); -} - -#ifndef BOOST_RE_NO_STRING_H -template -inline unsigned int reg_grep(Predicate foo, const std::basic_string& s, - const reg_expression& e, - unsigned flags = match_default) -{ - return reg_grep(foo, s.begin(), s.end(), e, flags); -} -#endif -#else // partial specialisation -inline unsigned int reg_grep(bool (*foo)(const cmatch&), const char* str, - const regex& e, - unsigned flags = match_default) -{ - return reg_grep(foo, str, str + regex::traits_type::length(str), e, flags); -} -#ifndef BOOST_NO_WREGEX -inline unsigned int reg_grep(bool (*foo)(const wcmatch&), const wchar_t* str, - const wregex& e, - unsigned flags = match_default) -{ - return reg_grep(foo, str, str + wregex::traits_type::length(str), e, flags); -} -#endif -#ifndef BOOST_RE_NO_STRING_H -inline unsigned int reg_grep(bool (*foo)(const boost::match_results&), const std::string& s, - const regex& e, - unsigned flags = match_default) -{ - return reg_grep(foo, s.begin(), s.end(), e, flags); -} -#if !defined(BOOST_NO_WREGEX) -inline unsigned int reg_grep(bool (*foo)(const boost::match_results::const_iterator, wregex::allocator_type>&), - const std::basic_string& s, - const wregex& e, - unsigned flags = match_default) -{ - return reg_grep(foo, s.begin(), s.end(), e, flags); -} -#endif - -#endif - -#endif - -// -// finally for compatablity with version 1.x of the library -// we need a form of reg_grep that takes an output iterator -// as its first argument: -// - -// -// struct grep_match: -// stores what matched during a reg_grep, -// the output iterator type passed to reg_grep must have an -// operator*() that returns a type with an -// operator=(const grep_match&); -// -template -struct grep_match -{ - unsigned int line; - iterator line_start; - reg_match what; - - grep_match(Allocator a = Allocator()) : what(a) {} - - grep_match(unsigned int l, iterator p1, const boost::match_results& m) - : what(m) { line = l; line_start = p1; } - - bool operator == (const grep_match& ) - { return false; } - - bool operator < (const grep_match&) - { return false; } -}; - -namespace re_detail{ - -template -struct grep_adaptor -{ - O oi; - reg_match m; - grep_adaptor(O i, A a) : m(a), oi(i) {} - bool operator()(const boost::re_detail::match_results_base& w) - { - m.what = w; - m.line = w.line(); - m.line_start = w.line_start(); - *oi = m; - ++oi; - return true; - } -}; - -} // namespace re_detail - -template -inline unsigned int reg_grep_old(Out oi, iterator first, iterator last, const reg_expression& e, unsigned flags = match_default) -{ - return boost::regex_grep(re_detail::grep_adaptor(oi, e.allocator()), first, last, e, flags); -} - -template -OutputIterator BOOST_REGEX_CALL reg_format(OutputIterator out, - const boost::match_results& m, - const charT* fmt) -{ - // - // start by updating the locale: - // - return boost::re_detail::_reg_format_aux(out, m, fmt, 0); -} - -template -std::basic_string BOOST_REGEX_CALL reg_format(const boost::match_results& m, const charT* fmt) -{ - std::basic_string result; - boost::re_detail::string_out_iterator > i(result); - reg_format(i, m, fmt); - return result; -} - -template -OutputIterator BOOST_REGEX_CALL reg_merge(OutputIterator out, - iterator first, - iterator last, - const reg_expression& e, - const charT* fmt, - bool copy = true, - unsigned int flags = match_default) -{ - // - // start by updating the locale: - // - iterator l = first; - if(!copy) flags |= format_no_copy; - boost::re_detail::merge_out_predicate oi(out, l, fmt, flags, e.get_traits()); - regex_grep(oi, first, last, e, flags); - return copy ? boost::re_detail::re_copy_out(out, l, last) : out; -} - -template -std::basic_string BOOST_REGEX_CALL reg_merge(const std::basic_string& s, - const reg_expression& e, - const charT* fmt, - bool copy = true, - unsigned int flags = match_default) -{ - std::basic_string result; - boost::re_detail::string_out_iterator > i(result); - reg_merge(i, s.begin(), s.end(), e, fmt, copy, flags); - return result; -} - -} // namespace deprecated - -using deprecated::query_match; -using deprecated::reg_search; -using deprecated::reg_grep; -using deprecated::reg_format; -using deprecated::reg_merge; -//using re_detail::jm_def_alloc; -using deprecated::char_regex_traits_i; -//using re_detail::re_alloc_binder; -using re_detail::padding_size; - - -} // namspace boost - -namespace jm = boost; - -#if !defined(BOOST_RE_NO_NAMESPACES) && !defined(BOOST_RE_NO_USING) - -using boost::bad_expression; -template -struct char_regex_traits : boost::regex_traits{}; -using boost::deprecated::char_regex_traits_i; -using boost::regbase; -using boost::reg_expression; -using boost::deprecated::reg_match; -//using boost::reg_match_base; -using boost::sub_match; -using boost::regex; -using boost::cmatch; -#ifndef BOOST_NO_WREGEX -using boost::wregex; -using boost::wcmatch; -#endif -using boost::deprecated::reg_match; -using boost::deprecated::query_match; -using boost::deprecated::reg_search; -using boost::deprecated::reg_grep; -using boost::deprecated::reg_format; -using boost::deprecated::reg_merge; -//using boost::re_detail::jm_def_alloc; - -#endif - -#ifdef BOOST_RE_USING_HACK -using namespace boost; -using namespace boost::deprecated; -#endif - - - -#endif - diff --git a/old_include/tests/snip1.cpp b/old_include/tests/snip1.cpp deleted file mode 100644 index 972a881a..00000000 --- a/old_include/tests/snip1.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * - * Copyright (c) 1998-2000 - * 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 -#include -#include -#include - -using namespace std; - -regex expression("^([0-9]+)(\\-| |$)(.*)$"); - -// process_ftp: -// on success returns the ftp response code, and fills -// msg with the ftp response message. -int process_ftp(const char* response, std::string* msg) -{ - cmatch what; - if(query_match(response, response + strlen(response), what, expression)) - { - // what[0] contains the whole string - // what[1] contains the response code - // what[2] contains the separator character - // what[3] contains the text message. - if(msg) - msg->assign(what[3].first, what[3].second); - return atoi(what[1].first); - } - // failure did not match - if(msg) - msg->erase(); - return -1; -} - -int main() -{ - std::string in, out; - while(true) - { - cout << "enter test string" << endl; - std::getline(cin, in); - if(in == "quit") - break; - int result; - result = process_ftp(in.c_str(), &out); - if(result != -1) - { - cout << "Match found:" << endl; - cout << "Response code: " << result << endl; - cout << "Message text: " << out << endl; - } - else - { - cout << "Match not found" << endl; - } - cout << endl; - } - return 0; -} - - - - - - - diff --git a/old_include/tests/snip2.cpp b/old_include/tests/snip2.cpp deleted file mode 100644 index 7f0218e6..00000000 --- a/old_include/tests/snip2.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * - * Copyright (c) 1998-2000 - * 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 -#include -#include - -// purpose: -// takes the contents of a file in the form of a string -// and searches for all the C++ class definitions, storing -// their locations in a map of strings/int's - -typedef std::map > map_type; - -regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)"); - -void IndexClasses(map_type& m, const std::string& file) -{ - std::string::const_iterator start, end; - start = file.begin(); - end = file.end(); - reg_match what; - unsigned int flags = match_default; - while(reg_search(start, end, what, expression, flags)) - { - // what[0] contains the whole string - // what[5] contains the class name. - // what[6] contains the template specialisation if any. - // add class name and position to map: - m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = - what[5].first - file.begin(); - // update search position: - start = what[0].second; - // update flags: - flags |= match_prev_avail; - flags |= ~match_not_bob; - } -} - - -#include -#include - -using namespace std; - -int main(int argc, const char** argv) -{ - for(int i = 1; i < argc; ++i) - { - cout << "Processing file " << argv[i] << endl; - map_type m; - mapfile f(argv[i]); - std::string text(f.begin(), f.end()); - IndexClasses(m, text); - cout << m.size() << " matches found" << endl; - map_type::iterator c, d; - c = m.begin(); - d = m.end(); - while(c != d) - { - cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; - ++c; - } - } - return 0; -} - - - - - - - diff --git a/old_include/tests/snip3.cpp b/old_include/tests/snip3.cpp deleted file mode 100644 index 2038cdb1..00000000 --- a/old_include/tests/snip3.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * - * Copyright (c) 1998-2000 - * 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 -#include -#include - -// purpose: -// takes the contents of a file in the form of a string -// and searches for all the C++ class definitions, storing -// their locations in a map of strings/int's - -typedef std::map > map_type; - -regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)"); - -class IndexClassesPred -{ - map_type& m; - std::string::const_iterator base; -public: - IndexClassesPred(map_type& a, std::string::const_iterator b) : m(a), base(b) {} - bool operator()(const reg_match& what) - { - // what[0] contains the whole string - // what[5] contains the class name. - // what[6] contains the template specialisation if any. - // add class name and position to map: - m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = - what[5].first - base; - return true; - } -}; - -void IndexClasses(map_type& m, const std::string& file) -{ - std::string::const_iterator start, end; - start = file.begin(); - end = file.end(); - reg_grep(IndexClassesPred(m, start), start, end, expression, match_default); -} - - -#include -#include - -using namespace std; - -int main(int argc, const char** argv) -{ - for(int i = 1; i < argc; ++i) - { - cout << "Processing file " << argv[i] << endl; - map_type m; - mapfile f(argv[i]); - std::string text(f.begin(), f.end()); - IndexClasses(m, text); - cout << m.size() << " matches found" << endl; - map_type::iterator c, d; - c = m.begin(); - d = m.end(); - while(c != d) - { - cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; - ++c; - } - } - return 0; -} - - - - - diff --git a/old_include/tests/snip4.cpp b/old_include/tests/snip4.cpp deleted file mode 100644 index a83e6631..00000000 --- a/old_include/tests/snip4.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * Copyright (c) 1998-2000 - * 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 -#include -#include -#include -#include -#include -#include - -// purpose: -// takes the contents of a file and transform to -// syntax highlighted code in html format - -regex e1, e2; -extern const char* expression_text; -extern const char* format_string; -extern const char* pre_expression; -extern const char* pre_format; -extern const char* header_text; -extern const char* footer_text; - -int main(int argc, const char** argv) -{ - e1.set_expression(expression_text); - e2.set_expression(pre_expression); - for(int i = 1; i < argc; ++i) - { - std::cout << "Processing file " << argv[i] << std::endl; - mapfile in(argv[i]); - std::string out_name(std::string(argv[i]) + std::string(".htm")); - std::ofstream os(out_name.c_str()); - os << header_text; - // strip '<' and '>' first by outputting to a - // temporary string stream - std::ostringstream t(std::ios::out | std::ios::binary); - std::ostream_iterator oi(t); - reg_merge(oi, in.begin(), in.end(), e2, pre_format, true); - // then output to final output stream - // adding syntax highlighting: - std::string s(t.str()); - std::ostream_iterator out(os); - reg_merge(out, s.begin(), s.end(), e1, format_string, true); - os << footer_text; - } - return 0; -} - -extern const char* pre_expression = "(<)|(>)|\\r"; -extern const char* pre_format = "(?1<)(?2>)"; - - -const char* expression_text = // preprocessor directives: index 1 - "(^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*)|" - // comment: index 3 - "(//[^\\n]*|/\\*([^*]|\\*+[^*/])*\\*+/)|" - // literals: index 5 - "\\<([+-]?((0x[[:xdigit:]]+)|(([[:digit:]]*\\.)?[[:digit:]]+([eE][+-]?[[:digit:]]+)?))u?((int(8|16|32|64))|L)?)\\>|" - // string literals: index 14 - "('([^\\\\']|\\\\.)*'|\"([^\\\\\"]|\\\\.)*\")|" - // keywords: index 17 - "\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import" - "|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall" - "|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool" - "|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete" - "|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto" - "|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected" - "|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast" - "|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned" - "|using|virtual|void|volatile|wchar_t|while)\\>" - ; - -const char* format_string = "(?1$&)" - "(?3$&)" - "(?5$&)" - "(?14$&)" - "(?17$&)"; - -const char* header_text = "\n\n" - "\n" - "\n" - "\n" - " \n
";
-
-const char* footer_text = "
\n\n\n"; - - - - - - - - diff --git a/old_include/tests/snip5.cpp b/old_include/tests/snip5.cpp deleted file mode 100644 index ded9d634..00000000 --- a/old_include/tests/snip5.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * - * Copyright (c) 1998-2000 - * 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 -#include -#include - -// purpose: -// takes the contents of a file in the form of a string -// and searches for all the C++ class definitions, storing -// their locations in a map of strings/int's - -typedef std::map > map_type; - -regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?(\\{|:[^;\\{()]*\\{)"); -map_type class_index; -std::string::const_iterator base; - -bool grep_callback(const reg_match& what) -{ - // what[0] contains the whole string - // what[5] contains the class name. - // what[6] contains the template specialisation if any. - // add class name and position to map: - class_index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = - what[5].first - base; - return true; -} - -void IndexClasses(const std::string& file) -{ - std::string::const_iterator start, end; - start = file.begin(); - end = file.end(); - base = start; - reg_grep(grep_callback, start, end, expression, match_default); -} - - - diff --git a/old_include/tests/snip6.cpp b/old_include/tests/snip6.cpp deleted file mode 100644 index de7c22e8..00000000 --- a/old_include/tests/snip6.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * Copyright (c) 1998-2000 - * 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 -#include -#include -#include - -// purpose: -// takes the contents of a file in the form of a string -// and searches for all the C++ class definitions, storing -// their locations in a map of strings/int's - -typedef std::map > map_type; - -class class_index -{ - jm::regex expression; - map_type index; - std::string::const_iterator base; - - bool grep_callback(reg_match what); -public: - map_type& get_map() { return index; } - void IndexClasses(const std::string& file); - class_index() - : index(), - expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?" - "(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?" - "[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?" - "(\\{|:[^;\\{()]*\\{)" - ){} -}; - -bool class_index::grep_callback(reg_match what) -{ - // what[0] contains the whole string - // what[5] contains the class name. - // what[6] contains the template specialisation if any. - // add class name and position to map: - index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = - what[5].first - base; - return true; -} - -void class_index::IndexClasses(const std::string& file) -{ - std::string::const_iterator start, end; - start = file.begin(); - end = file.end(); - base = start; - reg_grep(std::bind1st(std::mem_fun(&class_index::grep_callback), this), - start, - end, - expression, - match_default); -} - - - -using namespace std; - -#include -#include - -int main(int argc, const char** argv) -{ - for(int i = 1; i < argc; ++i) - { - cout << "Processing file " << argv[i] << endl; - mapfile f(argv[i]); - std::string text(f.begin(), f.end()); - class_index i; - i.IndexClasses(text); - cout << i.get_map().size() << " matches found" << endl; - map_type::iterator c, d; - c = i.get_map().begin(); - d = i.get_map().end(); - while(c != d) - { - cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; - ++c; - } - } - return 0; -} - - - diff --git a/old_include/tests/snip7.cpp b/old_include/tests/snip7.cpp deleted file mode 100644 index 00dd7f70..00000000 --- a/old_include/tests/snip7.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * - * Copyright (c) 1998-2000 - * 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 -#include -#include -#include - -// purpose: -// takes the contents of a file in the form of a string -// and searches for all the C++ class definitions, storing -// their locations in a map of strings/int's - -typedef std::map > map_type; - -class class_index -{ - jm::regex expression; - map_type index; - std::string::const_iterator base; - typedef reg_match arg_type; - - bool grep_callback(const reg_match& what); -public: - map_type& get_map() { return index; } - typedef bool (__closure* grep_callback_type)(const arg_type&); - void IndexClasses(const std::string& file); - class_index() - : index(), - expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?" - "(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?" - "[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>[[:space:]]*)?" - "(\\{|:[^;\\{()]*\\{)" - ){} -}; - -bool class_index::grep_callback(const reg_match& what) -{ - // what[0] contains the whole string - // what[5] contains the class name. - // what[6] contains the template specialisation if any. - // add class name and position to map: - index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] = - what[5].first - base; - return true; -} - -void class_index::IndexClasses(const std::string& file) -{ - std::string::const_iterator start, end; - start = file.begin(); - end = file.end(); - base = start; - class_index::grep_callback_type cl = &(this->grep_callback); - reg_grep(cl, - start, - end, - expression, - match_default); -} - - -using namespace std; - -#include -#include - -int main(int argc, const char** argv) -{ - for(int i = 1; i < argc; ++i) - { - cout << "Processing file " << argv[i] << endl; - mapfile f(argv[i]); - std::string text(f.begin(), f.end()); - class_index i; - i.IndexClasses(text); - cout << i.get_map().size() << " matches found" << endl; - map_type::iterator c, d; - c = i.get_map().begin(); - d = i.get_map().end(); - while(c != d) - { - cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl; - ++c; - } - } - return 0; -} - - - diff --git a/src/usinstances.cpp b/src/usinstances.cpp index b26614ed..3fe54a36 100644 --- a/src/usinstances.cpp +++ b/src/usinstances.cpp @@ -26,20 +26,20 @@ #ifdef _DLL_CPPLIB namespace std{ template _CRTIMP2 bool __cdecl operator==( - const basic_string, allocator >&, - const basic_string, allocator >&); + const basic_string, allocator >&, + const basic_string, allocator >&); template _CRTIMP2 bool __cdecl operator==( - const unsigned short *, - const basic_string, allocator >&); + const unsigned short *, + const basic_string, allocator >&); template _CRTIMP2 bool __cdecl operator==( - const basic_string, allocator >&, - const unsigned short *); + const basic_string, allocator >&, + const unsigned short *); template _CRTIMP2 bool __cdecl operator<( - const basic_string, allocator >&, - const basic_string, allocator >&); + const basic_string, allocator >&, + const basic_string, allocator >&); template _CRTIMP2 bool __cdecl operator>( - const basic_string, allocator >&, - const basic_string, allocator >&); + const basic_string, allocator >&, + const basic_string, allocator >&); } #endif diff --git a/src/wc_regex_traits.cpp b/src/wc_regex_traits.cpp index 406a22be..9daf0804 100644 --- a/src/wc_regex_traits.cpp +++ b/src/wc_regex_traits.cpp @@ -182,7 +182,7 @@ c_regex_traits::string_type BOOST_REGEX_CALL c_regex_traits::l std::string name; const wchar_t* p0 = p1; while(p0 != p2) - name.append(1, char(*p0++)); + name.append(1, char(*p0++)); #endif name = ::boost::re_detail::lookup_default_collate_name(name); #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\ @@ -193,13 +193,13 @@ c_regex_traits::string_type BOOST_REGEX_CALL c_regex_traits::l #else if(name.size()) { - string_type result; - typedef std::string::const_iterator iter; - iter b = name.begin(); - iter e = name.end(); - while(b != e) - result.append(1, wchar_t(*b++)); - return result; + string_type result; + typedef std::string::const_iterator iter; + iter b = name.begin(); + iter e = name.end(); + while(b != e) + result.append(1, wchar_t(*b++)); + return result; } #endif if(p2 - p1 == 1) diff --git a/test/regress/test_perl_ex.cpp b/test/regress/test_perl_ex.cpp index 0a192ae1..1ebd64dc 100644 --- a/test/regress/test_perl_ex.cpp +++ b/test/regress/test_perl_ex.cpp @@ -153,7 +153,7 @@ void test_options() TEST_REGEX_SEARCH("#rhubarb\r\n abcd", perl|mod_x, "abcd", match_default, make_array(0, 4, -2, -2)); TEST_REGEX_SEARCH("^abcd#rhubarb", perl|mod_x, "abcd", match_default, make_array(0, 4, -2, -2)); TEST_REGEX_SEARCH("^abcd#rhubarb", perl, "abcd#rhubarb", match_default, make_array(0, 12, -2, -2)); - TEST_REGEX_SEARCH("^a b\n\n c", perl|mod_x, "abc", match_default, make_array(0, 3, -2, -2)); + TEST_REGEX_SEARCH("^a b\n\n c", perl|mod_x, "abc", match_default, make_array(0, 3, -2, -2)); TEST_REGEX_SEARCH("(?(?=[^a-z]+[a-z]) \\d{2}-[a-z]{3}-\\d{2} | \\d{2}-\\d{2}-\\d{2} ) ", perl|mod_x, "12-sep-98", match_default, make_array(0, 9, -2, -2)); TEST_REGEX_SEARCH("(?(?=[^a-z]+[a-z]) \\d{2}-[a-z]{3}-\\d{2} | \\d{2}-\\d{2}-\\d{2} ) ", perl|mod_x, "12-09-98", match_default, make_array(0, 8, -2, -2)); diff --git a/test/regress/test_tricky_cases.cpp b/test/regress/test_tricky_cases.cpp index 3d4bc026..87de1cd6 100644 --- a/test/regress/test_tricky_cases.cpp +++ b/test/regress/test_tricky_cases.cpp @@ -240,11 +240,11 @@ void test_tricky_cases2() void test_tricky_cases3() { using namespace boost::regex_constants; - TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "0xFF", match_default, make_array(0, 4, 0, 4, 0, 4, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2)); + TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "0xFF", match_default, make_array(0, 4, 0, 4, 0, 4, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2)); TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "35", match_default, make_array(0, 2, 0, 2, -1, -1, 0, 2, -1, -1, -1, -1, -1, -1, -2, -2)); TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "0xFFu", match_default, make_array(0, 5, 0, 4, 0, 4, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2)); TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "0xFFL", match_default, make_array(0, 5, 0, 4, 0, 4, -1, -1, 4, 5, -1, -1, -1, -1, -2, -2)); - TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "0xFFFFFFFFFFFFFFFFuint64", match_default, make_array(0, 24, 0, 18, 0, 18, -1, -1, 19, 24, 19, 24, 22, 24, -2, -2)); + TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "0xFFFFFFFFFFFFFFFFuint64", match_default, make_array(0, 24, 0, 18, 0, 18, -1, -1, 19, 24, 19, 24, 22, 24, -2, -2)); // strings: TEST_REGEX_SEARCH("'([^\\\\']|\\\\.)*'", perl, "'\\x3A'", match_default, make_array(0, 6, 4, 5, -2, -2)); TEST_REGEX_SEARCH("'([^\\\\']|\\\\.)*'", perl, "'\\''", match_default, make_array(0, 4, 1, 3, -2, -2));