Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58787 - in branches/release: . boost boost/algorithm/string boost/archive boost/config boost/filesystem boost/functional/hash boost/fusion boost/graph boost/integer boost/interprocess boost/intrusive boost/iostreams boost/math boost/numeric/ublas boost/program_options boost/property_tree boost/python boost/regex boost/serialization boost/signals boost/signals2 boost/spirit boost/spirit/home boost/spirit/home/karma boost/spirit/home/support boost/spirit/home/support/iterators boost/statechart boost/system boost/thread boost/tr1 boost/type_traits boost/unordered boost/utility boost/variant boost/wave doc libs libs/config libs/filesystem libs/functional/hash libs/fusion libs/graph_parallel libs/integer libs/interprocess libs/intrusive libs/iostreams libs/math libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/numeric/ublas libs/numeric/ublas/doc libs/program_options libs/property_tree libs/python libs/regex libs/regex/doc libs/serialization libs/signals libs/signals2 libs/spirit libs/spirit/classic/example libs/spirit/doc libs/spirit/example libs/spirit/example/karma libs/spirit/phoenix libs/spirit/test libs/spirit/test/karma libs/spirit/test/qi libs/statechart libs/static_assert libs/system libs/thread libs/thread/doc libs/timer libs/tr1 libs/type_traits libs/unordered libs/utility libs/wave more people status tools tools/bcp tools/boostbook tools/build/v2 tools/inspect tools/quickbook tools/regression tools/release tools/wave wiki
From: hartmut.kaiser_at_[hidden]
Date: 2010-01-07 11:23:41


Author: hkaiser
Date: 2010-01-07 11:23:39 EST (Thu, 07 Jan 2010)
New Revision: 58787
URL: http://svn.boost.org/trac/boost/changeset/58787

