Boost logo

Boost-Commit :

From: zeux_at_[hidden]
Date: 2007-06-11 18:02:28


Author: zeux
Date: 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
New Revision: 6982
URL: http://svn.boost.org/trac/boost/changeset/6982

Log:
Abs/div interface fixes, div implementation fixes, serialize header fixes, added serialization and functions test, added serialization source and build files (otherwise it does not link)

Added:
   sandbox/SOC/2007/bigint/libs/bigint/test/functions.cpp
   sandbox/SOC/2007/bigint/libs/bigint/test/serialization.cpp
   sandbox/SOC/2007/bigint/libs/detail/
   sandbox/SOC/2007/bigint/libs/detail/utf8_codecvt_facet.cpp
   sandbox/SOC/2007/bigint/libs/serialization/
   sandbox/SOC/2007/bigint/libs/serialization/build/
   sandbox/SOC/2007/bigint/libs/serialization/build/Jamfile.v2
   sandbox/SOC/2007/bigint/libs/serialization/build/serialization.jam
   sandbox/SOC/2007/bigint/libs/serialization/src/
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_archive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_archive_impl.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_iarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_iserializer.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_oarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_oserializer.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_pointer_iserializer.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_pointer_oserializer.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_serializer_map.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_iprimitive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_oprimitive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_wiprimitive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_woprimitive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_xml_archive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/basic_xml_grammar.ipp
   sandbox/SOC/2007/bigint/libs/serialization/src/binary_iarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/binary_oarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/binary_wiarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/binary_woarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/codecvt_null.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/extended_type_info.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/extended_type_info_no_rtti.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/extended_type_info_typeid.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/polymorphic_iarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/polymorphic_oarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/stl_port.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/text_iarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/text_oarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/text_wiarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/text_woarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/utf8_codecvt_facet.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/void_cast.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/xml_grammar.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/xml_iarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/xml_oarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/xml_wgrammar.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/xml_wiarchive.cpp
   sandbox/SOC/2007/bigint/libs/serialization/src/xml_woarchive.cpp
Text files modified:
   sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp | 9 +++++----
   sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp | 4 ++--
   sandbox/SOC/2007/bigint/boost/bigint/bigint_serialize.hpp | 4 ++++
   sandbox/SOC/2007/bigint/libs/bigint/test/Jamfile.v2 | 2 ++
   sandbox/SOC/2007/bigint/libs/bigint/todo.txt | 9 +++++----
   5 files changed, 18 insertions(+), 10 deletions(-)

Modified: sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp
==============================================================================
--- sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp (original)
+++ sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -13,6 +13,7 @@
 #include <string>
 #include <algorithm>
 
+#include <boost/detail/workaround.hpp>
 #include <boost/cstdint.hpp>
 
 #include <boost/bigint/bigint_config.hpp>
@@ -362,7 +363,7 @@
         friend bigint_base abs(const bigint_base& value)
         {
                 bigint_base result;
- result.impl.abs(value);
+ result.impl.abs(value.impl);
                 return result;
         }
 
@@ -373,11 +374,11 @@
                 return result;
         }
 
- // non-standard. Do we need to change it (introduce some equivalent to ldiv_t type) or is it ok?
- friend bigint_base ldiv(const bigint_base& lhs, const bigint_base& rhs, bigint_base& remainder)
+ // non-standard. Do we need to change it (introduce some equivalent to div_t type) or is it ok?
+ friend bigint_base div(const bigint_base& lhs, const bigint_base& rhs, bigint_base& remainder)
         {
                 bigint_base result;
- result.impl.ldiv(lhs.impl, rhs, remainder.impl);
+ result.impl.div(lhs.impl, rhs.impl, remainder.impl);
                 return result;
         }
 

Modified: sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp
==============================================================================
--- sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp (original)
+++ sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -391,9 +391,9 @@
                         }
                 }
                 
- void ldiv(const bigint_gmp_implementation& lhs, const bigint_gmp_implementation& rhs, bigint_gmp_implementation& remainder)
+ void div(const bigint_gmp_implementation& lhs, const bigint_gmp_implementation& rhs, bigint_gmp_implementation& remainder)
                 {
- mpz_fdiv_qr(data, remainder.data, lhs.data, rhs.data);
+ mpz_tdiv_qr(data, remainder.data, lhs.data, rhs.data);
                 }
                 
                 void sqrt(const bigint_gmp_implementation& lhs)

Modified: sandbox/SOC/2007/bigint/boost/bigint/bigint_serialize.hpp
==============================================================================
--- sandbox/SOC/2007/bigint/boost/bigint/bigint_serialize.hpp (original)
+++ sandbox/SOC/2007/bigint/boost/bigint/bigint_serialize.hpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -12,6 +12,10 @@
 
 #include <boost/bigint/bigint.hpp>
 
+#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
+#include <boost/serialization/extended_type_info_typeid.hpp>
+#endif
+
 #include <boost/serialization/string.hpp>
 #include <boost/serialization/split_free.hpp>
 

Modified: sandbox/SOC/2007/bigint/libs/bigint/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/bigint/libs/bigint/test/Jamfile.v2 (original)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/Jamfile.v2 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -16,6 +16,8 @@
    [ run comparison.cpp ]
    [ run unary.cpp ]
    [ run stream.cpp ]
+ [ run serialization.cpp ../../serialization/build//boost_serialization : : : : ]
+ [ run functions.cpp ]
    ;
 }
 

Added: sandbox/SOC/2007/bigint/libs/bigint/test/functions.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/functions.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,138 @@
+/* Boost functions.cpp test file
+ *
+ * Copyright 2007 Arseny Kapoulkine
+ *
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or
+ * copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#define BOOST_DISABLE_WIN32
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <boost/bigint/bigint.hpp>
+
+#pragma comment(lib, "libgmp-3.lib")
+
+#define ARRAY_SIZE(array) sizeof(array) / sizeof(array[0])
+
+template <typename I> void test()
+{
+ typedef boost::bigint_base<I> number;
+
+ // abs
+ {
+ BOOST_CHECK_EQUAL(abs(number(0)), 0);
+ BOOST_CHECK_EQUAL(abs(number("23923")), number("23923"));
+ BOOST_CHECK_EQUAL(abs(number("2234984058203945820345823904580234583923")), number("2234984058203945820345823904580234583923"));
+ BOOST_CHECK_EQUAL(abs(number("-23923")), number("23923"));
+ BOOST_CHECK_EQUAL(abs(number("-2234984058203945820345823904580234583923")), number("2234984058203945820345823904580234583923"));
+ }
+
+ // pow
+ {
+ // zero base
+ BOOST_CHECK_EQUAL(pow(number(0), 239482394), 0);
+ BOOST_CHECK_EQUAL(pow(number(0), boost::uint64_t(239482394) * boost::uint64_t(239482394)), 0);
+ // zero power
+ BOOST_CHECK_EQUAL(pow(number(0), 0), 1);
+ BOOST_CHECK_EQUAL(pow(number("24898934"), 0), 1);
+ BOOST_CHECK_EQUAL(pow(number("24898932398493444"), 0), 1);
+ BOOST_CHECK_EQUAL(pow(number("-240590245924898934"), 0), 1);
+ // base = one
+ BOOST_CHECK_EQUAL(pow(number(1), 239482394), 1);
+ BOOST_CHECK_EQUAL(pow(number(1), boost::uint64_t(239482394) * boost::uint64_t(239482394)), 1);
+ // other cases
+ BOOST_CHECK_EQUAL(pow(number(2), 20), 1048576);
+ BOOST_CHECK_EQUAL(pow(number(2), 65), number("36893488147419103232"));
+ BOOST_CHECK_EQUAL(pow(number(234895897), 3), number("12960635374738189889899273"));
+ // negative base
+ BOOST_CHECK_EQUAL(pow(number(-2), 20), 1048576);
+ BOOST_CHECK_EQUAL(pow(number(-2), 21), -2097152);
+ BOOST_CHECK_EQUAL(pow(number(-234895897), 2), number("55176082427434609"));
+ BOOST_CHECK_EQUAL(pow(number(-234895897), 3), number("-12960635374738189889899273"));
+ }
+
+ // ldiv
+ {
+ struct test_entry
+ {
+ const char* lhs;
+ const char* rhs;
+ const char* result;
+ const char* rem;
+ };
+
+ test_entry entries[] =
+ {
+ // zero
+ {"0", "23904293402394023940", "0", "0"},
+ // positive / larger positive
+ {"239409034", "23489023049230492304230493049034", "0", "239409034"},
+ {"-239409034", "23489023049230492304230493049034", "0", "-239409034"},
+ {"239409034", "-23489023049230492304230493049034", "0", "239409034"},
+ // ~ equal magnitudes
+ {"39049204923049203490234", "39049204923049203490230", "1", "4"},
+ {"-39049204923049203490234", "39049204923049203490230", "-1", "-4"},
+ {"39049204923049203490234", "-39049204923049203490230", "-1", "4"},
+ // some other numbers
+ {"13940239402394034213904", "49850", "279643719205497175", "40154"},
+ {"-9049594859482398349", "-3401", "2660862940159482", "-67"},
+ // proper rounding for positive numbers
+ {"3", "2", "1", "1"},
+ {"9304", "3", "3101", "1"},
+ {"394093", "11", "35826", "7"},
+ // proper rounding for positive results (negative numbers)
+ {"-3", "-2", "1", "-1"},
+ {"-9304", "-3", "3101", "-1"},
+ {"-394093", "-11", "35826", "-7"},
+ // proper rounding for positive / negative (towards zero)
+ {"-3", "2", "-1", "-1"},
+ {"-9304", "3", "-3101", "-1"},
+ {"-394093", "11", "-35826", "-7"},
+ // proper rounding for negative / positive (towards zero)
+ {"3", "-2", "-1", "1"},
+ {"9304", "-3", "-3101", "1"},
+ {"394093", "-11", "-35826", "7"},
+ };
+
+
+ for (size_t i = 0; i < ARRAY_SIZE(entries); ++i)
+ {
+ const test_entry& e = entries[i];
+
+ number rem;
+
+ BOOST_CHECK_EQUAL(div(number(e.lhs), number(e.rhs), rem), number(e.result));
+ BOOST_CHECK_EQUAL(rem, number(e.rem));
+ }
+ }
+
+ // sqrt
+ {
+ // zero
+ BOOST_CHECK_EQUAL(sqrt(number(0)), 0);
+ // perfect squares
+ BOOST_CHECK_EQUAL(sqrt(number(1)), 1);
+ BOOST_CHECK_EQUAL(sqrt(number(1048576)), 1024);
+ BOOST_CHECK_EQUAL(sqrt(number("80626033399934169")), 283947237);
+ // slightly more
+ BOOST_CHECK_EQUAL(sqrt(number(2)), 1);
+ BOOST_CHECK_EQUAL(sqrt(number(1048577)), 1024);
+ BOOST_CHECK_EQUAL(sqrt(number("80626033399934170")), 283947237);
+ // slightly less
+ BOOST_CHECK_EQUAL(sqrt(number(1048575)), 1023);
+ BOOST_CHECK_EQUAL(sqrt(number("80626033399934168")), 283947236);
+ // random numbers
+ BOOST_CHECK_EQUAL(sqrt(number("2138948239482394")), 46248764);
+ BOOST_CHECK_EQUAL(sqrt(number("93458908293847283478234234")), number("9667414767860"));
+ }
+}
+
+int test_main(int argc, char* argv[])
+{
+ test<boost::detail::bigint_gmp_implementation>();
+
+ return 0;
+}

Added: sandbox/SOC/2007/bigint/libs/bigint/test/serialization.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/serialization.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,65 @@
+/* Boost serialization.cpp test file
+ *
+ * Copyright 2007 Arseny Kapoulkine
+ *
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or
+ * copy at http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#define BOOST_DISABLE_WIN32
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+#include <boost/bigint/bigint.hpp>
+#include <boost/bigint/bigint_serialize.hpp>
+
+#include <sstream>
+
+#include <boost/archive/xml_iarchive.hpp>
+#include <boost/archive/xml_oarchive.hpp>
+
+#pragma comment(lib, "libgmp-3.lib")
+
+template <typename I> void test_number(const char* value)
+{
+ typedef boost::bigint_base<I> number;
+
+ number a(value);
+ std::stringstream ss;
+
+ BOOST_CHECK_EQUAL(a.str(), value);
+
+ // make an archive
+ boost::archive::xml_oarchive oa(ss);
+ oa << BOOST_SERIALIZATION_NVP(a);
+
+ BOOST_CHECK_EQUAL(a.str(), value);
+
+ a = number("1390139412349084098234098034958039485049589045340912304912304");
+ BOOST_CHECK(a.str() != value);
+
+ boost::archive::xml_iarchive ia(ss);
+ ia >> BOOST_SERIALIZATION_NVP(a);
+
+ BOOST_CHECK_EQUAL(a.str(), value);
+}
+
+template <typename I> void test()
+{
+ // small
+ test_number<I>("1");
+ test_number<I>("0");
+ test_number<I>("-1");
+
+ // big
+ test_number<I>("-1402341340123481239481902384190234801923480123848091234");
+ test_number<I>("20459234592043729834379238457823453409523049453848091234");
+}
+
+int test_main(int argc, char* argv[])
+{
+ test<boost::detail::bigint_gmp_implementation>();
+
+ return 0;
+}

Modified: sandbox/SOC/2007/bigint/libs/bigint/todo.txt
==============================================================================
--- sandbox/SOC/2007/bigint/libs/bigint/todo.txt (original)
+++ sandbox/SOC/2007/bigint/libs/bigint/todo.txt 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -156,11 +156,11 @@
 + test stream input/output
 Status: implemented
 
-- test abs, pow, ldiv, sqrt
-Status: needs implementing
++ test serialization
+Status: implemented
 
-- test serialization
-Status: needs implementing
++ test abs, pow, ldiv, sqrt
+Status: implemented
 
 - Is it possible to test cases when bigint must cause illegal operations (division by zero, sqrt(negative number))?
 Status: needs investigation
@@ -186,3 +186,4 @@
 - make GMP work with arbitrary storage strategy (and perhaps enforce supporting arbitrary strategy in future implementations)
 - getting several bits from an integer (say, 7 bits from 4859-th one). Perhaps, assigning several bits.
 - conversion from/to floating point (float, double, long double)
+- other styles of division (for now there's only truncating; floor and/or ceil perhaps?) & modulo

Added: sandbox/SOC/2007/bigint/libs/detail/utf8_codecvt_facet.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/detail/utf8_codecvt_facet.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,269 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// utf8_codecvt_facet.cpp
+
+// Copyright © 2001 Ronald Garcia, Indiana University (garcia_at_[hidden])
+// Andrew Lumsdaine, Indiana University (lums_at_[hidden]).
+// 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)
+
+// Please see the comments in <boost/detail/utf8_codecvt_facet.hpp> to
+// learn how this file should be used.
+
+#include <boost/detail/utf8_codecvt_facet.hpp>
+
+#include <cstdlib> // for multi-byte converson routines
+#include <cassert>
+
+#include <boost/limits.hpp>
+#include <boost/config.hpp>
+
+// If we don't have wstring, then Unicode support
+// is not available anyway, so we don't need to even
+// compiler this file. This also fixes the problem
+// with mingw, which can compile this file, but will
+// generate link error when building DLL.
+#ifndef BOOST_NO_STD_WSTRING
+
+BOOST_UTF8_BEGIN_NAMESPACE
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// implementation for wchar_t
+
+// Translate incoming UTF-8 into UCS-4
+std::codecvt_base::result utf8_codecvt_facet::do_in(
+ std::mbstate_t& /*state*/,
+ const char * from,
+ const char * from_end,
+ const char * & from_next,
+ wchar_t * to,
+ wchar_t * to_end,
+ wchar_t * & to_next
+) const {
+ // Basic algorithm: The first octet determines how many
+ // octets total make up the UCS-4 character. The remaining
+ // "continuing octets" all begin with "10". To convert, subtract
+ // the amount that specifies the number of octets from the first
+ // octet. Subtract 0x80 (1000 0000) from each continuing octet,
+ // then mash the whole lot together. Note that each continuing
+ // octet only uses 6 bits as unique values, so only shift by
+ // multiples of 6 to combine.
+ while (from != from_end && to != to_end) {
+
+ // Error checking on the first octet
+ if (invalid_leading_octet(*from)){
+ from_next = from;
+ to_next = to;
+ return std::codecvt_base::error;
+ }
+
+ // The first octet is adjusted by a value dependent upon
+ // the number of "continuing octets" encoding the character
+ const int cont_octet_count = get_cont_octet_count(*from);
+ const wchar_t octet1_modifier_table[] = {
+ 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
+ };
+
+ // The unsigned char conversion is necessary in case char is
+ // signed (I learned this the hard way)
+ wchar_t ucs_result =
+ (unsigned char)(*from++) - octet1_modifier_table[cont_octet_count];
+
+ // Invariants :
+ // 1) At the start of the loop, 'i' continuing characters have been
+ // processed
+ // 2) *from points to the next continuing character to be processed.
+ int i = 0;
+ while(i != cont_octet_count && from != from_end) {
+
+ // Error checking on continuing characters
+ if (invalid_continuing_octet(*from)) {
+ from_next = from;
+ to_next = to;
+ return std::codecvt_base::error;
+ }
+
+ ucs_result *= (1 << 6);
+
+ // each continuing character has an extra (10xxxxxx)b attached to
+ // it that must be removed.
+ ucs_result += (unsigned char)(*from++) - 0x80;
+ ++i;
+ }
+
+ // If the buffer ends with an incomplete unicode character...
+ if (from == from_end && i != cont_octet_count) {
+ // rewind "from" to before the current character translation
+ from_next = from - (i+1);
+ to_next = to;
+ return std::codecvt_base::partial;
+ }
+ *to++ = ucs_result;
+ }
+ from_next = from;
+ to_next = to;
+
+ // Were we done converting or did we run out of destination space?
+ if(from == from_end) return std::codecvt_base::ok;
+ else return std::codecvt_base::partial;
+}
+
+std::codecvt_base::result utf8_codecvt_facet::do_out(
+ std::mbstate_t& /*state*/,
+ const wchar_t * from,
+ const wchar_t * from_end,
+ const wchar_t * & from_next,
+ char * to,
+ char * to_end,
+ char * & to_next
+) const
+{
+ // RG - consider merging this table with the other one
+ const wchar_t octet1_modifier_table[] = {
+ 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
+ };
+
+ wchar_t max_wchar = (std::numeric_limits<wchar_t>::max)();
+ while (from != from_end && to != to_end) {
+
+ // Check for invalid UCS-4 character
+ if (*from > max_wchar) {
+ from_next = from;
+ to_next = to;
+ return std::codecvt_base::error;
+ }
+
+ int cont_octet_count = get_cont_octet_out_count(*from);
+
+ // RG - comment this formula better
+ int shift_exponent = (cont_octet_count) * 6;
+
+ // Process the first character
+ *to++ = octet1_modifier_table[cont_octet_count] +
+ (unsigned char)(*from / (1 << shift_exponent));
+
+ // Process the continuation characters
+ // Invariants: At the start of the loop:
+ // 1) 'i' continuing octets have been generated
+ // 2) '*to' points to the next location to place an octet
+ // 3) shift_exponent is 6 more than needed for the next octet
+ int i = 0;
+ while (i != cont_octet_count && to != to_end) {
+ shift_exponent -= 6;
+ *to++ = 0x80 + ((*from / (1 << shift_exponent)) % (1 << 6));
+ ++i;
+ }
+ // If we filled up the out buffer before encoding the character
+ if(to == to_end && i != cont_octet_count) {
+ from_next = from;
+ to_next = to - (i+1);
+ return std::codecvt_base::partial;
+ }
+ *from++;
+ }
+ from_next = from;
+ to_next = to;
+ // Were we done or did we run out of destination space
+ if(from == from_end) return std::codecvt_base::ok;
+ else return std::codecvt_base::partial;
+}
+
+// How many char objects can I process to get <= max_limit
+// wchar_t objects?
+int utf8_codecvt_facet::do_length(
+ BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
+ const char * from,
+ const char * from_end,
+ std::size_t max_limit
+#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
+) const throw()
+#else
+) const
+#endif
+{
+ // RG - this code is confusing! I need a better way to express it.
+ // and test cases.
+
+ // Invariants:
+ // 1) last_octet_count has the size of the last measured character
+ // 2) char_count holds the number of characters shown to fit
+ // within the bounds so far (no greater than max_limit)
+ // 3) from_next points to the octet 'last_octet_count' before the
+ // last measured character.
+ int last_octet_count=0;
+ std::size_t char_count = 0;
+ const char* from_next = from;
+ // Use "<" because the buffer may represent incomplete characters
+ while (from_next+last_octet_count <= from_end && char_count <= max_limit) {
+ from_next += last_octet_count;
+ last_octet_count = (get_octet_count(*from_next));
+ ++char_count;
+ }
+ return from_next-from_end;
+}
+
+unsigned int utf8_codecvt_facet::get_octet_count(
+ unsigned char lead_octet
+){
+ // if the 0-bit (MSB) is 0, then 1 character
+ if (lead_octet <= 0x7f) return 1;
+
+ // Otherwise the count number of consecutive 1 bits starting at MSB
+// assert(0xc0 <= lead_octet && lead_octet <= 0xfd);
+
+ if (0xc0 <= lead_octet && lead_octet <= 0xdf) return 2;
+ else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3;
+ else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4;
+ else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5;
+ else return 6;
+}
+BOOST_UTF8_END_NAMESPACE
+
+namespace {
+template<std::size_t s>
+int get_cont_octet_out_count_impl(wchar_t word){
+ if (word < 0x80) {
+ return 0;
+ }
+ if (word < 0x800) {
+ return 1;
+ }
+ return 2;
+}
+
+// note the following code will generate on some platforms where
+// wchar_t is defined as UCS2. The warnings are superfluous as
+// the specialization is never instantitiated with such compilers.
+template<>
+int get_cont_octet_out_count_impl<4>(wchar_t word){
+ if (word < 0x80) {
+ return 0;
+ }
+ if (word < 0x800) {
+ return 1;
+ }
+ if (word < 0x10000) {
+ return 2;
+ }
+ if (word < 0x200000) {
+ return 3;
+ }
+ if (word < 0x4000000) {
+ return 4;
+ }
+ return 5;
+}
+
+} // namespace anonymous
+
+BOOST_UTF8_BEGIN_NAMESPACE
+// How many "continuing octets" will be needed for this word
+// == total octets - 1.
+int utf8_codecvt_facet::get_cont_octet_out_count(
+ wchar_t word
+) const {
+ return get_cont_octet_out_count_impl<sizeof(wchar_t)>(word);
+}
+BOOST_UTF8_END_NAMESPACE
+
+#endif

