Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59011 - 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/karma/numeric boost/spirit/home/karma/numeric/detail boost/spirit/home/karma/stream/detail boost/spirit/home/qi/binary boost/spirit/home/qi/directive boost/spirit/home/qi/stream/detail boost/spirit/home/support 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/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-14 18:52:49


Author: hkaiser
Date: 2010-01-14 18:52:48 EST (Thu, 14 Jan 2010)
New Revision: 59011
URL: http://svn.boost.org/trac/boost/changeset/59011

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/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/karma/numeric/detail/numeric_utils.hpp | 23 +++++++++++++++
   branches/release/boost/spirit/home/karma/numeric/uint.hpp | 6 ++--
   branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp | 12 ++++----
   branches/release/boost/spirit/home/qi/binary/binary.hpp | 2
   branches/release/boost/spirit/home/qi/directive/matches.hpp | 2
   branches/release/boost/spirit/home/qi/stream/detail/match_manip.hpp | 12 ++++----
   branches/release/libs/spirit/test/karma/binary.cpp | 58 ++++++++++++++++++++++++++-------------
   branches/release/libs/spirit/test/karma/int_numerics.cpp | 4 ++
   branches/release/libs/spirit/test/qi/matches.cpp | 4 +-
   9 files changed, 84 insertions(+), 39 deletions(-)

Modified: branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp 2010-01-14 18:52:48 EST (Thu, 14 Jan 2010)
@@ -548,6 +548,29 @@
 
     ///////////////////////////////////////////////////////////////////////////
     //
+ // The uint_inserter template takes care of the conversion of any integer
+ // to a string, while interpreting the number as an unsigned type.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <
+ unsigned Radix, typename CharEncoding = unused_type
+ , typename Tag = unused_type>
+ struct uint_inserter : int_inserter<Radix, CharEncoding, Tag>
+ {
+ typedef int_inserter<Radix, CharEncoding, Tag> base_type;
+
+ // Common code for integer string representations
+ template <typename OutputIterator, typename T>
+ static bool
+ call(OutputIterator& sink, T const& n)
+ {
+ typename detail::absolute_value_helper<T>::result_type un = n;
+ return base_type::call(sink, un, un, 0);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
     // The sign_inserter template generates a sign for a given numeric value.
     //
     // The parameter forcesign allows to generate a sign even for positive

Modified: branches/release/boost/spirit/home/karma/numeric/uint.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/uint.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/uint.hpp 2010-01-14 18:52:48 EST (Thu, 14 Jan 2010)
@@ -249,7 +249,7 @@
             if (!traits::has_optional_value(attr))
                 return false; // fail if it's an uninitialized optional
 
- return int_inserter<Radix, CharEncoding, Tag>::
+ return uint_inserter<Radix, CharEncoding, Tag>::
                         call(sink, traits::extract_from(attr, context)) &&
                    delimit_out(sink, d); // always do post-delimiting
         }
@@ -315,7 +315,7 @@
             {
                 return false;
             }
- return int_inserter<Radix, CharEncoding, Tag>::call(sink, n_) &&
+ return uint_inserter<Radix, CharEncoding, Tag>::call(sink, n_) &&
                    delimit_out(sink, d); // always do post-delimiting
         }
 
@@ -325,7 +325,7 @@
         bool generate(OutputIterator& sink, Context&, Delimiter const& d
           , unused_type) const
         {
- return int_inserter<Radix, CharEncoding, Tag>::call(sink, n_) &&
+ return uint_inserter<Radix, CharEncoding, Tag>::call(sink, n_) &&
                    delimit_out(sink, d); // always do post-delimiting
         }
 

Modified: branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp (original)
+++ branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp 2010-01-14 18:52:48 EST (Thu, 14 Jan 2010)
@@ -25,6 +25,12 @@
       , typename Delimiter = unused_type, typename Attribute = unused_type>
     struct format_manip
     {
+ // This assertion makes sure we don't hit the only code path which is
+ // not implemented (because it isn't needed), where both, the
+ // expression and the attribute need to be held as a copy.
+ BOOST_SPIRIT_ASSERT_MSG(!CopyExpr::value || !CopyAttr::value
+ , error_invalid_should_not_happen, ());
+
         format_manip(Expr const& xpr, Delimiter const& d, Attribute const& a)
           : expr(xpr), delim(d), pre(delimit_flag::dont_predelimit), attr(a) {}
 
@@ -82,12 +88,6 @@
         format_manip& operator= (format_manip const&);
     };
 
- template <typename Expr, typename Delimiter, typename Attribute>
- struct format_manip<Expr, mpl::true_, mpl::true_, Delimiter, Attribute>
- {
- BOOST_SPIRIT_ASSERT_MSG(false, error_invalid_should_not_happen, ());
- };
-
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, typename Enable = void>
     struct format