Log:
Spirit: merging from trunk
Properties modified:
   branches/release/ (props changed)
   branches/release/CMakeLists.txt (props changed)
   branches/release/INSTALL (props changed)
   branches/release/Jamroot (props changed)
   branches/release/LICENSE_1_0.txt (props changed)
   branches/release/boost/ (props changed)
   branches/release/boost-build.jam (props changed)
   branches/release/boost.css (props changed)
   branches/release/boost.png (props changed)
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/boost/archive/ (props changed)
   branches/release/boost/config/ (props changed)
   branches/release/boost/filesystem/ (props changed)
   branches/release/boost/functional/hash/ (props changed)
   branches/release/boost/fusion/ (props changed)
   branches/release/boost/graph/ (props changed)
   branches/release/boost/integer/ (props changed)
   branches/release/boost/interprocess/ (props changed)
   branches/release/boost/intrusive/ (props changed)
   branches/release/boost/iostreams/ (props changed)
   branches/release/boost/math/ (props changed)
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/program_options/ (props changed)
   branches/release/boost/property_tree/ (props changed)
   branches/release/boost/python/ (props changed)
   branches/release/boost/regex/ (props changed)
   branches/release/boost/serialization/ (props changed)
   branches/release/boost/signals/ (props changed)
   branches/release/boost/signals2/ (props changed)
   branches/release/boost/spirit/ (props changed)
   branches/release/boost/spirit/home/ (props changed)
   branches/release/boost/spirit/home/karma/ (props changed)
   branches/release/boost/spirit/home/support/attributes.hpp (props changed)
   branches/release/boost/statechart/ (props changed)
   branches/release/boost/system/ (props changed)
   branches/release/boost/thread/ (props changed)
   branches/release/boost/thread.hpp (props changed)
   branches/release/boost/tr1/ (props changed)
   branches/release/boost/type_traits/ (props changed)
   branches/release/boost/unordered/ (props changed)
   branches/release/boost/utility/value_init.hpp (props changed)
   branches/release/boost/variant/ (props changed)
   branches/release/boost/version.hpp (props changed)
   branches/release/boost/wave/ (props changed)
   branches/release/bootstrap.bat (props changed)
   branches/release/bootstrap.sh (props changed)
   branches/release/doc/ (props changed)
   branches/release/index.htm (props changed)
   branches/release/index.html (props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/config/ (props changed)
   branches/release/libs/filesystem/ (props changed)
   branches/release/libs/functional/hash/ (props changed)
   branches/release/libs/fusion/ (props changed)
   branches/release/libs/graph_parallel/ (props changed)
   branches/release/libs/integer/ (props changed)
   branches/release/libs/interprocess/ (props changed)
   branches/release/libs/intrusive/ (props changed)
   branches/release/libs/iostreams/ (props changed)
   branches/release/libs/libraries.htm (props changed)
   branches/release/libs/maintainers.txt (props changed)
   branches/release/libs/math/ (props changed)
   branches/release/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   branches/release/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   branches/release/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   branches/release/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   branches/release/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   branches/release/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   branches/release/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   branches/release/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
   branches/release/libs/program_options/ (props changed)
   branches/release/libs/property_tree/ (props changed)
   branches/release/libs/python/ (props changed)
   branches/release/libs/regex/ (props changed)
   branches/release/libs/regex/doc/ (props changed)
   branches/release/libs/serialization/ (props changed)
   branches/release/libs/signals/ (props changed)
   branches/release/libs/signals2/ (props changed)
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/classic/example/ (props changed)
   branches/release/libs/spirit/doc/ (props changed)
   branches/release/libs/spirit/example/ (props changed)
   branches/release/libs/spirit/phoenix/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
   branches/release/libs/spirit/test/qi/optional.cpp (props changed)
   branches/release/libs/statechart/ (props changed)
   branches/release/libs/static_assert/ (props changed)
   branches/release/libs/system/ (props changed)
   branches/release/libs/thread/ (props changed)
   branches/release/libs/thread/doc/ (props changed)
   branches/release/libs/timer/ (props changed)
   branches/release/libs/tr1/ (props changed)
   branches/release/libs/type_traits/ (props changed)
   branches/release/libs/unordered/ (props changed)
   branches/release/libs/utility/swap.html (props changed)
   branches/release/libs/utility/value_init.htm (props changed)
   branches/release/libs/utility/value_init_test.cpp (props changed)
   branches/release/libs/wave/ (props changed)
   branches/release/more/ (props changed)
   branches/release/people/ (props changed)
   branches/release/rst.css (props changed)
   branches/release/status/ (props changed)
   branches/release/tools/ (props changed)
   branches/release/tools/bcp/ (props changed)
   branches/release/tools/boostbook/ (props changed)
   branches/release/tools/build/v2/ (props changed)
   branches/release/tools/inspect/ (props changed)
   branches/release/tools/quickbook/ (props changed)
   branches/release/tools/regression/ (props changed)
   branches/release/tools/release/ (props changed)
   branches/release/tools/wave/ (props changed)
   branches/release/wiki/ (props changed)
Text files modified:
   branches/release/boost/spirit/home/support/iterators/istream_iterator.hpp | 6 ++++
   branches/release/boost/spirit/home/support/iterators/look_ahead.hpp | 6 ++++
   branches/release/libs/spirit/example/karma/printf_style_double_format.cpp | 14 +++++-----
   branches/release/libs/spirit/test/karma/auto.cpp | 56 ++++++++++++++++++++++++++++++++++++++++
   branches/release/libs/spirit/test/karma/binary.cpp | 5 +--
   branches/release/libs/spirit/test/karma/test.hpp | 27 +++++++++++++++++++
   branches/release/libs/spirit/test/qi/match_manip.cpp | 2 +
   7 files changed, 106 insertions(+), 10 deletions(-)

Modified: branches/release/boost/spirit/home/support/iterators/istream_iterator.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/istream_iterator.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/istream_iterator.hpp 2010-01-07 11:23:39 EST (Thu, 07 Jan 2010)
@@ -64,6 +64,12 @@
           : base_type() {} // shipped with gcc 3.1
 #endif // BOOST_WORKAROUND(__GLIBCPP__, == 20020514)
 
+ basic_istream_iterator operator= (base_type const& rhs)
+ {
+ this->base_type::operator=(rhs);
+ return *this;
+ }
+
     // default generated operators, destructor and assignment operator are ok.
     };
 

Modified: branches/release/boost/spirit/home/support/iterators/look_ahead.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/look_ahead.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/look_ahead.hpp 2010-01-07 11:23:39 EST (Thu, 07 Jan 2010)
@@ -55,6 +55,12 @@
           : base_type() {} // shipped with gcc 3.1
 #endif // BOOST_WORKAROUND(__GLIBCPP__, == 20020514)
 
+ look_ahead operator= (base_type const& rhs)
+ {
+ this->base_type::operator=(rhs);
+ return *this;
+ }
+
     // default generated operators destructor and assignment operator are ok.
     };
 

