diff options
Diffstat (limited to 'src/boost/libs/spirit/workbench/qi')
-rw-r--r-- | src/boost/libs/spirit/workbench/qi/Jamfile | 19 | ||||
-rw-r--r-- | src/boost/libs/spirit/workbench/qi/attr_vs_actions.cpp | 98 | ||||
-rw-r--r-- | src/boost/libs/spirit/workbench/qi/int_parser.cpp | 106 | ||||
-rw-r--r-- | src/boost/libs/spirit/workbench/qi/keywords.cpp | 553 | ||||
-rw-r--r-- | src/boost/libs/spirit/workbench/qi/keywords.hpp | 49 | ||||
-rw-r--r-- | src/boost/libs/spirit/workbench/qi/real_parser.cpp | 118 |
6 files changed, 943 insertions, 0 deletions
diff --git a/src/boost/libs/spirit/workbench/qi/Jamfile b/src/boost/libs/spirit/workbench/qi/Jamfile new file mode 100644 index 00000000..176c28cb --- /dev/null +++ b/src/boost/libs/spirit/workbench/qi/Jamfile @@ -0,0 +1,19 @@ +#============================================================================== +# Copyright (c) 2001-2010 Joel de Guzman +# Copyright (c) 2001-2010 Hartmut Kaiser +# +# Distributed under 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) +#============================================================================== +project spirit-qi-benchmark + : requirements + <include>. + <c++-template-depth>300 + : + : + ; +# performance tests +exe int_parser : int_parser.cpp ; +exe real_parser : real_parser.cpp ; +exe attr_vs_actions : attr_vs_actions.cpp ; +exe keywords : keywords.cpp ; diff --git a/src/boost/libs/spirit/workbench/qi/attr_vs_actions.cpp b/src/boost/libs/spirit/workbench/qi/attr_vs_actions.cpp new file mode 100644 index 00000000..d85e0f48 --- /dev/null +++ b/src/boost/libs/spirit/workbench/qi/attr_vs_actions.cpp @@ -0,0 +1,98 @@ +// Copyright (c) 2002-2010 Joel de Guzman +// +// Distributed under 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 <boost/config/warning_disable.hpp> +#include <boost/spirit/include/qi.hpp> +#include <boost/spirit/include/phoenix_core.hpp> +#include <boost/spirit/include/phoenix_operator.hpp> +#include <boost/spirit/include/phoenix_object.hpp> +#include <boost/spirit/include/phoenix_stl.hpp> +#include <boost/fusion/include/adapt_struct.hpp> +#include <boost/fusion/include/io.hpp> + +#include <iostream> +#include <string> +#include <complex> + +using boost::spirit::qi::grammar; +using boost::spirit::qi::rule; +using boost::spirit::qi::char_; +using boost::spirit::qi::parse; +using boost::spirit::qi::_val; +using boost::spirit::qi::_1; +using boost::phoenix::push_back; + +#define ATTR_PROPAGATE + +struct test_attr +{ + test_attr() + { + std::cout << "default construct" << std::endl; + } + + test_attr(char) + { + std::cout << "construct from char" << std::endl; + } + + test_attr(test_attr const&) + { + std::cout << "copy construct" << std::endl; + } + + test_attr& operator=(test_attr const&) + { + std::cout << "assign" << std::endl; + return *this; + } +}; + +template <typename Iterator> +struct test_parser : grammar<Iterator, std::vector<test_attr>() > +{ + test_parser() : test_parser::base_type(start) + { +#ifdef ATTR_PROPAGATE + start = char_ >> *(',' >> char_); +#else + start = char_[push_back(_val, _1)] >> *(',' >> char_[push_back(_val, _1)]); +#endif + } + + rule<Iterator, std::vector<test_attr>()> start; +}; + +int main() +{ + typedef std::string::const_iterator iterator_type; + typedef test_parser<iterator_type> test_parser; + + test_parser g; + std::string str = "a,b,c,d,e"; + + std::vector<test_attr> result; + result.reserve(20); + std::string::const_iterator iter = str.begin(); + std::string::const_iterator end = str.end(); + bool r = parse(iter, end, g, result); + + if (r && iter == end) + { + std::cout << "-------------------------\n"; + std::cout << "Parsing succeeded\n"; + std::cout << "\n-------------------------\n"; + } + else + { + std::cout << "-------------------------\n"; + std::cout << "Parsing failed\n"; + std::cout << "-------------------------\n"; + } + + std::cout << "Bye... :-) \n\n"; + return 0; +} + diff --git a/src/boost/libs/spirit/workbench/qi/int_parser.cpp b/src/boost/libs/spirit/workbench/qi/int_parser.cpp new file mode 100644 index 00000000..3a25cd3a --- /dev/null +++ b/src/boost/libs/spirit/workbench/qi/int_parser.cpp @@ -0,0 +1,106 @@ +/*============================================================================= + Copyright (c) 2001-2010 Joel de Guzman + + Distributed under 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 "../measure.hpp" +#include <string> +#include <vector> +#include <cstdlib> +#include <boost/spirit/include/qi.hpp> + +namespace +{ + /////////////////////////////////////////////////////////////////////////// + // Generate a random number string with N digits + std::string + gen_int(int digits) + { + std::string result; + if (rand()%2) // Prepend a '-' + result += '-'; + result += '1' + (rand()%9); // The first digit cannot be '0' + + for (int i = 1; i < digits; ++i) // Generate the remaining digits + result += '0' + (rand()%10); + return result; + } + + std::string numbers[9]; + char const* first[9]; + char const* last[9]; + + /////////////////////////////////////////////////////////////////////////// + struct atoi_test : test::base + { + void benchmark() + { + for (int i = 0; i < 9; ++i) + this->val += atoi(first[i]); + } + }; + + /////////////////////////////////////////////////////////////////////////// + struct strtol_test : test::base + { + void benchmark() + { + for (int i = 0; i < 9; ++i) + this->val += strtol(first[i], const_cast<char**>(&last[i]), 10); + } + }; + + /////////////////////////////////////////////////////////////////////////// + struct spirit_int_test : test::base + { + static int parse(char const* first, char const* last) + { + int n; + namespace qi = boost::spirit::qi; + using qi::int_; + qi::parse(first, last, int_, n); + return n; + } + + void benchmark() + { + for (int i = 0; i < 9; ++i) + this->val += parse(first[i], last[i]); + } + }; +} + +int main() +{ + // Seed the random generator + srand(time(0)); + + // Generate random integers with 1 .. 9 digits + // We test only 9 digits to avoid overflow + std::cout << "///////////////////////////////////////////////////////////////////////////" << std::endl; + std::cout << "Numbers to test:" << std::endl; + for (int i = 0; i < 9; ++i) + { + numbers[i] = gen_int(i+1); + first[i] = numbers[i].c_str(); + last[i] = first[i]; + while (*last[i]) + last[i]++; + std::cout << i+1 << " digit number:" << numbers[i] << std::endl; + } + std::cout << "///////////////////////////////////////////////////////////////////////////" << std::endl; + + BOOST_SPIRIT_TEST_BENCHMARK( + 10000000, // This is the maximum repetitions to execute + (atoi_test) + (strtol_test) + (spirit_int_test) + ) + + // This is ultimately responsible for preventing all the test code + // from being optimized away. Change this to return 0 and you + // unplug the whole test's life support system. + return test::live_code != 0; +} + diff --git a/src/boost/libs/spirit/workbench/qi/keywords.cpp b/src/boost/libs/spirit/workbench/qi/keywords.cpp new file mode 100644 index 00000000..d8f7f450 --- /dev/null +++ b/src/boost/libs/spirit/workbench/qi/keywords.cpp @@ -0,0 +1,553 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2011 Thomas Bernard + + Distributed under 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) +=============================================================================*/ + +#define FUSION_MAX_VECTOR_SIZE 50 +#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +#define BOOST_MPL_LIMIT_LIST_SIZE 50 +#define BOOST_MPL_LIMIT_VECTOR_SIZE 50 + +#include "../measure.hpp" +#include <boost/config/warning_disable.hpp> +#include <boost/spirit/include/qi.hpp> +#include <boost/spirit/include/phoenix_core.hpp> +#include <boost/spirit/include/phoenix_operator.hpp> +#include <boost/spirit/include/phoenix_object.hpp> +#include <boost/spirit/include/phoenix_fusion.hpp> +#include <boost/spirit/include/phoenix_container.hpp> +#include <boost/fusion/include/adapt_struct.hpp> +#include <boost/fusion/include/io.hpp> +#include <boost/spirit/include/qi_permutation.hpp> +#include <boost/spirit/home/qi/string/tst_map.hpp> +#include <boost/spirit/repository/include/qi_kwd.hpp> +#include <boost/spirit/repository/include/qi_keywords.hpp> +#include <boost/optional.hpp> +#include <boost/spirit/home/phoenix/core/argument.hpp> +#include <boost/spirit/home/phoenix/bind/bind_member_variable.hpp> + +#include <iostream> +#include <string> +#include <complex> +#include <vector> +#include <iterator> +#include <stdexcept> + +#include <boost/preprocessor/control/if.hpp> +#include <boost/preprocessor/seq/for_each_i.hpp> +#include <boost/preprocessor/seq/size.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/stringize.hpp> + +#define KEYS_5 + +#include "keywords.hpp" + +#define declOptions(r, data, i, elem) boost::optional<int> BOOST_PP_CAT(option,i); +#define fusionOptions(r, data, i, elem) (boost::optional<int>, BOOST_PP_CAT(option,i)) + + +namespace client +{ + namespace qi = boost::spirit::qi; + namespace ascii = boost::spirit::ascii; + + /////////////////////////////////////////////////////////////////////////// + // Our parsedData struct + /////////////////////////////////////////////////////////////////////////// + //[tutorial_parsedData_struct + struct parsedDataOptions + { + BOOST_PP_SEQ_FOR_EACH_I(declOptions,_,keys) + }; + struct parsedData + { + + std::string name; + parsedDataOptions options; + void clear() + { + name.clear(); + } + }; + + struct parsedData2 + { + std::string name; + BOOST_PP_SEQ_FOR_EACH_I(declOptions,_,keys) + + void clear() + { + name.clear(); + } + }; +} + +std::ostream &operator<<(std::ostream & os, client::parsedData &data) +{ + os << data.name <<std::endl; + +#define generateOutput1(r, d, i, elem) if( BOOST_PP_CAT(data.options.option, i) ) os<< BOOST_PP_STRINGIZE( BOOST_PP_CAT(option,i)) <<" "<< * BOOST_PP_CAT(data.options.option , i)<<std::endl; + BOOST_PP_SEQ_FOR_EACH_I(generateOutput1,_,keys) + + os<<std::endl; + + return os; +} + +std::ostream &operator<<(std::ostream & os, client::parsedData2 &data) +{ + os << data.name <<std::endl; + +#define generateOutput2(r, d, i, elem) if(BOOST_PP_CAT(data.option, i)) os<< BOOST_PP_STRINGIZE( BOOST_PP_CAT(option,i)) <<" "<< * BOOST_PP_CAT(data.option,i)<<std::endl; + BOOST_PP_SEQ_FOR_EACH_I(generateOutput2,_,keys) + + os<<std::endl; + + return os; +} + + + +BOOST_FUSION_ADAPT_STRUCT( + client::parsedDataOptions, + BOOST_PP_SEQ_FOR_EACH_I(fusionOptions,_,keys) + ) + +BOOST_FUSION_ADAPT_STRUCT( + client::parsedData, + (std::string, name) + (client::parsedDataOptions, options) + ) + +BOOST_FUSION_ADAPT_STRUCT( + client::parsedData2, + (std::string, name) + BOOST_PP_SEQ_FOR_EACH_I(fusionOptions,_,keys) + ) +enum variation +{ + full, + no_assign, + assign +}; +namespace client +{ + + + /////////////////////////////////////////////////////////////////////////////// + // Our parsedData parser + /////////////////////////////////////////////////////////////////////////////// + //[tutorial_parsedData_parser + template <typename Iterator> + struct permutation_parser : qi::grammar<Iterator, parsedData(), ascii::space_type> + { + permutation_parser() : permutation_parser::base_type(start) + { + using qi::int_; + using qi::lit; + using qi::double_; + using qi::lexeme; + using ascii::char_; + using boost::phoenix::at_c; + using boost::phoenix::assign; + using qi::_r1; + using qi::_1; + using qi::_val; + using qi::omit; + using qi::repeat; + + + quoted_string %= lexeme[+(char_-' ')]; + +#define generateOptions1(r, data, i, elem) BOOST_PP_IF(i, ^(lit(elem) > int_) , (lit(elem) > int_)) + options = (BOOST_PP_SEQ_FOR_EACH_I(generateOptions1,_,keys)); + + start %= + quoted_string + >> options; + ; + v_vals = repeat(1,2)[int_]; + } + + typedef parsedData parser_target_type; + + qi::rule<Iterator, std::string(), ascii::space_type> quoted_string; + qi::rule<Iterator, parsedDataOptions(), ascii::space_type> options; + qi::rule<Iterator, std::vector<int>(), ascii::space_type> v_vals; + + qi::rule<Iterator, parsedData(), ascii::space_type> start; + }; + + template <typename Iterator> + struct alternative_parser : qi::grammar<Iterator, parsedData2(), ascii::space_type> + { + alternative_parser() : alternative_parser::base_type(start) + { + using qi::int_; + using qi::lit; + using qi::double_; + using qi::lexeme; + using ascii::char_; + using boost::phoenix::at_c; + using qi::_r1; + using qi::_1; + using qi::_val; + + quoted_string %= lexeme[+(char_-' ')]; + +#define generateOptions2(r, data, i, elem) BOOST_PP_IF(i, |(lit(elem) > int_[at_c<i+1>(_r1)=_1]) , (lit(elem) > int_[at_c<i+1>(_r1)=_1])) + options = (BOOST_PP_SEQ_FOR_EACH_I(generateOptions2,_,keys)); + + start = + quoted_string [at_c<0>(_val)=_1] + >> *options(_val); + ; + } + + typedef parsedData2 parser_target_type; + + qi::rule<Iterator, std::string(), ascii::space_type> quoted_string; + qi::rule<Iterator, void(parsedData2 & ), ascii::space_type> options; + qi::rule<Iterator, parsedData2(), ascii::space_type> start; + }; + + + + template <typename Iterator,typename variation> + struct tst_parser : qi::grammar<Iterator, parsedData2(), ascii::space_type> + { + typedef variation variation_type; + + tst_parser() : tst_parser::base_type(startalias) + { + namespace phx = boost::phoenix; + using qi::int_; + using qi::lit; + using qi::double_; + using qi::lexeme; + using ascii::char_; + using boost::phoenix::at_c; + using qi::_r1; + using qi::_1; + using qi::_a; + using qi::_val; + using qi::locals; + using qi::parameterized_nonterminal; + + startalias = start.alias(); + quoted_string %= lexeme[+(char_-' ')]; + +#define generateRules(r, data, i, elem) BOOST_PP_CAT(rule,i) = int_[phx::at_c<i+1>(*phx::ref(currentObj))=_1]; + BOOST_PP_SEQ_FOR_EACH_I(generateRules,_,keys) + +#define generateOptions3(r, data, i, elem) (elem,& BOOST_PP_CAT(rule,i)) + + + options.add BOOST_PP_SEQ_FOR_EACH_I(generateOptions3,_,keys); + switch(variation_type::value) + { + case full: + { + start = + quoted_string [at_c<0>(_val)=_1][phx::ref(currentObj)=&_val] + >> *( options [_a=_1] >> lazy(*_a)); + ; + break; + } + case no_assign: + { + start = + quoted_string [at_c<0>(_val)=_1][phx::ref(currentObj)=&_val] + >> *( options >> int_); + ; + break; + } + case assign: + { + start = + quoted_string [at_c<0>(_val)=_1][phx::ref(currentObj)=&_val] + >> *( options [_a=_1] >> int_); + ; + break; + } + } + + + } + + parsedData2 *currentObj; + + typedef parsedData2 parser_target_type; + + qi::rule<Iterator, std::string(), ascii::space_type> quoted_string; + typedef qi::rule<Iterator, ascii::space_type> optionsRule; +#define declareRules(r, data, i, elem) optionsRule BOOST_PP_CAT(rule,i); + + BOOST_PP_SEQ_FOR_EACH_I(declareRules,_,keys) + + qi::symbols<char,optionsRule* > options; + qi::rule<Iterator, parsedData2(), ascii::space_type> startalias; + qi::rule<Iterator, parsedData2(), qi::locals<optionsRule*>, ascii::space_type> start; + }; + + + + template <typename Iterator,typename variation> + struct tst_map_parser : qi::grammar<Iterator, parsedData2(), ascii::space_type> + { + typedef variation variation_type; + tst_map_parser() : tst_map_parser::base_type(startalias) + { + namespace phx = boost::phoenix; + using qi::int_; + using qi::lit; + using qi::double_; + using qi::lexeme; + using ascii::char_; + using boost::phoenix::at_c; + using qi::_r1; + using qi::_1; + using qi::_a; + using qi::_val; + using qi::locals; + using qi::parameterized_nonterminal; + + startalias = start.alias(); + quoted_string %= lexeme[+(char_-' ')]; + +#define generateRules3(r, data, i, elem) BOOST_PP_CAT(rule,i) = int_[phx::at_c<i+1>(*phx::ref(currentObj))=_1]; + BOOST_PP_SEQ_FOR_EACH_I(generateRules3,_,keys) + +#define generateOptions3(r, data, i, elem) (elem,& BOOST_PP_CAT(rule,i)) + + + options.add BOOST_PP_SEQ_FOR_EACH_I(generateOptions3,_,keys); + + switch(variation_type::value) + { + case full: + { + start = + quoted_string [at_c<0>(_val)=_1][phx::ref(currentObj)=&_val] + >> *( options [_a=_1] >> lazy(*_a)); + ; + break; + } + case no_assign: + { + start = + quoted_string [at_c<0>(_val)=_1][phx::ref(currentObj)=&_val] + >> *( options >> int_); + ; + break; + } + case assign: + { + start = + quoted_string [at_c<0>(_val)=_1][phx::ref(currentObj)=&_val] + >> *( options [_a=_1] >> int_); + ; + break; + } + } + } + + parsedData2 *currentObj; + + typedef parsedData2 parser_target_type; + + qi::rule<Iterator, std::string(), ascii::space_type> quoted_string; + typedef qi::rule<Iterator, ascii::space_type> optionsRule; +#define declareRules(r, data, i, elem) optionsRule BOOST_PP_CAT(rule,i); + + BOOST_PP_SEQ_FOR_EACH_I(declareRules,_,keys) + + qi::symbols<char,optionsRule*, boost::spirit::qi::tst_map<char,optionsRule*> > options; + qi::rule<Iterator, parsedData2(), ascii::space_type> startalias; + qi::rule<Iterator, parsedData2(), qi::locals<optionsRule*>, ascii::space_type> start; + }; + + + template <typename Iterator> + struct kwd_parser : qi::grammar<Iterator, parsedData(), ascii::space_type> + { + kwd_parser() : kwd_parser::base_type(start) + { + using qi::int_; + using qi::lit; + using qi::double_; + using qi::lexeme; + using ascii::char_; + using qi::_r1; + using qi::_1; + using qi::_val; + using boost::spirit::repository::qi::kwd; + + quoted_string %= lexeme[+(char_-' ')]; + +#define generateOptions4(r, data, i, elem) BOOST_PP_IF(i, / kwd( elem )[ int_ ] , kwd( elem )[ int_ ] ) + options = (BOOST_PP_SEQ_FOR_EACH_I(generateOptions4,_,keys)); + + start %= + quoted_string + >> options; + ; + } + + typedef parsedData parser_target_type; + + qi::rule<Iterator, std::string(), ascii::space_type> quoted_string; + qi::rule<Iterator, parsedDataOptions(), ascii::space_type> options; + qi::rule<Iterator, boost::fusion::vector<boost::optional<int>,boost::optional<int> > () , ascii::space_type> v_vals; + + qi::rule<Iterator, parsedData(), ascii::space_type> start; + }; + +} + + +template <typename parserType> + struct timeParser : test::base{ + timeParser(const std::string & str) : str(str) + { + } + parserType &get_parser(){ + static parserType parser; + return parser; + } + + std::string str; + + void benchmark() + { + + using boost::spirit::ascii::space; + bool r = false; + std::string::const_iterator end = str.end(); + std::string::const_iterator iter = str.begin(); + + + typename parserType::parser_target_type data; + r = phrase_parse(iter, end, get_parser(), space, data); + + if (r && iter == end) + { + this->val += data.name.size(); + } + else + { + throw std::runtime_error("Parsing failed"); + } + } + + }; + + + + +typedef std::string::const_iterator iterator_type; +typedef client::permutation_parser<iterator_type> permutation_parser; +typedef client::kwd_parser<iterator_type> kwd_parser; +typedef client::alternative_parser<iterator_type> alternative_parser; +typedef client::tst_map_parser<iterator_type, boost::mpl::int_<full> > tst_map_parser; + +struct permutation_timer_fwd : timeParser<permutation_parser> +{ + permutation_timer_fwd() : timeParser<permutation_parser>(fwd) {} +}; + +struct permutation_timer_back : timeParser<permutation_parser> +{ + permutation_timer_back() : timeParser<permutation_parser>(back) {} +}; + +struct alternative_timer_fwd : timeParser<alternative_parser> +{ + alternative_timer_fwd() : timeParser<alternative_parser>(fwd) {} +}; + +struct alternative_timer_back : timeParser<alternative_parser> +{ + alternative_timer_back() : timeParser<alternative_parser>(back) {} +}; + +struct tst_timer_fwd_full : timeParser< client::tst_parser<iterator_type, boost::mpl::int_<full> > > +{ + tst_timer_fwd_full() : timeParser< client::tst_parser<iterator_type, boost::mpl::int_<full> > >(fwd) {} +}; + +struct tst_timer_fwd_no_assign : timeParser< client::tst_parser<iterator_type, boost::mpl::int_<no_assign> > > +{ + tst_timer_fwd_no_assign() : timeParser< client::tst_parser<iterator_type,boost::mpl::int_<no_assign> > >(fwd) {} +}; + +struct tst_timer_fwd_assign : timeParser< client::tst_parser<iterator_type,boost::mpl::int_<assign> > > +{ + tst_timer_fwd_assign() : timeParser< client::tst_parser<iterator_type,boost::mpl::int_<assign> > >(fwd) {} +}; + + + +struct tst_timer_back : timeParser< client::tst_parser<iterator_type,boost::mpl::int_<full> > > +{ + tst_timer_back() : timeParser< client::tst_parser<iterator_type,boost::mpl::int_<full> > >(back) {} +}; + +struct tst_map_timer_fwd : timeParser<tst_map_parser> +{ + tst_map_timer_fwd() : timeParser<tst_map_parser>(fwd) {} +}; + +struct tst_map_timer_back : timeParser<tst_map_parser> +{ + tst_map_timer_back() : timeParser<tst_map_parser>(back) {} +}; + +struct kwd_timer_fwd : timeParser<kwd_parser> +{ + kwd_timer_fwd() : timeParser<kwd_parser>(fwd) {} +}; + +struct kwd_timer_back : timeParser<kwd_parser> +{ + kwd_timer_back() : timeParser<kwd_parser>(back) {} +}; + + + + + +//////////////////////////////////////////////////////////////////////////// +// Main program +//////////////////////////////////////////////////////////////////////////// + int +main() +{ + + BOOST_SPIRIT_TEST_BENCHMARK( + 10000000000, // This is the maximum repetitions to execute + (permutation_timer_fwd) + (permutation_timer_back) + (alternative_timer_fwd) + (alternative_timer_back) + (tst_timer_fwd_full) + (tst_timer_fwd_no_assign) + (tst_timer_fwd_assign) + (tst_timer_back) + (tst_map_timer_fwd) + (tst_map_timer_back) + (kwd_timer_fwd) + (kwd_timer_back) + ) + + // This is ultimately responsible for preventing all the test code + // from being optimized away. Change this to return 0 and you + // unplug the whole test's life support system. + return test::live_code != 0; +} + + diff --git a/src/boost/libs/spirit/workbench/qi/keywords.hpp b/src/boost/libs/spirit/workbench/qi/keywords.hpp new file mode 100644 index 00000000..b57adc26 --- /dev/null +++ b/src/boost/libs/spirit/workbench/qi/keywords.hpp @@ -0,0 +1,49 @@ +/*============================================================================= + Copyright (c) 2011 Thomas Bernard + + Distributed under 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) +=============================================================================*/ + +#if defined(KEYS_1) +#define keys ("WeaBGNogxKwkyFilMHOp") + +const std::string fwd = "test WeaBGNogxKwkyFilMHOp 1655 "; +const std::string back = "test WeaBGNogxKwkyFilMHOp 1372 "; +#endif +#if defined(KEYS_5) +#define keys ("xSjJfIbmYDvQHhKTLZca")("JPvLQbGsXantCZpoeEiB")("MAZjzUrtdRSmhNnqxPVX")("PhuXTxIQCijHnZgUkLMY")("yQbTUMoPqwKvpIzekhfY") + +const std::string fwd = "test xSjJfIbmYDvQHhKTLZca 1450 JPvLQbGsXantCZpoeEiB 1691 MAZjzUrtdRSmhNnqxPVX 64 PhuXTxIQCijHnZgUkLMY 640 yQbTUMoPqwKvpIzekhfY 135"; +const std::string back = "test yQbTUMoPqwKvpIzekhfY 1903 PhuXTxIQCijHnZgUkLMY 404 MAZjzUrtdRSmhNnqxPVX 1473 JPvLQbGsXantCZpoeEiB 1478 xSjJfIbmYDvQHhKTLZca 1063"; +#endif +#if defined(KEYS_10) +#define keys ("briLcUzOEDAswdGuIXlp")("ZwKsyzktMrnERbDLThlB")("QCvkgGRYrmDVfiApzStM")("FUsjQAtlVrYSBmLvzxid")("gcvoqwKZIGMxatCdkDLH")("zmoqaLnEjGstTIbDkhBe")("cMQikmaJZgfEDIeNYGxK")("dufrWGRjHqZOENKhJitl")("MJKlZWrFVBLoUfjDcREw")("yVaJUIlYvumSdpTEXhKB") + +const std::string fwd = "test briLcUzOEDAswdGuIXlp 1580 ZwKsyzktMrnERbDLThlB 301 QCvkgGRYrmDVfiApzStM 301 FUsjQAtlVrYSBmLvzxid 1050 gcvoqwKZIGMxatCdkDLH 229 zmoqaLnEjGstTIbDkhBe 1962 cMQikmaJZgfEDIeNYGxK 789 dufrWGRjHqZOENKhJitl 1991 MJKlZWrFVBLoUfjDcREw 1819 yVaJUIlYvumSdpTEXhKB 193 "; +const std::string back = "test yVaJUIlYvumSdpTEXhKB 1009 MJKlZWrFVBLoUfjDcREw 1585 dufrWGRjHqZOENKhJitl 313 cMQikmaJZgfEDIeNYGxK 791 zmoqaLnEjGstTIbDkhBe 544 gcvoqwKZIGMxatCdkDLH 672 FUsjQAtlVrYSBmLvzxid 78 QCvkgGRYrmDVfiApzStM 1069 ZwKsyzktMrnERbDLThlB 1741 briLcUzOEDAswdGuIXlp 1051 "; +#endif +#if defined(KEYS_20) +#define keys ("yTMiuczAoDwJhIBCGvPl")("JUTVaEqDepvsiXwBgSYd")("voeXaAjyCqKtFxRhEblz")("rvQaNuXGkILPcdnSbWKw")("DWrTLiQlHhIjCXVEgGtw")("OMjiwLbahJdCzUGNmoZX")("FDNwcClbuBHeShriUfMK")("FkXLDcdKfJmjtgpAvVSG")("gjQWltFPcdvkBOnEbpGr")("MHkicpLbzqOFUVgnrQZG")("RPLWdKwJZAgsmFeqXnNx")("mdRMYcEfbezLguxOXBhF")("QsiEYSpTjonBqHLUaWzD")("POZcyDElsqoJGmSpQXrw")("PlscizNMqaYvLZBTxtQA")("zhxamRtXHuoyriGJjSIn")("YDAuwLaZEnNGgIJCUepR")("ogOdBYzCEJZqMHmuRsPt")("gWFzoLBUheNwlVrcOYbT")("pKcMQIkvriCLxfSDNEXA") + +const std::string fwd = "test yTMiuczAoDwJhIBCGvPl 1021 JUTVaEqDepvsiXwBgSYd 1480 voeXaAjyCqKtFxRhEblz 255 rvQaNuXGkILPcdnSbWKw 1792 DWrTLiQlHhIjCXVEgGtw 1117 OMjiwLbahJdCzUGNmoZX 920 FDNwcClbuBHeShriUfMK 924 FkXLDcdKfJmjtgpAvVSG 1798 gjQWltFPcdvkBOnEbpGr 1298 MHkicpLbzqOFUVgnrQZG 673 RPLWdKwJZAgsmFeqXnNx 35 mdRMYcEfbezLguxOXBhF 703 QsiEYSpTjonBqHLUaWzD 595 POZcyDElsqoJGmSpQXrw 798 PlscizNMqaYvLZBTxtQA 780 zhxamRtXHuoyriGJjSIn 385 YDAuwLaZEnNGgIJCUepR 1834 ogOdBYzCEJZqMHmuRsPt 43 gWFzoLBUheNwlVrcOYbT 1885 pKcMQIkvriCLxfSDNEXA 1397 "; +const std::string back = "test pKcMQIkvriCLxfSDNEXA 1885 gWFzoLBUheNwlVrcOYbT 978 ogOdBYzCEJZqMHmuRsPt 929 YDAuwLaZEnNGgIJCUepR 1929 zhxamRtXHuoyriGJjSIn 859 PlscizNMqaYvLZBTxtQA 1505 POZcyDElsqoJGmSpQXrw 1317 QsiEYSpTjonBqHLUaWzD 122 mdRMYcEfbezLguxOXBhF 610 RPLWdKwJZAgsmFeqXnNx 133 MHkicpLbzqOFUVgnrQZG 371 gjQWltFPcdvkBOnEbpGr 1770 FkXLDcdKfJmjtgpAvVSG 128 FDNwcClbuBHeShriUfMK 1829 OMjiwLbahJdCzUGNmoZX 1187 DWrTLiQlHhIjCXVEgGtw 822 rvQaNuXGkILPcdnSbWKw 1321 voeXaAjyCqKtFxRhEblz 855 JUTVaEqDepvsiXwBgSYd 219 yTMiuczAoDwJhIBCGvPl 1209 "; +#endif +#if defined(KEYS_30) +#define keys ("GgrRUxIZCFYkpnsvyzwb")("fLpJmgZEQAKdbcSuNFPr")("aMZVkzfvrXLyPjeUBRus")("gBefvhWdnzbEGHLmUDpO")("fXZnwLWDeNtrMQzhqOsb")("CusxSlJpKvtmOHrBjzAX")("yufeisPwaUIKtNYVTAbC")("WMCzLygdkDHAOEpJeSBr")("lxQzaLBHwTvXJZUMyVho")("JdPxVYOgsGUEFBtvmZkL")("wPaFKqnJRfuODGWLvkgA")("iwJpIslCdTqEnMQocbxN")("vRQzSrpTMCKhwABHLPDx")("xHAJatdSfnXevMYKwLcV")("mEDZwUnfxzAaqkpQlNKr")("rHQwgpxqPsWzJGVlYEMn")("vczEywanJWBrMHIhLDKx")("rWpuIPmoReFSBGNYLUXJ")("cHNZVmYAOpkBRwWUhyae")("tNOpTMRadcHjLDUAoyvX")("bRLrhnmXvdyTZcHWQgDB")("STpWfPAhqQvjsdkHeZlU")("JsMdBawTzIgPGouHipRl")("qEHdLhXwsmSfbaoWkGiM")("jrZHNnElwcPAbsOFzdfT")("NvarfYcMCUXqxbDwgRVT")("zwOxryohHjCuNpnKDPdl")("mHOtuLrZKveTjsbzApan")("qFEHhLbeWpUtaozKCBSX")("pnlSjeQETKfRwNvOYDdJ") + +const std::string fwd = "test GgrRUxIZCFYkpnsvyzwb 573 fLpJmgZEQAKdbcSuNFPr 1748 aMZVkzfvrXLyPjeUBRus 919 gBefvhWdnzbEGHLmUDpO 1491 fXZnwLWDeNtrMQzhqOsb 1023 CusxSlJpKvtmOHrBjzAX 656 yufeisPwaUIKtNYVTAbC 1963 WMCzLygdkDHAOEpJeSBr 1171 lxQzaLBHwTvXJZUMyVho 51 JdPxVYOgsGUEFBtvmZkL 125 wPaFKqnJRfuODGWLvkgA 273 iwJpIslCdTqEnMQocbxN 58 vRQzSrpTMCKhwABHLPDx 347 xHAJatdSfnXevMYKwLcV 440 mEDZwUnfxzAaqkpQlNKr 442 rHQwgpxqPsWzJGVlYEMn 1527 vczEywanJWBrMHIhLDKx 1671 rWpuIPmoReFSBGNYLUXJ 457 cHNZVmYAOpkBRwWUhyae 1721 tNOpTMRadcHjLDUAoyvX 919 bRLrhnmXvdyTZcHWQgDB 317 STpWfPAhqQvjsdkHeZlU 1886 JsMdBawTzIgPGouHipRl 352 qEHdLhXwsmSfbaoWkGiM 1641 jrZHNnElwcPAbsOFzdfT 1430 NvarfYcMCUXqxbDwgRVT 383 zwOxryohHjCuNpnKDPdl 402 mHOtuLrZKveTjsbzApan 46 qFEHhLbeWpUtaozKCBSX 681 pnlSjeQETKfRwNvOYDdJ 36 "; +const std::string back = "test pnlSjeQETKfRwNvOYDdJ 976 qFEHhLbeWpUtaozKCBSX 1787 mHOtuLrZKveTjsbzApan 832 zwOxryohHjCuNpnKDPdl 487 NvarfYcMCUXqxbDwgRVT 1973 jrZHNnElwcPAbsOFzdfT 68 qEHdLhXwsmSfbaoWkGiM 157 JsMdBawTzIgPGouHipRl 1017 STpWfPAhqQvjsdkHeZlU 74 bRLrhnmXvdyTZcHWQgDB 1010 tNOpTMRadcHjLDUAoyvX 313 cHNZVmYAOpkBRwWUhyae 521 rWpuIPmoReFSBGNYLUXJ 1286 vczEywanJWBrMHIhLDKx 1942 rHQwgpxqPsWzJGVlYEMn 1048 mEDZwUnfxzAaqkpQlNKr 1170 xHAJatdSfnXevMYKwLcV 152 vRQzSrpTMCKhwABHLPDx 1330 iwJpIslCdTqEnMQocbxN 1927 wPaFKqnJRfuODGWLvkgA 1347 JdPxVYOgsGUEFBtvmZkL 1569 lxQzaLBHwTvXJZUMyVho 766 WMCzLygdkDHAOEpJeSBr 966 yufeisPwaUIKtNYVTAbC 186 CusxSlJpKvtmOHrBjzAX 1494 fXZnwLWDeNtrMQzhqOsb 1722 gBefvhWdnzbEGHLmUDpO 1829 aMZVkzfvrXLyPjeUBRus 134 fLpJmgZEQAKdbcSuNFPr 963 GgrRUxIZCFYkpnsvyzwb 465 "; +#endif +#if defined(KEYS_40) +#define keys ("xjSUvfTWlVeoLEtdmKBz")("HSDfyWRmjsxiXFOJQvoT")("gvByQMLTjeGdiVXkWqnf")("HZJdriPpDLsvEhfzKXBa")("hMXgUkzBHRbJWvCalsAN")("rOsvXRwgNyTkPDYBzELC")("CbRfwqJONDHFYGzPaZpo")("dUOPAuIDElRjWQeBkiMN")("KTWfmbAeOUhJsuaEvMwr")("QhglZMDOsAYwamrxvPUH")("TNgnvqHzjFyDPlhmVItC")("RxOnIzgaMdpwekBYNvLC")("VnPsKoruveyOUDQtBRGj")("QJcuxWkrsgfviopSDIhC")("ZAhUFndDgemHLTtsCfpu")("HQywNcbTtzpknSsBjJqo")("fCKXUHGBPzkZlTYoSnWy")("FagwxrUtbGizkNcTELfC")("kNvJBuTQZbEfWVYLlrOA")("pHDuhFJBOrzPALCtEWNU")("FczoOhKDLyNgGdfPrUJj")("DPzioljtskSICqveWrxm")("LhbOFicHYwCpdUqJaVgW")("rbVRhimjwDLlvSIFWUxt")("xsUXlLEyVQinuSZjbwGD")("zAGgCYZqhVMkfWavsKeX")("zetXFOmPBZRQJswHYDbj")("ZvwSjyIJBmQRNiVTDpqE")("cixUqrmszRbvpMPhTwVt")("mEeHfzKtrSyUDGcnOlgv")("oqYWiUSKmdJGXBNnlEue")("cTkYIdoQpHbnDhuCywJi")("kGNHjfpBlntPFwygicIL")("PFSwazNXjbGrdAuRKqVk")("drwmptOPlUxgnCjyqWSJ")("CBLImQsdlkXqEfDWpYug")("DHgsPldqzuGxfEnLFriS")("ATRzQeVUgIJuCmcqSPGX")("WiPZTDXgxeAsKFwfamoy")("KgdSxtYMlEqmPJkFRzWQ") + +const std::string fwd = "test xjSUvfTWlVeoLEtdmKBz 1324 HSDfyWRmjsxiXFOJQvoT 310 gvByQMLTjeGdiVXkWqnf 671 HZJdriPpDLsvEhfzKXBa 427 hMXgUkzBHRbJWvCalsAN 524 rOsvXRwgNyTkPDYBzELC 1295 CbRfwqJONDHFYGzPaZpo 1233 dUOPAuIDElRjWQeBkiMN 1432 KTWfmbAeOUhJsuaEvMwr 623 QhglZMDOsAYwamrxvPUH 70 TNgnvqHzjFyDPlhmVItC 235 RxOnIzgaMdpwekBYNvLC 170 VnPsKoruveyOUDQtBRGj 918 QJcuxWkrsgfviopSDIhC 619 ZAhUFndDgemHLTtsCfpu 27 HQywNcbTtzpknSsBjJqo 985 fCKXUHGBPzkZlTYoSnWy 1876 FagwxrUtbGizkNcTELfC 1761 kNvJBuTQZbEfWVYLlrOA 1823 pHDuhFJBOrzPALCtEWNU 1872 FczoOhKDLyNgGdfPrUJj 162 DPzioljtskSICqveWrxm 1704 LhbOFicHYwCpdUqJaVgW 405 rbVRhimjwDLlvSIFWUxt 135 xsUXlLEyVQinuSZjbwGD 1555 zAGgCYZqhVMkfWavsKeX 1553 zetXFOmPBZRQJswHYDbj 315 ZvwSjyIJBmQRNiVTDpqE 1844 cixUqrmszRbvpMPhTwVt 949 mEeHfzKtrSyUDGcnOlgv 1293 oqYWiUSKmdJGXBNnlEue 1554 cTkYIdoQpHbnDhuCywJi 1829 kGNHjfpBlntPFwygicIL 191 PFSwazNXjbGrdAuRKqVk 355 drwmptOPlUxgnCjyqWSJ 1403 CBLImQsdlkXqEfDWpYug 57 DHgsPldqzuGxfEnLFriS 748 ATRzQeVUgIJuCmcqSPGX 841 WiPZTDXgxeAsKFwfamoy 1660 KgdSxtYMlEqmPJkFRzWQ 1126 "; +const std::string back = "test KgdSxtYMlEqmPJkFRzWQ 364 WiPZTDXgxeAsKFwfamoy 176 ATRzQeVUgIJuCmcqSPGX 793 DHgsPldqzuGxfEnLFriS 179 CBLImQsdlkXqEfDWpYug 1570 drwmptOPlUxgnCjyqWSJ 1635 PFSwazNXjbGrdAuRKqVk 793 kGNHjfpBlntPFwygicIL 1294 cTkYIdoQpHbnDhuCywJi 966 oqYWiUSKmdJGXBNnlEue 642 mEeHfzKtrSyUDGcnOlgv 830 cixUqrmszRbvpMPhTwVt 1842 ZvwSjyIJBmQRNiVTDpqE 1617 zetXFOmPBZRQJswHYDbj 718 zAGgCYZqhVMkfWavsKeX 587 xsUXlLEyVQinuSZjbwGD 1597 rbVRhimjwDLlvSIFWUxt 770 LhbOFicHYwCpdUqJaVgW 1100 DPzioljtskSICqveWrxm 473 FczoOhKDLyNgGdfPrUJj 74 pHDuhFJBOrzPALCtEWNU 902 kNvJBuTQZbEfWVYLlrOA 749 FagwxrUtbGizkNcTELfC 964 fCKXUHGBPzkZlTYoSnWy 819 HQywNcbTtzpknSsBjJqo 1535 ZAhUFndDgemHLTtsCfpu 859 QJcuxWkrsgfviopSDIhC 1648 VnPsKoruveyOUDQtBRGj 1368 RxOnIzgaMdpwekBYNvLC 757 TNgnvqHzjFyDPlhmVItC 245 QhglZMDOsAYwamrxvPUH 170 KTWfmbAeOUhJsuaEvMwr 671 dUOPAuIDElRjWQeBkiMN 1792 CbRfwqJONDHFYGzPaZpo 1117 rOsvXRwgNyTkPDYBzELC 1293 hMXgUkzBHRbJWvCalsAN 1563 HZJdriPpDLsvEhfzKXBa 675 gvByQMLTjeGdiVXkWqnf 1734 HSDfyWRmjsxiXFOJQvoT 1858 xjSUvfTWlVeoLEtdmKBz 1030 "; +#endif +#if defined(KEYS_50) +#define keys ("QZMaswnqKlYGVWArzRSm")("EKWLSbqXhjIvQgpJrxnF")("ENVahOdugPMsewLIzGWD")("XeuQTSmbIFZcKvRJNOqP")("nOZjiVoQxeJhgRsPDFSI")("BNFEOLMKgepudtCmrPWR")("ElUzSiPTnCyvtdkeRxKL")("LwkRqhCYgpvjNEIVonWT")("ePqFoWSwgBkRcKvYxCsu")("uImFlasHEAPqzNtKWhTY")("LegKBDklPxyXhwUWMpTd")("wOLlVmQiKMrDdRxjSfcI")("wluBvdVhMazxSUWFCjtZ")("DuRnZmNdsOEeWrqxQFUz")("dQVlbzjCMNSwnRqrofFI")("ivdCbNxuXOWJBUGEjIwh")("gFzqlpbPCZtARScNrvjK")("PtGVUfkdiupEKsIOgjNW")("ucDVgUApjNkPGixQbdMS")("DwRyzVleMbBmOorvNTxX")("TYJjBKcZiFqpWyaLbNhS")("mgTbPuslkvFMrHVENcAY")("zDQxOBgJXswcWIqdMmZa")("jUbvKZIkrCduqtgMyAzx")("NlnChoIEKuXQdwzOvMat")("eNtPxwYzMJCDfsQVlLGA")("DhBpcTgvJtAROaLFMuwz")("QZXfGWqONEmHSytbUTnh")("yJHPXhVSpAwebWnkGxQZ")("UonOKFbImdWhuBspTcEg")("ytOAXPUDGrjgqeEvpTIs")("dEiSHXlCoAsfBhcwTNZJ")("QTtfvRhnVjZKdsOkFCzH")("vbFAtKSRYEskzBruWgXH")("sGLvhxcdbZJoujrwERDp")("QBvJhYMDsgGNfziSkPtF")("TWIfucYJrRQBPyKsFGzg")("sqhuViGvxDAkjLnfpmQC")("YHLhZVGXNOQrzKMFvRWk")("wykaZKTmfOoFHPQDAsqn")("lkzZeRXCHLaOjJDhsKtg")("CaWUzuhvkqHLrwBMbpFo")("STLfmxsWGEKRDyzadihv")("svpKlVfeGYjMEkCXbtDS")("GAJxeMwbWCDHiczpslVn")("aqDeBkoTOcrVPtliRzFH")("VvjJPaLxpuRKSDsdmtgY")("WHbLDZABtSFMElKJYPOj")("agKVtLdsSpPzTfOmNxWy")("ZIJokqupeBRrTlHNKChz") + +const std::string fwd = "test QZMaswnqKlYGVWArzRSm 1285 EKWLSbqXhjIvQgpJrxnF 966 ENVahOdugPMsewLIzGWD 1122 XeuQTSmbIFZcKvRJNOqP 1863 nOZjiVoQxeJhgRsPDFSI 1738 BNFEOLMKgepudtCmrPWR 842 ElUzSiPTnCyvtdkeRxKL 278 LwkRqhCYgpvjNEIVonWT 983 ePqFoWSwgBkRcKvYxCsu 1387 uImFlasHEAPqzNtKWhTY 282 LegKBDklPxyXhwUWMpTd 635 wOLlVmQiKMrDdRxjSfcI 563 wluBvdVhMazxSUWFCjtZ 1091 DuRnZmNdsOEeWrqxQFUz 1773 dQVlbzjCMNSwnRqrofFI 102 ivdCbNxuXOWJBUGEjIwh 1562 gFzqlpbPCZtARScNrvjK 354 PtGVUfkdiupEKsIOgjNW 1728 ucDVgUApjNkPGixQbdMS 1874 DwRyzVleMbBmOorvNTxX 1594 TYJjBKcZiFqpWyaLbNhS 1654 mgTbPuslkvFMrHVENcAY 89 zDQxOBgJXswcWIqdMmZa 1814 jUbvKZIkrCduqtgMyAzx 559 NlnChoIEKuXQdwzOvMat 748 eNtPxwYzMJCDfsQVlLGA 435 DhBpcTgvJtAROaLFMuwz 1649 QZXfGWqONEmHSytbUTnh 1530 yJHPXhVSpAwebWnkGxQZ 244 UonOKFbImdWhuBspTcEg 1712 ytOAXPUDGrjgqeEvpTIs 124 dEiSHXlCoAsfBhcwTNZJ 1759 QTtfvRhnVjZKdsOkFCzH 1655 vbFAtKSRYEskzBruWgXH 1325 sGLvhxcdbZJoujrwERDp 1979 QBvJhYMDsgGNfziSkPtF 304 TWIfucYJrRQBPyKsFGzg 1721 sqhuViGvxDAkjLnfpmQC 1693 YHLhZVGXNOQrzKMFvRWk 389 wykaZKTmfOoFHPQDAsqn 1592 lkzZeRXCHLaOjJDhsKtg 902 CaWUzuhvkqHLrwBMbpFo 374 STLfmxsWGEKRDyzadihv 1912 svpKlVfeGYjMEkCXbtDS 61 GAJxeMwbWCDHiczpslVn 1652 aqDeBkoTOcrVPtliRzFH 591 VvjJPaLxpuRKSDsdmtgY 1892 WHbLDZABtSFMElKJYPOj 756 agKVtLdsSpPzTfOmNxWy 1866 ZIJokqupeBRrTlHNKChz 1972 "; +const std::string back = "test ZIJokqupeBRrTlHNKChz 277 agKVtLdsSpPzTfOmNxWy 424 WHbLDZABtSFMElKJYPOj 313 VvjJPaLxpuRKSDsdmtgY 1114 aqDeBkoTOcrVPtliRzFH 1458 GAJxeMwbWCDHiczpslVn 1248 svpKlVfeGYjMEkCXbtDS 225 STLfmxsWGEKRDyzadihv 1745 CaWUzuhvkqHLrwBMbpFo 629 lkzZeRXCHLaOjJDhsKtg 130 wykaZKTmfOoFHPQDAsqn 10 YHLhZVGXNOQrzKMFvRWk 1463 sqhuViGvxDAkjLnfpmQC 1319 TWIfucYJrRQBPyKsFGzg 1057 QBvJhYMDsgGNfziSkPtF 445 sGLvhxcdbZJoujrwERDp 313 vbFAtKSRYEskzBruWgXH 1758 QTtfvRhnVjZKdsOkFCzH 1190 dEiSHXlCoAsfBhcwTNZJ 1008 ytOAXPUDGrjgqeEvpTIs 916 UonOKFbImdWhuBspTcEg 1699 yJHPXhVSpAwebWnkGxQZ 840 QZXfGWqONEmHSytbUTnh 1041 DhBpcTgvJtAROaLFMuwz 699 eNtPxwYzMJCDfsQVlLGA 701 NlnChoIEKuXQdwzOvMat 21 jUbvKZIkrCduqtgMyAzx 1506 zDQxOBgJXswcWIqdMmZa 689 mgTbPuslkvFMrHVENcAY 1292 TYJjBKcZiFqpWyaLbNhS 1015 DwRyzVleMbBmOorvNTxX 1099 ucDVgUApjNkPGixQbdMS 1389 PtGVUfkdiupEKsIOgjNW 820 gFzqlpbPCZtARScNrvjK 1748 ivdCbNxuXOWJBUGEjIwh 240 dQVlbzjCMNSwnRqrofFI 546 DuRnZmNdsOEeWrqxQFUz 1015 wluBvdVhMazxSUWFCjtZ 1058 wOLlVmQiKMrDdRxjSfcI 935 LegKBDklPxyXhwUWMpTd 1609 uImFlasHEAPqzNtKWhTY 17 ePqFoWSwgBkRcKvYxCsu 680 LwkRqhCYgpvjNEIVonWT 189 ElUzSiPTnCyvtdkeRxKL 589 BNFEOLMKgepudtCmrPWR 622 nOZjiVoQxeJhgRsPDFSI 741 XeuQTSmbIFZcKvRJNOqP 1843 ENVahOdugPMsewLIzGWD 220 EKWLSbqXhjIvQgpJrxnF 774 QZMaswnqKlYGVWArzRSm 140 "; +#endif diff --git a/src/boost/libs/spirit/workbench/qi/real_parser.cpp b/src/boost/libs/spirit/workbench/qi/real_parser.cpp new file mode 100644 index 00000000..66ae54e5 --- /dev/null +++ b/src/boost/libs/spirit/workbench/qi/real_parser.cpp @@ -0,0 +1,118 @@ +/*============================================================================= + Copyright (c) 2001-2010 Joel de Guzman + + Distributed under 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 "../measure.hpp" +#include <string> +#include <vector> +#include <cstdlib> +#include <boost/spirit/include/qi.hpp> + +namespace +{ + int const ndigits = 9; + std::string numbers[ndigits] = + { + "1234", + "-1.2e3", + "0.1", + "-1.2e-3", + "-.2e3", + "-2e6", + "1.2345e5", + "-5.7222349715140557e+307", + "2.0332938517515416e-308" + }; + + char const* first[ndigits]; + char const* last[ndigits]; + + /////////////////////////////////////////////////////////////////////////// + struct atof_test : test::base + { + void benchmark() + { + for (int i = 0; i < ndigits; ++i) + { + double d = atof(first[i]); + this->val += *reinterpret_cast<int*>(&d); + } + } + }; + + /////////////////////////////////////////////////////////////////////////// + struct strtod_test : test::base + { + void benchmark() + { + for (int i = 0; i < ndigits; ++i) + { + double d = strtod(first[i], const_cast<char**>(&last[i])); + this->val += *reinterpret_cast<int*>(&d); + } + } + }; + + /////////////////////////////////////////////////////////////////////////// + struct spirit_double_test : test::base + { + static double parse(char const* first, char const* last) + { + double n; + namespace qi = boost::spirit::qi; + using qi::double_; + qi::parse(first, last, double_, n); + return n; + } + + void benchmark() + { + for (int i = 0; i < ndigits; ++i) + { + double d = parse(first[i], last[i]); + this->val += *reinterpret_cast<int*>(&d); + } + } + }; +} + +int main() +{ + std::cout << "///////////////////////////////////////////////////////////////////////////" << std::endl; + std::cout << "Numbers to test:" << std::endl; + for (int i = 0; i < ndigits; ++i) + { + first[i] = numbers[i].c_str(); + last[i] = first[i]; + while (*last[i]) + last[i]++; + std::cout << numbers[i] << std::endl; + } + std::cout.precision(17); + std::cout << "///////////////////////////////////////////////////////////////////////////" << std::endl; + std::cout << "atof/strtod/qi.double results:" << std::endl; + for (int i = 0; i < ndigits; ++i) + { + std::cout + << atof(first[i]) << ',' + << strtod(first[i], const_cast<char**>(&last[i])) << ',' + << spirit_double_test::parse(first[i], last[i]) << ',' + << std::endl; + } + std::cout << "///////////////////////////////////////////////////////////////////////////" << std::endl; + + BOOST_SPIRIT_TEST_BENCHMARK( + 10000000, // This is the maximum repetitions to execute + (atof_test) + (strtod_test) + (spirit_double_test) + ) + + // This is ultimately responsible for preventing all the test code + // from being optimized away. Change this to return 0 and you + // unplug the whole test's life support system. + return test::live_code != 0; +} + |