Modified: branches/release/boost/spirit/home/qi/binary/binary.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/binary/binary.hpp (original)
+++ branches/release/boost/spirit/home/qi/binary/binary.hpp 2010-01-14 18:52:48 EST (Thu, 14 Jan 2010)
@@ -250,7 +250,7 @@
             Iterator it = first;
             for (unsigned int i = 0; i < sizeof(attr_); ++i)
             {
- if (it == last || *bytes++ != *it++)
+ if (it == last || *bytes++ != static_cast<unsigned char>(*it++))
                     return false;
             }
 

Modified: branches/release/boost/spirit/home/qi/directive/matches.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/directive/matches.hpp (original)
+++ branches/release/boost/spirit/home/qi/directive/matches.hpp 2010-01-14 18:52:48 EST (Thu, 14 Jan 2010)
@@ -57,7 +57,7 @@
         {
             bool result = subject.parse(first, last, context, skipper, unused);
             spirit::traits::assign_to(result, attr);
- return result;
+ return true;
         }
 
         template <typename Context>

Modified: branches/release/boost/spirit/home/qi/stream/detail/match_manip.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/stream/detail/match_manip.hpp (original)
+++ branches/release/boost/spirit/home/qi/stream/detail/match_manip.hpp 2010-01-14 18:52:48 EST (Thu, 14 Jan 2010)
@@ -28,6 +28,12 @@
       , typename Skipper = unused_type, typename Attribute = unused_type const>
     struct match_manip
     {
+ // This assertion makes sure we don't hit the only code path which is
+ // not implemented (because it isn't needed), where both, the
+ // expression and the attribute need to be held as a copy.
+ BOOST_SPIRIT_ASSERT_MSG(!CopyExpr::value || !CopyAttr::value
+ , error_invalid_should_not_happen, ());
+
         match_manip(Expr const& xpr, Skipper const& s, Attribute& a)
           : expr(xpr), skipper(s), attr(a), post_skip(skip_flag::postskip) {}
 
@@ -85,12 +91,6 @@
         match_manip& operator= (match_manip const&);
     };
 
- template <typename Expr, typename Skipper, typename Attribute>
- struct match_manip<Expr, mpl::true_, mpl::true_, Skipper, Attribute>
- {
- BOOST_SPIRIT_ASSERT_MSG(false, error_invalid_should_not_happen, ());
- };
-
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, typename Enable = void>
     struct match

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-14 18:52:48 EST (Thu, 14 Jan 2010)
@@ -28,11 +28,16 @@
     { // test native endian binaries
 #ifdef BOOST_LITTLE_ENDIAN
         BOOST_TEST(binary_test("\x01", 1, byte_, 0x01));
- BOOST_TEST(binary_test("\x01\x02", 2, word, 0x0201));
- BOOST_TEST(binary_test("\x01\x02\x03\x04", 4, dword, 0x04030201));
-#ifdef BOOST_HAS_LONG_LONG
- BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x08", 8, qword,
- 0x0807060504030201LL));
+ BOOST_TEST(binary_test("\x80", 1, byte_, 0x80));
+ BOOST_TEST(binary_test("\x01\x82", 2, word, 0x8201));
+ BOOST_TEST(binary_test("\x81\x02", 2, word, 0x0281));
+ BOOST_TEST(binary_test("\x01\x02\x03\x84", 4, dword, 0x84030201));
+ BOOST_TEST(binary_test("\x81\x02\x03\x04", 4, dword, 0x04030281));
+#ifdef BOOST_HAS_LONG_LONG
+ BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x88", 8, qword,
+ 0x8807060504030201LL));
+ BOOST_TEST(binary_test("\x81\x02\x03\x04\x05\x06\x07\x08", 8, qword,
+ 0x0807060504030281LL));
 #endif
 
         BOOST_TEST(binary_test_delimited("\x01\x00\x00\x00", 4, byte_, 0x01, pad(4)));
@@ -46,11 +51,16 @@
 #else // BOOST_LITTLE_ENDIAN
 
         BOOST_TEST(binary_test("\x01", 1, byte_, 0x01));
- BOOST_TEST(binary_test("\x01\x02", 2, word, 0x0102));
- BOOST_TEST(binary_test("\x01\x02\x03\x04", 4, dword, 0x01020304));
-#ifdef BOOST_HAS_LONG_LONG
- BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x08", 8, qword,
- 0x0102030405060708LL));
+ BOOST_TEST(binary_test("\x80", 1, byte_, 0x80));
+ BOOST_TEST(binary_test("\x01\x82", 2, word, 0x0182));
+ BOOST_TEST(binary_test("\x81\x02", 2, word, 0x8102));
+ BOOST_TEST(binary_test("\x01\x02\x03\x84", 4, dword, 0x01020384));
+ BOOST_TEST(binary_test("\x81\x02\x03\x04", 4, dword, 0x81020304));
+#ifdef BOOST_HAS_LONG_LONG
+ BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x88", 8, qword,
+ 0x0102030405060788LL));
+ BOOST_TEST(binary_test("\x81\x02\x03\x04\x05\x06\x07\x08", 8, qword,
+ 0x8102030405060708LL));
 #endif
 
         BOOST_TEST(binary_test_delimited("\x01\x00\x00\x00", 4, byte_, 0x01, pad(4)));