Added: sandbox/SOC/2007/bigint/libs/serialization/build/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/build/Jamfile.v2 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,70 @@
+# Boost serialization Library Build Jamfile
+# (C) Copyright Robert Ramey 2002-2004.
+# Use, modification, and distribution are subject to the
+# Boost Software License, Version 1.0. (See accompanying file
+# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+#
+# See http://www.boost.org/libs/serialization for the library home page.
+
+project boost/serialization
+ : source-location ../src
+ ;
+
+SOURCES =
+ basic_archive
+ basic_archive_impl
+ basic_iarchive
+ basic_oarchive
+ basic_iserializer
+ basic_oserializer
+ basic_pointer_iserializer
+ basic_pointer_oserializer
+ basic_serializer_map
+ basic_text_iprimitive
+ basic_text_oprimitive
+ basic_xml_archive
+ binary_iarchive
+ binary_oarchive
+ extended_type_info
+ extended_type_info_no_rtti
+ extended_type_info_typeid
+ polymorphic_iarchive
+ polymorphic_oarchive
+ stl_port
+ text_iarchive
+ text_oarchive
+ void_cast
+ xml_grammar
+ xml_iarchive
+ xml_oarchive
+;
+
+WSOURCES =
+ codecvt_null
+ utf8_codecvt_facet
+ basic_text_wiprimitive
+ basic_text_woprimitive
+ binary_wiarchive
+ binary_woarchive
+ text_wiarchive
+ text_woarchive
+ xml_wgrammar
+ xml_wiarchive
+ xml_woarchive
+;
+
+lib boost_serialization
+ : $(SOURCES).cpp
+ : <toolset>msvc:<cxxflags>/Gy
+ <link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
+ :
+ : <link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
+ ;
+
+lib boost_wserialization
+ : $(WSOURCES).cpp boost_serialization
+ : <toolset>msvc:<cxxflags>/Gy
+ <link>shared:<define>BOOST_WSERIALIZATION_DYN_LINK=1
+ :
+ : <link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
+ ;

