updated boost on windows
This commit is contained in:
@@ -193,14 +193,25 @@ namespace boost { namespace spirit { namespace traits
|
||||
struct extract_from_attribute<
|
||||
fusion::extension::adt_attribute_proxy<T, N, Const>, Exposed>
|
||||
{
|
||||
typedef
|
||||
typename fusion::extension::adt_attribute_proxy<T, N, Const>::type
|
||||
get_return_type;
|
||||
typedef typename remove_const<
|
||||
typename remove_reference<
|
||||
typename fusion::extension::adt_attribute_proxy<T, N, Const>::type
|
||||
get_return_type
|
||||
>::type
|
||||
>::type embedded_type;
|
||||
typedef
|
||||
typename spirit::result_of::extract_from<Exposed, embedded_type>::type
|
||||
type;
|
||||
extracted_type;
|
||||
|
||||
// If adt_attribute_proxy returned a value we must pass the attribute
|
||||
// by value, otherwise we will end up with a reference to a temporary
|
||||
// that will expire out of scope of the function call.
|
||||
typedef typename mpl::if_c<is_reference<get_return_type>::value
|
||||
, extracted_type
|
||||
, typename remove_reference<extracted_type>::type
|
||||
>::type type;
|
||||
|
||||
template <typename Context>
|
||||
static type
|
||||
|
||||
@@ -48,7 +48,10 @@ namespace boost { namespace spirit
|
||||
any_if_ns(First1 const& first1, First2 const& first2
|
||||
, Last1 const& last1, Last2 const& last2, F& f, mpl::false_)
|
||||
{
|
||||
return (0 != (f(*first1, spirit::detail::attribute_value<Pred, First1, Last2>(first2)) |
|
||||
typename result_of::attribute_value<First1, First2, Last2, Pred>::type
|
||||
attribute = spirit::detail::attribute_value<Pred, First1, Last2>(first2);
|
||||
|
||||
return (0 != (f(*first1, attribute) |
|
||||
detail::any_if_ns<Pred>(
|
||||
fusion::next(first1)
|
||||
, attribute_next<Pred, First1, Last2>(first2)
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_ANY_IF_NS_SO_DECEMBER_03_2017_0826PM)
|
||||
#define BOOST_SPIRIT_ANY_IF_NS_SO_DECEMBER_03_2017_0826PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/support/algorithm/any_ns_so.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// This is a special version for a binary fusion::any. The predicate
|
||||
// is used to decide whether to advance the second iterator or not.
|
||||
// This is needed for sequences containing components with unused
|
||||
// attributes. The second iterator is advanced only if the attribute
|
||||
// of the corresponding component iterator is not unused.
|
||||
//
|
||||
// This is a non-short circuiting (ns) strict order (so) version of the
|
||||
// any_if algorithm.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
namespace detail
|
||||
{
|
||||
template <
|
||||
typename Pred, typename First1, typename Last1, typename First2
|
||||
, typename Last2, typename F
|
||||
>
|
||||
inline bool
|
||||
any_if_ns_so(First1 const&, First2 const&, Last1 const&, Last2 const&
|
||||
, F const&, mpl::true_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <
|
||||
typename Pred, typename First1, typename Last1, typename First2
|
||||
, typename Last2, typename F
|
||||
>
|
||||
inline bool
|
||||
any_if_ns_so(First1 const& first1, First2 const& first2
|
||||
, Last1 const& last1, Last2 const& last2, F& f, mpl::false_)
|
||||
{
|
||||
typename result_of::attribute_value<First1, First2, Last2, Pred>::type
|
||||
attribute = spirit::detail::attribute_value<Pred, First1, Last2>(first2);
|
||||
|
||||
bool head = f(*first1, attribute);
|
||||
bool tail =
|
||||
detail::any_if_ns_so<Pred>(
|
||||
fusion::next(first1)
|
||||
, attribute_next<Pred, First1, Last2>(first2)
|
||||
, last1, last2
|
||||
, f
|
||||
, fusion::result_of::equal_to<
|
||||
typename fusion::result_of::next<First1>::type, Last1>());
|
||||
return head || tail;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Pred, typename Sequence1, typename Sequence2, typename F>
|
||||
inline bool
|
||||
any_if_ns_so(Sequence1 const& seq1, Sequence2& seq2, F f, Pred)
|
||||
{
|
||||
return detail::any_if_ns_so<Pred>(
|
||||
fusion::begin(seq1), fusion::begin(seq2)
|
||||
, fusion::end(seq1), fusion::end(seq2)
|
||||
, f
|
||||
, fusion::result_of::equal_to<
|
||||
typename fusion::result_of::begin<Sequence1>::type
|
||||
, typename fusion::result_of::end<Sequence1>::type>());
|
||||
}
|
||||
|
||||
template <typename Pred, typename Sequence, typename F>
|
||||
inline bool
|
||||
any_if_ns_so(Sequence const& seq, unused_type const, F f, Pred)
|
||||
{
|
||||
return detail::any_ns_so(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, fusion::result_of::equal_to<
|
||||
typename fusion::result_of::begin<Sequence>::type
|
||||
, typename fusion::result_of::end<Sequence>::type>());
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
106
winx64/include/boost/spirit/home/support/algorithm/any_ns_so.hpp
Normal file
106
winx64/include/boost/spirit/home/support/algorithm/any_ns_so.hpp
Normal file
@@ -0,0 +1,106 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_ANY_NS_SO_DECEMBER_03_2017_0826PM)
|
||||
#define BOOST_SPIRIT_ANY_NS_SO_DECEMBER_03_2017_0826PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/include/equal_to.hpp>
|
||||
#include <boost/fusion/include/next.hpp>
|
||||
#include <boost/fusion/include/deref.hpp>
|
||||
#include <boost/fusion/include/begin.hpp>
|
||||
#include <boost/fusion/include/end.hpp>
|
||||
#include <boost/fusion/include/any.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
// A non-short circuiting (ns) strict order (so) version of the any
|
||||
// algorithm
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename First1, typename Last, typename First2, typename F>
|
||||
inline bool
|
||||
any_ns_so(First1 const&, First2 const&, Last const&, F const&, mpl::true_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename First1, typename Last, typename First2, typename F>
|
||||
inline bool
|
||||
any_ns_so(First1 const& first1, First2 const& first2, Last const& last, F& f, mpl::false_)
|
||||
{
|
||||
bool head = f(*first1, *first2);
|
||||
bool tail =
|
||||
detail::any_ns_so(
|
||||
fusion::next(first1)
|
||||
, fusion::next(first2)
|
||||
, last
|
||||
, f
|
||||
, fusion::result_of::equal_to<
|
||||
typename fusion::result_of::next<First1>::type, Last>());
|
||||
return head || tail;
|
||||
}
|
||||
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
any_ns_so(First const&, Last const&, F const&, mpl::true_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
any_ns_so(First const& first, Last const& last, F& f, mpl::false_)
|
||||
{
|
||||
bool head = f(*first);
|
||||
bool tail =
|
||||
detail::any_ns_so(
|
||||
fusion::next(first)
|
||||
, last
|
||||
, f
|
||||
, fusion::result_of::equal_to<
|
||||
typename fusion::result_of::next<First>::type, Last>());
|
||||
return head || tail;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Sequence1, typename Sequence2, typename F>
|
||||
inline bool
|
||||
any_ns_so(Sequence1 const& seq1, Sequence2& seq2, F f)
|
||||
{
|
||||
return detail::any_ns_so(
|
||||
fusion::begin(seq1)
|
||||
, fusion::begin(seq2)
|
||||
, fusion::end(seq1)
|
||||
, f
|
||||
, fusion::result_of::equal_to<
|
||||
typename fusion::result_of::begin<Sequence1>::type
|
||||
, typename fusion::result_of::end<Sequence1>::type>());
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
inline bool
|
||||
any_ns_so(Sequence const& seq, unused_type, F f)
|
||||
{
|
||||
return detail::any_ns_so(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, fusion::result_of::equal_to<
|
||||
typename fusion::result_of::begin<Sequence>::type
|
||||
, typename fusion::result_of::end<Sequence>::type>());
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,10 +28,9 @@
|
||||
#include <boost/fusion/include/for_each.hpp>
|
||||
#include <boost/fusion/include/is_view.hpp>
|
||||
#include <boost/fusion/include/mpl.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/utility/value_init.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/end.hpp>
|
||||
#include <boost/mpl/find_if.hpp>
|
||||
@@ -46,6 +45,7 @@
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <iterator> // for std::iterator_traits, std::distance
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <ios>
|
||||
@@ -279,11 +279,6 @@ namespace boost { namespace spirit { namespace traits
|
||||
: mpl::false_
|
||||
{};
|
||||
|
||||
template <typename T, typename Domain>
|
||||
struct not_is_variant<boost::optional<T>, Domain>
|
||||
: not_is_variant<T, Domain>
|
||||
{};
|
||||
|
||||
// we treat every type as if it where the variant (as this meta function is
|
||||
// invoked for variant types only)
|
||||
template <typename T>
|
||||
@@ -296,6 +291,11 @@ namespace boost { namespace spirit { namespace traits
|
||||
: variant_type<T>
|
||||
{};
|
||||
|
||||
template <typename T, typename Domain>
|
||||
struct not_is_variant_or_variant_in_optional
|
||||
: not_is_variant<typename variant_type<T>::type, Domain>
|
||||
{};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// The compute_compatible_component_variant
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -339,7 +339,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
|
||||
template <typename Variant, typename Expected>
|
||||
struct compute_compatible_component_variant<Variant, Expected, mpl::false_
|
||||
, typename enable_if<detail::has_types<Variant> >::type>
|
||||
, typename enable_if<detail::has_types<typename variant_type<Variant>::type> >::type>
|
||||
{
|
||||
typedef typename traits::variant_type<Variant>::type variant_type;
|
||||
typedef typename variant_type::types types;
|
||||
@@ -372,7 +372,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
template <typename Expected, typename Attribute, typename Domain>
|
||||
struct compute_compatible_component
|
||||
: compute_compatible_component_variant<Attribute, Expected
|
||||
, typename spirit::traits::not_is_variant<Attribute, Domain>::type> {};
|
||||
, typename not_is_variant_or_variant_in_optional<Attribute, Domain>::type> {};
|
||||
|
||||
template <typename Expected, typename Domain>
|
||||
struct compute_compatible_component<Expected, unused_type, Domain>
|
||||
@@ -560,12 +560,12 @@ namespace boost { namespace spirit { namespace traits
|
||||
template <typename Iterator>
|
||||
struct attribute_size<iterator_range<Iterator> >
|
||||
{
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::
|
||||
typedef typename std::iterator_traits<Iterator>::
|
||||
difference_type type;
|
||||
|
||||
static type call(iterator_range<Iterator> const& r)
|
||||
{
|
||||
return boost::detail::distance(r.begin(), r.end());
|
||||
return std::distance(r.begin(), r.end());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -924,6 +924,23 @@ namespace boost { namespace spirit { namespace traits
|
||||
type;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
// Domain-agnostic class template partial specializations and
|
||||
// type agnostic domain partial specializations are ambious.
|
||||
// To resolve the ambiguity type agnostic domain partial
|
||||
// specializations are dispatched via intermediate type.
|
||||
template <typename Exposed, typename Transformed, typename Domain>
|
||||
struct transform_attribute_base;
|
||||
|
||||
template <typename Attribute>
|
||||
struct synthesize_attribute
|
||||
{
|
||||
typedef Attribute type;
|
||||
static Attribute pre(unused_type) { return Attribute(); }
|
||||
static void post(unused_type, Attribute const&) {}
|
||||
static void fail(unused_type) {}
|
||||
};
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// transform_attribute
|
||||
//
|
||||
@@ -931,91 +948,32 @@ namespace boost { namespace spirit { namespace traits
|
||||
// attributes. This template can be used as a customization point, where
|
||||
// the user is able specify specific transformation rules for any attribute
|
||||
// type.
|
||||
//
|
||||
// Note: the transformations involving unused_type are internal details
|
||||
// and may be subject to change at any time.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Exposed, typename Transformed, typename Domain
|
||||
, typename Enable/* = void*/>
|
||||
struct transform_attribute;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Domain, typename Transformed, typename Exposed>
|
||||
typename spirit::result_of::pre_transform<Exposed, Transformed, Domain>::type
|
||||
pre_transform(Exposed& attr BOOST_PROTO_DISABLE_IF_IS_CONST(Exposed))
|
||||
struct transform_attribute
|
||||
: detail::transform_attribute_base<Exposed, Transformed, Domain>
|
||||
{
|
||||
return transform_attribute<Exposed, Transformed, Domain>::pre(attr);
|
||||
}
|
||||
|
||||
template <typename Domain, typename Transformed, typename Exposed>
|
||||
typename spirit::result_of::pre_transform<Exposed const, Transformed, Domain>::type
|
||||
pre_transform(Exposed const& attr)
|
||||
{
|
||||
return transform_attribute<Exposed const, Transformed, Domain>::pre(attr);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// make_attribute
|
||||
//
|
||||
// All parsers and generators have specific attribute types.
|
||||
// Spirit parsers and generators are passed an attribute; these are either
|
||||
// references to the expected type, or an unused_type -- to flag that we do
|
||||
// not care about the attribute. For semantic actions, however, we need to
|
||||
// have a real value to pass to the semantic action. If the client did not
|
||||
// provide one, we will have to synthesize the value. This class takes care
|
||||
// of that. *Note that this behavior has changed. From Boost 1.47, semantic
|
||||
// actions always take in the passed attribute as-is if the PP constant:
|
||||
// BOOST_SPIRIT_ACTIONS_ALLOW_ATTR_COMPAT is defined.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Attribute, typename ActualAttribute>
|
||||
struct make_attribute
|
||||
{
|
||||
typedef typename remove_const<Attribute>::type attribute_type;
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_same<typename remove_const<ActualAttribute>::type, unused_type>
|
||||
, attribute_type
|
||||
, ActualAttribute&>::type
|
||||
type;
|
||||
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_same<typename remove_const<ActualAttribute>::type, unused_type>
|
||||
, attribute_type
|
||||
, ActualAttribute>::type
|
||||
value_type;
|
||||
|
||||
static Attribute call(unused_type)
|
||||
{
|
||||
// synthesize the attribute/parameter
|
||||
return boost::get(value_initialized<attribute_type>());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T& call(T& value)
|
||||
{
|
||||
return value; // just pass the one provided
|
||||
}
|
||||
BOOST_STATIC_ASSERT_MSG(!is_reference<Exposed>::value,
|
||||
"Exposed cannot be a reference type");
|
||||
BOOST_STATIC_ASSERT_MSG(!is_reference<Transformed>::value,
|
||||
"Transformed cannot be a reference type");
|
||||
};
|
||||
|
||||
template <typename Attribute, typename ActualAttribute>
|
||||
struct make_attribute<Attribute&, ActualAttribute>
|
||||
: make_attribute<Attribute, ActualAttribute>
|
||||
template <typename Transformed, typename Domain>
|
||||
struct transform_attribute<unused_type, Transformed, Domain>
|
||||
: detail::synthesize_attribute<Transformed>
|
||||
{};
|
||||
|
||||
template <typename Attribute, typename ActualAttribute>
|
||||
struct make_attribute<Attribute const&, ActualAttribute>
|
||||
: make_attribute<Attribute const, ActualAttribute>
|
||||
template <typename Transformed, typename Domain>
|
||||
struct transform_attribute<unused_type const, Transformed, Domain>
|
||||
: detail::synthesize_attribute<Transformed>
|
||||
{};
|
||||
|
||||
template <typename ActualAttribute>
|
||||
struct make_attribute<unused_type, ActualAttribute>
|
||||
{
|
||||
typedef unused_type type;
|
||||
typedef unused_type value_type;
|
||||
static unused_type call(unused_type)
|
||||
{
|
||||
return unused;
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// swap_impl
|
||||
//
|
||||
@@ -1032,8 +990,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
template <typename T>
|
||||
void swap_impl(T& a, T& b)
|
||||
{
|
||||
using namespace std;
|
||||
swap(a, b);
|
||||
boost::swap(a, b);
|
||||
}
|
||||
|
||||
template <typename A>
|
||||
@@ -1383,14 +1340,4 @@ namespace boost { namespace spirit { namespace traits
|
||||
}
|
||||
}}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace result_of
|
||||
{
|
||||
template <typename Exposed, typename Transformed, typename Domain>
|
||||
struct pre_transform
|
||||
: traits::transform_attribute<Exposed, Transformed, Domain>
|
||||
{};
|
||||
}}}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,9 +30,6 @@ namespace boost { namespace spirit { namespace result_of
|
||||
template <typename T, typename Attribute>
|
||||
struct attribute_as;
|
||||
|
||||
template <typename Exposed, typename Transformed, typename Domain>
|
||||
struct pre_transform;
|
||||
|
||||
template <typename T>
|
||||
struct optional_value;
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace boost { namespace spirit
|
||||
( strict, strict_type )
|
||||
( relaxed, relaxed_type )
|
||||
( duplicate, duplicate_type )
|
||||
( expect, expect_type )
|
||||
)
|
||||
|
||||
// Our extended terminals
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/attributes_fwd.hpp>
|
||||
#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
@@ -23,6 +22,7 @@
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repeat.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
@@ -465,7 +465,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
template <typename Iterator, typename Enable/* = void*/>
|
||||
struct deref_iterator
|
||||
{
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::reference type;
|
||||
typedef typename std::iterator_traits<Iterator>::reference type;
|
||||
static type call(Iterator& it)
|
||||
{
|
||||
return *it;
|
||||
|
||||
@@ -34,9 +34,13 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/endian.hpp>
|
||||
#include <boost/predef/other/endian.h>
|
||||
#ifndef BOOST_MINIMAL_INTEGER_COVER_OPERATORS
|
||||
#define BOOST_MINIMAL_INTEGER_COVER_OPERATORS
|
||||
#endif
|
||||
#ifndef BOOST_NO_IO_COVER_OPERATORS
|
||||
#define BOOST_NO_IO_COVER_OPERATORS
|
||||
#endif
|
||||
#include <boost/spirit/home/support/detail/endian/cover_operators.hpp>
|
||||
#undef BOOST_NO_IO_COVER_OPERATORS
|
||||
#undef BOOST_MINIMAL_INTEGER_COVER_OPERATORS
|
||||
@@ -52,10 +56,10 @@
|
||||
# error Platforms with CHAR_BIT != 8 are not supported
|
||||
# endif
|
||||
|
||||
# define BOOST_ENDIAN_DEFAULT_CONSTRUCT {} // C++03
|
||||
# define BOOST_SPIRIT_ENDIAN_DEFAULT_CONSTRUCT {} // C++03
|
||||
|
||||
# if defined(BOOST_ENDIAN_FORCE_PODNESS)
|
||||
# define BOOST_ENDIAN_NO_CTORS
|
||||
# if defined(BOOST_ENDIAN_NO_CTORS) || defined(BOOST_ENDIAN_FORCE_PODNESS)
|
||||
# define BOOST_SPIRIT_ENDIAN_NO_CTORS
|
||||
# endif
|
||||
|
||||
|
||||
@@ -315,8 +319,8 @@ namespace boost { namespace spirit
|
||||
BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits );
|
||||
public:
|
||||
typedef T value_type;
|
||||
# ifndef BOOST_ENDIAN_NO_CTORS
|
||||
endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
|
||||
# ifndef BOOST_SPIRIT_ENDIAN_NO_CTORS
|
||||
endian() BOOST_SPIRIT_ENDIAN_DEFAULT_CONSTRUCT
|
||||
explicit endian(T val)
|
||||
{
|
||||
# ifdef BOOST_ENDIAN_LOG
|
||||
@@ -347,8 +351,8 @@ namespace boost { namespace spirit
|
||||
BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits );
|
||||
public:
|
||||
typedef T value_type;
|
||||
# ifndef BOOST_ENDIAN_NO_CTORS
|
||||
endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
|
||||
# ifndef BOOST_SPIRIT_ENDIAN_NO_CTORS
|
||||
endian() BOOST_SPIRIT_ENDIAN_DEFAULT_CONSTRUCT
|
||||
explicit endian(T val)
|
||||
{
|
||||
# ifdef BOOST_ENDIAN_LOG
|
||||
@@ -379,15 +383,15 @@ namespace boost { namespace spirit
|
||||
BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits );
|
||||
public:
|
||||
typedef T value_type;
|
||||
# ifndef BOOST_ENDIAN_NO_CTORS
|
||||
endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
# ifndef BOOST_SPIRIT_ENDIAN_NO_CTORS
|
||||
endian() BOOST_SPIRIT_ENDIAN_DEFAULT_CONSTRUCT
|
||||
# if BOOST_ENDIAN_BIG_BYTE
|
||||
explicit endian(T val) { detail::store_big_endian<T, n_bits/8>(m_value, val); }
|
||||
# else
|
||||
explicit endian(T val) { detail::store_little_endian<T, n_bits/8>(m_value, val); }
|
||||
# endif
|
||||
# endif
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
# if BOOST_ENDIAN_BIG_BYTE
|
||||
endian & operator=(T val) { detail::store_big_endian<T, n_bits/8>(m_value, val); return *this; }
|
||||
operator T() const { return detail::load_big_endian<T, n_bits/8>(m_value); }
|
||||
# else
|
||||
@@ -410,15 +414,15 @@ namespace boost { namespace spirit
|
||||
BOOST_STATIC_ASSERT( sizeof(T) == n_bits/8 );
|
||||
public:
|
||||
typedef T value_type;
|
||||
# ifndef BOOST_ENDIAN_NO_CTORS
|
||||
endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
# ifndef BOOST_SPIRIT_ENDIAN_NO_CTORS
|
||||
endian() BOOST_SPIRIT_ENDIAN_DEFAULT_CONSTRUCT
|
||||
# if BOOST_ENDIAN_BIG_BYTE
|
||||
endian(T val) : m_value(val) { }
|
||||
# else
|
||||
explicit endian(T val) { detail::store_big_endian<T, sizeof(T)>(&m_value, val); }
|
||||
# endif
|
||||
# endif
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
# if BOOST_ENDIAN_BIG_BYTE
|
||||
endian & operator=(T val) { m_value = val; return *this; }
|
||||
operator T() const { return m_value; }
|
||||
# else
|
||||
@@ -438,15 +442,15 @@ namespace boost { namespace spirit
|
||||
BOOST_STATIC_ASSERT( sizeof(T) == n_bits/8 );
|
||||
public:
|
||||
typedef T value_type;
|
||||
# ifndef BOOST_ENDIAN_NO_CTORS
|
||||
endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
|
||||
# ifdef BOOST_LITTLE_ENDIAN
|
||||
# ifndef BOOST_SPIRIT_ENDIAN_NO_CTORS
|
||||
endian() BOOST_SPIRIT_ENDIAN_DEFAULT_CONSTRUCT
|
||||
# if BOOST_ENDIAN_LITTLE_BYTE
|
||||
endian(T val) : m_value(val) { }
|
||||
# else
|
||||
explicit endian(T val) { detail::store_little_endian<T, sizeof(T)>(&m_value, val); }
|
||||
# endif
|
||||
# endif
|
||||
# ifdef BOOST_LITTLE_ENDIAN
|
||||
# if BOOST_ENDIAN_LITTLE_BYTE
|
||||
endian & operator=(T val) { m_value = val; return *this; }
|
||||
operator T() const { return m_value; }
|
||||
#else
|
||||
@@ -519,10 +523,6 @@ namespace boost { namespace spirit
|
||||
typedef endian< endianness::native, uint_least64_t, 56 > unative56_t;
|
||||
typedef endian< endianness::native, uint_least64_t, 64 > unative64_t;
|
||||
|
||||
#define BOOST_HAS_INT16_T
|
||||
#define BOOST_HAS_INT32_T
|
||||
#define BOOST_HAS_INT64_T
|
||||
|
||||
// These types only present if platform has exact size integers:
|
||||
// aligned big endian signed integer types
|
||||
// aligned big endian unsigned integer types
|
||||
@@ -532,35 +532,32 @@ namespace boost { namespace spirit
|
||||
// aligned native endian typedefs are not provided because
|
||||
// <cstdint> types are superior for this use case
|
||||
|
||||
# if defined(BOOST_HAS_INT16_T)
|
||||
#ifdef INT16_MAX
|
||||
typedef endian< endianness::big, int16_t, 16, alignment::aligned > aligned_big16_t;
|
||||
typedef endian< endianness::big, uint16_t, 16, alignment::aligned > aligned_ubig16_t;
|
||||
typedef endian< endianness::little, int16_t, 16, alignment::aligned > aligned_little16_t;
|
||||
typedef endian< endianness::little, uint16_t, 16, alignment::aligned > aligned_ulittle16_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if defined(BOOST_HAS_INT32_T)
|
||||
#ifdef INT32_MAX
|
||||
typedef endian< endianness::big, int32_t, 32, alignment::aligned > aligned_big32_t;
|
||||
typedef endian< endianness::big, uint32_t, 32, alignment::aligned > aligned_ubig32_t;
|
||||
typedef endian< endianness::little, int32_t, 32, alignment::aligned > aligned_little32_t;
|
||||
typedef endian< endianness::little, uint32_t, 32, alignment::aligned > aligned_ulittle32_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if defined(BOOST_HAS_INT64_T)
|
||||
#ifdef INT64_MAX
|
||||
typedef endian< endianness::big, int64_t, 64, alignment::aligned > aligned_big64_t;
|
||||
typedef endian< endianness::big, uint64_t, 64, alignment::aligned > aligned_ubig64_t;
|
||||
typedef endian< endianness::little, int64_t, 64, alignment::aligned > aligned_little64_t;
|
||||
typedef endian< endianness::little, uint64_t, 64, alignment::aligned > aligned_ulittle64_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
} // namespace endian
|
||||
}} // namespace boost::spirit
|
||||
|
||||
// import the namespace above into boost::endian
|
||||
namespace boost { namespace endian
|
||||
{
|
||||
using namespace boost::spirit::endian;
|
||||
}}
|
||||
#undef BOOST_SPIRIT_ENDIAN_DEFAULT_CONSTRUCT
|
||||
#undef BOOST_SPIRIT_ENDIAN_NO_CTORS
|
||||
|
||||
#if defined(__BORLANDC__) || defined( __CODEGEARC__)
|
||||
# pragma pack(pop)
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace boost { namespace spirit
|
||||
: from(src.name()), to(dest.name())
|
||||
{}
|
||||
|
||||
virtual const char* what() const throw() { return "bad any cast"; }
|
||||
virtual const char* what() const BOOST_NOEXCEPT_OR_NOTHROW { return "bad any cast"; }
|
||||
|
||||
const char* from;
|
||||
const char* to;
|
||||
@@ -101,13 +101,13 @@ namespace boost { namespace spirit
|
||||
*reinterpret_cast<T*>(dest) =
|
||||
*reinterpret_cast<T const*>(src);
|
||||
}
|
||||
static std::basic_istream<Char>&
|
||||
static std::basic_istream<Char>&
|
||||
stream_in (std::basic_istream<Char>& i, void** obj)
|
||||
{
|
||||
i >> *reinterpret_cast<T*>(obj);
|
||||
return i;
|
||||
}
|
||||
static std::basic_ostream<Char>&
|
||||
static std::basic_ostream<Char>&
|
||||
stream_out(std::basic_ostream<Char>& o, void* const* obj)
|
||||
{
|
||||
o << *reinterpret_cast<T const*>(obj);
|
||||
@@ -146,13 +146,13 @@ namespace boost { namespace spirit
|
||||
**reinterpret_cast<T**>(dest) =
|
||||
**reinterpret_cast<T* const*>(src);
|
||||
}
|
||||
static std::basic_istream<Char>&
|
||||
static std::basic_istream<Char>&
|
||||
stream_in(std::basic_istream<Char>& i, void** obj)
|
||||
{
|
||||
i >> **reinterpret_cast<T**>(obj);
|
||||
return i;
|
||||
}
|
||||
static std::basic_ostream<Char>&
|
||||
static std::basic_ostream<Char>&
|
||||
stream_out(std::basic_ostream<Char>& o, void* const* obj)
|
||||
{
|
||||
o << **reinterpret_cast<T* const*>(obj);
|
||||
@@ -198,7 +198,7 @@ namespace boost { namespace spirit
|
||||
// value of the required type to the hold_any instance you want to
|
||||
// stream to. This assignment has to be executed before the actual
|
||||
// call to the operator>>().
|
||||
BOOST_ASSERT(false &&
|
||||
BOOST_ASSERT(false &&
|
||||
"Tried to insert from a std istream into an empty "
|
||||
"hold_any instance");
|
||||
return i;
|
||||
@@ -222,10 +222,8 @@ namespace boost { namespace spirit
|
||||
explicit basic_hold_any(T const& x)
|
||||
: table(spirit::detail::get_table<T>::template get<Char>()), object(0)
|
||||
{
|
||||
if (spirit::detail::get_table<T>::is_small::value)
|
||||
new (&object) T(x);
|
||||
else
|
||||
object = new T(x);
|
||||
new_object(object, x,
|
||||
typename spirit::detail::get_table<T>::is_small());
|
||||
}
|
||||
|
||||
basic_hold_any()
|
||||
@@ -297,6 +295,18 @@ namespace boost { namespace spirit
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void new_object(void*& object, T const& x, mpl::true_)
|
||||
{
|
||||
new (&object) T(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void new_object(void*& object, T const& x, mpl::false_)
|
||||
{
|
||||
object = new T(x);
|
||||
}
|
||||
|
||||
// assignment operator
|
||||
#ifdef BOOST_HAS_RVALUE_REFS
|
||||
template <typename T>
|
||||
@@ -317,6 +327,11 @@ namespace boost { namespace spirit
|
||||
return assign(x);
|
||||
}
|
||||
#endif
|
||||
// copy assignment operator
|
||||
basic_hold_any& operator=(basic_hold_any const& x)
|
||||
{
|
||||
return assign(x);
|
||||
}
|
||||
|
||||
// utility functions
|
||||
basic_hold_any& swap(basic_hold_any& x)
|
||||
@@ -369,14 +384,14 @@ namespace boost { namespace spirit
|
||||
// because spirit::hold_any is used only in contexts where these operators
|
||||
// do exist
|
||||
template <typename Char_>
|
||||
friend inline std::basic_istream<Char_>&
|
||||
friend inline std::basic_istream<Char_>&
|
||||
operator>> (std::basic_istream<Char_>& i, basic_hold_any<Char_>& obj)
|
||||
{
|
||||
return obj.table->stream_in(i, &obj.object);
|
||||
}
|
||||
|
||||
template <typename Char_>
|
||||
friend inline std::basic_ostream<Char_>&
|
||||
friend inline std::basic_ostream<Char_>&
|
||||
operator<< (std::basic_ostream<Char_>& o, basic_hold_any<Char_> const& obj)
|
||||
{
|
||||
return obj.table->stream_out(o, &obj.object);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "consts.hpp"
|
||||
#include "internals.hpp"
|
||||
#include <iostream>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include "runtime_error.hpp"
|
||||
#include "size_t.hpp"
|
||||
#include "state_machine.hpp"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "parser/tree/node.hpp"
|
||||
#include "parser/parser.hpp"
|
||||
#include "containers/ptr_list.hpp"
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include "rules.hpp"
|
||||
#include "state_machine.hpp"
|
||||
|
||||
@@ -116,10 +117,10 @@ public:
|
||||
protected:
|
||||
typedef detail::basic_charset<CharT> charset;
|
||||
typedef detail::ptr_list<charset> charset_list;
|
||||
typedef std::auto_ptr<charset> charset_ptr;
|
||||
typedef boost::movelib::unique_ptr<charset> charset_ptr;
|
||||
typedef detail::equivset equivset;
|
||||
typedef detail::ptr_list<equivset> equivset_list;
|
||||
typedef std::auto_ptr<equivset> equivset_ptr;
|
||||
typedef boost::movelib::unique_ptr<equivset> equivset_ptr;
|
||||
typedef typename charset::index_set index_set;
|
||||
typedef std::vector<index_set> index_set_vector;
|
||||
typedef detail::basic_parser<CharT> parser;
|
||||
@@ -377,8 +378,8 @@ protected:
|
||||
if (followpos_->empty ()) return npos;
|
||||
|
||||
std::size_t index_ = 0;
|
||||
std::auto_ptr<node_set> set_ptr_ (new node_set);
|
||||
std::auto_ptr<node_vector> vector_ptr_ (new node_vector);
|
||||
boost::movelib::unique_ptr<node_set> set_ptr_ (new node_set);
|
||||
boost::movelib::unique_ptr<node_vector> vector_ptr_ (new node_vector);
|
||||
|
||||
for (typename detail::node::node_vector::const_iterator iter_ =
|
||||
followpos_->begin (), end_ = followpos_->end ();
|
||||
@@ -494,21 +495,13 @@ protected:
|
||||
delete *l_iter_;
|
||||
*l_iter_ = overlap_.release ();
|
||||
|
||||
// VC++ 6 Hack:
|
||||
charset_ptr temp_overlap_ (new charset);
|
||||
|
||||
overlap_ = temp_overlap_;
|
||||
overlap_.reset (new charset);
|
||||
++iter_;
|
||||
}
|
||||
else if (r_->empty ())
|
||||
{
|
||||
delete r_.release ();
|
||||
r_ = overlap_;
|
||||
|
||||
// VC++ 6 Hack:
|
||||
charset_ptr temp_overlap_ (new charset);
|
||||
|
||||
overlap_ = temp_overlap_;
|
||||
overlap_.swap (r_);
|
||||
overlap_.reset (new charset);
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -517,10 +510,7 @@ protected:
|
||||
static_cast<charset *>(0));
|
||||
*iter_ = overlap_.release ();
|
||||
|
||||
// VC++ 6 Hack:
|
||||
charset_ptr temp_overlap_ (new charset);
|
||||
|
||||
overlap_ = temp_overlap_;
|
||||
overlap_.reset(new charset);
|
||||
++iter_;
|
||||
end_ = lhs_->end ();
|
||||
}
|
||||
@@ -642,21 +632,13 @@ protected:
|
||||
delete *l_iter_;
|
||||
*l_iter_ = overlap_.release ();
|
||||
|
||||
// VC++ 6 Hack:
|
||||
equivset_ptr temp_overlap_ (new equivset);
|
||||
|
||||
overlap_ = temp_overlap_;
|
||||
overlap_.reset (new equivset);
|
||||
++iter_;
|
||||
}
|
||||
else if (r_->empty ())
|
||||
{
|
||||
delete r_.release ();
|
||||
r_ = overlap_;
|
||||
|
||||
// VC++ 6 Hack:
|
||||
equivset_ptr temp_overlap_ (new equivset);
|
||||
|
||||
overlap_ = temp_overlap_;
|
||||
overlap_.swap (r_);
|
||||
overlap_.reset (new equivset);
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -665,10 +647,7 @@ protected:
|
||||
static_cast<equivset *>(0));
|
||||
*iter_ = overlap_.release ();
|
||||
|
||||
// VC++ 6 Hack:
|
||||
equivset_ptr temp_overlap_ (new equivset);
|
||||
|
||||
overlap_ = temp_overlap_;
|
||||
overlap_.reset (new equivset);
|
||||
++iter_;
|
||||
end_ = lhs_->end ();
|
||||
}
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
#define BOOST_LEXER_INPUT
|
||||
|
||||
#include "char_traits.hpp"
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include "size_t.hpp"
|
||||
#include "state_machine.hpp"
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace lexer
|
||||
{
|
||||
template<typename FwdIter, typename Traits =
|
||||
char_traits<typename boost::detail::iterator_traits<FwdIter>::value_type> >
|
||||
char_traits<typename std::iterator_traits<FwdIter>::value_type> >
|
||||
class basic_input
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
#ifndef BOOST_LEXER_RUNTIME_ERROR_HPP
|
||||
#define BOOST_LEXER_RUNTIME_ERROR_HPP
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_SYMBOL_VISIBLE
|
||||
#include <stdexcept>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace lexer
|
||||
{
|
||||
class runtime_error : public std::runtime_error
|
||||
class BOOST_SYMBOL_VISIBLE runtime_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
runtime_error (const std::string &what_arg_) :
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// examples/serialise.hpp
|
||||
// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_LEXER_SERIALISE_HPP
|
||||
#define BOOST_LEXER_SERIALISE_HPP
|
||||
|
||||
#include "internals.hpp"
|
||||
#include "state_machine.hpp"
|
||||
#include <boost/serialization/vector.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace lexer
|
||||
{
|
||||
// IMPORTANT! This won't work if you don't enable RTTI!
|
||||
template<typename CharT, class Archive>
|
||||
void serialise (basic_state_machine<CharT> &sm_, Archive &ar_,
|
||||
unsigned int version_ = 1)
|
||||
{
|
||||
detail::internals &internals_ = const_cast<detail::internals &>
|
||||
(sm_.data ());
|
||||
|
||||
ar_ & version_;
|
||||
ar_ & *internals_._lookup;
|
||||
ar_ & internals_._dfa_alphabet;
|
||||
ar_ & *internals_._dfa;
|
||||
ar_ & internals_._seen_BOL_assertion;
|
||||
ar_ & internals_._seen_EOL_assertion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,583 +0,0 @@
|
||||
// fp_traits.hpp
|
||||
|
||||
#ifndef BOOST_SPIRIT_MATH_FP_TRAITS_HPP
|
||||
#define BOOST_SPIRIT_MATH_FP_TRAITS_HPP
|
||||
|
||||
// Copyright (c) 2006 Johan Rade
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT
|
||||
# error The VAX floating point mode on VMS is not supported.
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/detail/endian.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace boost {
|
||||
namespace spirit {
|
||||
namespace math {
|
||||
namespace detail {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
Most processors support three different floating point precisions:
|
||||
single precision (32 bits), double precision (64 bits)
|
||||
and extended double precision (>64 bits)
|
||||
|
||||
Note that the C++ type long double can be implemented
|
||||
both as double precision and extended double precision.
|
||||
*/
|
||||
|
||||
struct single_precision_tag {};
|
||||
struct double_precision_tag {};
|
||||
struct extended_double_precision_tag {};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
template<class T, class U> struct fp_traits_impl;
|
||||
|
||||
This is traits class that describes the binary structure of floating
|
||||
point numbers of C++ type T and precision U
|
||||
|
||||
Requirements:
|
||||
|
||||
T = float, double or long double
|
||||
U = single_precision_tag, double_precision_tag
|
||||
or extended_double_precision_tag
|
||||
|
||||
Typedef members:
|
||||
|
||||
bits -- the target type when copying the leading bytes of a floating
|
||||
point number. It is a typedef for uint32_t or uint64_t.
|
||||
|
||||
coverage -- tells us whether all bytes are copied or not.
|
||||
It is a typedef for all_bits or not_all_bits.
|
||||
|
||||
Static data members:
|
||||
|
||||
sign, exponent, flag, mantissa -- bit masks that give the meaning of the bits
|
||||
in the leading bytes.
|
||||
|
||||
Static function members:
|
||||
|
||||
init() -- initializes the static data members, if needed.
|
||||
(Is a no-op in the specialized versions of the template.)
|
||||
|
||||
get_bits(), set_bits() -- provide access to the leading bytes.
|
||||
*/
|
||||
|
||||
struct all_bits {};
|
||||
struct not_all_bits {};
|
||||
|
||||
// Generic version -------------------------------------------------------------
|
||||
|
||||
// The generic version uses run time initialization to determine the floating
|
||||
// point format. It is capable of handling most formats,
|
||||
// but not the Motorola 68K extended double precision format.
|
||||
|
||||
// Currently the generic version is used only for extended double precision
|
||||
// on Itanium. In all other cases there are specializations of the template
|
||||
// that use compile time initialization.
|
||||
|
||||
template<class T> struct uint32_t_coverage
|
||||
{
|
||||
typedef not_all_bits type;
|
||||
};
|
||||
|
||||
template<> struct uint32_t_coverage<single_precision_tag>
|
||||
{
|
||||
typedef all_bits type;
|
||||
};
|
||||
|
||||
template<class T, class U> struct fp_traits_impl
|
||||
{
|
||||
typedef uint32_t bits;
|
||||
typedef BOOST_DEDUCED_TYPENAME uint32_t_coverage<U>::type coverage;
|
||||
|
||||
BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000);
|
||||
static uint32_t exponent;
|
||||
static uint32_t flag;
|
||||
static uint32_t mantissa;
|
||||
|
||||
static void init()
|
||||
{
|
||||
if(is_init_) return;
|
||||
do_init_();
|
||||
is_init_ = true;
|
||||
}
|
||||
|
||||
static void get_bits(T x, uint32_t& a)
|
||||
{
|
||||
memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
|
||||
}
|
||||
|
||||
static void set_bits(T& x, uint32_t a)
|
||||
{
|
||||
memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
|
||||
}
|
||||
|
||||
private:
|
||||
static size_t offset_;
|
||||
static bool is_init_;
|
||||
static void do_init_();
|
||||
};
|
||||
|
||||
//..............................................................................
|
||||
|
||||
template<class T, class U> uint32_t fp_traits_impl<T,U>::exponent;
|
||||
template<class T, class U> uint32_t fp_traits_impl<T,U>::flag;
|
||||
template<class T, class U> uint32_t fp_traits_impl<T,U>::mantissa;
|
||||
template<class T, class U> size_t fp_traits_impl<T,U>::offset_;
|
||||
template<class T, class U> bool fp_traits_impl<T,U>::is_init_;
|
||||
|
||||
// In a single-threaded program, do_init will be called exactly once.
|
||||
// In a multi-threaded program, do_init may be called simultaneously
|
||||
// by more then one thread. That should not be a problem.
|
||||
|
||||
//..............................................................................
|
||||
|
||||
template<class T, class U> void fp_traits_impl<T,U>::do_init_()
|
||||
{
|
||||
T x = static_cast<T>(3) / static_cast<T>(4);
|
||||
// sign bit = 0
|
||||
// exponent: first and last bit = 0, all other bits = 1
|
||||
// flag bit (if present) = 1
|
||||
// mantissa: first bit = 1, all other bits = 0
|
||||
|
||||
uint32_t a;
|
||||
|
||||
for(size_t k = 0; k <= sizeof(T) - 4; ++k) {
|
||||
|
||||
memcpy(&a, reinterpret_cast<unsigned char*>(&x) + k, 4);
|
||||
|
||||
switch(a) {
|
||||
|
||||
case 0x3f400000: // IEEE single precision format
|
||||
|
||||
offset_ = k;
|
||||
exponent = 0x7f800000;
|
||||
flag = 0x00000000;
|
||||
mantissa = 0x007fffff;
|
||||
return;
|
||||
|
||||
case 0x3fe80000: // IEEE double precision format
|
||||
// and PowerPC extended double precision format
|
||||
offset_ = k;
|
||||
exponent = 0x7ff00000;
|
||||
flag = 0x00000000;
|
||||
mantissa = 0x000fffff;
|
||||
return;
|
||||
|
||||
case 0x3ffe0000: // Motorola extended double precision format
|
||||
|
||||
// Must not get here. Must be handled by specialization.
|
||||
// To get accurate cutoff between normals and subnormals
|
||||
// we must use the flag bit that is in the 5th byte.
|
||||
// Otherwise this cutoff will be off by a factor 2.
|
||||
// If we do get here, then we have failed to detect the Motorola
|
||||
// processor at compile time.
|
||||
|
||||
BOOST_ASSERT(false &&
|
||||
"Failed to detect the Motorola processor at compile time");
|
||||
return;
|
||||
|
||||
case 0x3ffe8000: // IEEE extended double precision format
|
||||
// with 15 exponent bits
|
||||
offset_ = k;
|
||||
exponent = 0x7fff0000;
|
||||
flag = 0x00000000;
|
||||
mantissa = 0x0000ffff;
|
||||
return;
|
||||
|
||||
case 0x3ffec000: // Intel extended double precision format
|
||||
|
||||
offset_ = k;
|
||||
exponent = 0x7fff0000;
|
||||
flag = 0x00008000;
|
||||
mantissa = 0x00007fff;
|
||||
return;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_ASSERT(false);
|
||||
|
||||
// Unknown format.
|
||||
}
|
||||
|
||||
|
||||
// float (32 bits) -------------------------------------------------------------
|
||||
|
||||
template<> struct fp_traits_impl<float, single_precision_tag>
|
||||
{
|
||||
typedef uint32_t bits;
|
||||
typedef all_bits coverage;
|
||||
|
||||
BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7f800000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, mantissa = 0x007fffff);
|
||||
|
||||
static void init() {}
|
||||
static void get_bits(float x, uint32_t& a) { memcpy(&a, &x, 4); }
|
||||
static void set_bits(float& x, uint32_t a) { memcpy(&x, &a, 4); }
|
||||
};
|
||||
|
||||
|
||||
// double (64 bits) ------------------------------------------------------------
|
||||
|
||||
#if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
|
||||
|
||||
template<> struct fp_traits_impl<double, double_precision_tag>
|
||||
{
|
||||
typedef uint32_t bits;
|
||||
typedef not_all_bits coverage;
|
||||
|
||||
BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, flag = 0);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, mantissa = 0x000fffff);
|
||||
|
||||
static void init() {}
|
||||
|
||||
static void get_bits(double x, uint32_t& a)
|
||||
{
|
||||
memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
|
||||
}
|
||||
|
||||
static void set_bits(double& x, uint32_t a)
|
||||
{
|
||||
memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
BOOST_STATIC_CONSTANT(int, offset_ = 0);
|
||||
#elif defined(BOOST_LITTLE_ENDIAN)
|
||||
BOOST_STATIC_CONSTANT(int, offset_ = 4);
|
||||
#else
|
||||
BOOST_STATIC_ASSERT(false);
|
||||
#endif
|
||||
};
|
||||
|
||||
//..............................................................................
|
||||
|
||||
#else
|
||||
|
||||
template<> struct fp_traits_impl<double, double_precision_tag>
|
||||
{
|
||||
typedef uint64_t bits;
|
||||
typedef all_bits coverage;
|
||||
|
||||
static const uint64_t sign = (uint64_t)0x80000000 << 32;
|
||||
static const uint64_t exponent = (uint64_t)0x7ff00000 << 32;
|
||||
static const uint64_t flag = 0;
|
||||
static const uint64_t mantissa
|
||||
= ((uint64_t)0x000fffff << 32) + (uint64_t)0xffffffff;
|
||||
|
||||
static void init() {}
|
||||
static void get_bits(double x, uint64_t& a) { memcpy(&a, &x, 8); }
|
||||
static void set_bits(double& x, uint64_t a) { memcpy(&x, &a, 8); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// long double (64 bits) -------------------------------------------------------
|
||||
|
||||
#if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
|
||||
|
||||
template<> struct fp_traits_impl<long double, double_precision_tag>
|
||||
{
|
||||
typedef uint32_t bits;
|
||||
typedef not_all_bits coverage;
|
||||
|
||||
BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, flag = 0);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, mantissa = 0x000fffff);
|
||||
|
||||
static void init() {}
|
||||
|
||||
static void get_bits(long double x, uint32_t& a)
|
||||
{
|
||||
memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
|
||||
}
|
||||
|
||||
static void set_bits(long double& x, uint32_t a)
|
||||
{
|
||||
memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
BOOST_STATIC_CONSTANT(int, offset_ = 0);
|
||||
#elif defined(BOOST_LITTLE_ENDIAN)
|
||||
BOOST_STATIC_CONSTANT(int, offset_ = 4);
|
||||
#else
|
||||
BOOST_STATIC_ASSERT(false);
|
||||
#endif
|
||||
};
|
||||
|
||||
//..............................................................................
|
||||
|
||||
#else
|
||||
|
||||
template<> struct fp_traits_impl<long double, double_precision_tag>
|
||||
{
|
||||
typedef uint64_t bits;
|
||||
typedef all_bits coverage;
|
||||
|
||||
static const uint64_t sign = (uint64_t)0x80000000 << 32;
|
||||
static const uint64_t exponent = (uint64_t)0x7ff00000 << 32;
|
||||
static const uint64_t flag = 0;
|
||||
static const uint64_t mantissa
|
||||
= ((uint64_t)0x000fffff << 32) + (uint64_t)0xffffffff;
|
||||
|
||||
static void init() {}
|
||||
static void get_bits(long double x, uint64_t& a) { memcpy(&a, &x, 8); }
|
||||
static void set_bits(long double& x, uint64_t a) { memcpy(&x, &a, 8); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// long double (>64 bits), x86 and x64 -----------------------------------------
|
||||
|
||||
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) \
|
||||
|| defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) \
|
||||
|| defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)
|
||||
|
||||
// Intel extended double precision format (80 bits)
|
||||
|
||||
template<> struct fp_traits_impl<long double, extended_double_precision_tag>
|
||||
{
|
||||
typedef uint32_t bits;
|
||||
typedef not_all_bits coverage;
|
||||
|
||||
BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00008000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, mantissa = 0x00007fff);
|
||||
|
||||
static void init() {}
|
||||
|
||||
static void get_bits(long double x, uint32_t& a)
|
||||
{
|
||||
memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + 6, 4);
|
||||
}
|
||||
|
||||
static void set_bits(long double& x, uint32_t a)
|
||||
{
|
||||
memcpy(reinterpret_cast<unsigned char*>(&x) + 6, &a, 4);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// long double (>64 bits), Itanium ---------------------------------------------
|
||||
|
||||
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
|
||||
|
||||
// The floating point format is unknown at compile time
|
||||
// No template specialization is provided.
|
||||
// The generic definition is used.
|
||||
|
||||
// The Itanium supports both
|
||||
// the Intel extended double precision format (80 bits) and
|
||||
// the IEEE extended double precision format with 15 exponent bits (128 bits).
|
||||
|
||||
|
||||
// long double (>64 bits), PowerPC ---------------------------------------------
|
||||
|
||||
#elif defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) \
|
||||
|| defined(__ppc) || defined(__ppc__) || defined(__PPC__)
|
||||
|
||||
// PowerPC extended double precision format (128 bits)
|
||||
|
||||
template<> struct fp_traits_impl<long double, extended_double_precision_tag>
|
||||
{
|
||||
typedef uint32_t bits;
|
||||
typedef not_all_bits coverage;
|
||||
|
||||
BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, mantissa = 0x000fffff);
|
||||
|
||||
static void init() {}
|
||||
|
||||
static void get_bits(long double x, uint32_t& a)
|
||||
{
|
||||
memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
|
||||
}
|
||||
|
||||
static void set_bits(long double& x, uint32_t a)
|
||||
{
|
||||
memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
BOOST_STATIC_CONSTANT(int, offset_ = 0);
|
||||
#elif defined(BOOST_LITTLE_ENDIAN)
|
||||
BOOST_STATIC_CONSTANT(int, offset_ = 12);
|
||||
#else
|
||||
BOOST_STATIC_ASSERT(false);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
// long double (>64 bits), Motorola 68K ----------------------------------------
|
||||
|
||||
#elif defined(__m68k) || defined(__m68k__) \
|
||||
|| defined(__mc68000) || defined(__mc68000__) \
|
||||
|
||||
// Motorola extended double precision format (96 bits)
|
||||
|
||||
// It is the same format as the Intel extended double precision format,
|
||||
// except that 1) it is big-endian, 2) the 3rd and 4th byte are padding, and
|
||||
// 3) the flag bit is not set for infinity
|
||||
|
||||
template<> struct fp_traits_impl<long double, extended_double_precision_tag>
|
||||
{
|
||||
typedef uint32_t bits;
|
||||
typedef not_all_bits coverage;
|
||||
|
||||
BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00008000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, mantissa = 0x00007fff);
|
||||
|
||||
static void init() {}
|
||||
|
||||
// copy 1st, 2nd, 5th and 6th byte. 3rd and 4th byte are padding.
|
||||
|
||||
static void get_bits(long double x, uint32_t& a)
|
||||
{
|
||||
memcpy(&a, &x, 2);
|
||||
memcpy(reinterpret_cast<unsigned char*>(&a) + 2,
|
||||
reinterpret_cast<const unsigned char*>(&x) + 4, 2);
|
||||
}
|
||||
|
||||
static void set_bits(long double& x, uint32_t a)
|
||||
{
|
||||
memcpy(&x, &a, 2);
|
||||
memcpy(reinterpret_cast<unsigned char*>(&x) + 4,
|
||||
reinterpret_cast<const unsigned char*>(&a) + 2, 2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// long double (>64 bits), All other processors --------------------------------
|
||||
|
||||
#else
|
||||
|
||||
// IEEE extended double precision format with 15 exponent bits (128 bits)
|
||||
|
||||
template<> struct fp_traits_impl<long double, extended_double_precision_tag>
|
||||
{
|
||||
typedef uint32_t bits;
|
||||
typedef not_all_bits coverage;
|
||||
|
||||
BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000);
|
||||
BOOST_STATIC_CONSTANT(uint32_t, mantissa = 0x0000ffff);
|
||||
|
||||
static void init() {}
|
||||
|
||||
static void get_bits(long double x, uint32_t& a)
|
||||
{
|
||||
memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
|
||||
}
|
||||
|
||||
static void set_bits(long double& x, uint32_t a)
|
||||
{
|
||||
memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
BOOST_STATIC_CONSTANT(int, offset_ = 0);
|
||||
#elif defined(BOOST_LITTLE_ENDIAN)
|
||||
BOOST_STATIC_CONSTANT(int, offset_ = 12);
|
||||
#else
|
||||
BOOST_STATIC_ASSERT(false);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// size_to_precision is a type switch for converting a C++ floating point type
|
||||
// to the corresponding precision type.
|
||||
|
||||
template<int n> struct size_to_precision;
|
||||
|
||||
template<> struct size_to_precision<4>
|
||||
{
|
||||
typedef single_precision_tag type;
|
||||
};
|
||||
|
||||
template<> struct size_to_precision<8>
|
||||
{
|
||||
typedef double_precision_tag type;
|
||||
};
|
||||
|
||||
template<> struct size_to_precision<10>
|
||||
{
|
||||
typedef extended_double_precision_tag type;
|
||||
};
|
||||
|
||||
template<> struct size_to_precision<12>
|
||||
{
|
||||
typedef extended_double_precision_tag type;
|
||||
};
|
||||
|
||||
template<> struct size_to_precision<16>
|
||||
{
|
||||
typedef extended_double_precision_tag type;
|
||||
};
|
||||
|
||||
// fp_traits is a type switch that selects the right fp_traits_impl
|
||||
|
||||
template<class T> struct fp_traits
|
||||
{
|
||||
BOOST_STATIC_ASSERT(boost::is_floating_point<T>::value);
|
||||
typedef BOOST_DEDUCED_TYPENAME size_to_precision<sizeof(T)>::type precision;
|
||||
typedef fp_traits_impl<T, precision> type;
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
} // namespace detail
|
||||
} // namespace math
|
||||
} // namespace spirit
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -1,235 +0,0 @@
|
||||
// fpclassify.hpp
|
||||
|
||||
#ifndef BOOST_SPIRIT_MATH_FPCLASSIFY_HPP
|
||||
#define BOOST_SPIRIT_MATH_FPCLASSIFY_HPP
|
||||
|
||||
// Copyright (c) 2006 Johan Rade
|
||||
|
||||
// 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)
|
||||
|
||||
/*
|
||||
The following algorithm is used:
|
||||
|
||||
If all exponent bits, the flag bit (if there is one),
|
||||
and all mantissa bits are 0, then the number is zero.
|
||||
|
||||
If all exponent bits and the flag bit (if there is one) are 0,
|
||||
and at least one mantissa bit is 1, then the number is subnormal.
|
||||
|
||||
If all exponent bits are 1 and all mantissa bits are 0,
|
||||
then the number is infinity.
|
||||
|
||||
If all exponent bits are 1 and at least one mantissa bit is 1,
|
||||
then the number is a not-a-number.
|
||||
|
||||
Otherwise the number is normal.
|
||||
|
||||
(Note that the binary representation of infinity
|
||||
has flag bit 0 for Motorola 68K extended double precision,
|
||||
and flag bit 1 for Intel extended double precision.)
|
||||
|
||||
To get the bits, the four or eight most significant bytes are copied
|
||||
into an uint32_t or uint64_t and bit masks are applied.
|
||||
This covers all the exponent bits and the flag bit (if there is one),
|
||||
but not always all the mantissa bits.
|
||||
Some of the functions below have two implementations,
|
||||
depending on whether all the mantissa bits are copied or not.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#ifndef FP_INFINITE
|
||||
# define FP_INFINITE 0
|
||||
# define FP_NAN 1
|
||||
# define FP_NORMAL 2
|
||||
# define FP_SUBNORMAL 3
|
||||
# define FP_ZERO 4
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/support/detail/math/detail/fp_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace spirit {
|
||||
namespace math {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class T> bool (isfinite)(T x)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
|
||||
traits::init();
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent;
|
||||
return a != traits::exponent;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class T> bool (isnormal)(T x)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
|
||||
traits::init();
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::flag;
|
||||
return (a != 0) && (a < traits::exponent);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class T> bool isinf_impl(T x, all_bits)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::mantissa;
|
||||
return a == traits::exponent;
|
||||
}
|
||||
|
||||
template<class T> bool isinf_impl(T x, not_all_bits)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::mantissa;
|
||||
if(a != traits::exponent)
|
||||
return false;
|
||||
|
||||
traits::set_bits(x,0);
|
||||
return x == 0;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class T> bool (isinf)(T x)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
|
||||
traits::init();
|
||||
return detail::isinf_impl(x, BOOST_DEDUCED_TYPENAME traits::coverage());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class T> bool isnan_impl(T x, all_bits)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
traits::init();
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::mantissa;
|
||||
return a > traits::exponent;
|
||||
}
|
||||
|
||||
template<class T> bool isnan_impl(T x, not_all_bits)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
traits::init();
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
|
||||
a &= traits::exponent | traits::mantissa;
|
||||
if(a < traits::exponent)
|
||||
return false;
|
||||
|
||||
a &= traits::mantissa;
|
||||
traits::set_bits(x,a);
|
||||
return x != 0;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class T> bool (isnan)(T x)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
|
||||
traits::init();
|
||||
return detail::isnan_impl(x, BOOST_DEDUCED_TYPENAME traits::coverage());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class T> int fpclassify_impl(T x, all_bits)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::flag | traits::mantissa;
|
||||
|
||||
if(a <= traits::mantissa) {
|
||||
if(a == 0)
|
||||
return FP_ZERO;
|
||||
else
|
||||
return FP_SUBNORMAL;
|
||||
}
|
||||
|
||||
if(a < traits::exponent)
|
||||
return FP_NORMAL;
|
||||
|
||||
a &= traits::mantissa;
|
||||
if(a == 0)
|
||||
return FP_INFINITE;
|
||||
|
||||
return FP_NAN;
|
||||
}
|
||||
|
||||
template<class T> int fpclassify_impl(T x, not_all_bits)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::exponent | traits::flag | traits::mantissa;
|
||||
|
||||
if(a <= traits::mantissa) {
|
||||
if(x == 0)
|
||||
return FP_ZERO;
|
||||
else
|
||||
return FP_SUBNORMAL;
|
||||
}
|
||||
|
||||
if(a < traits::exponent)
|
||||
return FP_NORMAL;
|
||||
|
||||
a &= traits::mantissa;
|
||||
traits::set_bits(x,a);
|
||||
if(x == 0)
|
||||
return FP_INFINITE;
|
||||
|
||||
return FP_NAN;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class T> int (fpclassify)(T x)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
|
||||
traits::init();
|
||||
return detail::fpclassify_impl(x, BOOST_DEDUCED_TYPENAME traits::coverage());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
} // namespace math
|
||||
} // namespace spirit
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -1,92 +0,0 @@
|
||||
// signbit.hpp
|
||||
|
||||
#ifndef BOOST_SPIRIT_MATH_SIGNBIT_HPP
|
||||
#define BOOST_SPIRIT_MATH_SIGNBIT_HPP
|
||||
|
||||
// Copyright (c) 2006 Johan Rade
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/support/detail/math/detail/fp_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace spirit {
|
||||
namespace math {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class T> bool (signbit)(T x)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
|
||||
traits::init();
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= traits::sign;
|
||||
return a != 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class T> T copysign_impl(T x, T y)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits;
|
||||
traits::init();
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a &= ~traits::sign;
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits b;
|
||||
traits::get_bits(y,b);
|
||||
b &= traits::sign;
|
||||
|
||||
traits::set_bits(x,a|b);
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
inline float (copysign)(float x, float y) // magnitude of x and sign of y
|
||||
{
|
||||
return detail::copysign_impl(x,y);
|
||||
}
|
||||
|
||||
inline double (copysign)(double x, double y)
|
||||
{
|
||||
return detail::copysign_impl(x,y);
|
||||
}
|
||||
|
||||
inline long double (copysign)(long double x, long double y)
|
||||
{
|
||||
return detail::copysign_impl(x,y);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class T> T (changesign)(T x)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits;
|
||||
traits::init();
|
||||
|
||||
BOOST_DEDUCED_TYPENAME traits::bits a;
|
||||
traits::get_bits(x,a);
|
||||
a ^= traits::sign;
|
||||
traits::set_bits(x,a);
|
||||
return x;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
} // namespace math
|
||||
} // namespace spirit
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <cfloat>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
|
||||
@@ -13,58 +13,21 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#if BOOST_VERSION < 104000
|
||||
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
|
||||
#include <boost/spirit/home/support/detail/math/signbit.hpp>
|
||||
#else
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <boost/math/special_functions/sign.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace spirit { namespace detail
|
||||
{
|
||||
#if BOOST_VERSION < 104000
|
||||
// signbit(-NAN) is broken for versions of Boost earlier than 1.40.0
|
||||
// This routine has been taken and adapted from Johan Rade's fp_traits
|
||||
// library
|
||||
template<typename T>
|
||||
inline bool (signbit)(T x)
|
||||
{
|
||||
return (boost::spirit::math::signbit)(x);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T (changesign)(T x)
|
||||
{
|
||||
return (boost::spirit::math::changesign)(x);
|
||||
}
|
||||
#else
|
||||
template<typename T>
|
||||
inline bool (signbit)(T x)
|
||||
{
|
||||
return (boost::math::signbit)(x) ? true : false;
|
||||
}
|
||||
|
||||
// This routine has been taken and adapted from Johan Rade's fp_traits
|
||||
// library
|
||||
template<typename T>
|
||||
inline T (changesign)(T x)
|
||||
{
|
||||
#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)
|
||||
return -x;
|
||||
#else
|
||||
typedef typename math::detail::fp_traits<T>::type traits_type;
|
||||
|
||||
typename traits_type::bits a;
|
||||
traits_type::get_bits(x, a);
|
||||
a ^= traits_type::sign;
|
||||
traits_type::set_bits(x, a);
|
||||
return x;
|
||||
#endif
|
||||
return (boost::math::changesign)(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ namespace boost { namespace spirit { namespace iterator_policies
|
||||
// thrown by buf_id_check CheckingPolicy if an instance of an iterator is
|
||||
// used after another one has invalidated the queue
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
class illegal_backtracking : public std::exception
|
||||
class BOOST_SYMBOL_VISIBLE illegal_backtracking : public std::exception
|
||||
{
|
||||
public:
|
||||
illegal_backtracking() throw() {}
|
||||
~illegal_backtracking() throw() {}
|
||||
illegal_backtracking() BOOST_NOEXCEPT_OR_NOTHROW {}
|
||||
~illegal_backtracking() BOOST_NOEXCEPT_OR_NOTHROW {}
|
||||
|
||||
char const* what() const throw()
|
||||
char const* what() const BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
return "boost::spirit::multi_pass::illegal_backtracking";
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
|
||||
#include <boost/spirit/home/support/iterators/detail/multi_pass.hpp>
|
||||
#include <boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp>
|
||||
#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits
|
||||
#include <boost/assert.hpp>
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
namespace boost { namespace spirit { namespace iterator_policies
|
||||
{
|
||||
@@ -35,18 +35,18 @@ namespace boost { namespace spirit { namespace iterator_policies
|
||||
{
|
||||
private:
|
||||
typedef
|
||||
typename boost::detail::iterator_traits<T>::value_type
|
||||
typename std::iterator_traits<T>::value_type
|
||||
result_type;
|
||||
|
||||
public:
|
||||
typedef
|
||||
typename boost::detail::iterator_traits<T>::difference_type
|
||||
typename std::iterator_traits<T>::difference_type
|
||||
difference_type;
|
||||
typedef
|
||||
typename boost::detail::iterator_traits<T>::difference_type
|
||||
typename std::iterator_traits<T>::difference_type
|
||||
distance_type;
|
||||
typedef
|
||||
typename boost::detail::iterator_traits<T>::pointer
|
||||
typename std::iterator_traits<T>::pointer
|
||||
pointer;
|
||||
typedef result_type& reference;
|
||||
typedef result_type value_type;
|
||||
@@ -96,7 +96,7 @@ namespace boost { namespace spirit { namespace iterator_policies
|
||||
struct shared
|
||||
{
|
||||
typedef
|
||||
typename boost::detail::iterator_traits<T>::value_type
|
||||
typename std::iterator_traits<T>::value_type
|
||||
result_type;
|
||||
|
||||
explicit shared(T const& input)
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
|
||||
#include <boost/spirit/home/support/iterators/detail/multi_pass.hpp>
|
||||
#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits
|
||||
#include <boost/assert.hpp>
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
namespace boost { namespace spirit { namespace iterator_policies
|
||||
{
|
||||
@@ -38,21 +38,21 @@ namespace boost { namespace spirit { namespace iterator_policies
|
||||
{
|
||||
private:
|
||||
typedef
|
||||
typename boost::detail::iterator_traits<T>::value_type
|
||||
typename std::iterator_traits<T>::value_type
|
||||
result_type;
|
||||
|
||||
public:
|
||||
typedef
|
||||
typename boost::detail::iterator_traits<T>::difference_type
|
||||
typename std::iterator_traits<T>::difference_type
|
||||
difference_type;
|
||||
typedef
|
||||
typename boost::detail::iterator_traits<T>::difference_type
|
||||
typename std::iterator_traits<T>::difference_type
|
||||
distance_type;
|
||||
typedef
|
||||
typename boost::detail::iterator_traits<T>::pointer
|
||||
typename std::iterator_traits<T>::pointer
|
||||
pointer;
|
||||
typedef
|
||||
typename boost::detail::iterator_traits<T>::reference
|
||||
typename std::iterator_traits<T>::reference
|
||||
reference;
|
||||
typedef result_type value_type;
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2010 Bryce Lelbach
|
||||
Copyright (c) 2014 Tomoki Imai
|
||||
|
||||
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)
|
||||
@@ -126,17 +127,30 @@ namespace boost { namespace spirit
|
||||
inline Iterator get_line_start(Iterator lower_bound, Iterator current)
|
||||
{
|
||||
Iterator latest = lower_bound;
|
||||
|
||||
bool prev_was_newline = false;
|
||||
for (Iterator i = lower_bound; i != current; ++i) {
|
||||
switch (*i) {
|
||||
case '\r':
|
||||
case '\n':
|
||||
latest = i;
|
||||
}
|
||||
if (prev_was_newline) {
|
||||
latest = i;
|
||||
}
|
||||
prev_was_newline = (*i == '\r') || (*i == '\n');
|
||||
}
|
||||
if (prev_was_newline) {
|
||||
latest = current;
|
||||
}
|
||||
|
||||
return latest;
|
||||
}
|
||||
|
||||
template <class Iterator>
|
||||
inline Iterator get_line_end(Iterator current, Iterator upper_bound)
|
||||
{
|
||||
for (Iterator i = current; i != upper_bound; ++i) {
|
||||
if ((*i == '\n') || (*i == '\r')) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return upper_bound;
|
||||
}
|
||||
|
||||
|
||||
template <class Iterator>
|
||||
inline iterator_range<Iterator>
|
||||
@@ -145,11 +159,7 @@ namespace boost { namespace spirit
|
||||
Iterator upper_bound)
|
||||
{
|
||||
Iterator first = get_line_start(lower_bound, current);
|
||||
Iterator last = get_line_start(current, upper_bound);
|
||||
|
||||
if (last == current)
|
||||
last = upper_bound;
|
||||
|
||||
Iterator last = get_line_end(current, upper_bound);
|
||||
return iterator_range<Iterator>(first, last);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,19 +148,19 @@ namespace boost { namespace spirit
|
||||
return policies_base_type::less_than(*this, y);
|
||||
}
|
||||
|
||||
bool operator!=(multi_pass const& y)
|
||||
bool operator!=(multi_pass const& y) const
|
||||
{
|
||||
return !(*this == y);
|
||||
}
|
||||
bool operator>(multi_pass const& y)
|
||||
bool operator>(multi_pass const& y) const
|
||||
{
|
||||
return y < *this;
|
||||
}
|
||||
bool operator>=(multi_pass const& y)
|
||||
bool operator>=(multi_pass const& y) const
|
||||
{
|
||||
return !(*this < y);
|
||||
}
|
||||
bool operator<=(multi_pass const& y)
|
||||
bool operator<=(multi_pass const& y) const
|
||||
{
|
||||
return !(y < *this);
|
||||
}
|
||||
|
||||
@@ -11,9 +11,8 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
@@ -115,13 +114,9 @@ namespace boost { namespace spirit { namespace traits
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct is_infinite;
|
||||
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct check_overflow : mpl::false_ {};
|
||||
|
||||
template <typename T>
|
||||
struct check_overflow<T, typename enable_if_c<integer_traits<T>::is_integral>::type>
|
||||
: mpl::true_ {};
|
||||
struct check_overflow : mpl::bool_<std::numeric_limits<T>::is_bounded> {};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -67,6 +67,44 @@ namespace boost { namespace spirit
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Assume wchar_t content is UTF-16 on Windows and UCS-4 on Unix
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
inline utf8_string to_utf8(wchar_t value)
|
||||
{
|
||||
utf8_string result;
|
||||
typedef std::back_insert_iterator<utf8_string> insert_iter;
|
||||
insert_iter out_iter(result);
|
||||
utf8_output_iterator<insert_iter> utf8_iter(out_iter);
|
||||
|
||||
u16_to_u32_iterator<wchar_t const*, ucs4_char> ucs4_iter(&value);
|
||||
*utf8_iter++ = *ucs4_iter;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline utf8_string to_utf8(wchar_t const* str)
|
||||
{
|
||||
utf8_string result;
|
||||
typedef std::back_insert_iterator<utf8_string> insert_iter;
|
||||
insert_iter out_iter(result);
|
||||
utf8_output_iterator<insert_iter> utf8_iter(out_iter);
|
||||
|
||||
u16_to_u32_iterator<wchar_t const*, ucs4_char> ucs4_iter(str);
|
||||
for (ucs4_char c; (c = *ucs4_iter) != ucs4_char(); ++ucs4_iter) {
|
||||
*utf8_iter++ = c;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Traits, typename Allocator>
|
||||
inline utf8_string
|
||||
to_utf8(std::basic_string<wchar_t, Traits, Allocator> const& str)
|
||||
{
|
||||
return to_utf8(str.c_str());
|
||||
}
|
||||
#endif
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,13 +44,15 @@ namespace boost { namespace spirit { namespace detail
|
||||
|
||||
inline short fast_string::tag() const
|
||||
{
|
||||
return (int(buff[small_string_size-2]) << 8) + (unsigned char)buff[small_string_size-1];
|
||||
boost::int16_t tmp;
|
||||
std::memcpy(&tmp, &buff[small_string_size-2], sizeof(tmp));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
inline void fast_string::tag(short tag)
|
||||
{
|
||||
buff[small_string_size-2] = tag >> 8;
|
||||
buff[small_string_size-1] = tag & 0xff;
|
||||
boost::int16_t tmp = tag;
|
||||
std::memcpy(&buff[small_string_size-2], &tmp, sizeof(tmp));
|
||||
}
|
||||
|
||||
inline bool fast_string::is_heap_allocated() const
|
||||
@@ -77,7 +79,7 @@ namespace boost { namespace spirit { namespace detail
|
||||
template <typename Iterator>
|
||||
inline void fast_string::construct(Iterator f, Iterator l)
|
||||
{
|
||||
unsigned const size = l-f;
|
||||
std::size_t const size = static_cast<std::size_t>(l-f);
|
||||
char* str;
|
||||
if (size < max_string_len)
|
||||
{
|
||||
@@ -931,11 +933,11 @@ namespace boost { namespace spirit
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline utree& utree::operator=(any_ptr const& p)
|
||||
inline utree& utree::operator=(any_ptr const& p_)
|
||||
{
|
||||
free();
|
||||
v.p = p.p;
|
||||
v.i = p.i;
|
||||
v.p = p_.p;
|
||||
v.i = p_.i;
|
||||
set_type(type::any_type);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -535,7 +535,14 @@ namespace boost { namespace spirit
|
||||
BOOST_SPIRIT_UTREE_CREATE_INTEGRAL_FUNCTION(bitxor_, a^b)
|
||||
BOOST_SPIRIT_UTREE_CREATE_INTEGRAL_FUNCTION(shift_left, a<<b)
|
||||
BOOST_SPIRIT_UTREE_CREATE_INTEGRAL_FUNCTION(shift_right, a>>b)
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wbool-operation" // '~' on an expression of type bool
|
||||
#endif
|
||||
BOOST_SPIRIT_UTREE_CREATE_INTEGRAL_FUNCTION(invert, ~a)
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
inline utree operator&&(utree const& a, utree const& b)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/spirit/home/support/utree/detail/utree_detail1.hpp>
|
||||
|
||||
@@ -43,7 +44,7 @@ namespace boost { namespace spirit
|
||||
{
|
||||
//[utree_exceptions
|
||||
/*` All exceptions thrown by utree are derived from utree_exception. */
|
||||
struct utree_exception : std::exception {};
|
||||
struct BOOST_SYMBOL_VISIBLE utree_exception : std::exception {};
|
||||
|
||||
/*`The `bad_type_exception` is thrown whenever somebody calls a member
|
||||
function, which applies to certain stored utree_type's only, but this
|
||||
@@ -143,9 +144,9 @@ namespace boost { namespace spirit
|
||||
msg = oss.str();
|
||||
}
|
||||
|
||||
virtual ~bad_type_exception() throw() {}
|
||||
virtual ~bad_type_exception() BOOST_NOEXCEPT_OR_NOTHROW {}
|
||||
|
||||
virtual char const* what() const throw()
|
||||
virtual char const* what() const BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return msg.c_str(); }
|
||||
};
|
||||
|
||||
@@ -155,9 +156,9 @@ namespace boost { namespace spirit
|
||||
|
||||
empty_exception(char const* error) : msg(error) {}
|
||||
|
||||
virtual ~empty_exception() throw() {}
|
||||
virtual ~empty_exception() BOOST_NOEXCEPT_OR_NOTHROW {}
|
||||
|
||||
virtual char const* what() const throw()
|
||||
virtual char const* what() const BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return msg; }
|
||||
};
|
||||
|
||||
|
||||
@@ -1149,26 +1149,26 @@ namespace boost { namespace spirit { namespace traits
|
||||
template <>
|
||||
struct extract_from_container<utree, utf8_symbol_type>
|
||||
{
|
||||
typedef std::string type;
|
||||
typedef utf8_symbol_type type;
|
||||
|
||||
template <typename Context>
|
||||
static type call(utree const& t, Context&)
|
||||
{
|
||||
utf8_symbol_range_type r = detail::get_or_deref<utf8_symbol_range_type>(t);
|
||||
return std::string(traits::begin(r), traits::end(r));
|
||||
return type(traits::begin(r), traits::end(r));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct extract_from_container<utree, utf8_string_type>
|
||||
{
|
||||
typedef std::string type;
|
||||
typedef utf8_string_type type;
|
||||
|
||||
template <typename Context>
|
||||
static type call(utree const& t, Context&)
|
||||
{
|
||||
utf8_string_range_type r = detail::get_or_deref<utf8_string_range_type>(t);
|
||||
return std::string(traits::begin(r), traits::end(r));
|
||||
return type(traits::begin(r), traits::end(r));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1264,24 +1264,24 @@ namespace boost { namespace spirit { namespace traits
|
||||
template <>
|
||||
struct transform_attribute<utree const, utf8_string_type, karma::domain>
|
||||
{
|
||||
typedef std::string type;
|
||||
typedef utf8_string_type type;
|
||||
|
||||
static type pre(utree const& t)
|
||||
{
|
||||
utf8_string_range_type r = detail::get_or_deref<utf8_string_range_type>(t);
|
||||
return std::string(traits::begin(r), traits::end(r));
|
||||
return type(traits::begin(r), traits::end(r));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct transform_attribute<utree const, utf8_symbol_type, karma::domain>
|
||||
{
|
||||
typedef std::string type;
|
||||
typedef utf8_symbol_type type;
|
||||
|
||||
static type pre(utree const& t)
|
||||
{
|
||||
utf8_symbol_range_type r = detail::get_or_deref<utf8_symbol_range_type>(t);
|
||||
return std::string(traits::begin(r), traits::end(r));
|
||||
return type(traits::begin(r), traits::end(r));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user