@@ -84,11 +94,15 @@
     }
 
     { // test big endian binaries
- BOOST_TEST(binary_test("\x01\x02", 2, big_word, 0x0102));
- BOOST_TEST(binary_test("\x01\x02\x03\x04", 4, big_dword, 0x01020304));
-#ifdef BOOST_HAS_LONG_LONG
- BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x08", 8, big_qword,
- 0x0102030405060708LL));
+ BOOST_TEST(binary_test("\x01\x82", 2, big_word, 0x0182));
+ BOOST_TEST(binary_test("\x81\x02", 2, big_word, 0x8102));
+ BOOST_TEST(binary_test("\x01\x02\x03\x84", 4, big_dword, 0x01020384));
+ BOOST_TEST(binary_test("\x81\x02\x03\x04", 4, big_dword, 0x81020304));
+#ifdef BOOST_HAS_LONG_LONG
+ BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x88", 8, big_qword,
+ 0x0102030405060788LL));
+ BOOST_TEST(binary_test("\x81\x02\x03\x04\x05\x06\x07\x08", 8, big_qword,
+ 0x8102030405060708LL));
         BOOST_TEST(binary_test_delimited("\x01\x02\x03\x04\x05\x06\x07\x08\x00\x00",
             10, big_qword, 0x0102030405060708LL, pad(10)));
 #endif
@@ -106,11 +120,15 @@
     }
 
     { // test little endian binaries
- BOOST_TEST(binary_test("\x01\x02", 2, little_word, 0x0201));
- BOOST_TEST(binary_test("\x01\x02\x03\x04", 4, little_dword, 0x04030201));
-#ifdef BOOST_HAS_LONG_LONG
- BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x08", 8, little_qword,
- 0x0807060504030201LL));
+ BOOST_TEST(binary_test("\x01\x82", 2, little_word, 0x8201));
+ BOOST_TEST(binary_test("\x81\x02", 2, little_word, 0x0281));
+ BOOST_TEST(binary_test("\x01\x02\x03\x84", 4, little_dword, 0x84030201));
+ BOOST_TEST(binary_test("\x81\x02\x03\x04", 4, little_dword, 0x04030281));
+#ifdef BOOST_HAS_LONG_LONG
+ BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x88", 8, little_qword,
+ 0x8807060504030201LL));
+ BOOST_TEST(binary_test("\x81\x02\x03\x04\x05\x06\x07\x08", 8, little_qword,
+ 0x0807060504030281LL));
         BOOST_TEST(binary_test_delimited("\x01\x02\x03\x04\x05\x06\x07\x08\x00\x00",
             10, little_qword, 0x0807060504030201LL, pad(10)));
 #endif

Modified: branches/release/libs/spirit/test/karma/int_numerics.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/int_numerics.cpp (original)
+++ branches/release/libs/spirit/test/karma/int_numerics.cpp 2010-01-14 18:52:48 EST (Thu, 14 Jan 2010)
@@ -287,6 +287,10 @@
         BOOST_TEST(test_delimited("1234 ", oct, 01234, char_(' ')));
         BOOST_TEST(test_delimited("11110000 ", bin, 0xf0, char_(' ')));
 
+ // test unsigned generator with signed integral value
+ BOOST_TEST(test("ff", hex, (char)0xff));
+ BOOST_TEST(test_delimited("ff ", hex, (char)0xff, char_(' ')));
+
         BOOST_TEST(test("1234", lower[uint_], 1234));
         BOOST_TEST(test("ff", lower[hex], 0xff));
         BOOST_TEST(test("1234", lower[oct], 01234));

Modified: branches/release/libs/spirit/test/qi/matches.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/matches.cpp (original)
+++ branches/release/libs/spirit/test/qi/matches.cpp 2010-01-14 18:52:48 EST (Thu, 14 Jan 2010)
@@ -31,9 +31,9 @@
         BOOST_TEST(!test("y", matches[char_('x')]));
         BOOST_TEST(!test("y", matches['x']));
         bool result = true;
- BOOST_TEST(!test_attr("y", matches[char_('x')], result) && !result);
+ BOOST_TEST(test_attr("y", matches[char_('x')], result, false) && !result);
         result = true;
- BOOST_TEST(!test_attr("y", matches['x'], result) && !result);
+ BOOST_TEST(test_attr("y", matches['x'], result, false) && !result);
     }
 
     return boost::report_errors();


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