|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66030 - in trunk: boost/archive/impl boost/serialization libs/serialization/performance/xml libs/serialization/src
From: admin_at_[hidden]
Date: 2010-10-16 17:33:25
Author: wash
Date: 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
New Revision: 66030
URL: http://svn.boost.org/trac/boost/changeset/66030
Log:
Rewrite of the Boost.Serialization XML grammar using Spirit.Qi.
Added:
trunk/libs/serialization/performance/xml/
trunk/libs/serialization/performance/xml/Jamfile.v2 (contents, props changed)
trunk/libs/serialization/performance/xml/harness.hpp (contents, props changed)
trunk/libs/serialization/performance/xml/high_resolution_timer.hpp (contents, props changed)
trunk/libs/serialization/performance/xml/int16_results.xml (contents, props changed)
trunk/libs/serialization/performance/xml/int16_test.cpp (contents, props changed)
trunk/libs/serialization/performance/xml/int256_results.xml (contents, props changed)
trunk/libs/serialization/performance/xml/int256_test.cpp (contents, props changed)
trunk/libs/serialization/performance/xml/int4_results.xml (contents, props changed)
trunk/libs/serialization/performance/xml/int4_test.cpp (contents, props changed)
trunk/libs/serialization/performance/xml/int64_results.xml (contents, props changed)
trunk/libs/serialization/performance/xml/int64_test.cpp (contents, props changed)
trunk/libs/serialization/performance/xml/macro.hpp (contents, props changed)
trunk/libs/serialization/performance/xml/node.hpp (contents, props changed)
trunk/libs/serialization/performance/xml/string16_results.xml (contents, props changed)
trunk/libs/serialization/performance/xml/string16_test.cpp (contents, props changed)
trunk/libs/serialization/performance/xml/string256_results.xml (contents, props changed)
trunk/libs/serialization/performance/xml/string256_test.cpp (contents, props changed)
trunk/libs/serialization/performance/xml/string4_results.xml (contents, props changed)
trunk/libs/serialization/performance/xml/string4_test.cpp (contents, props changed)
trunk/libs/serialization/performance/xml/string64_results.xml (contents, props changed)
trunk/libs/serialization/performance/xml/string64_test.cpp (contents, props changed)
Text files modified:
trunk/boost/archive/impl/basic_xml_grammar.hpp | 50 +--
trunk/boost/archive/impl/xml_iarchive_impl.ipp | 2
trunk/boost/serialization/item_version_type.hpp | 3
trunk/libs/serialization/src/basic_xml_grammar.ipp | 476 +++++++++++++--------------------------
trunk/libs/serialization/src/xml_grammar.cpp | 34 ++
trunk/libs/serialization/src/xml_wgrammar.cpp | 52 ++-
6 files changed, 247 insertions(+), 370 deletions(-)
Modified: trunk/boost/archive/impl/basic_xml_grammar.hpp
==============================================================================
--- trunk/boost/archive/impl/basic_xml_grammar.hpp (original)
+++ trunk/boost/archive/impl/basic_xml_grammar.hpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -9,6 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_xml_grammar.hpp
+// (C) Copyright 2010 Bryce Lelbach
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -55,8 +56,6 @@
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
-//#define BOOST_SPIRIT_DEBUG
-#include <boost/spirit/core/non_terminal/rule.hpp>
// the following hack is to evade a bogus error generated by using the
// word "arg" when bind.hpp has been included
@@ -64,18 +63,22 @@
#define arg xarg
#endif
-// spirit stuff
-#if (defined __BORLANDC__) && (__BORLANDC__ < 0x593) \
+/*#if (defined __BORLANDC__) && (__BORLANDC__ < 0x593) \
|| (defined _MSC_VER) && (_MSC_VER <= 1300)
#include <boost/spirit/utility/chset.hpp>
#else
#include <boost/spirit/include/classic_chset.hpp>
-#endif
+#endif */
+
+// spirit stuff
+#include <boost/spirit/include/qi_nonterminal.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
#undef arg
#endif
+#include <boost/integer.hpp>
+
#include <boost/archive/basic_archive.hpp>
#include <boost/serialization/tracking.hpp>
#include <boost/serialization/version.hpp>
@@ -97,37 +100,30 @@
private:
typedef BOOST_DEDUCED_TYPENAME std::basic_istream<CharType> IStream;
typedef BOOST_DEDUCED_TYPENAME std::basic_string<CharType> StringType;
- typedef BOOST_DEDUCED_TYPENAME boost::spirit::chset<CharType> chset_t;
- typedef BOOST_DEDUCED_TYPENAME boost::spirit::chlit<CharType> chlit_t;
- typedef BOOST_DEDUCED_TYPENAME boost::spirit::scanner<
- BOOST_DEDUCED_TYPENAME std::basic_string<CharType>::iterator
- > scanner_t;
- typedef BOOST_DEDUCED_TYPENAME boost::spirit::rule<scanner_t> rule_t;
- // Start grammar definition
+ typedef BOOST_DEDUCED_TYPENAME std::basic_string<CharType>::iterator Iterator;
+ typedef BOOST_DEDUCED_TYPENAME boost::spirit::qi::rule<Iterator> rule_t;
+
rule_t
Reference,
Eq,
STag,
ETag,
+ Name,
+ CharData,
LetterOrUnderscoreOrColon,
AttValue,
- CharRef1,
- CharRef2,
CharRef,
AmpRef,
LTRef,
GTRef,
AposRef,
QuoteRef,
- CharData,
- CharDataChars,
content,
AmpName,
LTName,
GTName,
ClassNameChar,
ClassName,
- Name,
XMLDecl,
XMLDeclChars,
DocTypeDecl,
@@ -141,22 +137,21 @@
Attribute,
SignatureAttribute,
SerializationWrapper,
- NameHead,
- NameTail,
AttributeList,
S;
- // XML Character classes
- chset_t
+ BOOST_DEDUCED_TYPENAME boost::spirit::qi::rule<Iterator, CharType()>
BaseChar,
Ideographic,
Char,
Letter,
Digit,
+ HexDigit,
CombiningChar,
Extender,
Sch,
- NameChar;
+ NameChar,
+ AnyChar;
void init_chset();
@@ -169,12 +164,9 @@
struct return_values {
StringType object_name;
StringType contents;
- //class_id_type class_id;
- int_least16_t class_id;
- //object_id_type object_id;
- uint_least32_t object_id;
- //version_type version;
- unsigned int version;
+ BOOST_DEDUCED_TYPENAME boost::int_t<16>::least class_id;
+ BOOST_DEDUCED_TYPENAME boost::uint_t<32>::least object_id;
+ BOOST_DEDUCED_TYPENAME boost::uint_t<32>::least version;
tracking_type tracking_level;
StringType class_name;
return_values() :
@@ -183,7 +175,7 @@
{}
} rv;
bool parse_start_tag(IStream & is) /*const*/;
- bool parse_end_tag(IStream & is) const;
+ bool parse_end_tag(IStream & is) /*const*/;
bool parse_string(IStream & is, StringType & s) /*const*/;
void init(IStream & is);
void windup(IStream & is);
Modified: trunk/boost/archive/impl/xml_iarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/xml_iarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/xml_iarchive_impl.ipp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -178,7 +178,7 @@
BOOST_TRY{
init();
}
- BOOST_CATCH(...){
+ BOOST_CATCH(...){
delete gimpl;
#ifndef BOOST_NO_EXCEPTIONS
throw; // re-throw
Modified: trunk/boost/serialization/item_version_type.hpp
==============================================================================
--- trunk/boost/serialization/item_version_type.hpp (original)
+++ trunk/boost/serialization/item_version_type.hpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -11,6 +11,9 @@
#include <boost/serialization/level.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
+// fixes broken example build on x86_64-linux-gnu-gcc-4.6.0
+#include <cassert>
+
namespace boost {
namespace serialization {
Added: trunk/libs/serialization/performance/xml/Jamfile.v2
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/Jamfile.v2 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,35 @@
+################################################################################
+#
+# (C) Copyright 2010 Bryce Lelbach
+#
+# Use, modification and distribution is 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)
+#
+################################################################################
+
+project bsl-xml-benchmark ;
+
+exe int4_test : int4_test.cpp
+ : <toolset>gcc:<linkflags>"-lrt -lboost_serialization" ;
+
+exe int16_test : int16_test.cpp
+ : <toolset>gcc:<linkflags>"-lrt -lboost_serialization" ;
+
+exe int64_test : int64_test.cpp
+ : <toolset>gcc:<linkflags>"-lrt -lboost_serialization" ;
+
+exe int256_test : int256_test.cpp
+ : <toolset>gcc:<linkflags>"-lrt -lboost_serialization" ;
+
+exe string4_test : string4_test.cpp
+ : <toolset>gcc:<linkflags>"-lrt -lboost_serialization" ;
+
+exe string16_test : string16_test.cpp
+ : <toolset>gcc:<linkflags>"-lrt -lboost_serialization" ;
+
+exe string64_test : string64_test.cpp
+ : <toolset>gcc:<linkflags>"-lrt -lboost_serialization" ;
+
+exe string256_test : string256_test.cpp
+ : <toolset>gcc:<linkflags>"-lrt -lboost_serialization" ;
Added: trunk/libs/serialization/performance/xml/harness.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/harness.hpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,188 @@
+/* /libs/serialization/xml_performance/harness.hpp *****************************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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)
+
+*******************************************************************************/
+
+#if !defined(BOOST_SERIALIZATION_XML_PERFORMANCE_HARNESS_HPP)
+#define BOOST_SERIALIZATION_XML_PERFORMANCE_HARNESS_HPP
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+ # pragma once
+#endif
+
+#include <cassert>
+#include <cstdio>
+
+#include <string>
+#include <fstream>
+#include <iostream>
+#include <utility>
+
+#include <boost/config.hpp>
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+ namespace std {
+ using ::remove;
+ }
+#endif
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_io.hpp>
+#include <boost/uuid/random_generator.hpp>
+
+#include <boost/functional/hash.hpp>
+
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/type_traits/is_integral.hpp>
+
+#include <boost/archive/xml_iarchive.hpp>
+#include <boost/archive/xml_oarchive.hpp>
+
+#include <boost/archive/archive_exception.hpp>
+
+#include "high_resolution_timer.hpp" // from /libs/spirit/optimization
+
+#include "node.hpp" // includes macro.hpp
+
+namespace boost {
+namespace archive {
+namespace xml {
+
+template<typename T> T random (void);
+
+template<typename T> T
+random (void) {
+ using namespace boost::uuids;
+
+ hash<uuid> hash;
+ basic_random_generator<mt19937> gen;
+
+ return hash(gen());
+}
+
+template<> std::string
+random<std::string> (void) {
+ using namespace boost::uuids;
+
+ basic_random_generator<mt19937> gen;
+ uuid u = gen();
+
+ return to_string(u);
+}
+
+template<typename T> std::string
+save_archive (T const& s) {
+ std::string fn = random<std::string>() +
+ "-" BOOST_PP_STRINGIZE(BSL_TYPE)
+ BOOST_PP_STRINGIZE(BSL_EXP(BSL_NODE_MAX, BSL_DEPTH))
+ ".xml"
+ ;
+
+ std::ofstream ofs(fn.c_str());
+
+ assert(ofs.good());
+
+ xml_oarchive oa(ofs);
+ oa << BOOST_SERIALIZATION_NVP(s);
+
+ ofs.close();
+ return fn;
+}
+
+template<typename T> std::pair<double, T>
+restore_archive (std::string fn) {
+ std::ifstream ifs(fn.c_str());
+ T s;
+
+ assert(ifs.good());
+
+ high_resolution_timer u;
+
+ xml_iarchive ia(ifs);
+ ia >> BOOST_SERIALIZATION_NVP(s);
+
+ ifs.close();
+ return std::pair<double, T>(u.elapsed(), s);
+}
+
+class result_set_exception: public virtual archive_exception {
+ public:
+ enum exception_code {
+ invalid_archive_metadata
+ };
+
+ result_set_exception (exception_code c = invalid_archive_metadata){ }
+
+ virtual const char* what() const throw() {
+ const char *msg = "";
+
+ switch (code) {
+ case invalid_archive_metadata:
+ msg = "result set was not created on this system";
+ default:
+ archive_exception::what();
+ }
+
+ return msg;
+ }
+};
+
+struct entry {
+ std::string type;
+ std::size_t size;
+ double data;
+
+ template<class ARC>
+ void serialize (ARC& ar, const unsigned int) {
+ ar & BOOST_SERIALIZATION_NVP(type)
+ & BOOST_SERIALIZATION_NVP(size)
+ & BOOST_SERIALIZATION_NVP(data)
+ ;
+ }
+
+ entry (void) { }
+
+ entry (std::string type, std::size_t size, double data):
+ type(type), size(size), data(data) { }
+};
+
+struct result_set {
+ std::string compiler;
+ std::string platform;
+ std::list<entry> entries;
+
+ template<class ARC>
+ void serialize (ARC& ar, const unsigned int) {
+ ar & BOOST_SERIALIZATION_NVP(compiler)
+ & BOOST_SERIALIZATION_NVP(platform)
+ & BOOST_SERIALIZATION_NVP(entries)
+ ;
+
+ if ( (compiler != BOOST_COMPILER)
+ || (platform != BOOST_PLATFORM))
+ throw result_set_exception();
+ }
+
+ result_set (void):
+ compiler(BOOST_COMPILER),
+ platform(BOOST_PLATFORM) { }
+
+ result_set (std::list<entry> entries):
+ compiler(BOOST_COMPILER),
+ platform(BOOST_PLATFORM),
+ entries(entries) { }
+};
+
+} // xml
+} // archive
+} // boost
+
+#endif // BOOST_SERIALIZATION_XML_PERFORMANCE_HARNESS_HPP
+
Added: trunk/libs/serialization/performance/xml/high_resolution_timer.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/high_resolution_timer.hpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,489 @@
+// Copyright (c) 2005-2010 Hartmut Kaiser
+// Copyright (c) 2009 Edward Grace
+//
+// 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(HIGH_RESOLUTION_TIMER_MAR_24_2008_1222PM)
+#define HIGH_RESOLUTION_TIMER_MAR_24_2008_1222PM
+
+#include <boost/config.hpp>
+#include <boost/throw_exception.hpp>
+
+#if defined(BOOST_HAS_UNISTD_H)
+#include <unistd.h>
+#endif
+#include <time.h>
+#include <stdexcept>
+#include <limits>
+
+#if defined(BOOST_WINDOWS)
+
+#include <windows.h>
+
+namespace boost {
+namespace archive {
+namespace xml {
+ ///////////////////////////////////////////////////////////////////////////////
+ //
+ // high_resolution_timer
+ // A timer object measures elapsed time.
+ // CAUTION: Windows only!
+ //
+ ///////////////////////////////////////////////////////////////////////////////
+ class high_resolution_timer
+ {
+ public:
+ high_resolution_timer()
+ {
+ restart();
+ }
+
+ high_resolution_timer(double t)
+ {
+ LARGE_INTEGER frequency;
+ if (!QueryPerformanceFrequency(&frequency))
+ boost::throw_exception(std::runtime_error("Couldn't acquire frequency"));
+
+ start_time.QuadPart = (LONGLONG)(t * frequency.QuadPart);
+ }
+
+ high_resolution_timer(high_resolution_timer const& rhs)
+ : start_time(rhs.start_time)
+ {
+ }
+
+ static double now()
+ {
+ SYSTEMTIME st;
+ GetSystemTime(&st);
+
+ FILETIME ft;
+ SystemTimeToFileTime(&st, &ft);
+
+ LARGE_INTEGER now;
+ now.LowPart = ft.dwLowDateTime;
+ now.HighPart = ft.dwHighDateTime;
+
+ // FileTime is in 100ns increments, result needs to be in [s]
+ return now.QuadPart * 1e-7;
+ }
+
+ void restart()
+ {
+ if (!QueryPerformanceCounter(&start_time))
+ boost::throw_exception(std::runtime_error("Couldn't initialize start_time"));
+ }
+ double elapsed() const // return elapsed time in seconds
+ {
+ LARGE_INTEGER now;
+ if (!QueryPerformanceCounter(&now))
+ boost::throw_exception(std::runtime_error("Couldn't get current time"));
+
+ LARGE_INTEGER frequency;
+ if (!QueryPerformanceFrequency(&frequency))
+ boost::throw_exception(std::runtime_error("Couldn't acquire frequency"));
+
+ return double(now.QuadPart - start_time.QuadPart) / frequency.QuadPart;
+ }
+
+ double elapsed_max() const // return estimated maximum value for elapsed()
+ {
+ LARGE_INTEGER frequency;
+ if (!QueryPerformanceFrequency(&frequency))
+ boost::throw_exception(std::runtime_error("Couldn't acquire frequency"));
+
+ return double((std::numeric_limits<LONGLONG>::max)() - start_time.QuadPart) /
+ double(frequency.QuadPart);
+ }
+
+ double elapsed_min() const // return minimum value for elapsed()
+ {
+ LARGE_INTEGER frequency;
+ if (!QueryPerformanceFrequency(&frequency))
+ boost::throw_exception(std::runtime_error("Couldn't acquire frequency"));
+
+ return 1.0 / frequency.QuadPart;
+ }
+
+ private:
+ LARGE_INTEGER start_time;
+ };
+
+} // xml
+} // archive
+} // boost
+
+#elif defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(_POSIX_THREAD_CPUTIME)
+
+#if _POSIX_THREAD_CPUTIME > 0 // timer always supported
+
+namespace boost {
+namespace archive {
+namespace xml {
+
+ ///////////////////////////////////////////////////////////////////////////////
+ //
+ // high_resolution_timer
+ // A timer object measures elapsed time.
+ //
+ ///////////////////////////////////////////////////////////////////////////////
+ class high_resolution_timer
+ {
+ public:
+ high_resolution_timer()
+ {
+ start_time.tv_sec = 0;
+ start_time.tv_nsec = 0;
+
+ restart();
+ }
+
+ high_resolution_timer(double t)
+ {
+ start_time.tv_sec = time_t(t);
+ start_time.tv_nsec = (t - start_time.tv_sec) * 1e9;
+ }
+
+ high_resolution_timer(high_resolution_timer const& rhs)
+ : start_time(rhs.start_time)
+ {
+ }
+
+ static double now()
+ {
+ timespec now;
+ if (-1 == clock_gettime(CLOCK_REALTIME, &now))
+ boost::throw_exception(std::runtime_error("Couldn't get current time"));
+ return double(now.tv_sec) + double(now.tv_nsec) * 1e-9;
+ }
+
+ void restart()
+ {
+ if (-1 == clock_gettime(CLOCK_REALTIME, &start_time))
+ boost::throw_exception(std::runtime_error("Couldn't initialize start_time"));
+ }
+ double elapsed() const // return elapsed time in seconds
+ {
+ timespec now;
+ if (-1 == clock_gettime(CLOCK_REALTIME, &now))
+ boost::throw_exception(std::runtime_error("Couldn't get current time"));
+
+ if (now.tv_sec == start_time.tv_sec)
+ return double(now.tv_nsec - start_time.tv_nsec) * 1e-9;
+
+ return double(now.tv_sec - start_time.tv_sec) +
+ (double(now.tv_nsec - start_time.tv_nsec) * 1e-9);
+ }
+
+ double elapsed_max() const // return estimated maximum value for elapsed()
+ {
+ return double((std::numeric_limits<time_t>::max)() - start_time.tv_sec);
+ }
+
+ double elapsed_min() const // return minimum value for elapsed()
+ {
+ timespec resolution;
+ if (-1 == clock_getres(CLOCK_REALTIME, &resolution))
+ boost::throw_exception(std::runtime_error("Couldn't get resolution"));
+ return double(resolution.tv_sec + resolution.tv_nsec * 1e-9);
+ }
+
+ private:
+ timespec start_time;
+ };
+
+} // xml
+} // archive
+} // boost
+
+#else // _POSIX_THREAD_CPUTIME > 0
+
+#include <boost/timer.hpp>
+
+// availability of high performance timers must be checked at runtime
+namespace boost {
+namespace archive {
+namespace xml {
+ ///////////////////////////////////////////////////////////////////////////////
+ //
+ // high_resolution_timer
+ // A timer object measures elapsed time.
+ //
+ ///////////////////////////////////////////////////////////////////////////////
+ class high_resolution_timer
+ {
+ public:
+ high_resolution_timer()
+ : use_backup(sysconf(_SC_THREAD_CPUTIME) <= 0)
+ {
+ if (!use_backup) {
+ start_time.tv_sec = 0;
+ start_time.tv_nsec = 0;
+ }
+ restart();
+ }
+
+ high_resolution_timer(double t)
+ : use_backup(sysconf(_SC_THREAD_CPUTIME) <= 0)
+ {
+ if (!use_backup) {
+ start_time.tv_sec = time_t(t);
+ start_time.tv_nsec = (t - start_time.tv_sec) * 1e9;
+ }
+ }
+
+ high_resolution_timer(high_resolution_timer const& rhs)
+ : use_backup(sysconf(_SC_THREAD_CPUTIME) <= 0),
+ start_time(rhs.start_time)
+ {
+ }
+
+ static double now()
+ {
+ if (sysconf(_SC_THREAD_CPUTIME) <= 0)
+ return double(std::clock());
+
+ timespec now;
+ if (-1 == clock_gettime(CLOCK_REALTIME, &now))
+ boost::throw_exception(std::runtime_error("Couldn't get current time"));
+ return double(now.tv_sec) + double(now.tv_nsec) * 1e-9;
+ }
+
+ void restart()
+ {
+ if (use_backup)
+ start_time_backup.restart();
+ else if (-1 == clock_gettime(CLOCK_REALTIME, &start_time))
+ boost::throw_exception(std::runtime_error("Couldn't initialize start_time"));
+ }
+ double elapsed() const // return elapsed time in seconds
+ {
+ if (use_backup)
+ return start_time_backup.elapsed();
+
+ timespec now;
+ if (-1 == clock_gettime(CLOCK_REALTIME, &now))
+ boost::throw_exception(std::runtime_error("Couldn't get current time"));
+
+ if (now.tv_sec == start_time.tv_sec)
+ return double(now.tv_nsec - start_time.tv_nsec) * 1e-9;
+
+ return double(now.tv_sec - start_time.tv_sec) +
+ (double(now.tv_nsec - start_time.tv_nsec) * 1e-9);
+ }
+
+ double elapsed_max() const // return estimated maximum value for elapsed()
+ {
+ if (use_backup)
+ start_time_backup.elapsed_max();
+
+ return double((std::numeric_limits<time_t>::max)() - start_time.tv_sec);
+ }
+
+ double elapsed_min() const // return minimum value for elapsed()
+ {
+ if (use_backup)
+ start_time_backup.elapsed_min();
+
+ timespec resolution;
+ if (-1 == clock_getres(CLOCK_REALTIME, &resolution))
+ boost::throw_exception(std::runtime_error("Couldn't get resolution"));
+ return double(resolution.tv_sec + resolution.tv_nsec * 1e-9);
+ }
+
+ private:
+ bool use_backup;
+ timespec start_time;
+ boost::timer start_time_backup;
+ };
+
+} // xml
+} // archive
+} // boost
+
+#endif // _POSIX_THREAD_CPUTIME > 0
+
+#else // !defined(BOOST_WINDOWS) && (!defined(_POSIX_TIMERS)
+ // || _POSIX_TIMERS <= 0
+ // || !defined(_POSIX_THREAD_CPUTIME)
+ // || _POSIX_THREAD_CPUTIME <= 0)
+
+#if defined(BOOST_HAS_GETTIMEOFDAY)
+
+// For platforms that do not support _POSIX_TIMERS but do have
+// GETTIMEOFDAY, which is still preferable to std::clock()
+#include <sys/time.h>
+
+namespace boost {
+namespace archive {
+namespace xml {
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // high_resolution_timer
+ // A timer object measures elapsed time.
+ //
+ // Implemented with gettimeofday() for platforms that support it,
+ // such as Darwin (OS X) but do not support the previous options.
+ //
+ // Copyright (c) 2009 Edward Grace
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ class high_resolution_timer
+ {
+ private:
+ template <typename U>
+ static inline double unsigned_diff(const U &a, const U &b)
+ {
+ if (a > b)
+ return static_cast<double>(a-b);
+ return -static_cast<double>(b-a);
+ }
+
+ // @brief Return the difference between two timeval types.
+ //
+ // @param t1 The most recent timeval.
+ // @param t0 The historical timeval.
+ //
+ // @return The difference between the two in seconds.
+ double elapsed(const timeval &t1, const timeval &t0) const
+ {
+ if (t1.tv_sec == t0.tv_sec)
+ return unsigned_diff(t1.tv_usec,t0.tv_usec) * 1e-6;
+
+ // We do it this way as the result of the difference of the
+ // microseconds can be negative if the clock is implemented so
+ // that the seconds timer increases in large steps.
+ //
+ // Naive subtraction of the unsigned types and conversion to
+ // double can wreak havoc!
+ return unsigned_diff(t1.tv_sec,t0.tv_sec) +
+ unsigned_diff(t1.tv_usec,t0.tv_usec) * 1e-6;
+ }
+
+ public:
+ high_resolution_timer()
+ {
+ start_time.tv_sec = 0;
+ start_time.tv_usec = 0;
+
+ restart();
+ }
+
+ high_resolution_timer(double t)
+ {
+ start_time.tv_sec = time_t(t);
+ start_time.tv_usec = (t - start_time.tv_sec) * 1e6;
+ }
+
+ high_resolution_timer(high_resolution_timer const& rhs)
+ : start_time(rhs.start_time)
+ {
+ }
+
+ static double now()
+ {
+ // Under some implementations gettimeofday() will always
+ // return zero. If it returns anything else however then
+ // we accept this as evidence of an error. Note we are
+ // not assuming that -1 explicitly indicates the error
+ // condition, just that non zero is indicative of the
+ // error.
+ timeval now;
+ if (gettimeofday(&now, NULL))
+ boost::throw_exception(std::runtime_error("Couldn't get current time"));
+ return double(now.tv_sec) + double(now.tv_usec) * 1e-6;
+ }
+
+ void restart()
+ {
+ if (gettimeofday(&start_time, NULL))
+ boost::throw_exception(std::runtime_error("Couldn't initialize start_time"));
+ }
+
+ double elapsed() const // return elapsed time in seconds
+ {
+ timeval now;
+ if (gettimeofday(&now, NULL))
+ boost::throw_exception(std::runtime_error("Couldn't get current time"));
+ return elapsed(now,start_time);
+ }
+
+ double elapsed_max() const // return estimated maximum value for elapsed()
+ {
+ return double((std::numeric_limits<time_t>::max)() - start_time.tv_sec);
+ }
+
+ double elapsed_min() const // return minimum value for elapsed()
+ {
+ // On systems without an explicit clock_getres or similar
+ // we can only estimate an upper bound on the resolution
+ // by repeatedly calling the gettimeofday function. This
+ // is often likely to be indicative of the true
+ // resolution.
+ timeval t0, t1;
+ double delta(0);
+
+ if (gettimeofday(&t0, NULL))
+ boost::throw_exception(std::runtime_error("Couldn't get resolution."));
+
+ // Spin around in a tight loop until we observe a change
+ // in the reported timer value.
+ do {
+ if (gettimeofday(&t1, NULL))
+ boost::throw_exception(std::runtime_error("Couldn't get resolution."));
+ delta = elapsed(t1, t0);
+ } while (delta <= 0.0);
+
+ return delta;
+ }
+
+ private:
+ timeval start_time;
+ };
+
+} // xml
+} // archive
+} // boost
+
+#else // BOOST_HAS_GETTIMEOFDAY
+
+// For platforms other than Windows or Linux, or not implementing gettimeofday
+// simply fall back to boost::timer
+#include <boost/timer.hpp>
+
+namespace boost {
+namespace archive {
+namespace xml {
+
+ struct high_resolution_timer
+ : boost::timer
+ {
+ static double now()
+ {
+ return double(std::clock());
+ }
+ };
+
+} // xml
+} // archive
+} // boost
+
+
+#endif
+
+#endif
+
+#endif // HIGH_RESOLUTION_TIMER_AUG_14_2009_0425PM
+
+//
+// $Log: high_resolution_timer.hpp,v $
+// Revision 1.4 2009/08/14 15:28:10 graceej
+// * It is entirely possible for the updating clock to increment the
+// * seconds and *decrement* the microseconds field. Consequently
+// * when subtracting these unsigned microseconds fields a wrap-around
+// * error can occur. For this reason elapsed(t1, t0) is used in a
+// * similar maner to cycle.h this preserves the sign of the
+// * difference.
+//
Added: trunk/libs/serialization/performance/xml/int16_results.xml
==============================================================================
Binary file. No diff available.
Added: trunk/libs/serialization/performance/xml/int16_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/int16_test.cpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,20 @@
+/* /libs/serialization/xml_performance/int25_test.cpp **************************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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)
+
+*******************************************************************************/
+
+#define BSL_TYPE int
+#define BSL_DEPTH 2
+#define BSL_ROUNDS 256
+#define BSL_NODE_MAX 4
+#define BSL_SAVE_TMPFILE 0
+
+#include "harness.hpp"
+
+BSL_MAIN
+
Added: trunk/libs/serialization/performance/xml/int256_results.xml
==============================================================================
Binary file. No diff available.
Added: trunk/libs/serialization/performance/xml/int256_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/int256_test.cpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,20 @@
+/* /libs/serialization/xml_performance/int25_test.cpp **************************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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)
+
+*******************************************************************************/
+
+#define BSL_TYPE int
+#define BSL_DEPTH 4
+#define BSL_ROUNDS 256
+#define BSL_NODE_MAX 4
+#define BSL_SAVE_TMPFILE 0
+
+#include "harness.hpp"
+
+BSL_MAIN
+
Added: trunk/libs/serialization/performance/xml/int4_results.xml
==============================================================================
Binary file. No diff available.
Added: trunk/libs/serialization/performance/xml/int4_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/int4_test.cpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,20 @@
+/* /libs/serialization/xml_performance/int5_test.cpp ***************************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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)
+
+*******************************************************************************/
+
+#define BSL_TYPE int
+#define BSL_DEPTH 1
+#define BSL_ROUNDS 256
+#define BSL_NODE_MAX 4
+#define BSL_SAVE_TMPFILE 0
+
+#include "harness.hpp"
+
+BSL_MAIN
+
Added: trunk/libs/serialization/performance/xml/int64_results.xml
==============================================================================
Binary file. No diff available.
Added: trunk/libs/serialization/performance/xml/int64_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/int64_test.cpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,20 @@
+/* /libs/serialization/xml_performance/int25_test.cpp **************************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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)
+
+*******************************************************************************/
+
+#define BSL_TYPE int
+#define BSL_DEPTH 3
+#define BSL_ROUNDS 256
+#define BSL_NODE_MAX 4
+#define BSL_SAVE_TMPFILE 0
+
+#include "harness.hpp"
+
+BSL_MAIN
+
Added: trunk/libs/serialization/performance/xml/macro.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/macro.hpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,229 @@
+/* /libs/serialization/xml_performance/macro.hpp *******************************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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)
+
+*******************************************************************************/
+
+#if !defined(BOOST_SERIALIZATION_XML_PERFORMANCE_MACRO_HPP)
+#define BOOST_SERIALIZATION_XML_PERFORMANCE_MACRO_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+ #pragma once
+#endif
+
+#include <boost/preprocessor.hpp>
+
+#if !defined(BSL_NODE_MAX)
+ #define BSL_NODE_MAX 4
+#endif
+
+#if !defined(BSL_DEPTH)
+ #define BSL_DEPTH 2
+#endif
+
+#if !defined(BSL_ROUNDS)
+ #define BSL_ROUNDS 256
+#endif
+
+#if !defined(BSL_TYPE)
+ #define BSL_TYPE int
+#endif
+
+#if !defined(BSL_SAVE_TMPFILE)
+ #define BSL_SAVE_TMPFILE 0
+#endif
+
+#if !defined(BSL_RESULTS_FILE)
+ #define BSL_RESULTS_FILE \
+ BOOST_PP_STRINGIZE(BSL_TYPE) \
+ BOOST_PP_STRINGIZE(BSL_EXP(BSL_NODE_MAX, BSL_DEPTH)) \
+ "_results.xml" \
+ /**/
+#endif
+
+// utility print macro
+
+#define BSL_PRINT(Z, N, T) T
+
+// preprocessor power function, BSL_EXP
+
+#define BSL_EXP_PRED(B, D) BOOST_PP_TUPLE_ELEM(3, 0, D)
+
+#define BSL_EXP_OP(B, D) \
+ ( \
+ BOOST_PP_DEC(BOOST_PP_TUPLE_ELEM(3, 0, D)), \
+ BOOST_PP_TUPLE_ELEM(3, 1, D), \
+ BOOST_PP_MUL_D( \
+ B, \
+ BOOST_PP_TUPLE_ELEM(3, 2, D), \
+ BOOST_PP_TUPLE_ELEM(3, 1, D) \
+ ) \
+ ) \
+ /**/
+
+#define BSL_EXP(X, N) \
+ BOOST_PP_TUPLE_ELEM( \
+ 3, 2, BOOST_PP_WHILE(BSL_EXP_PRED, BSL_EXP_OP, (N, X, 1)) \
+ ) \
+ /**/
+
+// boost::archive::xml::node macros
+
+#define BSL_NODE_DECL_MEMBER(Z, N, _) T ## N element ## N ;
+#define BSL_NODE_DECL_NONE(Z, N, _) unused_type element ## N ;
+#define BSL_NODE_xDECL_CTOR() node (void) { }
+
+#define BSL_NODE_DECL_CTOR(P) \
+ BOOST_PP_IF(P, \
+ BSL_NODE_xDECL_CTOR, \
+ BOOST_PP_EMPTY \
+ )() \
+ /**/
+
+#define BSL_NODE_SERIALIZE(Z, N, _) \
+ & BOOST_SERIALIZATION_NVP(BOOST_PP_CAT(element, N)) \
+ /**/
+
+#define BSL_NODE_INIT_LIST(Z, N, _) \
+ BOOST_PP_COMMA_IF(N) BOOST_PP_CAT(element, N) \
+ BOOST_PP_LPAREN() BOOST_PP_CAT(p, N) BOOST_PP_RPAREN() \
+ /**/
+
+#define BSL_NODE_DECL(Z, N, _) \
+ template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename T)> \
+ struct node< \
+ BOOST_PP_ENUM_PARAMS_Z(Z, N, T) \
+ BOOST_PP_COMMA_IF(N) \
+ BOOST_PP_ENUM_ ## Z(BOOST_PP_SUB(BSL_NODE_MAX, N), BSL_PRINT, unused_type) \
+ > { \
+ BOOST_PP_REPEAT_ ## Z(N, BSL_NODE_DECL_MEMBER, _) \
+ \
+ BOOST_PP_REPEAT_FROM_TO_ ## Z(N, BSL_NODE_MAX, BSL_NODE_DECL_NONE, _) \
+ \
+ template<class ARC> \
+ void serialize (ARC& ar, const unsigned int) { \
+ ar BOOST_PP_REPEAT_ ## Z(N, BSL_NODE_SERIALIZE, _); \
+ } \
+ \
+ BSL_NODE_DECL_CTOR(N) \
+ \
+ node (BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, T, p)): \
+ BOOST_PP_REPEAT_ ## Z(N, BSL_NODE_INIT_LIST, _) { } \
+ }; \
+ /**/
+
+// instantiation macros
+
+#define BSL_INST_BASE(Z, N, L) \
+ T0 T0 ## _ ## N(BOOST_PP_ENUM_ ## Z( \
+ BSL_NODE_MAX, BSL_PRINT, \
+ boost::archive::xml::random<BSL_TYPE> BOOST_PP_LPAREN() BOOST_PP_RPAREN() \
+ )); \
+ /**/
+
+#define BSL_INST_yNODES(Z, N, L) \
+ BOOST_PP_COMMA_IF(N) \
+ BOOST_PP_CAT(T, \
+ BOOST_PP_CAT(BOOST_PP_LIST_AT(L, 1), \
+ BOOST_PP_CAT(_, \
+ BOOST_PP_ADD(N, \
+ BOOST_PP_LIST_AT(L, 0) \
+ ) \
+ ) \
+ ) \
+ ) \
+ /**/
+
+#define BSL_INST_xNODES(Z, N, L) \
+ T ## L T ## L ## _ ## N( \
+ BOOST_PP_REPEAT_ ## Z( \
+ BSL_NODE_MAX, BSL_INST_yNODES, \
+ (BOOST_PP_MUL(N, BSL_NODE_MAX), (BOOST_PP_SUB(L, 1), BOOST_PP_NIL)) \
+ ) \
+ ); \
+ /**/
+
+#define BSL_INST_NODES(Z, N, L) \
+ BOOST_PP_REPEAT_ ## Z( \
+ BSL_EXP(BSL_NODE_MAX, BOOST_PP_SUB(BSL_DEPTH, N)), \
+ BSL_INST_xNODES, N \
+ ) \
+ /**/
+
+#define BSL_TYPEDEF_NODES(Z, N, L) \
+ typedef boost::archive::xml::node< \
+ BOOST_PP_ENUM_ ## Z( \
+ BSL_NODE_MAX, BSL_PRINT, BOOST_PP_CAT(T, BOOST_PP_SUB(N, 1)) \
+ ) \
+ > T ## N; \
+ /**/
+
+// main macro
+
+#define BSL_MAIN \
+ int main (void) { \
+ using namespace boost::archive; \
+ using namespace boost::archive::xml; \
+ \
+ typedef node<BOOST_PP_ENUM(BSL_NODE_MAX, BSL_PRINT, BSL_TYPE)> T0; \
+ \
+ BOOST_PP_REPEAT_FROM_TO(1, BSL_DEPTH, BSL_TYPEDEF_NODES, _) \
+ \
+ typedef node<BOOST_PP_ENUM( \
+ BSL_NODE_MAX, BSL_PRINT, \
+ BOOST_PP_CAT(T, BOOST_PP_SUB(BSL_DEPTH, 1)) \
+ )> HEAD; \
+ \
+ result_set results; \
+ std::size_t rounds = BSL_ROUNDS; \
+ \
+ while (rounds --> 0) { \
+ BOOST_PP_REPEAT(BSL_EXP(BSL_NODE_MAX, BSL_DEPTH), BSL_INST_BASE, _) \
+ \
+ BOOST_PP_REPEAT_FROM_TO(1, BSL_DEPTH, BSL_INST_NODES, _) \
+ \
+ HEAD h(BOOST_PP_ENUM_PARAMS( \
+ BSL_NODE_MAX, \
+ BOOST_PP_CAT(T, BOOST_PP_CAT(BOOST_PP_SUB(BSL_DEPTH, 1), _)) \
+ )); \
+ \
+ std::string fn = save_archive(h); \
+ \
+ std::pair<double, HEAD> r = restore_archive<HEAD>(fn); \
+ \
+ std::cout << "round " \
+ << ((BSL_ROUNDS - 1) - rounds) \
+ << " -> " << fn << "\n"; \
+ \
+ BOOST_PP_IF(BSL_SAVE_TMPFILE, \
+ BOOST_PP_EMPTY(), \
+ std::remove(fn.c_str()); \
+ ) \
+ \
+ results.entries.push_back(entry( \
+ BOOST_PP_STRINGIZE(BSL_TYPE), \
+ BSL_EXP(BSL_NODE_MAX, BSL_DEPTH), r.first \
+ )); \
+ } \
+ \
+ std::fstream fs(BSL_RESULTS_FILE, std::fstream::in); \
+ \
+ if (fs.good()) { \
+ xml_iarchive ia(fs); \
+ ia >> BOOST_SERIALIZATION_NVP(results); \
+ fs.close(); \
+ } \
+ \
+ fs.open(BSL_RESULTS_FILE, std::fstream::out | std::fstream::trunc); \
+ xml_oarchive oa(fs); \
+ oa << BOOST_SERIALIZATION_NVP(results); \
+ \
+ fs.close(); \
+ } \
+ /**/
+
+#endif // BOOST_SERIALIZATION_XML_PERFORMANCE_MACRO_HPP
Added: trunk/libs/serialization/performance/xml/node.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/node.hpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,63 @@
+/* /libs/serialization/xml_performance/node.hpp ********************************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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)
+
+*******************************************************************************/
+
+#if !defined(BOOST_SERIALIZATION_XML_PERFORMANCE_NODE_HPP)
+#define BOOST_SERIALIZATION_XML_PERFORMANCE_NODE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+ #pragma once
+#endif
+
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/utility.hpp>
+#include <boost/serialization/list.hpp>
+#include <boost/serialization/version.hpp>
+
+#include "macro.hpp"
+
+namespace boost {
+namespace archive {
+namespace xml {
+
+struct unused_type { };
+
+template<
+ typename T,
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_PP_SUB(BSL_NODE_MAX, 1), typename T, unused_type
+ )
+> struct node;
+
+BOOST_PP_REPEAT_FROM_TO(1, BSL_NODE_MAX, BSL_NODE_DECL, _)
+
+template<BOOST_PP_ENUM_PARAMS(BSL_NODE_MAX, typename T)>
+struct node {
+ BOOST_PP_REPEAT(BSL_NODE_MAX, BSL_NODE_DECL_MEMBER, _)
+
+ template<class ARC>
+ void serialize (ARC& ar, const unsigned int) {
+ ar
+ BOOST_PP_REPEAT(BSL_NODE_MAX, BSL_NODE_SERIALIZE, _)
+ ;
+ }
+
+ BSL_NODE_xDECL_CTOR()
+
+ node (BOOST_PP_ENUM_BINARY_PARAMS(BSL_NODE_MAX, T, p)):
+ BOOST_PP_REPEAT(BSL_NODE_MAX, BSL_NODE_INIT_LIST, _)
+ { }
+};
+
+} // xml
+} // archive
+} // boost
+
+#endif // BOOST_SERIALIZATION_XML_PERFORMANCE_NODE_HPP
+
Added: trunk/libs/serialization/performance/xml/string16_results.xml
==============================================================================
Binary file. No diff available.
Added: trunk/libs/serialization/performance/xml/string16_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/string16_test.cpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,24 @@
+/* /libs/serialization/xml_performance/string25_test.cpp ***********************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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 <string>
+
+typedef std::string string;
+
+#define BSL_TYPE string
+#define BSL_DEPTH 2
+#define BSL_ROUNDS 256
+#define BSL_NODE_MAX 4
+#define BSL_SAVE_TMPFILE 0
+
+#include "harness.hpp"
+
+BSL_MAIN
+
Added: trunk/libs/serialization/performance/xml/string256_results.xml
==============================================================================
Binary file. No diff available.
Added: trunk/libs/serialization/performance/xml/string256_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/string256_test.cpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,24 @@
+/* /libs/serialization/xml_performance/string25_test.cpp ***********************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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 <string>
+
+typedef std::string string;
+
+#define BSL_TYPE string
+#define BSL_DEPTH 4
+#define BSL_ROUNDS 256
+#define BSL_NODE_MAX 4
+#define BSL_SAVE_TMPFILE 0
+
+#include "harness.hpp"
+
+BSL_MAIN
+
Added: trunk/libs/serialization/performance/xml/string4_results.xml
==============================================================================
Binary file. No diff available.
Added: trunk/libs/serialization/performance/xml/string4_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/string4_test.cpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,24 @@
+/* /libs/serialization/xml_performance/string5_test.cpp ************************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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 <string>
+
+typedef std::string string;
+
+#define BSL_TYPE string
+#define BSL_DEPTH 1
+#define BSL_ROUNDS 256
+#define BSL_NODE_MAX 4
+#define BSL_SAVE_TMPFILE 0
+
+#include "harness.hpp"
+
+BSL_MAIN
+
Added: trunk/libs/serialization/performance/xml/string64_results.xml
==============================================================================
Binary file. No diff available.
Added: trunk/libs/serialization/performance/xml/string64_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/serialization/performance/xml/string64_test.cpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -0,0 +1,24 @@
+/* /libs/serialization/xml_performance/string25_test.cpp ***********************
+
+(C) Copyright 2010 Bryce Lelbach
+
+Use, modification and distribution is 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 <string>
+
+typedef std::string string;
+
+#define BSL_TYPE string
+#define BSL_DEPTH 3
+#define BSL_ROUNDS 256
+#define BSL_NODE_MAX 4
+#define BSL_SAVE_TMPFILE 0
+
+#include "harness.hpp"
+
+BSL_MAIN
+
Modified: trunk/libs/serialization/src/basic_xml_grammar.ipp
==============================================================================
--- trunk/libs/serialization/src/basic_xml_grammar.ipp (original)
+++ trunk/libs/serialization/src/basic_xml_grammar.ipp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -21,10 +21,19 @@
# pragma warning(disable : 4511 4512)
#endif
-// spirit stuff
-#include <boost/spirit/core/composite/operators.hpp>
-#include <boost/spirit/core/composite/actions.hpp>
-#include <boost/spirit/core/primitives/numerics.hpp>
+// #include <boost/spirit/core/composite/operators.hpp>
+// #include <boost/spirit/core/composite/actions.hpp>
+// #include <boost/spirit/core/primitives/numerics.hpp>
+
+#include <boost/spirit/include/qi_operator.hpp>
+#include <boost/spirit/include/qi_action.hpp>
+#include <boost/spirit/include/qi_char.hpp>
+#include <boost/spirit/include/qi_numeric.hpp>
+#include <boost/spirit/include/qi_string.hpp>
+
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/include/phoenix_container.hpp>
#ifdef BOOST_MSVC
#pragma warning(pop)
@@ -50,132 +59,9 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// template code for basic_xml_grammar of both wchar_t and char types
-namespace xml { // anonymous
-
-#ifdef BOOST_MSVC
-# pragma warning(push)
-# pragma warning(disable : 4511 4512)
-#endif
-
-template<class T>
-struct assign_impl {
- T & t;
- void operator()(const T t_) const {
- t = t_;
- }
- assign_impl(T & t_)
- : t(t_)
- {}
-};
-
-template<>
-struct assign_impl<std::string> {
- std::string & t;
- void operator()(
- std::string::const_iterator b,
- std::string::const_iterator e
- ) const {
- t.resize(0);
- while(b != e){
- t += * b;
- ++b;
- }
- }
- assign_impl<std::string> & operator=(
- assign_impl<std::string> & rhs
- );
- assign_impl(std::string & t_)
- : t(t_)
- {}
-};
-
-#ifndef BOOST_NO_STD_WSTRING
-template<>
-struct assign_impl<std::wstring> {
- std::wstring & t;
- void operator()(
- std::wstring::const_iterator b,
- std::wstring::const_iterator e
- ) const {
- t.resize(0);
- while(b != e){
- t += * b;
- ++b;
- }
- }
- assign_impl(std::wstring & t_)
- : t(t_)
- {}
-};
-#endif
-
-template<class T>
-assign_impl<T> assign_object(T &t){
- return assign_impl<T>(t);
-}
-
-struct assign_level {
- tracking_type & tracking_level;
- void operator()(const unsigned int tracking_level_) const {
- tracking_level = (0 == tracking_level_) ? false : true;
- }
- assign_level(tracking_type & tracking_level_)
- : tracking_level(tracking_level_)
- {}
-};
-
-template<class String, class Iterator>
-struct append_string {
- String & contents;
- void operator()(Iterator start, Iterator end) const {
- #if 0
- typedef boost::archive::iterators::xml_unescape<Iterator> translator;
- contents.append(
- translator(BOOST_MAKE_PFTO_WRAPPER(start)),
- translator(BOOST_MAKE_PFTO_WRAPPER(end))
- );
- #endif
- contents.append(start, end);
- }
- append_string(String & contents_)
- : contents(contents_)
- {}
-};
-
-template<class String>
-struct append_char {
- String & contents;
- void operator()(const unsigned int char_value) const {
- const BOOST_DEDUCED_TYPENAME String::value_type z = char_value;
- contents += z;
- }
- append_char(String & contents_)
- : contents(contents_)
- {}
-};
-
-template<class String, unsigned int c>
-struct append_lit {
- String & contents;
- template<class X, class Y>
- void operator()(const X & /*x*/, const Y & /*y*/) const {
- const BOOST_DEDUCED_TYPENAME String::value_type z = c;
- contents += z;
- }
- append_lit(String & contents_)
- : contents(contents_)
- {}
-};
-
-#ifdef BOOST_MSVC
-#pragma warning(pop)
-#endif
-
-} // namespace anonymous
-
template<class CharType>
bool basic_xml_grammar<CharType>::my_parse(
- BOOST_DEDUCED_TYPENAME basic_xml_grammar<CharType>::IStream & is,
+ IStream & is,
const rule_t & rule_,
CharType delimiter
) const {
@@ -206,21 +92,17 @@
// is terminated. This will permit the archive to be used for debug
// and transaction data logging in the standard way.
- parse_info<BOOST_DEDUCED_TYPENAME std::basic_string<CharType>::iterator>
- result = boost::spirit::parse(arg.begin(), arg.end(), rule_);
- return result.hit;
+ return qi::parse(arg.begin(), arg.end(), rule_);
}
template<class CharType>
-bool basic_xml_grammar<CharType>::parse_start_tag(
- BOOST_DEDUCED_TYPENAME basic_xml_grammar<CharType>::IStream & is
-){
+bool basic_xml_grammar<CharType>::parse_start_tag(IStream & is){
rv.class_name.resize(0);
return my_parse(is, STag);
}
template<class CharType>
-bool basic_xml_grammar<CharType>::parse_end_tag(IStream & is) const {
+bool basic_xml_grammar<CharType>::parse_end_tag(IStream & is) {
return my_parse(is, ETag);
}
@@ -230,7 +112,7 @@
bool result = my_parse(is, content, '<');
// note: unget caused a problem with dinkumware. replace with
// is.unget();
- // putback another dilimiter instead
+ // putback another delimiter instead
is.putback('<');
if(result)
s = rv.contents;
@@ -241,202 +123,164 @@
basic_xml_grammar<CharType>::basic_xml_grammar(){
init_chset();
- S =
- +(Sch)
- ;
+ /* [1] S ::= Sch+ */
+ S = +(Sch);
- // refactoring to workaround template depth on darwin
- NameHead = (Letter | '_' | ':');
- NameTail = *NameChar ;
- Name =
- NameHead >> NameTail
- ;
+ /* [2] Eq ::= !S '=' !S */
+ Eq = !S >> '=' >> !S;
- Eq =
- !S >> '=' >> !S
- ;
-
- AttributeList =
- *(S >> Attribute)
- ;
+ /* [3] AttributeList ::= (S Attribute)* */
+ AttributeList = *(S >> Attribute);
+
+ /* [4] STag ::= S? '<' Name AttributeLIst !S '>' */
+ STag = -S >> '<' >> Name >> AttributeList >> !S >> '>';
+
+ /* [5] ETag ::= S? "</" Name !S '>' */
+ ETag = -S >> "</" >> Name >> !S >> '>';
+
+ /* [6] CharData ::= (AnyChar - ("&" | "<"))+ */
+ CharData = +(AnyChar - (qi::lit(L"&") | L"<"))
+ [phoenix::ref(rv.contents) += qi::_1]
+ ;
+
+ /* [7] CharRef ::= ("&#" Digit* ';') | ("&#x" HexDigit* ';') */
+ CharRef
+ = (qi::lit(L"&#") >> *Digit[phoenix::ref(rv.contents) += qi::_1] >> L';')
+ | (L"&#x" >> *HexDigit[phoenix::ref(rv.contents) += qi::_1] >> L';')
+ ;
+
+ /* [8] AmpRef ::= "&" *
+ * [9] LTRef ::= "<" *
+ * [a] GTRef ::= ">" *
+ * [b] AposRef ::= "'" *
+ * [c] QuoteRef ::= """ */
+ AmpRef = qi::lit(L"&") [phoenix::ref(rv.contents) += L'&'];
+ LTRef = qi::lit(L"<") [phoenix::ref(rv.contents) += L'<'];
+ GTRef = qi::lit(L">") [phoenix::ref(rv.contents) += L'>'];
+ AposRef = qi::lit(L"'")[phoenix::ref(rv.contents) += L'\''];
+ QuoteRef = qi::lit(L""")[phoenix::ref(rv.contents) += L'"'];
- STag =
- !S
- >> '<'
- >> Name [xml::assign_object(rv.object_name)]
- >> AttributeList
- >> !S
- >> '>'
- ;
-
- ETag =
- !S
- >> "</"
- >> Name [xml::assign_object(rv.object_name)]
- >> !S
- >> '>'
- ;
-
- // refactoring to workaround template depth on darwin
- CharDataChars = +(anychar_p - chset_p(L"&<"));
- CharData =
- CharDataChars [
- xml::append_string<
- StringType,
- BOOST_DEDUCED_TYPENAME std::basic_string<CharType>::const_iterator
- >(rv.contents)
- ]
- ;
-
- // slight factoring works around ICE in msvc 6.0
- CharRef1 =
- str_p(L"&#") >> uint_p [xml::append_char<StringType>(rv.contents)] >> L';'
- ;
- CharRef2 =
- str_p(L"&#x") >> hex_p [xml::append_char<StringType>(rv.contents)] >> L';'
- ;
- CharRef = CharRef1 | CharRef2 ;
-
- AmpRef = str_p(L"&")[xml::append_lit<StringType, L'&'>(rv.contents)];
- LTRef = str_p(L"<")[xml::append_lit<StringType, L'<'>(rv.contents)];
- GTRef = str_p(L">")[xml::append_lit<StringType, L'>'>(rv.contents)];
- AposRef = str_p(L"'")[xml::append_lit<StringType, L'\''>(rv.contents)];
- QuoteRef = str_p(L""")[xml::append_lit<StringType, L'"'>(rv.contents)];
-
- Reference =
- AmpRef
- | LTRef
- | GTRef
- | AposRef
- | QuoteRef
- | CharRef
- ;
-
- content =
- L"<" // should be end_p
- | +(Reference | CharData) >> L"<"
- ;
-
- ClassIDAttribute =
- str_p(BOOST_ARCHIVE_XML_CLASS_ID()) >> NameTail
- >> Eq
- >> L'"'
- >> int_p [xml::assign_object(rv.class_id)]
- >> L'"'
- ;
-
- ObjectIDAttribute = (
- str_p(BOOST_ARCHIVE_XML_OBJECT_ID())
- |
- str_p(BOOST_ARCHIVE_XML_OBJECT_REFERENCE())
+ /* [d] AmpName ::= "&" *
+ * [e] LTName ::= "<" *
+ * [f] GTName ::= ">" */
+ AmpName = qi::lit(L"&")[phoenix::ref(rv.class_name) += L'&'];
+ LTName = qi::lit(L"<") [phoenix::ref(rv.class_name) += L'<'];
+ GTName = qi::lit(L">") [phoenix::ref(rv.class_name) += L'>'];
+
+ /* [10] Reference ::= AmpRef LTRef GTRef AposRef QuoteRef CharRef */
+ Reference
+ = AmpRef
+ | LTRef
+ | GTRef
+ | AposRef
+ | QuoteRef
+ | CharRef
+ ;
+
+ /* [11] content ::= '<' | (Reference | CharData)+ '<' */
+ content = qi::lit(L'<') | +(Reference | CharData) >> qi::lit(L'<');
+
+ ClassIDAttribute
+ = qi::lit(BOOST_ARCHIVE_XML_CLASS_ID())
+ >> *NameChar
+ >> Eq
+ >> L'"'
+ >> qi::short_[phoenix::ref(rv.class_id) = qi::_1]
+ >> L'"'
+ ;
+
+ ObjectIDAttribute
+ = ( qi::lit(BOOST_ARCHIVE_XML_OBJECT_ID())
+ | qi::lit(BOOST_ARCHIVE_XML_OBJECT_REFERENCE())
)
- >> NameTail
- >> Eq
- >> L'"'
- >> L'_'
- >> uint_p [xml::assign_object(rv.object_id)]
- >> L'"'
+ >> *NameChar
+ >> Eq
+ >> L'"'
+ >> qi::lit(L'_')
+ >> qi::uint_[phoenix::ref(rv.object_id) = qi::_1]
+ >> L'"'
;
- AmpName = str_p(L"&")[xml::append_lit<StringType, L'&'>(rv.class_name)];
- LTName = str_p(L"<")[xml::append_lit<StringType, L'<'>(rv.class_name)];
- GTName = str_p(L">")[xml::append_lit<StringType, L'>'>(rv.class_name)];
- ClassNameChar =
- AmpName
- | LTName
- | GTName
- | (anychar_p - chset_p(L"\"")) [xml::append_char<StringType>(rv.class_name)]
+ ClassNameChar
+ = AmpName
+ | LTName
+ | GTName
+ | (qi::char_ - L'"')[phoenix::ref(rv.class_name) += qi::_1]
;
- ClassName =
- * ClassNameChar
- ;
+ ClassName = *ClassNameChar;
- ClassNameAttribute =
- str_p(BOOST_ARCHIVE_XML_CLASS_NAME())
- >> Eq
- >> L'"'
- >> ClassName
- >> L'"'
- ;
-
- TrackingAttribute =
- str_p(BOOST_ARCHIVE_XML_TRACKING())
- >> Eq
- >> L'"'
- >> uint_p [xml::assign_level(rv.tracking_level)]
- >> L'"'
- ;
-
- VersionAttribute =
- str_p(BOOST_ARCHIVE_XML_VERSION())
- >> Eq
- >> L'"'
- >> uint_p [xml::assign_object(rv.version)]
- >> L'"'
- ;
-
- UnusedAttribute =
- Name
- >> Eq
- >> L'"'
- >> !CharData
- >> L'"'
- ;
-
- Attribute =
- ClassIDAttribute
- | ObjectIDAttribute
- | ClassNameAttribute
- | TrackingAttribute
- | VersionAttribute
- | UnusedAttribute
- ;
-
- XMLDeclChars = *(anychar_p - chset_p(L"?>"));
- XMLDecl =
- !S
- >> str_p(L"<?xml")
- >> S
- >> str_p(L"version")
- >> Eq
- >> str_p(L"\"1.0\"")
- >> XMLDeclChars
- >> !S
- >> str_p(L"?>")
- ;
-
- DocTypeDeclChars = *(anychar_p - chset_p(L">"));
- DocTypeDecl =
- !S
- >> str_p(L"<!DOCTYPE")
- >> DocTypeDeclChars
- >> L'>'
- ;
-
- SignatureAttribute =
- str_p(L"signature")
- >> Eq
- >> L'"'
- >> Name [xml::assign_object(rv.class_name)]
- >> L'"'
+ ClassNameAttribute
+ = qi::lit(BOOST_ARCHIVE_XML_CLASS_NAME())
+ >> Eq
+ >> L'"'
+ >> ClassName
+ >> L'"'
+ ;
+
+ TrackingAttribute
+ = qi::lit(BOOST_ARCHIVE_XML_TRACKING())
+ >> Eq
+ >> L'"'
+ >> qi::uint_[phoenix::ref(rv.tracking_level) = qi::_1]
+ >> L'"'
+ ;
+
+ VersionAttribute
+ = qi::lit(BOOST_ARCHIVE_XML_VERSION())
+ >> Eq
+ >> L'"'
+ >> qi::uint_[phoenix::ref(rv.version) = qi::_1]
+ >> L'"'
+ ;
+
+ UnusedAttribute
+ = Name
+ >> Eq
+ >> L'"'
+ >> !CharData
+ >> L'"'
+ ;
+
+ Attribute
+ = ClassIDAttribute
+ | ObjectIDAttribute
+ | ClassNameAttribute
+ | TrackingAttribute
+ | VersionAttribute
+ | UnusedAttribute
+ ;
+
+ XMLDecl
+ = -S
+ >> L"<?xml"
+ >> S
+ >> L"version"
+ >> Eq
+ >> L"\"1.0\""
+ >> XMLDeclChars
+ >> !S
+ >> L"?>"
;
+
+ DocTypeDecl = -S >> L"<!DOCTYPE" >> DocTypeDeclChars >> L">";
+
+ SignatureAttribute = qi::lit(L"signature") >> Eq >> L'"' >> Name >> L'"';
- SerializationWrapper =
- !S
- >> str_p(L"<boost_serialization")
- >> S
- >> SignatureAttribute
- >> S
- >> VersionAttribute
- >> !S
- >> L'>'
+ SerializationWrapper
+ = -S
+ >> L"<boost_serialization"
+ >> S
+ >> SignatureAttribute
+ >> S
+ >> VersionAttribute
+ >> !S
+ >> L'>'
;
}
template<class CharType>
void basic_xml_grammar<CharType>::init(IStream & is){
- init_chset();
if(! my_parse(is, XMLDecl))
boost::serialization::throw_exception(
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
Modified: trunk/libs/serialization/src/xml_grammar.cpp
==============================================================================
--- trunk/libs/serialization/src/xml_grammar.cpp (original)
+++ trunk/libs/serialization/src/xml_grammar.cpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -15,6 +15,14 @@
#define BOOST_ARCHIVE_SOURCE
#include <boost/archive/impl/basic_xml_grammar.hpp>
+#include <boost/spirit/include/qi_char.hpp>
+#include <boost/spirit/include/qi_operator.hpp>
+#include <boost/spirit/include/qi_action.hpp>
+
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/include/phoenix_container.hpp>
+
using namespace boost::spirit;
#include <boost/config.hpp>
@@ -49,12 +57,26 @@
template<>
void xml_grammar::init_chset(){
- Char = chset_t("\x9\xA\xD\x20-\x7f\x80\x81-\xFF");
- Letter = chset_t("\x41-\x5A\x61-\x7A\xC0-\xD6\xD8-\xF6\xF8-\xFF");
- Digit = chset_t("0-9");
- Extender = chset_t('\xB7');
- Sch = chset_t("\x20\x9\xD\xA");
- NameChar = Letter | Digit | chset_p("._:-") | Extender ;
+ Char = standard::char_("\x9\xA\xD\x20-\x7f\x80\x81-\xFF");
+ Letter = standard::char_("\x41-\x5A\x61-\x7A\xC0-\xD6\xD8-\xF6\xF8-\xFF");
+ Digit = standard::digit;
+ HexDigit = standard::xdigit;
+ Extender = standard::char_("\xB7");
+ Sch = standard::char_("\x20\x9\xD\xA");
+ NameChar = Letter | Digit | standard::char_("._:-") | Extender ;
+ AnyChar = standard::char_;
+
+ DocTypeDeclChars = *(standard::char_ - qi::lit(">"));
+ XMLDeclChars = *(standard::char_ - qi::lit("?>"));
+
+ Name =
+ (
+ (Letter | standard::char_('_') | standard::char_(':'))[
+ phoenix::ref(rv.object_name) = qi::_1
+ ] >>
+ *NameChar[phoenix::ref(rv.object_name) += qi::_1]
+ )
+ ;
}
} // namespace archive
Modified: trunk/libs/serialization/src/xml_wgrammar.cpp
==============================================================================
--- trunk/libs/serialization/src/xml_wgrammar.cpp (original)
+++ trunk/libs/serialization/src/xml_wgrammar.cpp 2010-10-16 17:33:22 EDT (Sat, 16 Oct 2010)
@@ -17,6 +17,14 @@
#define BOOST_WARCHIVE_SOURCE
#include <boost/archive/impl/basic_xml_grammar.hpp>
+#include <boost/spirit/include/qi_char.hpp>
+#include <boost/spirit/include/qi_operator.hpp>
+#include <boost/spirit/include/qi_action.hpp>
+
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/include/phoenix_container.hpp>
+
using namespace boost::spirit;
// fixup for RogueWave
@@ -49,7 +57,7 @@
template<>
void xml_wgrammar::init_chset(){
- Char = chset_t(
+ Char = standard_wide::char_(
#if defined(__GNUC__) && defined(linux)
L"\x9\xA\xD\x20-\xD7FF\xE000-\xFFFD\x10000-\x10FFFF"
#else
@@ -57,9 +65,9 @@
#endif
);
- Sch = chset_t(L"\x20\x9\xD\xA");
+ Sch = standard_wide::char_(L"\x20\x9\xD\xA");
- BaseChar = chset_t(
+ BaseChar = standard_wide::char_(
L"\x41-\x5A\x61-\x7A\xC0-\xD6\xD8-\xF6\xF8-\xFF\x100-\x131\x134-\x13E"
L"\x141-\x148\x14A-\x17E\x180-\x1C3\x1CD-\x1F0\x1F4-\x1F5\x1FA-\x217"
L"\x250-\x2A8\x2BB-\x2C1\x386\x388-\x38A\x38C\x38E-\x3A1\x3A3-\x3CE"
@@ -94,11 +102,11 @@
L"\x3041-\x3094\x30A1-\x30FA\x3105-\x312C\xAC00-\xD7A3"
);
- Ideographic = chset_t(L"\x4E00-\x9FA5\x3007\x3021-\x3029");
+ Ideographic = standard_wide::char_(L"\x4E00-\x9FA5\x3007\x3021-\x3029");
Letter = BaseChar | Ideographic;
- CombiningChar = chset_t(
+ CombiningChar = standard_wide::char_(
L"\x0300-\x0345\x0360-\x0361\x0483-\x0486\x0591-\x05A1\x05A3-\x05B9"
L"\x05BB-\x05BD\x05BF\x05C1-\x05C2\x05C4\x064B-\x0652\x0670"
L"\x06D6-\x06DC\x06DD-\x06DF\x06E0-\x06E4\x06E7-\x06E8\x06EA-\x06ED"
@@ -118,27 +126,35 @@
L"\x20D0-\x20DC\x20E1\x302A-\x302F\x3099\x309A"
);
- Digit = chset_t(
- L"\x0030-\x0039\x0660-\x0669\x06F0-\x06F9\x0966-\x096F\x09E6-\x09EF"
- L"\x0A66-\x0A6F\x0AE6-\x0AEF\x0B66-\x0B6F\x0BE7-\x0BEF\x0C66-\x0C6F"
- L"\x0CE6-\x0CEF\x0D66-\x0D6F\x0E50-\x0E59\x0ED0-\x0ED9\x0F20-\x0F29"
- );
-
- Extender = chset_t(
+ Digit = standard_wide::digit;
+ HexDigit = standard_wide::xdigit;
+
+ Extender = standard_wide::char_(
L"\x00B7\x02D0\x02D1\x0387\x0640\x0E46\x0EC6\x3005\x3031-\x3035"
L"\x309D-\x309E\x30FC-\x30FE"
);
- NameChar =
- Letter
+ NameChar
+ = Letter
| Digit
- | L'.'
- | L'-'
- | L'_'
- | L':'
+ | standard_wide::char_(L"[._:-")
| CombiningChar
| Extender
;
+
+ AnyChar = standard_wide::char_;
+
+ DocTypeDeclChars = *(standard_wide::char_ - qi::lit(L">"));
+ XMLDeclChars = *(standard_wide::char_ - qi::lit(L"?>"));
+
+ Name =
+ (
+ (Letter | standard_wide::char_(L'_') | standard_wide::char_(L':'))[
+ phoenix::ref(rv.object_name) = qi::_1
+ ] >>
+ *NameChar[phoenix::ref(rv.object_name) += qi::_1]
+ )
+ ;
}
} // namespace archive
} // namespace boost
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