Added: sandbox/SOC/2007/bigint/libs/serialization/build/serialization.jam
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/build/serialization.jam 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,126 @@
+# Boost serialization Library Build Jamfile
+# (C) Copyright Robert Ramey 2002-2004.
+# Use, modification, and distribution are subject to the
+# Boost Software License, Version 1.0. (See accompanying file
+# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+#
+# See http://www.boost.org/libs/serialization for the library home page.
+
+# building this library needs a working version of spirit
+rule toolset::require-boost-spirit-support ( toolset variant : subvariant-path properties * )
+{
+ local requires-spirit = false ;
+ switch $(toolset) {
+ case "borland*" :
+ requires-spirit = true ;
+ case "msvc*" :
+ requires-spirit = true ;
+ case "iw*" :
+ requires-spirit = true ;
+ case "vc-6*" :
+ requires-spirit = true ;
+ case "vc7*" :
+ requires-spirit = true ;
+ case "vc-7_0*" :
+ requires-spirit = true ;
+ case "gcc-2*" :
+ requires-spirit = true ;
+ }
+ if $(requires-spirit) = true {
+ if $(SPIRIT_ROOT) # && ( exist $(SPIRIT_ROOT) )
+ {
+ properties += <include>$(SPIRIT_ROOT) ;
+ }
+ else {
+ echo **** spirit 1.6x required to build library with this compiler **** ;
+ properties = [ impose-requirements $(properties) : <build>no ] ;
+ }
+ }
+ return $(subvariant-path) $(properties) ;
+}
+
+# certain tool sets are known apriori not to support wide char i/o
+rule toolset::require-wide-char-io-support ( toolset variant : subvariant-path properties * )
+{
+ switch $(toolset) {
+ case "*cygwin" :
+ echo **** wide char i/o not supported by cygwin gcc library **** ;
+ properties = [ impose-requirements $(properties) : <build>no ] ;
+
+ case "como*" :
+ echo **** wide char i/o not supported by libcomo standard library **** ;
+ properties = [ impose-requirements $(properties) : <build>no ] ;
+ case "mingw*" :
+ if ! [ MATCH "^([5][.][0])$" : [ get-values <stlport-version> : $(properties) ] ]
+ {
+ echo **** wide char i/o not supported by the mingw standard library **** ;
+ properties = [ impose-requirements $(properties) : <build>no ] ;
+ }
+ }
+ return $(subvariant-path) $(properties) ;
+}
+
+# certain tool sets are known apriori not to support creation of DLLS
+rule toolset::require-shared-libraries-support ( toolset variant : subvariant-path properties * )
+{
+ switch $(toolset) {
+ case "como*" :
+ echo **** DLLs cannot be built with this compiler **** ;
+ properties = [ impose-requirements $(properties) : <build>no ] ;
+ case "msvc-stlport*" :
+ echo **** DLLs cannot be built with this compiler and stlport 4.x **** ;
+ properties = [ impose-requirements $(properties) : <build>no ] ;
+ case "vc-6_5-stlport*" :
+ echo **** DLLs cannot be built with this compiler and stlport 4.x **** ;
+ properties = [ impose-requirements $(properties) : <build>no ] ;
+ case "cw*" :
+ local runtime-link = [ get-values <runtime-link> : $(properties) ] ;
+ if static in $(runtime-link) {
+ echo **** DLLS cannot be built with static runtime linking **** ;
+ properties = [ impose-requirements $(properties) : <build>no ] ;
+ }
+
+ }
+ return $(subvariant-path) $(properties) ;
+}
+
+# certain tool sets display warnings which are not applicable to the serialization library
+rule toolset::suppress-warnings ( toolset variant : subvariant-path properties * )
+{
+ switch $(toolset) {
+ case "vc-8*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-wd4996" ] ;
+ case "*cygwin*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-Wno-non-virtual-dtor -Wno-ctor-dtor-privacy" ] ;
+ case "gcc*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-Wno-non-virtual-dtor -Wno-ctor-dtor-privacy" ] ;
+ case "mingw*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-Wno-non-virtual-dtor -Wno-ctor-dtor-privacy" ] ;
+ case "borland*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-w-8080 -w-8071 -w-8057 -w-8062 -w-8008 -w-0018 -w-8066" ] ;
+ }
+ return $(subvariant-path) $(properties) ;
+}
+
+# set optimization switches for certain toolsets. We do it here rather than in the
+# Jamfile requirements because here we can use a regex for the compiler name.
+rule toolset::optimizations ( toolset variant : subvariant-path properties * )
+{
+ switch $(toolset) {
+ case "vc*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-Gy" ] ;
+ case "msvc*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-Gy" ] ;
+ case "gcc*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-ftemplate-depth-255" ] ;
+ case "qcc*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-ftemplate-depth-255" ] ;
+ case "QCC*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-ftemplate-depth-255" ] ;
+ case "mingw*" :
+ properties = [ impose-requirements $(properties) : <cxxflags>"-ftemplate-depth-255" ] ;
+ }
+ return $(subvariant-path) $(properties) ;
+}
+
+

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_archive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_archive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,63 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_archive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+//////////////////////////////////////////////////////////////////////
+//
+// objects are stored as
+//
+// class_id* // -1 for a null pointer
+// if a new class id
+// [
+// exported key - class name*
+// tracking level - always/never
+// file version
+// ]
+//
+// if tracking
+// [
+// object_id
+// ]
+//
+// [ // if a new object id
+// data...
+// ]
+//
+// * required only for pointers - optional for objects
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/basic_archive.hpp>
+
+namespace boost {
+namespace archive {
+
+///////////////////////////////////////////////////////////////////////
+// constants used in archive signature
+//This should never ever change. note that is not an std::string
+// string.
+BOOST_ARCHIVE_DECL(const char *)
+ARCHIVE_SIGNATURE(){
+ return "serialization::archive";
+}
+
+// this should change if the capabilities are added to the library
+// such that archives can be created which can't be read by previous
+// versions of this library
+// 1 - initial version
+// 2 - made address tracking optional
+// 3 - numerous changes - can't guarentee compatibility with previous versions
+// 4 - Boost 1.34
+// added register_version to properly support versioning for collections
+BOOST_ARCHIVE_DECL(unsigned char)
+ARCHIVE_VERSION(){
+ return 4;
+}
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_archive_impl.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_archive_impl.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,46 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_archive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+#include <utility>
+#include <boost/shared_ptr.hpp>
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/detail/auto_link_archive.hpp>
+#include <boost/archive/detail/basic_archive_impl.hpp>
+
+namespace boost {
+namespace archive {
+namespace detail {
+
+BOOST_ARCHIVE_DECL(void)
+basic_archive_impl::lookup_helper(
+ const boost::serialization::extended_type_info * const eti,
+ shared_ptr<void> & sph
+){
+ helper_iterator it;
+ const helper_type ht(sph, eti);
+ it = m_helpers.find(ht);
+ if(it == m_helpers.end())
+ sph.reset();
+ else
+ sph = it->m_helper;
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_archive_impl::insert_helper(
+ const boost::serialization::extended_type_info * const eti,
+ shared_ptr<void> & sph
+){
+ const helper_type ht(sph, eti);
+ std::pair<helper_iterator, bool> result = m_helpers.insert(ht);
+}
+
+} // namespace detail
+} // namespace serialization
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_iarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_iarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,612 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_archive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings
+
+#include <cassert>
+#include <set>
+#include <list>
+#include <vector>
+#include <cstddef> // size_t
+
+#include <boost/config.hpp>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::size_t;
+} // namespace std
+#endif
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/detail/auto_link_archive.hpp>
+
+#include <boost/limits.hpp>
+#include <boost/state_saver.hpp>
+#include <boost/throw_exception.hpp>
+
+#include <boost/archive/detail/basic_iserializer.hpp>
+#include <boost/archive/detail/basic_pointer_iserializer.hpp>
+#include <boost/archive/detail/basic_iarchive.hpp>
+#include <boost/archive/detail/basic_archive_impl.hpp>
+#include <boost/archive/archive_exception.hpp>
+
+#include <boost/serialization/tracking.hpp>
+#include <boost/serialization/extended_type_info.hpp>
+
+using namespace boost::serialization;
+
+namespace boost {
+namespace archive {
+namespace detail {
+
+class basic_iserializer;
+class basic_pointer_iserializer;
+
+class basic_iarchive_impl :
+ public basic_archive_impl
+{
+ friend class basic_iarchive;
+
+ version_type m_archive_library_version;
+ unsigned int m_flags;
+
+ //////////////////////////////////////////////////////////////////////
+ // information about each serialized object loaded
+ // indexed on object_id
+ struct aobject
+ {
+ void * address;
+ class_id_type class_id;
+ aobject(
+ void *a,
+ class_id_type class_id_
+ ) :
+ address(a),
+ class_id(class_id_)
+ {}
+ aobject() : address(NULL), class_id(-2) {}
+ };
+ typedef std::vector<aobject> object_id_vector_type;
+ object_id_vector_type object_id_vector;
+
+ //////////////////////////////////////////////////////////////////////
+ // used to implement the reset_object_address operation.
+ // list of objects which might be moved. We use a vector for implemenation
+ // in the hope the the truncation operation will be faster than either
+ // with a list or stack adaptor
+ object_id_type moveable_objects_start;
+ object_id_type moveable_objects_end;
+ object_id_type moveable_objects_recent;
+
+ void reset_object_address(
+ const void * new_address,
+ const void *old_address
+ );
+
+ //////////////////////////////////////////////////////////////////////
+ // used by load object to look up class id given basic_serializer
+ struct cobject_type
+ {
+ const basic_iserializer * bis;
+ const class_id_type class_id;
+ cobject_type(
+ class_id_type class_id_,
+ const basic_iserializer & bis_
+ ) :
+ bis(& bis_),
+ class_id(class_id_)
+ {}
+ cobject_type(const cobject_type & rhs) :
+ bis(rhs.bis),
+ class_id(rhs.class_id)
+ {}
+ // the following cannot be defined because of the const
+ // member. This will generate a link error if an attempt
+ // is made to assign. This should never be necessary
+ cobject_type & operator=(const cobject_type & rhs);
+ bool operator<(const cobject_type &rhs) const
+ {
+ return *bis < *(rhs.bis);
+ }
+ };
+ typedef std::set<cobject_type> cobject_info_set_type;
+ cobject_info_set_type cobject_info_set;
+
+ //////////////////////////////////////////////////////////////////////
+ // information about each serialized class indexed on class_id
+ class cobject_id
+ {
+ public:
+ cobject_id & operator=(const cobject_id & rhs){
+ bis_ptr = rhs.bis_ptr;
+ bpis_ptr = rhs.bpis_ptr;
+ file_version = rhs.file_version;
+ tracking_level = rhs.tracking_level;
+ initialized = rhs.initialized;
+ return *this;
+ }
+ const basic_iserializer * bis_ptr;
+ const basic_pointer_iserializer * bpis_ptr;
+ version_type file_version;
+ tracking_type tracking_level;
+ bool initialized;
+
+ cobject_id(const basic_iserializer & bis_) :
+ bis_ptr(& bis_),
+ bpis_ptr(NULL),
+ file_version(0),
+ tracking_level(track_never),
+ initialized(false)
+ {}
+ cobject_id(const cobject_id &rhs):
+ bis_ptr(rhs.bis_ptr),
+ bpis_ptr(rhs.bpis_ptr),
+ file_version(rhs.file_version),
+ tracking_level(rhs.tracking_level),
+ initialized(rhs.initialized)
+ {}
+ };
+ typedef std::vector<cobject_id> cobject_id_vector_type;
+ cobject_id_vector_type cobject_id_vector;
+
+ //////////////////////////////////////////////////////////////////////
+ // list of objects created by de-serialization. Used to implement
+ // clean up after exceptions.
+ class created_pointer_type
+ {
+ public:
+ created_pointer_type(
+ class_id_type class_id_,
+ void * address_
+ ) :
+ class_id(class_id_),
+ address(address_)
+ {}
+ created_pointer_type(const created_pointer_type &rhs) :
+ class_id(rhs.class_id),
+ address(rhs.address)
+ {}
+ created_pointer_type & operator=(const created_pointer_type &){
+ assert(false);
+ return *this;
+ }
+ void * get_address() const {
+ return address;
+ }
+ // object to which this item refers
+ const class_id_type class_id;
+ private:
+ void * address;
+ };
+
+ std::list<created_pointer_type> created_pointers;
+
+ //////////////////////////////////////////////////////////////////////
+ // address of the most recent object serialized as a poiner
+ // whose data itself is now pending serialization
+ void * pending_object;
+ const basic_iserializer * pending_bis;
+ version_type pending_version;
+
+ basic_iarchive_impl(unsigned int flags) :
+ m_archive_library_version(ARCHIVE_VERSION()),
+ m_flags(flags),
+ moveable_objects_start(0),
+ moveable_objects_end(0),
+ pending_object(NULL),
+ pending_bis(NULL),
+ pending_version(0)
+ {}
+ ~basic_iarchive_impl(){}
+ void set_library_version(unsigned int archive_library_version){
+ m_archive_library_version = archive_library_version;
+ }
+ bool
+ track(
+ basic_iarchive & ar,
+ void * & t
+ );
+ void
+ load_preamble(
+ basic_iarchive & ar,
+ cobject_id & co
+ );
+ class_id_type register_type(
+ const basic_iserializer & bis
+ );
+
+ // redirect through virtual functions to load functions for this archive
+ template<class T>
+ void load(basic_iarchive & ar, T & t){
+ ar.vload(t);
+ }
+
+//public:
+ void
+ next_object_pointer(void * t){
+ pending_object = t;
+ }
+ void delete_created_pointers();
+ class_id_type register_type(
+ const basic_pointer_iserializer & bpis
+ );
+ void load_object(
+ basic_iarchive & ar,
+ void * t,
+ const basic_iserializer & bis
+ );
+ const basic_pointer_iserializer * load_pointer(
+ basic_iarchive & ar,
+ void * & t,
+ const basic_pointer_iserializer * bpis,
+ const basic_pointer_iserializer * (*finder)(
+ const boost::serialization::extended_type_info & type
+ )
+ );
+};
+
+inline void
+basic_iarchive_impl::reset_object_address(
+ const void * new_address,
+ const void *old_address
+){
+ object_id_type i;
+ // this code handles a couple of situations.
+ // a) where reset_object_address is applied to an untracked object.
+ // In such a case the call is really superfluous and its really an
+ // an error. But we don't have access to the types here so we can't
+ // know that. However, this code will effectively turn this situation
+ // into a no-op and every thing will work fine - albeat with a small
+ // execution time penalty.
+ // b) where the call to reset_object_address doesn't immediatly follow
+ // the << operator to which it corresponds. This would be a bad idea
+ // but the code may work anyway. Naturally, a bad practice on the part
+ // of the programmer but we can't detect it - as above. So maybe we
+ // can save a few more people from themselves as above.
+ for(i = moveable_objects_recent; i < moveable_objects_end; ++i){
+ if(old_address == object_id_vector[i].address)
+ break;
+ }
+ for(; i < moveable_objects_end; ++i){
+
+ // calculate displacement from this level
+ // warning - pointer arithmetic on void * is in herently non-portable
+ // but expected to work on all platforms in current usage
+ if(object_id_vector[i].address > old_address){
+ std::size_t member_displacement
+ = reinterpret_cast<std::size_t>(object_id_vector[i].address)
+ - reinterpret_cast<std::size_t>(old_address);
+ object_id_vector[i].address = reinterpret_cast<void *>(
+ reinterpret_cast<std::size_t>(new_address) + member_displacement
+ );
+ }
+ else{
+ std::size_t member_displacement
+ = reinterpret_cast<std::size_t>(old_address)
+ - reinterpret_cast<std::size_t>(object_id_vector[i].address);
+ object_id_vector[i].address = reinterpret_cast<void *>(
+ reinterpret_cast<std::size_t>(new_address) - member_displacement
+ );
+ }
+ ++i;
+ }
+}
+
+inline void
+basic_iarchive_impl::delete_created_pointers()
+{
+ while(! created_pointers.empty()){
+ const created_pointer_type & cp = created_pointers.front();
+
+ // figure out the class of the object to be deleted
+ // note: extra line used to evade borland issue
+ const int id = cp.class_id;
+ const cobject_id & co = cobject_id_vector[id];
+ // with the appropriate input serializer,
+ // delete the indicated object
+ co.bis_ptr->destroy(cp.get_address());
+ created_pointers.pop_front();
+ }
+}
+
+inline class_id_type
+basic_iarchive_impl::register_type(
+ const basic_iserializer & bis
+){
+ class_id_type id(static_cast<int>(cobject_info_set.size()));
+ cobject_type co(id, bis);
+ std::pair<cobject_info_set_type::const_iterator, bool>
+ result = cobject_info_set.insert(co);
+
+ if(result.second){
+ cobject_id_vector.push_back(cobject_id(bis));
+ assert(cobject_info_set.size() == cobject_id_vector.size());
+ }
+ id = result.first->class_id;
+ // borland complains without this minor hack
+ const int tid = id;
+ cobject_id & coid = cobject_id_vector[tid];
+ coid.bpis_ptr = bis.get_bpis_ptr();
+ return id;
+}
+
+void
+basic_iarchive_impl::load_preamble(
+ basic_iarchive & ar,
+ cobject_id & co
+){
+ if(! co.initialized){
+ if(co.bis_ptr->class_info()){
+ class_id_optional_type cid;
+ load(ar, cid); // to be thrown away
+ load(ar, co.tracking_level);
+ load(ar, co.file_version);
+ }
+ else{
+ // override tracking with indicator from class information
+ co.tracking_level = co.bis_ptr->tracking(m_flags);
+ co.file_version = version_type(
+ co.bis_ptr->version()
+ );
+ }
+ co.initialized = true;
+ }
+}
+
+bool
+basic_iarchive_impl::track(
+ basic_iarchive & ar,
+ void * & t
+){
+ object_id_type oid;
+ load(ar, oid);
+
+ // if its a reference to a old object
+ if(object_id_type(object_id_vector.size()) > oid){
+ // we're done
+ t = object_id_vector[oid].address;
+ return false;
+ }
+ return true;
+}
+
+inline void
+basic_iarchive_impl::load_object(
+ basic_iarchive & ar,
+ void * t,
+ const basic_iserializer & bis
+){
+ // if its been serialized through a pointer and the preamble's been done
+ if(t == pending_object && & bis == pending_bis){
+ // read data
+ (bis.load_object_data)(ar, t, pending_version);
+ return;
+ }
+
+ const class_id_type cid = register_type(bis);
+ // note: extra line used to evade borland issue
+ const int id = cid;
+ cobject_id & co = cobject_id_vector[id];
+
+ load_preamble(ar, co);
+
+ // save the current move stack position in case we want to truncate it
+ boost::state_saver<object_id_type> w(moveable_objects_start);
+
+ // note: extra line used to evade borland issue
+ const bool tracking = co.tracking_level;
+
+ object_id_type this_id;
+ moveable_objects_start =
+ this_id = object_id_vector.size();
+
+ // if we tracked this object when the archive was saved
+ if(tracking){
+ // if it was already read
+ if(!track(ar, t))
+ // we're done
+ return;
+ // add a new enty into the tracking list
+ object_id_vector.push_back(aobject(t, cid));
+ // and add an entry for this object
+ moveable_objects_end = object_id_vector.size();
+ }
+ // read data
+ (bis.load_object_data)(ar, t, co.file_version);
+ moveable_objects_recent = this_id;
+}
+
+inline const basic_pointer_iserializer *
+basic_iarchive_impl::load_pointer(
+ basic_iarchive &ar,
+ void * & t,
+ const basic_pointer_iserializer * bpis_ptr,
+ const basic_pointer_iserializer * (*finder)(
+ const boost::serialization::extended_type_info & type_
+ )
+){
+ class_id_type cid;
+ load(ar, cid);
+
+ if(NULL_POINTER_TAG == cid){
+ t = NULL;
+ return bpis_ptr;
+ }
+
+ // if its a new class type - i.e. never been registered
+ if(class_id_type(cobject_info_set.size()) <= cid){
+ // if its either abstract
+ if(NULL == bpis_ptr
+ // or polymorphic
+ || bpis_ptr->get_basic_serializer().is_polymorphic()){
+ // is must have been exported
+ char key[BOOST_SERIALIZATION_MAX_KEY_SIZE];
+ class_name_type class_name(key);
+ load(ar, class_name);
+ // if it has a class name
+ const serialization::extended_type_info *eti = NULL;
+ if(0 != key[0])
+ eti = serialization::extended_type_info::find(key);
+ if(NULL == eti)
+ boost::throw_exception(
+ archive_exception(archive_exception::unregistered_class)
+ );
+ bpis_ptr = (*finder)(*eti);
+ }
+ assert(NULL != bpis_ptr);
+ class_id_type new_cid = register_type(bpis_ptr->get_basic_serializer());
+ int i = cid;
+ cobject_id_vector[i].bpis_ptr = bpis_ptr;
+ assert(new_cid == cid);
+ }
+ int i = cid;
+ cobject_id & co = cobject_id_vector[i];
+ bpis_ptr = co.bpis_ptr;
+
+ load_preamble(ar, co);
+
+ // extra line to evade borland issue
+ const bool tracking = co.tracking_level;
+ // if we're tracking and the pointer has already been read
+ if(tracking && ! track(ar, t))
+ // we're done
+ return bpis_ptr;
+
+ // save state
+ state_saver<object_id_type> w_start(moveable_objects_start);
+
+ if(! tracking){
+ bpis_ptr->load_object_ptr(ar, t, co.file_version);
+ }
+ else{
+ state_saver<void *> x(pending_object);
+ state_saver<const basic_iserializer *> y(pending_bis);
+ state_saver<version_type> z(pending_version);
+
+ pending_bis = & bpis_ptr->get_basic_serializer();
+ pending_version = co.file_version;
+
+ // predict next object id to be created
+ const unsigned int ui = object_id_vector.size();
+
+ state_saver<object_id_type> w_end(moveable_objects_end);
+
+ // because the following operation could move the items
+ // don't use co after this
+ // add to list of serialized objects so that we can properly handle
+ // cyclic strucures
+ object_id_vector.push_back(aobject(t, cid));
+
+ bpis_ptr->load_object_ptr(
+ ar,
+ object_id_vector[ui].address,
+ co.file_version
+ );
+ t = object_id_vector[ui].address;
+ assert(NULL != t);
+
+ // and add to list of created pointers
+ created_pointers.push_back(created_pointer_type(cid, t));
+ }
+
+ return bpis_ptr;
+}
+
+//////////////////////////////////////////////////////////////////////
+// implementation of basic_iarchive functions
+
+BOOST_ARCHIVE_DECL(void)
+basic_iarchive::next_object_pointer(void *t){
+ pimpl->next_object_pointer(t);
+}
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_iarchive::basic_iarchive(unsigned int flags) :
+ pimpl(new basic_iarchive_impl(flags))
+{}
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_iarchive::~basic_iarchive()
+{
+ delete pimpl;
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_iarchive::set_library_version(unsigned int archive_library_version){
+ pimpl->set_library_version(archive_library_version);
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_iarchive::reset_object_address(
+ const void * new_address,
+ const void * old_address
+){
+ pimpl->reset_object_address(new_address, old_address);
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_iarchive::load_object(
+ void *t,
+ const basic_iserializer & bis
+){
+ pimpl->load_object(*this, t, bis);
+}
+
+// load a pointer object
+BOOST_ARCHIVE_DECL(const basic_pointer_iserializer *)
+basic_iarchive::load_pointer(
+ void * &t,
+ const basic_pointer_iserializer * bpis_ptr,
+ const basic_pointer_iserializer * (*finder)(
+ const boost::serialization::extended_type_info & type_
+ )
+){
+ return pimpl->load_pointer(*this, t, bpis_ptr, finder);
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_iarchive::register_basic_serializer(const basic_iserializer & bis){
+ pimpl->register_type(bis);
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_iarchive::lookup_basic_helper(
+ const boost::serialization::extended_type_info * const eti,
+ shared_ptr<void> & sph
+){
+ pimpl->lookup_helper(eti, sph);
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_iarchive::insert_basic_helper(
+ const boost::serialization::extended_type_info * const eti,
+ shared_ptr<void> & sph
+){
+ pimpl->insert_helper(eti, sph);
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_iarchive::delete_created_pointers()
+{
+ pimpl->delete_created_pointers();
+}
+
+BOOST_ARCHIVE_DECL(unsigned int)
+basic_iarchive::get_library_version() const{
+ return pimpl->m_archive_library_version;
+}
+
+BOOST_ARCHIVE_DECL(unsigned int)
+basic_iarchive::get_flags() const{
+ return pimpl->m_flags;
+}
+
+} // namespace detail
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_iserializer.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_iserializer.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,31 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_iserializer.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/detail/basic_iserializer.hpp>
+
+namespace boost {
+namespace archive {
+namespace detail {
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_iserializer::basic_iserializer(
+ const boost::serialization::extended_type_info & eti
+) :
+ basic_serializer(eti),
+ bpis(NULL)
+{}
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_iserializer::~basic_iserializer(){}
+
+} // namespace detail
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_oarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_oarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,463 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_oarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
+
+#include <cassert>
+#include <set>
+
+#include <boost/limits.hpp>
+#include <boost/state_saver.hpp>
+#include <boost/throw_exception.hpp>
+
+// including this here to work around an ICC in intel 7.0
+// normally this would be part of basic_oarchive.hpp below.
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/basic_archive.hpp>
+
+#include <boost/archive/detail/basic_oserializer.hpp>
+#include <boost/archive/detail/basic_pointer_oserializer.hpp>
+#include <boost/archive/detail/basic_oarchive.hpp>
+#include <boost/archive/detail/basic_archive_impl.hpp>
+#include <boost/archive/archive_exception.hpp>
+
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4251 4231 4660 4275)
+#endif
+
+using namespace boost::serialization;
+
+namespace boost {
+namespace serialization {
+ class extended_type_info;
+}
+namespace archive {
+namespace detail {
+
+class basic_oserializer;
+class basic_pointer_oserializer;
+
+class basic_oarchive_impl :
+ public basic_archive_impl
+{
+ friend class basic_oarchive;
+
+ unsigned int m_flags;
+
+ //////////////////////////////////////////////////////////////////////
+ // information about each serialized object saved
+ // keyed on address, class_id
+ struct aobject
+ {
+ const void * address;
+ class_id_type class_id;
+ object_id_type object_id;
+
+ bool operator<(const aobject &rhs) const
+ {
+ assert(NULL != address);
+ assert(NULL != rhs.address);
+ if( address < rhs.address )
+ return true;
+ if( address > rhs.address )
+ return false;
+ return class_id < rhs.class_id;
+ }
+ aobject & operator=(const aobject & rhs)
+ {
+ address = rhs.address;
+ class_id = rhs.class_id;
+ object_id = rhs.object_id;
+ return *this;
+ }
+ aobject(
+ const void *a,
+ class_id_type class_id_,
+ object_id_type object_id_
+ ) :
+ address(a),
+ class_id(class_id_),
+ object_id(object_id_)
+ {}
+ aobject() : address(NULL){}
+ };
+ // keyed on class_id, address
+ typedef std::set<aobject> object_set_type;
+ object_set_type object_set;
+
+ //////////////////////////////////////////////////////////////////////
+ // information about each serialized class saved
+ // keyed on type_info
+ struct cobject_type
+ {
+ const basic_oserializer * bos_ptr;
+ const class_id_type class_id;
+ bool initialized;
+ cobject_type(
+ std::size_t class_id_,
+ const basic_oserializer & bos_
+ ) :
+ bos_ptr(& bos_),
+ class_id(class_id_),
+ initialized(false)
+ {}
+ cobject_type(const basic_oserializer & bos_)
+ : bos_ptr(& bos_)
+ {}
+ cobject_type(
+ const cobject_type & rhs
+ ) :
+ bos_ptr(rhs.bos_ptr),
+ class_id(rhs.class_id),
+ initialized(rhs.initialized)
+ {}
+ // the following cannot be defined because of the const
+ // member. This will generate a link error if an attempt
+ // is made to assign. This should never be necessary
+ // use this only for lookup argument
+ cobject_type & operator=(const cobject_type &rhs);
+ bool operator<(const cobject_type &rhs) const {
+ return *bos_ptr < *(rhs.bos_ptr);
+ }
+ };
+ // keyed on type_info
+ typedef std::set<cobject_type> cobject_info_set_type;
+ cobject_info_set_type cobject_info_set;
+
+ // list of objects initially stored as pointers - used to detect errors
+ // keyed on object id
+ std::set<object_id_type> stored_pointers;
+
+ // address of the most recent object serialized as a poiner
+ // whose data itself is now pending serialization
+ const void * pending_object;
+ const basic_oserializer * pending_bos;
+
+ basic_oarchive_impl(unsigned int flags) :
+ m_flags(flags),
+ pending_object(NULL),
+ pending_bos(NULL)
+ {}
+
+ const cobject_type &
+ find(const basic_oserializer & bos);
+ const basic_oserializer *
+ find(const serialization::extended_type_info &ti) const;
+
+//public:
+ const cobject_type &
+ register_type(const basic_oserializer & bos);
+ void save_object(
+ basic_oarchive & ar,
+ const void *t,
+ const basic_oserializer & bos
+ );
+ void save_pointer(
+ basic_oarchive & ar,
+ const void * t,
+ const basic_pointer_oserializer * bpos
+ );
+};
+
+//////////////////////////////////////////////////////////////////////
+// implementation of basic_oarchive implementation functions
+
+// given a type_info - find its bos
+// return NULL if not found
+inline const basic_oserializer *
+basic_oarchive_impl::find(const serialization::extended_type_info & ti) const {
+ class bosarg : public basic_oserializer
+ {
+ bool class_info() const {
+ assert(false);
+ return false;
+ }
+ // returns true if objects should be tracked
+ bool tracking(const unsigned int) const {
+ assert(false);
+ return false;
+ }
+ // returns class version
+ unsigned int version() const {
+ assert(false);
+ return 0;
+ }
+ // returns true if this class is polymorphic
+ bool is_polymorphic() const{
+ assert(false);
+ return false;
+ }
+ void save_object_data(
+ basic_oarchive & ar, const void * x
+ ) const {
+ assert(false);
+ }
+ public:
+ bosarg(const serialization::extended_type_info & eti) :
+ boost::archive::detail::basic_oserializer(eti)
+ {}
+ };
+ bosarg bos(ti);
+ cobject_info_set_type::const_iterator cit
+ = cobject_info_set.find(cobject_type(bos));
+ // it should already have been "registered" - see below
+ if(cit == cobject_info_set.end()){
+ // if an entry is not found in the table it is because a pointer
+ // of a derived class has been serialized through its base class
+ // but the derived class hasn't been "registered"
+ return NULL;
+ }
+ // return pointer to the real class
+ return cit->bos_ptr;
+}
+
+inline const basic_oarchive_impl::cobject_type &
+basic_oarchive_impl::find(const basic_oserializer & bos)
+{
+ std::pair<cobject_info_set_type::iterator, bool> cresult =
+ cobject_info_set.insert(cobject_type(cobject_info_set.size(), bos));
+ return *(cresult.first);
+}
+
+inline const basic_oarchive_impl::cobject_type &
+basic_oarchive_impl::register_type(
+ const basic_oserializer & bos
+){
+ cobject_type co(cobject_info_set.size(), bos);
+ std::pair<cobject_info_set_type::const_iterator, bool>
+ result = cobject_info_set.insert(co);
+ return *(result.first);
+}
+
+inline void
+basic_oarchive_impl::save_object(
+ basic_oarchive & ar,
+ const void *t,
+ const basic_oserializer & bos
+){
+ // if its been serialized through a pointer and the preamble's been done
+ if(t == pending_object && pending_bos == & bos){
+ // just save the object data
+ ar.end_preamble();
+ (bos.save_object_data)(ar, t);
+ return;
+ }
+
+ // get class information for this object
+ const cobject_type & co = register_type(bos);
+ if(bos.class_info()){
+ if( ! co.initialized){
+ ar.vsave(class_id_optional_type(co.class_id));
+ ar.vsave(tracking_type(bos.tracking(m_flags)));
+ ar.vsave(version_type(bos.version()));
+ (const_cast<cobject_type &>(co)).initialized = true;
+ }
+ }
+
+ // we're not tracking this type of object
+ if(! bos.tracking(m_flags)){
+ // just windup the preamble - no object id to write
+ ar.end_preamble();
+ // and save the data
+ (bos.save_object_data)(ar, t);
+ return;
+ }
+
+ // look for an existing object id
+ object_id_type oid(object_set.size());
+ // lookup to see if this object has already been written to the archive
+ basic_oarchive_impl::aobject ao(t, co.class_id, oid);
+ std::pair<basic_oarchive_impl::object_set_type::const_iterator, bool>
+ aresult = object_set.insert(ao);
+ oid = aresult.first->object_id;
+
+ // if its a new object
+ if(aresult.second){
+ // write out the object id
+ ar.vsave(oid);
+ ar.end_preamble();
+ // and data
+ (bos.save_object_data)(ar, t);
+ return;
+ }
+
+ // check that it wasn't originally stored through a pointer
+ if(stored_pointers.end() != stored_pointers.find(oid)){
+ // this has to be a user error. loading such an archive
+ // would create duplicate objects
+ boost::throw_exception(
+ archive_exception(archive_exception::pointer_conflict)
+ );
+ }
+ // just save the object id
+ ar.vsave(object_reference_type(oid));
+ ar.end_preamble();
+ return;
+}
+
+// save a pointer to an object instance
+inline void
+basic_oarchive_impl::save_pointer(
+ basic_oarchive & ar,
+ const void * t,
+ const basic_pointer_oserializer * bpos_ptr
+){
+ const basic_oserializer & bos = bpos_ptr->get_basic_serializer();
+ std::size_t original_count = cobject_info_set.size();
+ const cobject_type & co = register_type(bos);
+ if(! co.initialized){
+ ar.vsave(co.class_id);
+ // if its a previously unregistered class
+ if((cobject_info_set.size() > original_count)){
+ if(bos.is_polymorphic()){
+ const serialization::extended_type_info *eti = & bos.get_eti();
+ const char * key = NULL;
+ if(NULL != eti)
+ key = eti->get_key();
+ if(NULL != key){
+ // the following is required by IBM C++ compiler which
+ // makes a copy when passing a non-const to a const. This
+ // is permitted by the standard but rarely seen in practice
+ const class_name_type cn(key);
+ // write out the external class identifier
+ ar.vsave(cn);
+ }
+ else
+ // without an external class name
+ // we won't be able to de-serialize it so bail now
+ boost::throw_exception(
+ archive_exception(archive_exception::unregistered_class)
+ );
+ }
+ }
+ if(bos.class_info()){
+ ar.vsave(tracking_type(bos.tracking(m_flags)));
+ ar.vsave(version_type(bos.version()));
+ }
+ (const_cast<cobject_type &>(co)).initialized = true;
+ }
+ else{
+ ar.vsave(class_id_reference_type(co.class_id));
+ }
+
+ // if we're not tracking
+ if(! bos.tracking(m_flags)){
+ // just save the data itself
+ ar.end_preamble();
+ state_saver<const void *> x(pending_object);
+ state_saver<const basic_oserializer *> y(pending_bos);
+ pending_object = t;
+ pending_bos = & bpos_ptr->get_basic_serializer();
+ bpos_ptr->save_object_ptr(ar, t);
+ return;
+ }
+
+ object_id_type oid(object_set.size());
+ // lookup to see if this object has already been written to the archive
+ basic_oarchive_impl::aobject ao(t, co.class_id, oid);
+ std::pair<basic_oarchive_impl::object_set_type::const_iterator, bool>
+ aresult = object_set.insert(ao);
+ oid = aresult.first->object_id;
+ // if the saved object already exists
+ if(! aresult.second){
+ // append the object id to he preamble
+ ar.vsave(object_reference_type(oid));
+ // and windup.
+ ar.end_preamble();
+ return;
+ }
+
+ // append id of this object to preamble
+ ar.vsave(oid);
+ ar.end_preamble();
+
+ // and save the object itself
+ state_saver<const void *> x(pending_object);
+ state_saver<const basic_oserializer *> y(pending_bos);
+ pending_object = t;
+ pending_bos = & bpos_ptr->get_basic_serializer();
+ bpos_ptr->save_object_ptr(ar, t);
+ // add to the set of object initially stored through pointers
+ stored_pointers.insert(oid);
+}
+
+//////////////////////////////////////////////////////////////////////
+// implementation of basic_oarchive functions
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_oarchive::basic_oarchive(unsigned int flags)
+ : pimpl(new basic_oarchive_impl(flags))
+{}
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_oarchive::~basic_oarchive()
+{
+ delete pimpl;
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_oarchive::save_object(
+ const void *x,
+ const basic_oserializer & bos
+){
+ pimpl->save_object(*this, x, bos);
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_oarchive::save_pointer(
+ const void * t,
+ const basic_pointer_oserializer * bpos_ptr
+){
+ pimpl->save_pointer(*this, t, bpos_ptr);
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_oarchive::register_basic_serializer(const basic_oserializer & bos){
+ pimpl->register_type(bos);
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_oarchive::lookup_basic_helper(
+ const boost::serialization::extended_type_info * const eti,
+ shared_ptr<void> & sph
+){
+ pimpl->lookup_helper(eti, sph);
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_oarchive::insert_basic_helper(
+ const boost::serialization::extended_type_info * const eti,
+ shared_ptr<void> & sph
+){
+ pimpl->insert_helper(eti, sph);
+}
+
+BOOST_ARCHIVE_DECL(unsigned int)
+basic_oarchive::get_library_version() const{
+ return ARCHIVE_VERSION();
+}
+
+BOOST_ARCHIVE_DECL(unsigned int)
+basic_oarchive::get_flags() const{
+ return pimpl->m_flags;
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_oarchive::end_preamble(){
+}
+
+} // namespace detail
+} // namespace archive
+} // namespace boost
+
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_oserializer.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_oserializer.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,31 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_oserializer.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/detail/basic_oserializer.hpp>
+
+namespace boost {
+namespace archive {
+namespace detail {
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_oserializer::basic_oserializer(
+ const boost::serialization::extended_type_info & eti
+) :
+ basic_serializer(eti),
+ bpos(NULL)
+{}
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_oserializer::~basic_oserializer(){}
+
+} // namespace detail
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_pointer_iserializer.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_pointer_iserializer.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,30 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_pointer_iserializer.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/detail/basic_pointer_iserializer.hpp>
+
+namespace boost {
+namespace archive {
+namespace detail {
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_pointer_iserializer::basic_pointer_iserializer(
+ const boost::serialization::extended_type_info & eti
+) :
+ basic_serializer(eti)
+{}
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_pointer_iserializer::~basic_pointer_iserializer() {}
+
+} // namespace detail
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_pointer_oserializer.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_pointer_oserializer.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,30 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_pointer_oserializer.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/detail/basic_pointer_oserializer.hpp>
+
+namespace boost {
+namespace archive {
+namespace detail {
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_pointer_oserializer::basic_pointer_oserializer(
+ const boost::serialization::extended_type_info & eti
+) :
+ basic_serializer(eti)
+{}
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_pointer_oserializer::~basic_pointer_oserializer() {}
+
+} // namespace detail
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_serializer_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_serializer_map.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,78 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// serializer_map.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#include <set>
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/detail/basic_serializer.hpp>
+#include <boost/archive/detail/basic_serializer_map.hpp>
+
+namespace boost {
+ namespace serialization {
+ class extended_type_info;
+ }
+namespace archive {
+namespace detail {
+
+BOOST_ARCHIVE_DECL(bool)
+type_info_pointer_compare::operator()(
+ const basic_serializer * lhs, const basic_serializer * rhs
+) const {
+ return *lhs < *rhs;
+}
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_serializer_map::basic_serializer_map(bool & deleted) :
+ m_deleted(deleted)
+{
+ m_deleted = false;
+}
+
+BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
+basic_serializer_map::~basic_serializer_map(){
+ m_deleted = true;
+}
+
+BOOST_ARCHIVE_DECL(bool)
+basic_serializer_map::insert(const basic_serializer * bs){
+ return m_map.insert(bs).second;
+}
+
+BOOST_ARCHIVE_DECL(void)
+basic_serializer_map::erase(basic_serializer * bs){
+ m_map.erase(bs);
+}
+
+class basic_serializer_arg : public basic_serializer {
+public:
+ basic_serializer_arg(const serialization::extended_type_info & eti) :
+ basic_serializer(eti)
+ {}
+};
+
+BOOST_ARCHIVE_DECL(const basic_serializer *)
+basic_serializer_map::tfind(
+ const boost::serialization::extended_type_info & eti
+) const {
+ const basic_serializer_arg bs(eti);
+ map_type::const_iterator it;
+ it = m_map.find(& bs);
+ if(it == m_map.end())
+ return NULL;
+ return *it;
+}
+
+} // namespace detail
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_iprimitive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_iprimitive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,28 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_text_iprimitive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#include <istream>
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/detail/auto_link_archive.hpp>
+#include <boost/archive/impl/basic_text_iprimitive.ipp>
+
+namespace boost {
+namespace archive {
+
+// explicitly instantiate for this type of text stream
+template class basic_text_iprimitive<std::istream> ;
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_oprimitive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_oprimitive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,28 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_text_oprimitive.cpp:
+
+// (C) Copyright 2004 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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#include <ostream>
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/detail/auto_link_archive.hpp>
+#include <boost/archive/impl/basic_text_oprimitive.ipp>
+
+namespace boost {
+namespace archive {
+
+// explicitly instantiate for this type of text stream
+template class basic_text_oprimitive<std::ostream> ;
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_wiprimitive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_wiprimitive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,35 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_text_wiprimitive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#include <istream>
+
+#define BOOST_WARCHIVE_SOURCE
+#include <boost/archive/detail/auto_link_warchive.hpp>
+#include <boost/archive/impl/basic_text_iprimitive.ipp>
+
+namespace boost {
+namespace archive {
+
+template class basic_text_iprimitive<std::wistream> ;
+
+} // namespace archive
+} // namespace boost
+
+#endif // BOOST_NO_STD_WSTREAMBUF

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_woprimitive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_text_woprimitive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,35 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_text_woprimitive.cpp:
+
+// (C) Copyright 2004 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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#include <ostream>
+
+#define BOOST_WARCHIVE_SOURCE
+#include <boost/archive/detail/auto_link_warchive.hpp>
+#include <boost/archive/impl/basic_text_oprimitive.ipp>
+
+namespace boost {
+namespace archive {
+
+template class basic_text_oprimitive<std::wostream> ;
+
+} // namespace archive
+} // namespace boost
+
+#endif // BOOST_NO_STD_WSTREAMBUF

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_xml_archive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_xml_archive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,51 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// xml_archive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/basic_xml_archive.hpp>
+
+namespace boost {
+namespace archive {
+
+BOOST_ARCHIVE_DECL(const char *)
+OBJECT_ID(){
+ return "object_id";
+}
+BOOST_ARCHIVE_DECL(const char *)
+OBJECT_REFERENCE(){
+ return "object_id_reference";
+}
+BOOST_ARCHIVE_DECL(const char *)
+CLASS_ID(){
+ return "class_id";
+}
+BOOST_ARCHIVE_DECL(const char *)
+CLASS_ID_REFERENCE(){
+ return "class_id_reference";
+}
+BOOST_ARCHIVE_DECL(const char *)
+CLASS_NAME(){
+ return "class_name";
+}
+BOOST_ARCHIVE_DECL(const char *)
+TRACKING(){
+ return "tracking_level";
+}
+BOOST_ARCHIVE_DECL(const char *)
+VERSION(){
+ return "version";
+}
+BOOST_ARCHIVE_DECL(const char *)
+SIGNATURE(){
+ return "signature";
+}
+
+}// namespace archive
+}// namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/basic_xml_grammar.ipp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/basic_xml_grammar.ipp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,456 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// basic_xml_grammar.ipp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#include <istream>
+#include <algorithm>
+#include <boost/config.hpp> // BOOST_DEDUCED_TYPENAME
+
+// spirit stuff
+#include <boost/spirit/core/composite/operators.hpp>
+#include <boost/spirit/core/composite/actions.hpp>
+#include <boost/spirit/core/primitives/numerics.hpp>
+
+// for head_iterator test
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/pfto.hpp>
+
+#include <boost/io/ios_state.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/archive/impl/basic_xml_grammar.hpp>
+#include <boost/archive/basic_xml_archive.hpp>
+#include <boost/archive/iterators/xml_unescape.hpp>
+
+using namespace boost::spirit;
+
+namespace boost {
+namespace archive {
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// template code for basic_xml_grammar of both wchar_t and char types
+
+namespace { // anonymous
+
+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 & 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 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 typename String::value_type z = c;
+ contents += z;
+ }
+ append_lit(String & contents_)
+ : contents(contents_)
+ {}
+};
+
+} // namespace anonymous
+
+template<class CharType>
+bool basic_xml_grammar<CharType>::my_parse(
+ BOOST_DEDUCED_TYPENAME basic_xml_grammar<CharType>::IStream & is,
+ const rule_t & rule_,
+ CharType delimiter
+){
+ if(is.fail()){
+ boost::throw_exception(
+ archive_exception(archive_exception::stream_error)
+ );
+ }
+
+ boost::io::ios_flags_saver ifs(is);
+ is >> std::noskipws;
+
+ std::basic_string<CharType> arg;
+
+ CharType val;
+ do{
+ val = is.get();
+ arg += val;
+ if(is.fail())
+ return false;
+ }
+ while(val != delimiter);
+
+ // read just one more character. This will be the newline after the tag
+ // this is so that the next operation will return fail if the archive
+ // 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;
+}
+
+template<class CharType>
+bool basic_xml_grammar<CharType>::parse_start_tag(
+ BOOST_DEDUCED_TYPENAME basic_xml_grammar<CharType>::IStream & is
+) {
+ if(is.fail()){
+ boost::throw_exception(
+ archive_exception(archive_exception::stream_error)
+ );
+ }
+ rv.class_name.resize(0);
+ return my_parse(is, STag);
+}
+
+template<class CharType>
+bool basic_xml_grammar<CharType>::parse_end_tag(IStream & is) {
+ if(is.fail()){
+ boost::throw_exception(
+ archive_exception(archive_exception::stream_error)
+ );
+ }
+ return my_parse(is, ETag);
+}
+
+template<class CharType>
+bool basic_xml_grammar<CharType>::parse_string(IStream & is, StringType & s) {
+ if(is.fail()){
+ boost::throw_exception(
+ archive_exception(archive_exception::stream_error)
+ );
+ }
+ rv.contents.resize(0);
+ bool result = my_parse(is, content, '<');
+ // note: unget caused a problem with dinkumware. replace with
+ // is.unget();
+ // putback another dilimiter instead
+ is.putback('<');
+ if(result)
+ s = rv.contents;
+ return result;
+}
+
+template<class CharType>
+basic_xml_grammar<CharType>::basic_xml_grammar(){
+ init_chset();
+
+ S =
+ +(Sch)
+ ;
+
+ // refactoring to workaround template depth on darwin
+ NameHead = (Letter | '_' | ':');
+ NameTail = *NameChar ;
+ Name =
+ NameHead >> NameTail
+ ;
+
+ Eq =
+ !S >> '=' >> !S
+ ;
+
+ AttributeList =
+ *(S >> Attribute)
+ ;
+
+ STag =
+ !S
+ >> '<'
+ >> Name [assign_object(rv.object_name)]
+ >> AttributeList
+ >> !S
+ >> '>'
+ ;
+
+ ETag =
+ !S
+ >> "</"
+ >> Name [assign_object(rv.object_name)]
+ >> !S
+ >> '>'
+ ;
+
+ // refactoring to workaround template depth on darwin
+ CharDataChars = *(anychar_p - chset_p(L"&<"));
+ CharData =
+ CharDataChars [
+ 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 [append_char<StringType>(rv.contents)] >> L';'
+ ;
+ CharRef2 =
+ str_p(L"&#x") >> hex_p [append_char<StringType>(rv.contents)] >> L';'
+ ;
+ CharRef = CharRef1 | CharRef2 ;
+
+ AmpRef = str_p(L"&amp;")[append_lit<StringType, L'&'>(rv.contents)];
+ LTRef = str_p(L"&lt;")[append_lit<StringType, L'<'>(rv.contents)];
+ GTRef = str_p(L"&gt;")[append_lit<StringType, L'>'>(rv.contents)];
+ AposRef = str_p(L"&apos;")[append_lit<StringType, L'\''>(rv.contents)];
+ QuoteRef = str_p(L"&quot;")[append_lit<StringType, L'"'>(rv.contents)];
+
+ Reference =
+ AmpRef
+ | LTRef
+ | GTRef
+ | AposRef
+ | QuoteRef
+ | CharRef
+ ;
+
+ content =
+ L"<" // should be end_p
+ | (Reference | CharData) >> content
+ ;
+
+ ClassIDAttribute =
+ str_p(CLASS_ID()) >> NameTail
+ >> Eq
+ >> L'"'
+ >> int_p [assign_object(rv.class_id.t)]
+ >> L'"'
+ ;
+
+ ObjectIDAttribute =
+ (str_p(OBJECT_ID()) | str_p(OBJECT_REFERENCE()) )
+ >> NameTail
+ >> Eq
+ >> L'"'
+ >> L'_'
+ >> uint_p [assign_object(rv.object_id.t)]
+ >> L'"'
+ ;
+
+ AmpName = str_p(L"&amp;")[append_lit<StringType, L'&'>(rv.class_name)];
+ LTName = str_p(L"&lt;")[append_lit<StringType, L'<'>(rv.class_name)];
+ GTName = str_p(L"&gt;")[append_lit<StringType, L'>'>(rv.class_name)];
+ ClassNameChar =
+ AmpName
+ | LTName
+ | GTName
+ | (anychar_p - chset_p(L"\"")) [append_char<StringType>(rv.class_name)]
+ ;
+
+ ClassName =
+ * ClassNameChar
+ ;
+
+ ClassNameAttribute =
+ str_p(CLASS_NAME())
+ >> Eq
+ >> L'"'
+ >> ClassName
+ >> L'"'
+ ;
+
+ TrackingAttribute =
+ str_p(TRACKING())
+ >> Eq
+ >> L'"'
+ >> uint_p [assign_level(rv.tracking_level)]
+ >> L'"'
+ ;
+
+ VersionAttribute =
+ str_p(VERSION())
+ >> Eq
+ >> L'"'
+ >> uint_p [assign_object(rv.version.t)]
+ >> 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 [assign_object(rv.class_name)]
+ >> L'"'
+ ;
+
+ SerializationWrapper =
+ !S
+ >> str_p(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::throw_exception(
+ xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
+ );
+ if(! my_parse(is, DocTypeDecl))
+ boost::throw_exception(
+ xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
+ );
+ if(! my_parse(is, SerializationWrapper))
+ boost::throw_exception(
+ xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
+ );
+ if(! std::equal(rv.class_name.begin(), rv.class_name.end(), ARCHIVE_SIGNATURE()))
+ boost::throw_exception(
+ archive_exception(archive_exception::invalid_signature)
+ );
+}
+
+template<class CharType>
+void basic_xml_grammar<CharType>::windup(IStream & is){
+ if(is.fail())
+ return;
+ // uh-oh - don't exception from code called by a destructor !
+ // so just ignore any failure.
+ my_parse(is, ETag);
+}
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/binary_iarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/binary_iarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,38 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// binary_iarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <istream>
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/binary_iarchive.hpp>
+
+#include <boost/archive/impl/basic_binary_iprimitive.ipp>
+#include <boost/archive/impl/basic_binary_iarchive.ipp>
+#include <boost/archive/impl/archive_pointer_iserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+// explicitly instantiate for this type of stream
+template class basic_binary_iprimitive<
+ binary_iarchive,
+ char,
+ std::char_traits<char>
+>;
+template class basic_binary_iarchive<binary_iarchive> ;
+template class binary_iarchive_impl<
+ binary_iarchive,
+ char,
+ std::char_traits<char>
+>;
+template class detail::archive_pointer_iserializer<binary_iarchive> ;
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/binary_oarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/binary_oarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,38 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// binary_oarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <ostream>
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/binary_oarchive.hpp>
+
+#include <boost/archive/impl/basic_binary_oprimitive.ipp>
+#include <boost/archive/impl/basic_binary_oarchive.ipp>
+#include <boost/archive/impl/archive_pointer_oserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+// explicitly instantiate for this type of binary stream
+template class basic_binary_oprimitive<
+ binary_oarchive,
+ char,
+ std::char_traits<char>
+>;
+template class basic_binary_oarchive<binary_oarchive> ;
+template class binary_oarchive_impl<
+ binary_oarchive,
+ char,
+ std::char_traits<char>
+>;
+template class detail::archive_pointer_oserializer<binary_oarchive> ;
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/binary_wiarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/binary_wiarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,45 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// binary_wiarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#define BOOST_WARCHIVE_SOURCE
+#include <boost/archive/binary_wiarchive.hpp>
+
+#include <boost/archive/impl/basic_binary_iprimitive.ipp>
+#include <boost/archive/impl/basic_binary_iarchive.ipp>
+#include <boost/archive/impl/archive_pointer_iserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+// explicitly instantiate for this type of text stream
+template class basic_binary_iprimitive<
+ binary_wiarchive,
+ wchar_t,
+ std::char_traits<wchar_t>
+>;
+template class basic_binary_iarchive<binary_wiarchive> ;
+template class binary_iarchive_impl<
+ binary_wiarchive,
+ wchar_t,
+ std::char_traits<wchar_t>
+>;
+template class detail::archive_pointer_iserializer<binary_wiarchive> ;
+
+} // namespace archive
+} // namespace boost
+
+#endif // BOOST_NO_STD_WSTREAMBUF
+

Added: sandbox/SOC/2007/bigint/libs/serialization/src/binary_woarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/binary_woarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,44 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// binary_woarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#define BOOST_WARCHIVE_SOURCE
+#include <boost/archive/binary_woarchive.hpp>
+
+#include <boost/archive/impl/basic_binary_oprimitive.ipp>
+#include <boost/archive/impl/basic_binary_oarchive.ipp>
+#include <boost/archive/impl/archive_pointer_oserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+// explicitly instantiate for this type of text stream
+template class basic_binary_oprimitive<
+ binary_woarchive,
+ wchar_t,
+ std::char_traits<wchar_t>
+>;
+template class basic_binary_oarchive<binary_woarchive> ;
+template class binary_oarchive_impl<
+ binary_woarchive,
+ wchar_t,
+ std::char_traits<wchar_t>
+>;
+template class detail::archive_pointer_oserializer<binary_woarchive> ;
+
+} // namespace archive
+} // namespace boost
+
+#endif // BOOST_NO_STD_WSTREAMBUF

Added: sandbox/SOC/2007/bigint/libs/serialization/src/codecvt_null.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/codecvt_null.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,82 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// codecvt_null.cpp
+
+// Copyright © 2004 Robert Ramey, Indiana University (garcia_at_[hidden])
+// Andrew Lumsdaine, Indiana University (lums_at_[hidden]).
+// 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 <boost/archive/codecvt_null.hpp>
+
+// codecvt implementation for passing wchar_t objects to char output
+// without any translation whatever. Used to implement binary output
+// of wchar_t objects.
+
+namespace boost {
+namespace archive {
+
+std::codecvt_base::result
+codecvt_null<wchar_t>::do_out(
+ std::mbstate_t & state,
+ const wchar_t * first1,
+ const wchar_t * last1,
+ const wchar_t * & next1,
+ char * first2,
+ char * last2,
+ char * & next2
+) const {
+ while(first1 != last1){
+ // Per std::22.2.1.5.2/2, we can store no more that
+ // last2-first2 characters. If we need to more encode
+ // next internal char type, return 'partial'.
+ if(static_cast<int>(sizeof(wchar_t)) > (last2 - first2)){
+ next1 = first1;
+ next2 = first2;
+ return std::codecvt_base::partial;
+ }
+ * reinterpret_cast<wchar_t *>(first2) = * first1++;
+ first2 += sizeof(wchar_t);
+
+ }
+ next1 = first1;
+ next2 = first2;
+ return std::codecvt_base::ok;
+}
+
+std::codecvt_base::result
+codecvt_null<wchar_t>::do_in(
+ std::mbstate_t & state,
+ const char * first1,
+ const char * last1,
+ const char * & next1,
+ wchar_t * first2,
+ wchar_t * last2,
+ wchar_t * & next2
+) const {
+ // Process input characters until we've run of them,
+ // or the number of remaining characters is not
+ // enough to construct another output character,
+ // or we've run out of place for output characters.
+ while(first2 != last2){
+ // Have we converted all input characters?
+ // Return with 'ok', if so.
+ if (first1 == last1)
+ break;
+ // Do we have less input characters than needed
+ // for a single output character?
+ if(static_cast<int>(sizeof(wchar_t)) > (last1 - first1)){
+ next1 = first1;
+ next2 = first2;
+ return std::codecvt_base::partial;
+ }
+ *first2++ = * reinterpret_cast<const wchar_t *>(first1);
+ first1 += sizeof(wchar_t);
+ }
+ next1 = first1;
+ next2 = first2;
+ return std::codecvt_base::ok;
+}
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/extended_type_info.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/extended_type_info.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,294 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// extended_type_info.cpp: implementation for portable version of type_info
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#include <algorithm>
+#include <set>
+#include <cassert>
+
+#include <boost/config.hpp> // msvc needs this to suppress warning
+
+#include <cstring>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{ using ::strcmp; }
+#endif
+
+#include <boost/detail/no_exceptions_support.hpp>
+#define BOOST_SERIALIZATION_SOURCE
+#include <boost/serialization/extended_type_info.hpp>
+
+namespace boost {
+namespace serialization {
+
+// remove all registrations corresponding to a given type
+void unregister_void_casts(extended_type_info *eti);
+
+namespace detail {
+
+// it turns out that at least one compiler (msvc 6.0) doesn't guarentee
+// to destroy static objects in exactly the reverse sequence that they
+// are constructed. To guarentee this, use a singleton pattern
+
+// map for finding the unique global extended type entry for a given type
+class tkmap {
+ struct type_info_compare
+ {
+ bool
+ operator()(const extended_type_info * lhs, const extended_type_info * rhs) const
+ {
+ assert(! lhs->is_destructing());
+ assert(! rhs->is_destructing());
+ return *lhs < *rhs;
+ }
+ };
+// typedef std::multiset<const extended_type_info *, type_info_compare> type;
+ typedef std::set<const extended_type_info *, type_info_compare> type;
+ type m_map;
+ static tkmap * m_self;
+ tkmap(){}
+ static tkmap::type::iterator
+ lookup(const extended_type_info * eti){
+ return m_self->m_map.find(eti);
+ }
+public:
+ ~tkmap(){
+ m_self = NULL;
+ }
+ static void
+ insert(const extended_type_info * eti){
+ if(NULL == m_self){
+ static tkmap instance;
+ m_self = & instance;
+ }
+ // make sure that attempt at registration is done only once
+ assert(lookup(eti) == m_self->m_map.end());
+ m_self->m_map.insert(eti);
+ }
+ static const extended_type_info *
+ find(const extended_type_info * eti){
+ if(NULL == m_self)
+ return NULL;
+ tkmap::type::const_iterator it;
+ it = m_self->m_map.find(eti);
+ if(it == m_self->m_map.end())
+ return NULL;
+ return *it;
+ }
+ static void
+ purge(const extended_type_info * eti){
+ if(NULL == m_self)
+ return;
+ // note: the following can't be used as this function
+ // is called from a destructor of extended_type_info.
+ // This will generate an error on some machines - which
+ // makes sense be cause by this time the derived class data
+ // might be gone. Leave this in as a reminder not to do this
+ #if 0
+ tkmap::type::iterator it;
+ it = lookup(eti);
+ // it should be in there
+ assert(it != m_self->m_map.end());
+ m_self->m_map.erase(it);
+ #endif
+
+ tkmap::type::iterator i = m_self->m_map.begin();
+ tkmap::type::iterator k = m_self->m_map.end();
+ while(i != k){
+ // note that the erase might invalidate i so save it here
+ tkmap::type::iterator j = i++;
+ if(*j == eti)
+ m_self->m_map.erase(j);
+ }
+ }
+};
+
+tkmap * tkmap::m_self = NULL;
+
+// map for finding the unique global extended type info entry given its GUID
+class ktmap {
+ struct key_compare
+ {
+ bool
+ operator()(const extended_type_info * lhs, const extended_type_info * rhs) const
+ {
+ // shortcut to exploit string pooling
+ if(lhs->get_key() == rhs->get_key())
+ return false;
+ if(NULL == lhs->get_key())
+ return true;
+ if(NULL == rhs->get_key())
+ return false;
+ return std::strcmp(lhs->get_key(), rhs->get_key()) < 0;
+ }
+ };
+// typedef std::multiset<const extended_type_info *, key_compare> type;
+ typedef std::set<const extended_type_info *, key_compare> type;
+ type m_map;
+ static ktmap * m_self;
+ ktmap(){}
+ class extended_type_info_arg : public extended_type_info
+ {
+ public:
+ extended_type_info_arg(const char * key) :
+ extended_type_info(NULL)
+ {
+ m_key = key;
+ }
+ virtual bool
+ less_than(const extended_type_info &rhs) const
+ {
+ assert(false);
+ return false; // to prevent a syntax error
+ }
+ };
+ static ktmap::type::iterator
+ lookup(const char *key){
+ extended_type_info_arg arg(key);
+ return m_self->m_map.find(&arg);
+ }
+
+public:
+ ~ktmap(){
+ m_self = NULL;
+ }
+ static void
+ insert(const extended_type_info * eti){
+ if(NULL == m_self){
+ static ktmap instance;
+ m_self = & instance;
+ }
+ // make sure that all GUIDs are unique
+ assert(lookup(eti->get_key()) == m_self->m_map.end());
+ m_self->m_map.insert(eti);
+ }
+ static const extended_type_info *
+ find(const char *key)
+ {
+ if(NULL == m_self)
+ return NULL;
+ extended_type_info_arg arg(key);
+ ktmap::type::const_iterator it;
+ it = m_self->m_map.find(&arg);
+ if(it == m_self->m_map.end())
+ return NULL;
+ return *it;
+ }
+ static void
+ purge(const extended_type_info * eti){
+ if(NULL == m_self)
+ return;
+ // note: the following can't be used as this function
+ // is called from a destructor of extended_type_info.
+ // This will generate an error on some machines - which
+ // makes sense be cause by this time the derived class data
+ // might be gone. Leave this in as a reminder not to do this
+ #if 0
+ ktmap::type::iterator it;
+ it = lookup(eti->get_key());
+ // expect it to be in there !
+ assert(it != m_self->m_map.end());
+ m_self->m_map.erase(it);
+ #endif
+
+ ktmap::type::iterator i = m_self->m_map.begin();
+ ktmap::type::iterator k = m_self->m_map.end();
+ while(i != k){
+ // note that the erase might invalidate i so save it here
+ ktmap::type::iterator j = i++;
+ if(*j == eti)
+ m_self->m_map.erase(j);
+ }
+ }
+};
+
+ktmap * ktmap::m_self = NULL;
+
+} // namespace detail
+
+BOOST_SERIALIZATION_DECL(const extended_type_info *)
+extended_type_info::find(const char *key)
+{
+ return detail::ktmap::find(key);
+}
+
+BOOST_SERIALIZATION_DECL(void)
+extended_type_info::self_register()
+{
+ detail::tkmap::insert(this);
+ m_self_registered = true;
+}
+
+BOOST_SERIALIZATION_DECL(void)
+extended_type_info::key_register(const char *key_) {
+ if(NULL == key_)
+ return;
+ m_key = key_;
+ detail::ktmap::insert(this);
+ m_key_registered = true;
+}
+
+BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
+extended_type_info::extended_type_info(
+ const char * type_info_key
+) :
+ m_type_info_key(type_info_key),
+ m_self_registered(false),
+ m_key_registered(false),
+ m_is_destructing(false)
+{}
+
+BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
+extended_type_info::~extended_type_info(){
+ // remove entries in maps which correspond to this type
+ m_is_destructing = true;
+ BOOST_TRY{
+ if(m_self_registered)
+ detail::tkmap::purge(this);
+ if(m_key_registered)
+ detail::ktmap::purge(this);
+ unregister_void_casts(this);
+ }
+ BOOST_CATCH(...){}
+ BOOST_CATCH_END
+}
+
+BOOST_SERIALIZATION_DECL(int)
+extended_type_info::type_info_key_cmp(const extended_type_info & rhs) const {
+ if(m_type_info_key == rhs.m_type_info_key)
+ return 0;
+ //return strcmp(lhs.type_info_key, rhs.type_info_key);
+ // all we require is that the type_info_key be unique
+ // so just compare the addresses
+ return m_type_info_key < rhs.m_type_info_key ? -1 : 1;
+}
+
+BOOST_SERIALIZATION_DECL(const extended_type_info *)
+extended_type_info::find(const extended_type_info * t)
+{
+ return detail::tkmap::find(t);
+}
+
+BOOST_SERIALIZATION_DECL(bool)
+extended_type_info::operator<(const extended_type_info &rhs) const {
+ int i = type_info_key_cmp(rhs);
+ if(i < 0)
+ return true;
+ if(i > 0)
+ return false;
+ assert(! is_destructing());
+ assert(! rhs.is_destructing());
+ return less_than(rhs);
+}
+
+} // namespace serialization
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/extended_type_info_no_rtti.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/extended_type_info_no_rtti.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,43 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// extended_type_info_no_rtti.cpp: specific implementation of type info
+// that is NOT based on typeid
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+#include <cstring>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{ using ::strcmp; }
+#endif
+
+#define BOOST_SERIALIZATION_SOURCE
+#include <boost/serialization/extended_type_info_no_rtti.hpp>
+
+namespace boost {
+namespace serialization {
+namespace detail {
+
+BOOST_SERIALIZATION_DECL(bool)
+extended_type_info_no_rtti_0::less_than(
+ const boost::serialization::extended_type_info &rhs) const
+{
+ return std::strcmp(m_key, rhs.get_key()) < 0;
+}
+
+BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
+extended_type_info_no_rtti_0::extended_type_info_no_rtti_0() :
+ boost::serialization::extended_type_info("extended_type_info_no_rtti")
+{}
+
+BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
+extended_type_info_no_rtti_0::~extended_type_info_no_rtti_0()
+{}
+
+} // namespece detail
+} // namespace serialization
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/extended_type_info_typeid.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/extended_type_info_typeid.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,66 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// extended_type_info_typeid.cpp: specific implementation of type info
+// that is based on typeid
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#define BOOST_SERIALIZATION_SOURCE
+#include <boost/serialization/extended_type_info_typeid.hpp>
+
+namespace boost {
+namespace serialization {
+namespace detail {
+
+BOOST_SERIALIZATION_DECL(bool)
+extended_type_info_typeid_0::less_than(const extended_type_info &rhs) const
+{
+ return 0 != get_eti().before(
+ static_cast<const extended_type_info_typeid_0 &>(rhs).get_eti()
+ );
+}
+
+BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
+extended_type_info_typeid_0::extended_type_info_typeid_0() :
+ extended_type_info("extended_type_info_typeid")
+{}
+
+BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
+extended_type_info_typeid_0::~extended_type_info_typeid_0()
+{}
+
+// this derivation is used for creating search arguments
+class extended_type_info_typeid_arg :
+ public extended_type_info_typeid_0
+{
+private:
+ const std::type_info & ti;
+ virtual const std::type_info &get_eti() const
+ {
+ return ti;
+ }
+public:
+ extended_type_info_typeid_arg(const std::type_info & ti_)
+ : ti(ti_)
+ {
+ // note absense of self register and key as this is used only as
+ // search argument given a type_info reference and is not to
+ // be added to the map.
+ }
+};
+
+BOOST_SERIALIZATION_DECL(const extended_type_info *)
+extended_type_info_typeid_0::get_derived_extended_type_info(
+ const std::type_info & ti
+){
+ detail::extended_type_info_typeid_arg etia(ti);
+ return extended_type_info::find(& etia);
+}
+
+} // namespace detail
+} // namespace serialization
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/polymorphic_iarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/polymorphic_iarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,29 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// polymorphic_iarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#include <istream>
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/polymorphic_iarchive.hpp>
+
+// explicitly instantiate for this type of text stream
+#include <boost/archive/impl/archive_pointer_iserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+template class detail::archive_pointer_iserializer<polymorphic_iarchive> ;
+
+} // namespace serialization
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/polymorphic_oarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/polymorphic_oarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,29 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// polymorphic_oarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#include <ostream>
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/polymorphic_oarchive.hpp>
+
+// explicitly instantiate for this type of text stream
+#include <boost/archive/impl/archive_pointer_oserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+template class detail::archive_pointer_oserializer<polymorphic_oarchive> ;
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/stl_port.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/stl_port.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,45 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// stl_port.cpp: implementation of run-time casting of void pointers
+
+// (C) Copyright 2005 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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+// this befuddles the msvc 6 compiler so we can't use it
+#if ! ((defined _MSC_VER) && (_MSC_VER <= 1300)) \
+&& ! defined(__BORLANDC__)
+
+#include <boost/config.hpp>
+
+#if defined(__SGI_STL_PORT)
+#if defined(_STLPORT_VERSION) && (_STLPORT_VERSION < 0x500)
+
+#include <boost/archive/codecvt_null.hpp>
+
+// explicit instantiation
+
+namespace std {
+
+template
+locale::locale(
+ const locale& __loc, boost::archive::codecvt_null<char> * __f
+);
+
+template
+locale::locale(
+ const locale& __loc, boost::archive::codecvt_null<wchar_t> * __f
+);
+
+} // namespace std
+
+#endif
+#endif
+
+#endif

Added: sandbox/SOC/2007/bigint/libs/serialization/src/text_iarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/text_iarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,27 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// text_iarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/text_iarchive.hpp>
+
+// explicitly instantiate for this type of text stream
+#include <boost/archive/impl/basic_text_iarchive.ipp>
+#include <boost/archive/impl/text_iarchive_impl.ipp>
+#include <boost/archive/impl/archive_pointer_iserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+template class basic_text_iarchive<text_iarchive> ;
+template class text_iarchive_impl<text_iarchive> ;
+template class detail::archive_pointer_iserializer<text_iarchive> ;
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/text_oarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/text_oarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,32 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// text_oarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/text_oarchive.hpp>
+
+// explicitly instantiate for this type of text stream
+#include <boost/archive/impl/basic_text_oarchive.ipp>
+#include <boost/archive/impl/text_oarchive_impl.ipp>
+#include <boost/archive/impl/archive_pointer_oserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+//template class basic_text_oprimitive<std::ostream> ;
+template class basic_text_oarchive<text_oarchive> ;
+template class text_oarchive_impl<text_oarchive> ;
+template class detail::archive_pointer_oserializer<text_oarchive> ;
+
+} // namespace serialization
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/text_wiarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/text_wiarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,37 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// text_wiarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#define BOOST_WARCHIVE_SOURCE
+#include <boost/archive/text_wiarchive.hpp>
+
+// explicitly instantiate for this type of text stream
+#include <boost/archive/impl/basic_text_iarchive.ipp>
+#include <boost/archive/impl/text_wiarchive_impl.ipp>
+#include <boost/archive/impl/archive_pointer_iserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+template class basic_text_iarchive<text_wiarchive> ;
+template class text_wiarchive_impl<text_wiarchive> ;
+template class detail::archive_pointer_iserializer<text_wiarchive> ;
+
+} // namespace archive
+} // namespace boost
+
+#endif // BOOST_NO_STD_WSTREAMBUF
+
+

Added: sandbox/SOC/2007/bigint/libs/serialization/src/text_woarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/text_woarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,33 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// text_woarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#define BOOST_WARCHIVE_SOURCE
+#include <boost/archive/text_woarchive.hpp>
+
+#include <boost/archive/impl/basic_text_oarchive.ipp>
+#include <boost/archive/impl/text_woarchive_impl.ipp>
+#include <boost/archive/impl/archive_pointer_oserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+template class basic_text_oarchive<text_woarchive> ;
+template class text_woarchive_impl<text_woarchive> ;
+template class detail::archive_pointer_oserializer<text_woarchive> ;
+
+} // namespace archive
+} // namespace boost
+
+#endif // BOOST_NO_STD_WSTREAMBUF

Added: sandbox/SOC/2007/bigint/libs/serialization/src/utf8_codecvt_facet.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/utf8_codecvt_facet.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,21 @@
+// Copyright Vladimir Prus 2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#define BOOST_UTF8_BEGIN_NAMESPACE \
+ namespace boost { namespace archive { namespace detail {
+#define BOOST_UTF8_DECL
+#define BOOST_UTF8_END_NAMESPACE }}}
+#include "../../detail/utf8_codecvt_facet.cpp"
+#undef BOOST_UTF8_END_NAMESPACE
+#undef BOOST_UTF8_DECL
+#undef BOOST_UTF8_BEGIN_NAMESPACE
+
+#endif // BOOST_NO_STD_WSTREAMBUF
+

Added: sandbox/SOC/2007/bigint/libs/serialization/src/void_cast.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/void_cast.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,333 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// void_cast.cpp: implementation of run-time casting of void pointers
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+// <gennadiy.rozental_at_[hidden]>
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#include <cassert>
+
+// STL
+#include <set>
+#include <functional>
+#include <algorithm>
+#include <cassert>
+
+// BOOST
+#include <boost/shared_ptr.hpp>
+#define BOOST_SERIALIZATION_SOURCE
+#include <boost/serialization/extended_type_info.hpp>
+#include <boost/serialization/void_cast.hpp>
+
+namespace boost {
+namespace serialization {
+namespace void_cast_detail {
+
+struct void_caster_compare
+{
+ bool
+ operator()(
+ shared_ptr<const void_caster> lhs,
+ shared_ptr<const void_caster> rhs ) const
+ {
+ if( lhs.get()->m_derived_type < rhs.get()->m_derived_type )
+ return true;
+
+ if( rhs.get()->m_derived_type < lhs.get()->m_derived_type)
+ return false;
+
+ if( lhs.get()->m_base_type < rhs.get()->m_base_type )
+ return true;
+
+ return false;
+ }
+};
+
+struct null_deleter
+{
+ void operator()(void const *) const
+ {}
+};
+
+// it turns out that at least one compiler (msvc 6.0) doesn't guarentee
+// to destroy static objects in exactly the reverse sequence that they
+// are constructed. To guarentee this, use a singleton pattern
+class void_caster_registry
+{
+ typedef shared_ptr<const void_caster> value_type;
+ typedef std::set<value_type, void_caster_compare> set_type;
+ set_type m_set;
+ static void_caster_registry * m_self;
+ static void_caster_registry *
+ self(){
+ if(NULL == m_self){
+ static void_caster_registry instance;
+ m_self = & instance;
+ }
+ return m_self;
+ }
+ void_caster_registry(){}
+public:
+ ~void_caster_registry(){
+ m_self = 0;
+ }
+ typedef set_type::iterator iterator;
+ typedef set_type::const_iterator const_iterator;
+ static iterator
+ begin() {
+ return self()->m_set.begin();
+ }
+ static iterator
+ end() {
+ return self()->m_set.end();
+ }
+ static const_iterator
+ find(void_caster * vcp){
+ return self()->m_set.find(value_type(vcp, null_deleter()));
+ }
+ static std::pair<iterator, bool>
+ insert(const value_type & vcp){
+ return self()->m_set.insert(vcp);
+ }
+ static bool
+ empty(){
+ if(NULL == m_self)
+ return true;
+ return m_self->m_set.empty();
+ }
+ static void
+ purge(const extended_type_info * eti);
+};
+
+void_caster_registry * void_caster_registry::m_self = NULL;
+
+void
+void_caster_registry::purge(const extended_type_info * eti){
+ if(NULL == m_self)
+ return;
+ if(! empty()){
+ iterator i = m_self->m_set.begin();
+ while(i != m_self->m_set.end()){
+ // note that the erase might invalidate i so save it here
+ iterator j = i++;
+ if((*j)->includes(eti))
+ m_self->m_set.erase(j);
+ }
+ }
+}
+
+BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
+void_caster::void_caster(
+ extended_type_info const & derived_type_,
+ extended_type_info const & base_type_
+) :
+ m_derived_type( derived_type_),
+ m_base_type(base_type_)
+{}
+
+BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
+void_caster::~void_caster(){}
+
+bool
+void_caster::includes(const extended_type_info * eti) const {
+ return & m_derived_type == eti || & m_base_type == eti;
+}
+
+void BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
+void_caster::static_register(const void_caster * vcp)
+{
+ void_caster_registry::insert(shared_ptr<const void_caster>(vcp, null_deleter()));
+}
+
+class void_caster_derived : public void_caster
+{
+ std::ptrdiff_t difference;
+ virtual void const*
+ upcast( void const* t ) const{
+ return static_cast<const char*> ( t ) + difference;
+ }
+ virtual void const*
+ downcast( void const* t ) const{
+ return static_cast<const char*> ( t ) - difference;
+ }
+public:
+ void_caster_derived(
+ extended_type_info const& derived_type_,
+ extended_type_info const& base_type_,
+ std::ptrdiff_t difference_
+ ) :
+ void_caster(derived_type_, base_type_),
+ difference( difference_ )
+ {}
+};
+
+// just used as a search key
+class void_caster_argument : public void_caster
+{
+ virtual void const*
+ upcast( void const* t ) const {
+ assert(false);
+ return NULL;
+ }
+ virtual void const*
+ downcast( void const* t ) const {
+ assert(false);
+ return NULL;
+ }
+public:
+ void_caster_argument(
+ extended_type_info const& derived_type_,
+ extended_type_info const& base_type_
+ ) :
+ void_caster(derived_type_, base_type_)
+ {}
+};
+
+} // namespace void_cast_detail
+
+void BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
+unregister_void_casts(extended_type_info *eti)
+{
+ void_cast_detail::void_caster_registry::purge(eti);
+}
+
+// Given a void *, assume that it really points to an instance of one type
+// and alter it so that it would point to an instance of a related type.
+// Return the altered pointer. If there exists no sequence of casts that
+// can transform from_type to to_type, return a NULL.
+
+BOOST_SERIALIZATION_DECL(void const *)
+void_upcast(
+ extended_type_info const & derived_type,
+ extended_type_info const & base_type,
+ void const * const t,
+ bool top
+){
+ // same types - trivial case
+ if (derived_type == base_type)
+ return t;
+
+ // check to see if base/derived pair is found in the registry
+ void_cast_detail::void_caster_argument ca(derived_type, base_type );
+ void_cast_detail::void_caster_registry::const_iterator it;
+ it = void_cast_detail::void_caster_registry::find( &ca );
+
+ const void * t_new = NULL;
+
+ // if so
+ if (it != void_cast_detail::void_caster_registry::end())
+ // we're done
+ return (*it)->upcast(t);
+
+ // try to find a chain that gives us what we want
+ for(
+ it = void_cast_detail::void_caster_registry::begin();
+ it != void_cast_detail::void_caster_registry::end();
+ ++it
+ ){
+ // if the current candidate doesn't cast to the desired target type
+ if ((*it)->m_base_type == base_type){
+ // if the current candidate casts from the desired source type
+ if ((*it)->m_derived_type == derived_type){
+ // we have a base/derived match - we're done
+ // cast to the intermediate type
+ t_new = (*it)->upcast(t);
+ break;
+ }
+ t_new = void_upcast(derived_type, (*it)->m_derived_type, t, false);
+ if (NULL != t_new){
+ t_new = (*it)->upcast(t_new);
+ assert(NULL != t_new);
+ if(top){
+ // register the this pair so we will have to go through
+ // keep this expensive search process more than once.
+ void_cast_detail::void_caster * vcp =
+ new void_cast_detail::void_caster_derived(
+ derived_type,
+ base_type,
+ static_cast<const char*>(t_new) - static_cast<const char*>(t)
+ );
+ void_cast_detail::void_caster_registry::insert(
+ shared_ptr<const void_cast_detail::void_caster>(vcp)
+ );
+ }
+ break;
+ }
+ }
+ }
+ return t_new;
+}
+
+BOOST_SERIALIZATION_DECL(void const *)
+void_downcast(
+ const extended_type_info & derived_type,
+ const extended_type_info & base_type,
+ const void * const t,
+ bool top
+){
+ // same types - trivial case
+ if (derived_type == base_type)
+ return t;
+
+ // check to see if base/derived pair is found in the registry
+ void_cast_detail::void_caster_argument ca(derived_type, base_type );
+ void_cast_detail::void_caster_registry::const_iterator it;
+ it = void_cast_detail::void_caster_registry::find( &ca );
+
+ // if so
+ if (it != void_cast_detail::void_caster_registry::end())
+ // we're done
+ return (*it)->downcast(t);
+
+ const void * t_new = NULL;
+ // try to find a chain that gives us what we want
+ for(
+ it = void_cast_detail::void_caster_registry::begin();
+ it != void_cast_detail::void_caster_registry::end();
+ ++it
+ ){
+ // if the current candidate doesn't casts from the desired target type
+ if ((*it)->m_derived_type == derived_type){
+ // if the current candidate casts to the desired source type
+ if ((*it)->m_base_type == base_type){
+ // we have a base/derived match - we're done
+ // cast to the intermediate type
+ t_new = (*it)->downcast(t);
+ break;
+ }
+ t_new = void_downcast((*it)->m_base_type, base_type, t, false);
+ if (NULL != t_new){
+ t_new = (*it)->downcast(t_new);
+ assert(NULL != t_new);
+ if(top){
+ // register the this pair so we will have to go through
+ // keep this expensive search process more than once.
+ void_cast_detail::void_caster * vcp =
+ new void_cast_detail::void_caster_derived(
+ derived_type,
+ base_type,
+ static_cast<const char*>(t) - static_cast<const char*>(t_new)
+ );
+ void_cast_detail::void_caster_registry::insert(
+ shared_ptr<const void_cast_detail::void_caster>(vcp)
+ );
+ }
+ break;
+ }
+ }
+ }
+ return t_new;
+}
+
+} // namespace serialization
+} // namespace boost
+
+// EOF

Added: sandbox/SOC/2007/bigint/libs/serialization/src/xml_grammar.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/xml_grammar.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,73 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// xml_grammar.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/impl/basic_xml_grammar.hpp>
+
+using namespace boost::spirit;
+
+#include <boost/config.hpp>
+
+// fixup for borland
+// The following code will be put into Boost.Config in a later revision
+#if ! defined(__SGI_STL_PORT) \
+&& defined(BOOST_RWSTD_VER) && BOOST_RWSTD_VER<=0x020101
+#include <string>
+namespace std {
+ template<>
+ inline string &
+ string::replace (
+ char * first1,
+ char * last1,
+ const char * first2,
+ const char * last2
+ ){
+ replace(first1-begin(),last1-first1,first2,last2-first2,0,last2-first2);
+ return *this;
+ }
+} // namespace std
+#endif
+
+namespace boost {
+namespace archive {
+
+typedef basic_xml_grammar<char> xml_grammar;
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// specific definitions for char based XML
+
+template<>
+void xml_grammar::init_chset(){
+ Char = chset_t("\x9\xA\xD\x20-\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 ;
+}
+
+} // namespace archive
+} // namespace boost
+
+#include "basic_xml_grammar.ipp"
+
+namespace boost {
+namespace archive {
+
+// explicit instantiation of xml for 8 bit characters
+template class basic_xml_grammar<char>;
+
+} // namespace archive
+} // namespace boost
+

Added: sandbox/SOC/2007/bigint/libs/serialization/src/xml_iarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/xml_iarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,41 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// xml_iarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#define BOOST_ARCHIVE_SOURCE
+
+// the following works around an issue between spirit 1.61 and borland.
+// it turns out the the certain spirit stuff must be defined before
+// certain parts of mpl. including this here makes sure that happens
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+#if BOOST_WORKAROUND(__BORLANDC__, <= 0x560 )
+#include <boost/archive/impl/basic_xml_grammar.hpp>
+#endif
+
+#include <boost/archive/xml_iarchive.hpp>
+
+// explicitly instantiate for this type of xml stream
+#include <boost/archive/impl/basic_xml_iarchive.ipp>
+#include <boost/archive/impl/archive_pointer_iserializer.ipp>
+#include <boost/archive/impl/xml_iarchive_impl.ipp>
+
+namespace boost {
+namespace archive {
+
+template class basic_xml_iarchive<xml_iarchive> ;
+template class detail::archive_pointer_iserializer<xml_iarchive> ;
+template class xml_iarchive_impl<xml_iarchive> ;
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/xml_oarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/xml_oarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,31 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// xml_oarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#define BOOST_ARCHIVE_SOURCE
+#include <boost/archive/xml_oarchive.hpp>
+
+#include <boost/archive/impl/basic_xml_oarchive.ipp>
+#include <boost/archive/impl/archive_pointer_oserializer.ipp>
+#include <boost/archive/impl/xml_oarchive_impl.ipp>
+
+namespace boost {
+namespace archive {
+
+// explicitly instantiate for this type of xml stream
+template class basic_xml_oarchive<xml_oarchive> ;
+template class detail::archive_pointer_oserializer<xml_oarchive> ;
+template class xml_oarchive_impl<xml_oarchive> ;
+
+} // namespace archive
+} // namespace boost

Added: sandbox/SOC/2007/bigint/libs/serialization/src/xml_wgrammar.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/xml_wgrammar.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,254 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// xml_wgrammar.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#define BOOST_WARCHIVE_SOURCE
+#include <boost/archive/impl/basic_xml_grammar.hpp>
+
+using namespace boost::spirit;
+
+// fixup for RogueWave
+#include <boost/config.hpp>
+#if ! defined(__SGI_STL_PORT) \
+&& defined(BOOST_RWSTD_VER) && BOOST_RWSTD_VER<=0x020101
+#include <string>
+namespace std {
+ template<>
+ inline wstring &
+ wstring::replace (
+ wchar_t * first1,
+ wchar_t * last1,
+ const wchar_t * first2,
+ const wchar_t * last2
+ ){
+ replace(first1-begin(),last1-first1,first2,last2-first2,0,last2-first2);
+ return *this;
+ }
+} // namespace std
+#endif
+
+namespace boost {
+namespace archive {
+
+typedef basic_xml_grammar<wchar_t> xml_wgrammar;
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// specific definitions for wchar_t based XML
+
+#if 0
+template<>
+const xml_wgrammar::chset_t xml_wgrammar::
+ #if defined(__GNUC__) && defined(linux)
+ Char(L"\x9\xA\xD\x20-\xD7FF\xE000-\xFFFD\x10000-\x10FFFF");
+ #else
+ Char(L"\x9\xA\xD\x20-\xD7FF\xE000-\xFFFD");
+ #endif
+
+template<>
+const xml_wgrammar::chset_t xml_wgrammar::Sch(L"\x20\x9\xD\xA");
+
+template<>
+const xml_wgrammar::chset_t xml_wgrammar::BaseChar (
+ 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"
+ L"\x3D0-\x3D6\x3DA\x3DC\x3DE\x3E0\x3E2-\x3F3\x401-\x40C\x40E-\x44F"
+ L"\x451-\x45C\x45E-\x481\x490-\x4C4\x4C7-\x4C8\x4CB-\x4CC\x4D0-\x4EB"
+ L"\x4EE-\x4F5\x4F8-\x4F9\x531-\x556\x559\x561-\x586\x5D0-\x5EA"
+ L"\x5F0-\x5F2\x621-\x63A\x641-\x64A\x671-\x6B7\x6BA-\x6BE\x6C0-\x6CE"
+ L"\x6D0-\x6D3\x6D5\x6E5-\x6E6\x905-\x939\x93D\x958-\x961\x985-\x98C"
+ L"\x98F-\x990\x993-\x9A8\x9AA-\x9B0\x9B2\x9B6-\x9B9\x9DC-\x9DD"
+ L"\x9DF-\x9E1\x9F0-\x9F1\xA05-\xA0A\xA0F-\xA10\xA13-\xA28\xA2A-\xA30"
+ L"\xA32-\xA33\xA35-\xA36\xA38-\xA39\xA59-\xA5C\xA5E\xA72-\xA74"
+ L"\xA85-\xA8B\xA8D\xA8F-\xA91\xA93-\xAA8\xAAA-\xAB0\xAB2-\xAB3"
+ L"\xAB5-\xAB9\xABD\xAE0\xB05-\xB0C\xB0F-\xB10\xB13-\xB28\xB2A-\xB30"
+ L"\xB32-\xB33\xB36-\xB39\xB3D\xB5C-\xB5D\xB5F-\xB61\xB85-\xB8A"
+ L"\xB8E-\xB90\xB92-\xB95\xB99-\xB9A\xB9C\xB9E-\xB9F\xBA3-\xBA4"
+ L"\xBA8-\xBAA\xBAE-\xBB5\xBB7-\xBB9\xC05-\xC0C\xC0E-\xC10\xC12-\xC28"
+ L"\xC2A-\xC33\xC35-\xC39\xC60-\xC61\xC85-\xC8C\xC8E-\xC90\xC92-\xCA8"
+ L"\xCAA-\xCB3\xCB5-\xCB9\xCDE\xCE0-\xCE1\xD05-\xD0C\xD0E-\xD10"
+ L"\xD12-\xD28\xD2A-\xD39\xD60-\xD61\xE01-\xE2E\xE30\xE32-\xE33"
+ L"\xE40-\xE45\xE81-\xE82\xE84\xE87-\xE88\xE8A\xE8D\xE94-\xE97"
+ L"\xE99-\xE9F\xEA1-\xEA3\xEA5\xEA7\xEAA-\xEAB\xEAD-\xEAE\xEB0"
+ L"\xEB2-\xEB3\xEBD\xEC0-\xEC4\xF40-\xF47\xF49-\xF69\x10A0-\x10C5"
+ L"\x10D0-\x10F6\x1100\x1102-\x1103\x1105-\x1107\x1109\x110B-\x110C"
+ L"\x110E-\x1112\x113C\x113E\x1140\x114C\x114E\x1150\x1154-\x1155"
+ L"\x1159\x115F-\x1161\x1163\x1165\x1167\x1169\x116D-\x116E"
+ L"\x1172-\x1173\x1175\x119E\x11A8\x11AB\x11AE-\x11AF\x11B7-\x11B8"
+ L"\x11BA\x11BC-\x11C2\x11EB\x11F0\x11F9\x1E00-\x1E9B\x1EA0-\x1EF9"
+ L"\x1F00-\x1F15\x1F18-\x1F1D\x1F20-\x1F45\x1F48-\x1F4D\x1F50-\x1F57"
+ L"\x1F59\x1F5B\x1F5D\x1F5F-\x1F7D\x1F80-\x1FB4\x1FB6-\x1FBC\x1FBE"
+ L"\x1FC2-\x1FC4\x1FC6-\x1FCC\x1FD0-\x1FD3\x1FD6-\x1FDB\x1FE0-\x1FEC"
+ L"\x1FF2-\x1FF4\x1FF6-\x1FFC\x2126\x212A-\x212B\x212E\x2180-\x2182"
+ L"\x3041-\x3094\x30A1-\x30FA\x3105-\x312C\xAC00-\xD7A3");
+
+template<>
+const xml_wgrammar::chset_t xml_wgrammar::Ideographic(
+ L"\x4E00-\x9FA5\x3007\x3021-\x3029");
+
+template<>
+const xml_wgrammar::chset_t xml_wgrammar::Letter = BaseChar | Ideographic;
+
+template<>
+const xml_wgrammar::chset_t xml_wgrammar::CombiningChar(
+ 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"
+ L"\x0901-\x0903\x093C\x093E-\x094C\x094D\x0951-\x0954\x0962-\x0963"
+ L"\x0981-\x0983\x09BC\x09BE\x09BF\x09C0-\x09C4\x09C7-\x09C8"
+ L"\x09CB-\x09CD\x09D7\x09E2-\x09E3\x0A02\x0A3C\x0A3E\x0A3F"
+ L"\x0A40-\x0A42\x0A47-\x0A48\x0A4B-\x0A4D\x0A70-\x0A71\x0A81-\x0A83"
+ L"\x0ABC\x0ABE-\x0AC5\x0AC7-\x0AC9\x0ACB-\x0ACD\x0B01-\x0B03\x0B3C"
+ L"\x0B3E-\x0B43\x0B47-\x0B48\x0B4B-\x0B4D\x0B56-\x0B57\x0B82-\x0B83"
+ L"\x0BBE-\x0BC2\x0BC6-\x0BC8\x0BCA-\x0BCD\x0BD7\x0C01-\x0C03"
+ L"\x0C3E-\x0C44\x0C46-\x0C48\x0C4A-\x0C4D\x0C55-\x0C56\x0C82-\x0C83"
+ L"\x0CBE-\x0CC4\x0CC6-\x0CC8\x0CCA-\x0CCD\x0CD5-\x0CD6\x0D02-\x0D03"
+ L"\x0D3E-\x0D43\x0D46-\x0D48\x0D4A-\x0D4D\x0D57\x0E31\x0E34-\x0E3A"
+ L"\x0E47-\x0E4E\x0EB1\x0EB4-\x0EB9\x0EBB-\x0EBC\x0EC8-\x0ECD"
+ L"\x0F18-\x0F19\x0F35\x0F37\x0F39\x0F3E\x0F3F\x0F71-\x0F84"
+ L"\x0F86-\x0F8B\x0F90-\x0F95\x0F97\x0F99-\x0FAD\x0FB1-\x0FB7\x0FB9"
+ L"\x20D0-\x20DC\x20E1\x302A-\x302F\x3099\x309A");
+
+template<>
+const xml_wgrammar::chset_t xml_wgrammar::Digit(
+ 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");
+
+template<>
+const xml_wgrammar::chset_t xml_wgrammar::Extender(
+ L"\x00B7\x02D0\x02D1\x0387\x0640\x0E46\x0EC6\x3005\x3031-\x3035"
+ L"\x309D-\x309E\x30FC-\x30FE");
+
+template<>
+const xml_wgrammar::chset_t xml_wgrammar::NameChar =
+ Letter
+ | Digit
+ | L'.'
+ | L'-'
+ | L'_'
+ | L':'
+ | CombiningChar
+ | Extender;
+#endif
+
+template<>
+void xml_wgrammar::init_chset(){
+ Char = chset_t(
+ #if defined(__GNUC__) && defined(linux)
+ L"\x9\xA\xD\x20-\xD7FF\xE000-\xFFFD\x10000-\x10FFFF"
+ #else
+ L"\x9\xA\xD\x20-\xD7FF\xE000-\xFFFD"
+ #endif
+ );
+
+ Sch = chset_t(L"\x20\x9\xD\xA");
+
+ BaseChar = chset_t(
+ 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"
+ L"\x3D0-\x3D6\x3DA\x3DC\x3DE\x3E0\x3E2-\x3F3\x401-\x40C\x40E-\x44F"
+ L"\x451-\x45C\x45E-\x481\x490-\x4C4\x4C7-\x4C8\x4CB-\x4CC\x4D0-\x4EB"
+ L"\x4EE-\x4F5\x4F8-\x4F9\x531-\x556\x559\x561-\x586\x5D0-\x5EA"
+ L"\x5F0-\x5F2\x621-\x63A\x641-\x64A\x671-\x6B7\x6BA-\x6BE\x6C0-\x6CE"
+ L"\x6D0-\x6D3\x6D5\x6E5-\x6E6\x905-\x939\x93D\x958-\x961\x985-\x98C"
+ L"\x98F-\x990\x993-\x9A8\x9AA-\x9B0\x9B2\x9B6-\x9B9\x9DC-\x9DD"
+ L"\x9DF-\x9E1\x9F0-\x9F1\xA05-\xA0A\xA0F-\xA10\xA13-\xA28\xA2A-\xA30"
+ L"\xA32-\xA33\xA35-\xA36\xA38-\xA39\xA59-\xA5C\xA5E\xA72-\xA74"
+ L"\xA85-\xA8B\xA8D\xA8F-\xA91\xA93-\xAA8\xAAA-\xAB0\xAB2-\xAB3"
+ L"\xAB5-\xAB9\xABD\xAE0\xB05-\xB0C\xB0F-\xB10\xB13-\xB28\xB2A-\xB30"
+ L"\xB32-\xB33\xB36-\xB39\xB3D\xB5C-\xB5D\xB5F-\xB61\xB85-\xB8A"
+ L"\xB8E-\xB90\xB92-\xB95\xB99-\xB9A\xB9C\xB9E-\xB9F\xBA3-\xBA4"
+ L"\xBA8-\xBAA\xBAE-\xBB5\xBB7-\xBB9\xC05-\xC0C\xC0E-\xC10\xC12-\xC28"
+ L"\xC2A-\xC33\xC35-\xC39\xC60-\xC61\xC85-\xC8C\xC8E-\xC90\xC92-\xCA8"
+ L"\xCAA-\xCB3\xCB5-\xCB9\xCDE\xCE0-\xCE1\xD05-\xD0C\xD0E-\xD10"
+ L"\xD12-\xD28\xD2A-\xD39\xD60-\xD61\xE01-\xE2E\xE30\xE32-\xE33"
+ L"\xE40-\xE45\xE81-\xE82\xE84\xE87-\xE88\xE8A\xE8D\xE94-\xE97"
+ L"\xE99-\xE9F\xEA1-\xEA3\xEA5\xEA7\xEAA-\xEAB\xEAD-\xEAE\xEB0"
+ L"\xEB2-\xEB3\xEBD\xEC0-\xEC4\xF40-\xF47\xF49-\xF69\x10A0-\x10C5"
+ L"\x10D0-\x10F6\x1100\x1102-\x1103\x1105-\x1107\x1109\x110B-\x110C"
+ L"\x110E-\x1112\x113C\x113E\x1140\x114C\x114E\x1150\x1154-\x1155"
+ L"\x1159\x115F-\x1161\x1163\x1165\x1167\x1169\x116D-\x116E"
+ L"\x1172-\x1173\x1175\x119E\x11A8\x11AB\x11AE-\x11AF\x11B7-\x11B8"
+ L"\x11BA\x11BC-\x11C2\x11EB\x11F0\x11F9\x1E00-\x1E9B\x1EA0-\x1EF9"
+ L"\x1F00-\x1F15\x1F18-\x1F1D\x1F20-\x1F45\x1F48-\x1F4D\x1F50-\x1F57"
+ L"\x1F59\x1F5B\x1F5D\x1F5F-\x1F7D\x1F80-\x1FB4\x1FB6-\x1FBC\x1FBE"
+ L"\x1FC2-\x1FC4\x1FC6-\x1FCC\x1FD0-\x1FD3\x1FD6-\x1FDB\x1FE0-\x1FEC"
+ L"\x1FF2-\x1FF4\x1FF6-\x1FFC\x2126\x212A-\x212B\x212E\x2180-\x2182"
+ L"\x3041-\x3094\x30A1-\x30FA\x3105-\x312C\xAC00-\xD7A3"
+ );
+
+ Ideographic = chset_t(L"\x4E00-\x9FA5\x3007\x3021-\x3029");
+
+ Letter = BaseChar | Ideographic;
+
+ CombiningChar = chset_t(
+ 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"
+ L"\x0901-\x0903\x093C\x093E-\x094C\x094D\x0951-\x0954\x0962-\x0963"
+ L"\x0981-\x0983\x09BC\x09BE\x09BF\x09C0-\x09C4\x09C7-\x09C8"
+ L"\x09CB-\x09CD\x09D7\x09E2-\x09E3\x0A02\x0A3C\x0A3E\x0A3F"
+ L"\x0A40-\x0A42\x0A47-\x0A48\x0A4B-\x0A4D\x0A70-\x0A71\x0A81-\x0A83"
+ L"\x0ABC\x0ABE-\x0AC5\x0AC7-\x0AC9\x0ACB-\x0ACD\x0B01-\x0B03\x0B3C"
+ L"\x0B3E-\x0B43\x0B47-\x0B48\x0B4B-\x0B4D\x0B56-\x0B57\x0B82-\x0B83"
+ L"\x0BBE-\x0BC2\x0BC6-\x0BC8\x0BCA-\x0BCD\x0BD7\x0C01-\x0C03"
+ L"\x0C3E-\x0C44\x0C46-\x0C48\x0C4A-\x0C4D\x0C55-\x0C56\x0C82-\x0C83"
+ L"\x0CBE-\x0CC4\x0CC6-\x0CC8\x0CCA-\x0CCD\x0CD5-\x0CD6\x0D02-\x0D03"
+ L"\x0D3E-\x0D43\x0D46-\x0D48\x0D4A-\x0D4D\x0D57\x0E31\x0E34-\x0E3A"
+ L"\x0E47-\x0E4E\x0EB1\x0EB4-\x0EB9\x0EBB-\x0EBC\x0EC8-\x0ECD"
+ L"\x0F18-\x0F19\x0F35\x0F37\x0F39\x0F3E\x0F3F\x0F71-\x0F84"
+ L"\x0F86-\x0F8B\x0F90-\x0F95\x0F97\x0F99-\x0FAD\x0FB1-\x0FB7\x0FB9"
+ 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(
+ L"\x00B7\x02D0\x02D1\x0387\x0640\x0E46\x0EC6\x3005\x3031-\x3035"
+ L"\x309D-\x309E\x30FC-\x30FE"
+ );
+
+ NameChar =
+ Letter
+ | Digit
+ | L'.'
+ | L'-'
+ | L'_'
+ | L':'
+ | CombiningChar
+ | Extender
+ ;
+}
+} // namespace archive
+} // namespace boost
+
+#include "basic_xml_grammar.ipp"
+
+namespace boost {
+namespace archive {
+
+// explicit instantiation of xml for wide characters
+template class basic_xml_grammar<wchar_t>;
+
+} // namespace archive
+} // namespace boost
+
+#endif

Added: sandbox/SOC/2007/bigint/libs/serialization/src/xml_wiarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/xml_wiarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,48 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// xml_wiarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#include <boost/detail/workaround.hpp>
+
+#if (defined _MSC_VER) && (_MSC_VER == 1200)
+# pragma warning (disable : 4786) // too long name, harmless warning
+#endif
+
+#define BOOST_WARCHIVE_SOURCE
+
+// the following works around an issue between spirit 1.61 and borland.
+// it turns out the the certain spirit stuff must be defined before
+// certain parts of mpl. including this here makes sure that happens
+#if BOOST_WORKAROUND(__BORLANDC__, <= 0x560 )
+#include <boost/archive/impl/basic_xml_grammar.hpp>
+#endif
+
+#include <boost/archive/xml_wiarchive.hpp>
+
+// explicitly instantiate for this type of xml stream
+#include <boost/archive/impl/basic_xml_iarchive.ipp>
+#include <boost/archive/impl/xml_wiarchive_impl.ipp>
+#include <boost/archive/impl/archive_pointer_iserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+template class basic_xml_iarchive<xml_wiarchive> ;
+template class xml_wiarchive_impl<xml_wiarchive> ;
+template class detail::archive_pointer_iserializer<xml_wiarchive> ;
+
+} // namespace archive
+} // namespace boost
+
+#endif // BOOST_NO_STD_WSTREAMBUF

Added: sandbox/SOC/2007/bigint/libs/serialization/src/xml_woarchive.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/bigint/libs/serialization/src/xml_woarchive.cpp 2007-06-11 18:02:24 EDT (Mon, 11 Jun 2007)
@@ -0,0 +1,64 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// xml_woarchive.cpp:
+
+// (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
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#define BOOST_WARCHIVE_SOURCE
+#include <boost/archive/xml_woarchive.hpp>
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// implemenations of functions specific to wide char archives
+
+#include <boost/archive/impl/basic_xml_oarchive.ipp>
+#include <boost/archive/impl/xml_woarchive_impl.ipp>
+#include <boost/archive/impl/archive_pointer_oserializer.ipp>
+
+namespace boost {
+namespace archive {
+
+BOOST_WARCHIVE_DECL(std::wostream &)
+operator<<(std::wostream &os, const char *t){
+ for(;;){
+ wchar_t wc;
+ int result = std::mbtowc(&wc, t, 10 /* max number */);
+ if(0 < result)
+ os.put(wc);
+ else
+ if(0 == result)
+ break;
+ else
+ boost::throw_exception(
+ iterators::dataflow_exception(
+ iterators::dataflow_exception::invalid_conversion
+ )
+ );
+ }
+ return os;
+}
+
+BOOST_WARCHIVE_DECL(std::wostream &)
+operator<<(std::wostream &os, const char t){
+ wchar_t wc;
+ std::mbtowc(&wc, &t, 1);
+ os.put(wc);
+ return os;
+}
+
+template class basic_xml_oarchive<xml_woarchive> ;
+template class xml_woarchive_impl<xml_woarchive> ;
+template class detail::archive_pointer_oserializer<xml_woarchive> ;
+
+} // namespace archive
+} // namespace boost
+
+#endif // BOOST_NO_STD_WSTREAMBUF


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