Modified: branches/release/libs/spirit/example/karma/printf_style_double_format.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/printf_style_double_format.cpp (original)
+++ branches/release/libs/spirit/example/karma/printf_style_double_format.cpp 2010-01-07 11:23:39 EST (Thu, 07 Jan 2010)
@@ -47,7 +47,7 @@
 //
 
 ///////////////////////////////////////////////////////////////////////////////
-// define a data structure and an corresponding parser to hold the formatting
+// define a data structure and a corresponding parser to hold the formatting
 // information extracted from the format specification string
 namespace client
 {
@@ -89,11 +89,11 @@
             format %= '%' >> flags >> fill >> width >> prec >> type;
 
             // default flags is right aligned
- flags %= char_('+') | char_('-') | attr(' ');
- fill %= char_('0') | attr(' '); // default fill is space
- width %= uint_ | attr(-1);
- prec %= '.' >> uint_ | attr(3); // default is 3 digits
- type %= no_case[char_('e')] | char_('f') | no_case[char_('g')];
+ flags = char_('+') | char_('-') | attr(' ');
+ fill = char_('0') | attr(' '); // default fill is space
+ width = uint_ | attr(-1);
+ prec = '.' >> uint_ | attr(3); // default is 3 digits
+ type = no_case[char_('e')] | char_('f') | no_case[char_('g')];
         };
 
         qi::rule<Iterator, format_data()> format;
@@ -233,7 +233,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 // This is the generator usable in any Karma output format expression, it needs
-// to be used as
+// to be utilized as
 //
 // generate(sink, real("%6.3f"), 3.1415926536); // prints: ' 3.142'
 //

