stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork
This commit is contained in:
@@ -0,0 +1,188 @@
|
||||
// Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
//
|
||||
// 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_KARMA_AUTO_NOV_29_2009_0339PM)
|
||||
#define BOOST_SPIRIT_KARMA_AUTO_NOV_29_2009_0339PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/support/common_terminals.hpp>
|
||||
#include <boost/spirit/home/support/info.hpp>
|
||||
#include <boost/spirit/home/support/container.hpp>
|
||||
#include <boost/spirit/home/support/assert_msg.hpp>
|
||||
#include <boost/spirit/home/support/detail/hold_any.hpp>
|
||||
#include <boost/spirit/home/karma/domain.hpp>
|
||||
#include <boost/spirit/home/karma/meta_compiler.hpp>
|
||||
#include <boost/spirit/home/karma/delimit_out.hpp>
|
||||
#include <boost/spirit/home/karma/generator.hpp>
|
||||
#include <boost/spirit/home/karma/auto/create_generator.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Enablers
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <>
|
||||
struct use_terminal<karma::domain, tag::auto_> // enables auto_
|
||||
: mpl::true_ {};
|
||||
|
||||
template <typename A0>
|
||||
struct use_terminal<karma::domain // enables auto_(...)
|
||||
, terminal_ex<tag::auto_, fusion::vector1<A0> >
|
||||
> : mpl::true_ {};
|
||||
|
||||
template <> // enables auto_(f)
|
||||
struct use_lazy_terminal<
|
||||
karma::domain, tag::auto_, 1 /*arity*/
|
||||
> : mpl::true_ {};
|
||||
|
||||
}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace karma
|
||||
{
|
||||
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
using spirit::auto_;
|
||||
#endif
|
||||
using spirit::auto_type;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Modifiers>
|
||||
struct auto_generator
|
||||
: generator<auto_generator<Modifiers> >
|
||||
{
|
||||
typedef mpl::int_<generator_properties::all_properties> properties;
|
||||
|
||||
template <typename Context, typename Unused>
|
||||
struct attribute
|
||||
{
|
||||
typedef spirit::basic_hold_any<char> type;
|
||||
};
|
||||
|
||||
auto_generator(Modifiers const& modifiers)
|
||||
: modifiers_(modifiers) {}
|
||||
|
||||
// auto_generator has an attached attribute
|
||||
template <
|
||||
typename OutputIterator, typename Context, typename Delimiter
|
||||
, typename Attribute>
|
||||
bool generate(OutputIterator& sink, Context& context
|
||||
, Delimiter const& d, Attribute const& attr) const
|
||||
{
|
||||
return compile<karma::domain>(create_generator<Attribute>(), modifiers_)
|
||||
.generate(sink, context, d, attr);
|
||||
}
|
||||
|
||||
// this auto_generator has no attribute attached, it needs to have been
|
||||
// initialized from a value/variable
|
||||
template <typename OutputIterator, typename Context
|
||||
, typename Delimiter>
|
||||
static bool
|
||||
generate(OutputIterator&, Context&, Delimiter const&, unused_type)
|
||||
{
|
||||
// It is not possible (doesn't make sense) to use auto_ generators
|
||||
// without providing any attribute, as the generator doesn't 'know'
|
||||
// what to output. The following assertion fires if this situation
|
||||
// is detected in your code.
|
||||
BOOST_SPIRIT_ASSERT_FAIL(OutputIterator, auto_not_usable_without_attribute, ());
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
info what(Context& /*context*/) const
|
||||
{
|
||||
return info("auto_");
|
||||
}
|
||||
|
||||
Modifiers modifiers_;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename T, typename Modifiers>
|
||||
struct lit_auto_generator
|
||||
: generator<lit_auto_generator<T, Modifiers> >
|
||||
{
|
||||
typedef mpl::int_<generator_properties::all_properties> properties;
|
||||
|
||||
template <typename Context, typename Unused>
|
||||
struct attribute
|
||||
{
|
||||
typedef unused_type type;
|
||||
};
|
||||
|
||||
lit_auto_generator(typename add_reference<T>::type t, Modifiers const& modifiers)
|
||||
: t_(t)
|
||||
, generator_(compile<karma::domain>(create_generator<T>(), modifiers))
|
||||
{}
|
||||
|
||||
// auto_generator has an attached attribute
|
||||
template <
|
||||
typename OutputIterator, typename Context, typename Delimiter
|
||||
, typename Attribute>
|
||||
bool generate(OutputIterator& sink, Context& context
|
||||
, Delimiter const& d, Attribute const&) const
|
||||
{
|
||||
return generator_.generate(sink, context, d, t_);
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
info what(Context& /*context*/) const
|
||||
{
|
||||
return info("auto_");
|
||||
}
|
||||
|
||||
typedef typename spirit::result_of::create_generator<T>::type
|
||||
generator_type;
|
||||
|
||||
typedef typename spirit::result_of::compile<
|
||||
karma::domain, generator_type, Modifiers>::type generator_impl_type;
|
||||
|
||||
T t_;
|
||||
generator_impl_type generator_;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
lit_auto_generator& operator= (lit_auto_generator const&);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Generator generators: make_xxx function (objects)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// auto_
|
||||
template <typename Modifiers>
|
||||
struct make_primitive<tag::auto_, Modifiers>
|
||||
{
|
||||
typedef auto_generator<Modifiers> result_type;
|
||||
|
||||
result_type operator()(unused_type, Modifiers const& modifiers) const
|
||||
{
|
||||
return result_type(modifiers);
|
||||
}
|
||||
};
|
||||
|
||||
// auto_(...)
|
||||
template <typename Modifiers, typename A0>
|
||||
struct make_primitive<
|
||||
terminal_ex<tag::auto_, fusion::vector1<A0> >, Modifiers>
|
||||
{
|
||||
typedef typename add_const<A0>::type const_attribute;
|
||||
|
||||
typedef lit_auto_generator<const_attribute, Modifiers> result_type;
|
||||
|
||||
template <typename Terminal>
|
||||
result_type operator()(Terminal const& term, Modifiers const& modifiers) const
|
||||
{
|
||||
return result_type(fusion::at_c<0>(term.args), modifiers);
|
||||
}
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
//
|
||||
// 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_KARMA_CREATE_NOV_21_2009_0340PM)
|
||||
#define BOOST_SPIRIT_KARMA_CREATE_NOV_21_2009_0340PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/karma/auto/meta_create.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace result_of
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
struct create_generator
|
||||
: spirit::traits::meta_create<karma::domain, T> {};
|
||||
}}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace karma
|
||||
{
|
||||
// Main API function for generator creation from data type
|
||||
template <typename T>
|
||||
typename result_of::create_generator<T>::type
|
||||
create_generator()
|
||||
{
|
||||
return spirit::traits::meta_create<karma::domain, T>::call();
|
||||
}
|
||||
}}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
// Meta function returning true if create_generator does return a valid
|
||||
// generator for the given type T.
|
||||
template <typename T>
|
||||
struct create_generator_exists
|
||||
: meta_create_exists<karma::domain, T> {};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,339 @@
|
||||
// Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
//
|
||||
// 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_KARMA_META_CREATE_NOV_21_2009_0425PM)
|
||||
#define BOOST_SPIRIT_KARMA_META_CREATE_NOV_21_2009_0425PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/karma/domain.hpp>
|
||||
#include <boost/spirit/home/support/common_terminals.hpp>
|
||||
#include <boost/spirit/home/support/auto/meta_create.hpp>
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/fold.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/push_back.hpp>
|
||||
#include <boost/fusion/include/as_vector.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace karma
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// compatible STL containers
|
||||
template <typename Container>
|
||||
struct meta_create_container
|
||||
{
|
||||
typedef make_unary_proto_expr<
|
||||
typename Container::value_type
|
||||
, proto::tag::dereference, karma::domain
|
||||
> make_proto_expr;
|
||||
|
||||
typedef typename make_proto_expr::type type;
|
||||
|
||||
static type call()
|
||||
{
|
||||
return make_proto_expr::call();
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// String types
|
||||
template <typename String>
|
||||
struct meta_create_string
|
||||
{
|
||||
typedef spirit::standard::string_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct meta_create_string<wchar_t*>
|
||||
{
|
||||
typedef spirit::standard_wide::string_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct meta_create_string<wchar_t const*>
|
||||
{
|
||||
typedef spirit::standard_wide::string_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
|
||||
template <int N>
|
||||
struct meta_create_string<wchar_t[N]>
|
||||
{
|
||||
typedef spirit::standard_wide::string_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
|
||||
template <int N>
|
||||
struct meta_create_string<wchar_t const[N]>
|
||||
{
|
||||
typedef spirit::standard_wide::string_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
|
||||
template <int N>
|
||||
struct meta_create_string<wchar_t(&)[N]>
|
||||
{
|
||||
typedef spirit::standard_wide::string_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
|
||||
template <int N>
|
||||
struct meta_create_string<wchar_t const(&)[N]>
|
||||
{
|
||||
typedef spirit::standard_wide::string_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
|
||||
template <typename Traits, typename Allocator>
|
||||
struct meta_create_string<std::basic_string<wchar_t, Traits, Allocator> >
|
||||
{
|
||||
typedef spirit::standard_wide::string_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Fusion sequences
|
||||
template <typename Sequence>
|
||||
struct meta_create_sequence
|
||||
{
|
||||
// create a mpl sequence from the given fusion sequence
|
||||
typedef typename mpl::fold<
|
||||
typename fusion::result_of::as_vector<Sequence>::type
|
||||
, mpl::vector<>, mpl::push_back<mpl::_, mpl::_>
|
||||
>::type sequence_type;
|
||||
|
||||
typedef make_nary_proto_expr<
|
||||
sequence_type, proto::tag::shift_left, karma::domain
|
||||
> make_proto_expr;
|
||||
|
||||
typedef typename make_proto_expr::type type;
|
||||
|
||||
static type call()
|
||||
{
|
||||
return make_proto_expr::call();
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// the default is to use the standard streaming operator unless it's a
|
||||
// STL container or a fusion sequence
|
||||
|
||||
// The default implementation will be chosen if no predefined mapping of
|
||||
// the data type T to a Karma component is defined.
|
||||
struct no_auto_mapping_exists {};
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct meta_create_impl : mpl::identity<no_auto_mapping_exists> {};
|
||||
|
||||
template <typename T>
|
||||
struct meta_create_impl<T
|
||||
, typename enable_if<
|
||||
mpl::and_<
|
||||
traits::is_container<T>
|
||||
, mpl::not_<traits::is_string<T> >
|
||||
, mpl::not_<fusion::traits::is_sequence<T> >
|
||||
> >::type>
|
||||
: meta_create_container<T> {};
|
||||
|
||||
template <typename T>
|
||||
struct meta_create_impl<T
|
||||
, typename enable_if<traits::is_string<T> >::type>
|
||||
: meta_create_string<T> {};
|
||||
|
||||
template <typename T>
|
||||
struct meta_create_impl<T, typename enable_if<
|
||||
spirit::detail::is_fusion_sequence_but_not_proto_expr<T>
|
||||
>::type>
|
||||
: meta_create_sequence<T> {};
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct meta_create : meta_create_impl<T> {};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// optional
|
||||
template <typename T>
|
||||
struct meta_create<boost::optional<T> >
|
||||
{
|
||||
typedef make_unary_proto_expr<
|
||||
T, proto::tag::negate, karma::domain
|
||||
> make_proto_expr;
|
||||
|
||||
typedef typename make_proto_expr::type type;
|
||||
|
||||
static type call()
|
||||
{
|
||||
return make_proto_expr::call();
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// alternatives
|
||||
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
|
||||
struct meta_create<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
|
||||
{
|
||||
typedef make_nary_proto_expr<
|
||||
typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
|
||||
, proto::tag::bitwise_or, karma::domain
|
||||
> make_proto_expr;
|
||||
|
||||
typedef typename make_proto_expr::type type;
|
||||
|
||||
static type call()
|
||||
{
|
||||
return make_proto_expr::call();
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// predefined specializations for primitive components
|
||||
|
||||
// character generator
|
||||
template <>
|
||||
struct meta_create<char>
|
||||
{
|
||||
typedef spirit::standard::char_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
template <>
|
||||
struct meta_create<signed char>
|
||||
{
|
||||
typedef spirit::standard::char_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
template <>
|
||||
struct meta_create<wchar_t>
|
||||
{
|
||||
typedef spirit::standard_wide::char_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct meta_create<unsigned char>
|
||||
{
|
||||
typedef spirit::standard::char_type type;
|
||||
static type const call() { return type(); }
|
||||
};
|
||||
|
||||
// boolean generator
|
||||
template <>
|
||||
struct meta_create<bool>
|
||||
{
|
||||
typedef spirit::bool_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
|
||||
// integral generators
|
||||
template <>
|
||||
struct meta_create<int>
|
||||
{
|
||||
typedef spirit::int_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
template <>
|
||||
struct meta_create<short>
|
||||
{
|
||||
typedef spirit::short_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
template <>
|
||||
struct meta_create<long>
|
||||
{
|
||||
typedef spirit::long_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
template <>
|
||||
struct meta_create<unsigned int>
|
||||
{
|
||||
typedef spirit::uint_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
template <>
|
||||
struct meta_create<unsigned short>
|
||||
{
|
||||
typedef spirit::ushort_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
#endif
|
||||
template <>
|
||||
struct meta_create<unsigned long>
|
||||
{
|
||||
typedef spirit::ulong_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
template <>
|
||||
struct meta_create<boost::long_long_type>
|
||||
{
|
||||
typedef spirit::long_long_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
template <>
|
||||
struct meta_create<boost::ulong_long_type>
|
||||
{
|
||||
typedef spirit::ulong_long_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
#endif
|
||||
|
||||
// floating point generators
|
||||
template <>
|
||||
struct meta_create<float>
|
||||
{
|
||||
typedef spirit::float_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
template <>
|
||||
struct meta_create<double>
|
||||
{
|
||||
typedef spirit::double_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
template <>
|
||||
struct meta_create<long double>
|
||||
{
|
||||
typedef spirit::long_double_type type;
|
||||
static type call() { return type(); }
|
||||
};
|
||||
}}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// main customization point for create_generator
|
||||
template <typename T, typename Enable = void>
|
||||
struct create_generator : karma::meta_create<T> {};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// dispatch this to the karma related specializations
|
||||
template <typename T>
|
||||
struct meta_create<karma::domain, T>
|
||||
: create_generator<typename spirit::detail::remove_const_ref<T>::type> {};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Check whether a valid mapping exits for the given data type to a Karma
|
||||
// component
|
||||
template <typename T>
|
||||
struct meta_create_exists<karma::domain, T>
|
||||
: mpl::not_<is_same<
|
||||
karma::no_auto_mapping_exists
|
||||
, typename meta_create<karma::domain, T>::type
|
||||
> > {};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user