Modified: branches/release/libs/spirit/test/karma/auto.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/auto.cpp (original)
+++ branches/release/libs/spirit/test/karma/auto.cpp 2010-01-07 11:23:39 EST (Thu, 07 Jan 2010)
@@ -228,6 +228,62 @@
     }
 
     {
+ using karma::auto_;
+ using karma::upper;
+ using spirit_test::test;
+ using spirit_test::test_delimited;
+
+ // test primitive types
+ BOOST_TEST(test("true", auto_(true)));
+ BOOST_TEST(test("1", auto_(1)));
+ BOOST_TEST(test("1.1", auto_(1.1)));
+ BOOST_TEST(test("test", auto_("test")));
+ BOOST_TEST(test(L"test", auto_(L"test")));
+ BOOST_TEST(test("a", auto_('a')));
+ BOOST_TEST(test(L"a", auto_(L'a')));
+
+ BOOST_TEST(test("TRUE", upper[auto_(true)]));
+ BOOST_TEST(test("TEST", upper[auto_("test")]));
+
+ // test containers
+ std::vector<int> v;
+ v.push_back(0);
+ v.push_back(1);
+ v.push_back(2);
+ BOOST_TEST(test("012", auto_(v)));
+ BOOST_TEST(test_delimited("0,1,2,", auto_(v), ','));
+
+ std::list<int> l;
+ l.push_back(0);
+ l.push_back(1);
+ l.push_back(2);
+ BOOST_TEST(test("012", auto_(l)));
+ BOOST_TEST(test_delimited("0,1,2,", auto_(l), ','));
+
+ // test optional
+ boost::optional<int> o;
+ BOOST_TEST(test("", auto_(o)));
+ o = 1;
+ BOOST_TEST(test("1", auto_(o)));
+
+ // test alternative
+ boost::variant<int, double, float, std::string> vv;
+ vv = 1;
+ BOOST_TEST(test("1", auto_(vv)));
+ vv = 1.0;
+ BOOST_TEST(test("1.0", auto_(vv)));
+ vv = 1.0f;
+ BOOST_TEST(test("1.0", auto_(vv)));
+ vv = "some string";
+ BOOST_TEST(test("some string", auto_(vv)));
+
+ // test fusion sequence
+ std::pair<int, double> p (1, 2.0);
+ BOOST_TEST(test("12.0", auto_, p));
+ BOOST_TEST(test_delimited("1,2.0,", auto_(p), ','));
+ }
+
+ {
         using spirit_test::test;
         using spirit_test::test_delimited;
 

Modified: branches/release/libs/spirit/test/karma/binary.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/binary.cpp (original)
+++ branches/release/libs/spirit/test/karma/binary.cpp 2010-01-07 11:23:39 EST (Thu, 07 Jan 2010)
@@ -193,7 +193,7 @@
 
 #ifdef BOOST_LITTLE_ENDIAN
         BOOST_TEST(binary_test("\x01", 1, byte_, phoenix::val(0x01)));
- BOOST_TEST(binary_test("\x01\0x02", 2, byte_, phoenix::val(0x0201)));
+ BOOST_TEST(binary_test("\x01\x02", 2, word, phoenix::val(0x0201)));
         BOOST_TEST(binary_test("\x01\x02\x03\x04", 4, dword,
             phoenix::val(0x04030201)));
 
@@ -223,8 +223,7 @@
 #else // BOOST_LITTLE_ENDIAN
 
         BOOST_TEST(binary_test("\x01", 1, byte_, phoenix::val(0x01)));
- BOOST_TEST(binary_test("\x01\x02", 2, byte_,
- phoenix::val(boost::uint16_t(0x0102))));
+ BOOST_TEST(binary_test("\x01\x02", 2, word, phoenix::val(0x0102)));
         BOOST_TEST(binary_test("\x01\x02\x03\x04", 4, dword,
             phoenix::val(0x01020304)));
 

Modified: branches/release/libs/spirit/test/karma/test.hpp
==============================================================================
--- branches/release/libs/spirit/test/karma/test.hpp (original)
+++ branches/release/libs/spirit/test/karma/test.hpp 2010-01-07 11:23:39 EST (Thu, 07 Jan 2010)
@@ -10,8 +10,10 @@
 #include <string>
 #include <iterator>
 #include <iostream>
+#include <iomanip>
 #include <typeinfo>
 
+#include <boost/foreach.hpp>
 #include <boost/spirit/include/karma_generate.hpp>
 #include <boost/spirit/include/karma_what.hpp>
 
@@ -57,6 +59,23 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
+ template <typename Char, typename T>
+ void print_binary_if_failed(char const* func, bool result
+ , std::basic_string<Char> const& generated, T const& expected)
+ {
+ if (!result)
+ std::cerr << "in " << func << ": result is false" << std::endl;
+ else if (generated.size() != expected.size() ||
+ std::memcmp(generated.c_str(), expected.c_str(), generated.size()))
+ {
+ std::cerr << "in " << func << ": generated \"";
+ BOOST_FOREACH(int c, generated)
+ std::cerr << "\\x" << std::hex << std::setfill('0') << std::setw(2) << c;
+ std::cerr << "\"" << std::endl;
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
     template <typename Char, typename Generator>
     inline bool test(Char const *expected, Generator const& g)
     {
@@ -229,6 +248,8 @@
         std::back_insert_iterator<string_type> outit(generated);
         bool result = karma::generate(outit, g);
 
+ print_binary_if_failed("binary_test", result, generated
+ , std::string(expected, size));
         return result && !std::memcmp(generated.c_str(), expected, size);
     }
 
@@ -249,6 +270,8 @@
         std::back_insert_iterator<string_type> outit(generated);
         bool result = karma::generate(outit, g, attrib);
 
+ print_binary_if_failed("binary_test", result, generated
+ , std::string(expected, size));
         return result && !std::memcmp(generated.c_str(), expected, size);
     }
 
@@ -269,6 +292,8 @@
         std::back_insert_iterator<string_type> outit(generated);
         bool result = karma::generate_delimited(outit, g, d);
 
+ print_binary_if_failed("binary_test_delimited", result, generated
+ , std::string(expected, size));
         return result && !std::memcmp(generated.c_str(), expected, size);
     }
 
@@ -289,6 +314,8 @@
         std::back_insert_iterator<string_type> outit(generated);
         bool result = karma::generate_delimited(outit, g, d, attrib);
 
+ print_binary_if_failed("binary_test_delimited", result, generated
+ , std::string(expected, size));
         return result && !std::memcmp(generated.c_str(), expected, size);
     }
 

Modified: branches/release/libs/spirit/test/qi/match_manip.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/match_manip.cpp (original)
+++ branches/release/libs/spirit/test/qi/match_manip.cpp 2010-01-07 11:23:39 EST (Thu, 07 Jan 2010)
@@ -35,6 +35,7 @@
     BOOST_SPIRIT_ASSERT_MATCH(spirit::qi::domain, Expr);
 
     std::istringstream istrm(toparse);
+ istrm.unsetf(std::ios::skipws);
     istrm >> spirit::qi::compile<spirit::qi::domain>(expr);
     return istrm.good() || istrm.eof();
 }
@@ -46,6 +47,7 @@
         Expr, CopyExpr, CopyAttr, Skipper, Attribute> const& mm)
 {
     std::istringstream istrm(toparse);
+ istrm.unsetf(std::ios::skipws);
     istrm >> mm;
     return istrm.good() || istrm.eof();
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk