Initial Commit
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
// (C) Copyright John Maddock 2005-2006.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MATH_HYPOT_INCLUDED
|
||||
#define BOOST_MATH_HYPOT_INCLUDED
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/math/tools/config.hpp>
|
||||
#include <boost/math/tools/precision.hpp>
|
||||
#include <boost/math/policies/error_handling.hpp>
|
||||
#include <boost/math/special_functions/math_fwd.hpp>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <algorithm> // for swap
|
||||
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
namespace std{ using ::sqrt; using ::fabs; }
|
||||
#endif
|
||||
|
||||
namespace boost{ namespace math{ namespace detail{
|
||||
|
||||
template <class T, class Policy>
|
||||
T hypot_imp(T x, T y, const Policy& pol)
|
||||
{
|
||||
//
|
||||
// Normalize x and y, so that both are positive and x >= y:
|
||||
//
|
||||
using std::fabs; using std::sqrt; // ADL of std names
|
||||
|
||||
x = fabs(x);
|
||||
y = fabs(y);
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4127)
|
||||
#endif
|
||||
// special case, see C99 Annex F:
|
||||
if(std::numeric_limits<T>::has_infinity
|
||||
&& ((x == std::numeric_limits<T>::infinity())
|
||||
|| (y == std::numeric_limits<T>::infinity())))
|
||||
return policies::raise_overflow_error<T>("boost::math::hypot<%1%>(%1%,%1%)", 0, pol);
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
if(y > x)
|
||||
(std::swap)(x, y);
|
||||
|
||||
if(x * tools::epsilon<T>() >= y)
|
||||
return x;
|
||||
|
||||
T rat = y / x;
|
||||
return x * sqrt(1 + rat*rat);
|
||||
} // template <class T> T hypot(T x, T y)
|
||||
|
||||
}
|
||||
|
||||
template <class T1, class T2>
|
||||
inline typename tools::promote_args<T1, T2>::type
|
||||
hypot(T1 x, T2 y)
|
||||
{
|
||||
typedef typename tools::promote_args<T1, T2>::type result_type;
|
||||
return detail::hypot_imp(
|
||||
static_cast<result_type>(x), static_cast<result_type>(y), policies::policy<>());
|
||||
}
|
||||
|
||||
template <class T1, class T2, class Policy>
|
||||
inline typename tools::promote_args<T1, T2>::type
|
||||
hypot(T1 x, T2 y, const Policy& pol)
|
||||
{
|
||||
typedef typename tools::promote_args<T1, T2>::type result_type;
|
||||
return detail::hypot_imp(
|
||||
static_cast<result_type>(x), static_cast<result_type>(y), pol);
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_MATH_HYPOT_INCLUDED
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,640 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2010. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#ifndef BOOST_RANGE_DETAIL_ANY_ITERATOR_WRAPPER_HPP_INCLUDED
|
||||
#define BOOST_RANGE_DETAIL_ANY_ITERATOR_WRAPPER_HPP_INCLUDED
|
||||
|
||||
#include <boost/cast.hpp>
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/range/detail/any_iterator_interface.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template<typename TargetT, typename SourceT>
|
||||
TargetT& polymorphic_ref_downcast(SourceT& source)
|
||||
{
|
||||
#ifdef BOOST_NO_RTTI
|
||||
return static_cast<TargetT&>(source);
|
||||
#else
|
||||
return *boost::polymorphic_downcast<TargetT*>(&source);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class Reference, class T>
|
||||
Reference dereference_cast(T& x)
|
||||
{
|
||||
return static_cast<Reference>(x);
|
||||
}
|
||||
template<class Reference, class T>
|
||||
Reference dereference_cast(const T& x)
|
||||
{
|
||||
return static_cast<Reference>(const_cast<T&>(x));
|
||||
}
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Reference
|
||||
, class Buffer
|
||||
>
|
||||
class any_incrementable_iterator_wrapper
|
||||
: public any_incrementable_iterator_interface<
|
||||
Reference
|
||||
, Buffer
|
||||
>
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( IncrementableIteratorConcept<WrappedIterator> ));
|
||||
public:
|
||||
typedef WrappedIterator wrapped_type;
|
||||
|
||||
BOOST_STATIC_ASSERT(( is_convertible<
|
||||
typename iterator_reference<WrappedIterator>::type
|
||||
, Reference
|
||||
>::value ));
|
||||
|
||||
any_incrementable_iterator_wrapper()
|
||||
: m_it()
|
||||
{}
|
||||
|
||||
explicit any_incrementable_iterator_wrapper(wrapped_type it)
|
||||
: m_it(it)
|
||||
{}
|
||||
|
||||
// any_incrementable_iterator implementation
|
||||
virtual any_incrementable_iterator_wrapper* clone(
|
||||
typename any_incrementable_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
return new (buffer.allocate(sizeof(*this)))
|
||||
any_incrementable_iterator_wrapper(m_it);
|
||||
}
|
||||
|
||||
virtual any_incrementable_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_incrementable_iterator_wrapper::const_reference
|
||||
, Buffer
|
||||
>* clone_const_ref(
|
||||
typename any_incrementable_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
typedef any_incrementable_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_incrementable_iterator_wrapper::const_reference
|
||||
, Buffer
|
||||
> result_type;
|
||||
|
||||
return new (buffer.allocate(sizeof(result_type)))
|
||||
result_type(m_it);
|
||||
}
|
||||
|
||||
virtual any_incrementable_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_incrementable_iterator_wrapper::reference_as_value_type
|
||||
, Buffer
|
||||
>* clone_reference_as_value(
|
||||
typename any_incrementable_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
typedef any_incrementable_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_incrementable_iterator_wrapper::reference_as_value_type
|
||||
, Buffer
|
||||
> result_type;
|
||||
|
||||
return new (buffer.allocate(sizeof(result_type)))
|
||||
result_type(m_it);
|
||||
}
|
||||
|
||||
virtual void increment()
|
||||
{
|
||||
++m_it;
|
||||
}
|
||||
|
||||
private:
|
||||
wrapped_type m_it;
|
||||
};
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Reference
|
||||
, class Buffer
|
||||
>
|
||||
class any_single_pass_iterator_wrapper
|
||||
: public any_single_pass_iterator_interface<
|
||||
Reference
|
||||
, Buffer
|
||||
>
|
||||
{
|
||||
struct disabler {};
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassIteratorConcept<WrappedIterator> ));
|
||||
typedef any_single_pass_iterator_interface<
|
||||
Reference,
|
||||
Buffer
|
||||
> base_type;
|
||||
|
||||
public:
|
||||
typedef typename base_type::reference reference;
|
||||
|
||||
any_single_pass_iterator_wrapper()
|
||||
: m_it()
|
||||
{}
|
||||
|
||||
explicit any_single_pass_iterator_wrapper(const WrappedIterator& it)
|
||||
: m_it(it)
|
||||
{}
|
||||
// any_single_pass_iterator_interface<Reference> implementation
|
||||
virtual any_single_pass_iterator_wrapper* clone(
|
||||
typename any_single_pass_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
return new (buffer.allocate(sizeof(*this)))
|
||||
any_single_pass_iterator_wrapper(m_it);
|
||||
}
|
||||
|
||||
virtual any_single_pass_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_single_pass_iterator_wrapper::const_reference
|
||||
, Buffer
|
||||
>* clone_const_ref(
|
||||
typename any_single_pass_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
typedef any_single_pass_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_single_pass_iterator_wrapper::const_reference
|
||||
, Buffer
|
||||
> result_type;
|
||||
|
||||
return new (buffer.allocate(sizeof(result_type)))
|
||||
result_type(m_it);
|
||||
}
|
||||
|
||||
virtual any_single_pass_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_single_pass_iterator_wrapper::reference_as_value_type
|
||||
, Buffer
|
||||
>* clone_reference_as_value(
|
||||
typename any_single_pass_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
typedef any_single_pass_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_single_pass_iterator_wrapper::reference_as_value_type
|
||||
, Buffer
|
||||
> result_type;
|
||||
|
||||
return new (buffer.allocate(sizeof(result_type)))
|
||||
result_type(m_it);
|
||||
}
|
||||
|
||||
virtual void increment()
|
||||
{
|
||||
++m_it;
|
||||
}
|
||||
|
||||
virtual bool equal(const any_single_pass_iterator_interface<Reference, Buffer>& other) const
|
||||
{
|
||||
return m_it == range_detail::polymorphic_ref_downcast<const any_single_pass_iterator_wrapper>(other).m_it;
|
||||
}
|
||||
|
||||
virtual reference dereference() const
|
||||
{
|
||||
return dereference_cast<reference>(*m_it);
|
||||
}
|
||||
|
||||
private:
|
||||
WrappedIterator m_it;
|
||||
};
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Reference
|
||||
, class Buffer
|
||||
>
|
||||
class any_forward_iterator_wrapper
|
||||
: public any_forward_iterator_interface<
|
||||
Reference
|
||||
, Buffer
|
||||
>
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardIteratorConcept<WrappedIterator> ));
|
||||
typedef any_forward_iterator_interface<
|
||||
Reference,
|
||||
Buffer
|
||||
> base_type;
|
||||
|
||||
public:
|
||||
typedef typename base_type::reference reference;
|
||||
|
||||
any_forward_iterator_wrapper()
|
||||
: m_it()
|
||||
{}
|
||||
|
||||
explicit any_forward_iterator_wrapper(const WrappedIterator& it)
|
||||
: m_it(it)
|
||||
{}
|
||||
|
||||
// any_forward_iterator_interface<Reference> implementation
|
||||
virtual any_forward_iterator_wrapper* clone(
|
||||
typename any_forward_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
return new (buffer.allocate(sizeof(*this)))
|
||||
any_forward_iterator_wrapper(m_it);
|
||||
}
|
||||
|
||||
virtual any_forward_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_forward_iterator_wrapper::const_reference
|
||||
, Buffer
|
||||
>* clone_const_ref(
|
||||
typename any_forward_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
typedef any_forward_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_forward_iterator_wrapper::const_reference
|
||||
, Buffer
|
||||
> result_type;
|
||||
|
||||
return new (buffer.allocate(sizeof(result_type)))
|
||||
result_type(m_it);
|
||||
}
|
||||
|
||||
virtual any_forward_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_forward_iterator_wrapper::reference_as_value_type
|
||||
, Buffer
|
||||
>* clone_reference_as_value(
|
||||
typename any_forward_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
typedef any_forward_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_forward_iterator_wrapper::reference_as_value_type
|
||||
, Buffer
|
||||
> result_type;
|
||||
|
||||
return new (buffer.allocate(sizeof(result_type)))
|
||||
result_type(m_it);
|
||||
}
|
||||
|
||||
virtual void increment()
|
||||
{
|
||||
++m_it;
|
||||
}
|
||||
|
||||
virtual bool equal(const any_single_pass_iterator_interface<Reference, Buffer>& other) const
|
||||
{
|
||||
return m_it == range_detail::polymorphic_ref_downcast<const any_forward_iterator_wrapper>(other).m_it;
|
||||
}
|
||||
|
||||
virtual reference dereference() const
|
||||
{
|
||||
return dereference_cast<reference>(*m_it);
|
||||
}
|
||||
private:
|
||||
WrappedIterator m_it;
|
||||
};
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Reference
|
||||
, class Buffer
|
||||
>
|
||||
class any_bidirectional_iterator_wrapper
|
||||
: public any_bidirectional_iterator_interface<
|
||||
Reference
|
||||
, Buffer
|
||||
>
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalIteratorConcept<WrappedIterator> ));
|
||||
typedef any_bidirectional_iterator_interface<
|
||||
Reference,
|
||||
Buffer
|
||||
> base_type;
|
||||
|
||||
public:
|
||||
typedef typename base_type::reference reference;
|
||||
|
||||
any_bidirectional_iterator_wrapper()
|
||||
: m_it()
|
||||
{
|
||||
}
|
||||
|
||||
explicit any_bidirectional_iterator_wrapper(const WrappedIterator& it)
|
||||
: m_it(it)
|
||||
{
|
||||
}
|
||||
|
||||
virtual any_bidirectional_iterator_wrapper* clone(
|
||||
typename any_bidirectional_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
return new (buffer.allocate(sizeof(*this)))
|
||||
any_bidirectional_iterator_wrapper(*this);
|
||||
}
|
||||
|
||||
virtual any_bidirectional_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_bidirectional_iterator_wrapper::const_reference
|
||||
, Buffer
|
||||
>* clone_const_ref(
|
||||
typename any_bidirectional_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
typedef any_bidirectional_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_bidirectional_iterator_wrapper::const_reference
|
||||
, Buffer
|
||||
> result_type;
|
||||
|
||||
return new (buffer.allocate(sizeof(result_type)))
|
||||
result_type(m_it);
|
||||
}
|
||||
|
||||
virtual any_bidirectional_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_bidirectional_iterator_wrapper::reference_as_value_type
|
||||
, Buffer
|
||||
>* clone_reference_as_value(
|
||||
typename any_bidirectional_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
typedef any_bidirectional_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_bidirectional_iterator_wrapper::reference_as_value_type
|
||||
, Buffer
|
||||
> result_type;
|
||||
|
||||
return new (buffer.allocate(sizeof(result_type)))
|
||||
result_type(m_it);
|
||||
}
|
||||
|
||||
virtual void increment()
|
||||
{
|
||||
++m_it;
|
||||
}
|
||||
|
||||
virtual void decrement()
|
||||
{
|
||||
--m_it;
|
||||
}
|
||||
|
||||
virtual bool equal(const any_single_pass_iterator_interface<Reference, Buffer>& other) const
|
||||
{
|
||||
return m_it == range_detail::polymorphic_ref_downcast<const any_bidirectional_iterator_wrapper>(other).m_it;
|
||||
}
|
||||
|
||||
virtual reference dereference() const
|
||||
{
|
||||
return dereference_cast<reference>(*m_it);
|
||||
}
|
||||
|
||||
private:
|
||||
WrappedIterator m_it;
|
||||
};
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
class any_random_access_iterator_wrapper
|
||||
: public any_random_access_iterator_interface<
|
||||
Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessIteratorConcept<WrappedIterator> ));
|
||||
typedef any_random_access_iterator_interface<
|
||||
Reference,
|
||||
Difference,
|
||||
Buffer
|
||||
> base_type;
|
||||
|
||||
public:
|
||||
typedef typename base_type::reference reference;
|
||||
typedef Difference difference_type;
|
||||
|
||||
any_random_access_iterator_wrapper()
|
||||
: m_it()
|
||||
{
|
||||
}
|
||||
|
||||
explicit any_random_access_iterator_wrapper(const WrappedIterator& other)
|
||||
: m_it(other)
|
||||
{
|
||||
}
|
||||
|
||||
virtual any_random_access_iterator_wrapper* clone(
|
||||
typename any_random_access_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
return new (buffer.allocate(sizeof(*this)))
|
||||
any_random_access_iterator_wrapper(*this);
|
||||
}
|
||||
|
||||
virtual any_random_access_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_random_access_iterator_wrapper::const_reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>* clone_const_ref(
|
||||
typename any_random_access_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
typedef any_random_access_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_random_access_iterator_wrapper::const_reference
|
||||
, Difference
|
||||
, Buffer
|
||||
> result_type;
|
||||
|
||||
return new (buffer.allocate(sizeof(result_type)))
|
||||
result_type(m_it);
|
||||
}
|
||||
|
||||
virtual any_random_access_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_random_access_iterator_wrapper::reference_as_value_type
|
||||
, Difference
|
||||
, Buffer
|
||||
>* clone_reference_as_value(
|
||||
typename any_random_access_iterator_wrapper::buffer_type& buffer
|
||||
) const
|
||||
{
|
||||
typedef any_random_access_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, typename any_random_access_iterator_wrapper::reference_as_value_type
|
||||
, Difference
|
||||
, Buffer
|
||||
> result_type;
|
||||
|
||||
return new (buffer.allocate(sizeof(result_type)))
|
||||
result_type(m_it);
|
||||
}
|
||||
|
||||
virtual void increment()
|
||||
{
|
||||
++m_it;
|
||||
}
|
||||
|
||||
virtual bool equal(const any_single_pass_iterator_interface<Reference, Buffer>& other) const
|
||||
{
|
||||
return m_it == range_detail::polymorphic_ref_downcast<const any_random_access_iterator_wrapper>(other).m_it;
|
||||
}
|
||||
|
||||
virtual void decrement()
|
||||
{
|
||||
--m_it;
|
||||
}
|
||||
|
||||
virtual void advance(Difference offset)
|
||||
{
|
||||
m_it += offset;
|
||||
}
|
||||
|
||||
virtual reference dereference() const
|
||||
{
|
||||
return dereference_cast<reference>(*m_it);
|
||||
}
|
||||
|
||||
virtual Difference distance_to(const any_random_access_iterator_interface<Reference, Difference, Buffer>& other) const
|
||||
{
|
||||
return range_detail::polymorphic_ref_downcast<const any_random_access_iterator_wrapper>(other).m_it - m_it;
|
||||
}
|
||||
|
||||
private:
|
||||
WrappedIterator m_it;
|
||||
};
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Traversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
struct any_iterator_wrapper_type_generator;
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
struct any_iterator_wrapper_type_generator<
|
||||
WrappedIterator
|
||||
, incrementable_traversal_tag
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>
|
||||
{
|
||||
typedef any_incrementable_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, Reference
|
||||
, Buffer
|
||||
> type;
|
||||
};
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
struct any_iterator_wrapper_type_generator<
|
||||
WrappedIterator
|
||||
, single_pass_traversal_tag
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>
|
||||
{
|
||||
typedef any_single_pass_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, Reference
|
||||
, Buffer
|
||||
> type;
|
||||
};
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
struct any_iterator_wrapper_type_generator<
|
||||
WrappedIterator
|
||||
, forward_traversal_tag
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>
|
||||
{
|
||||
typedef any_forward_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, Reference
|
||||
, Buffer
|
||||
> type;
|
||||
};
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
struct any_iterator_wrapper_type_generator<
|
||||
WrappedIterator
|
||||
, bidirectional_traversal_tag
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>
|
||||
{
|
||||
typedef any_bidirectional_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, Reference
|
||||
, Buffer
|
||||
> type;
|
||||
};
|
||||
|
||||
template<
|
||||
class WrappedIterator
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
struct any_iterator_wrapper_type_generator<
|
||||
WrappedIterator
|
||||
, random_access_traversal_tag
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>
|
||||
{
|
||||
typedef any_random_access_iterator_wrapper<
|
||||
WrappedIterator
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
> type;
|
||||
};
|
||||
|
||||
} // namespace range_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,55 @@
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* Original code copied from
|
||||
http://rosettacode.org/wiki/Evaluate_binomial_coefficients
|
||||
*/
|
||||
|
||||
/* We go to some effort to handle overflow situations */
|
||||
|
||||
static unsigned long long gcd_ui(unsigned long long x, unsigned long long y) {
|
||||
unsigned long long t;
|
||||
if (y < x) { t = x; x = y; y = t; }
|
||||
while (y > 0) {
|
||||
t = y; y = x % y; x = t; /* y1 <- x0 % y0 ; x1 <- y0 */
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
unsigned long long binomial(unsigned long long n, unsigned long long k) {
|
||||
unsigned long long d, g, r = 1;
|
||||
if (k == 0) return 1;
|
||||
if (k == 1) return n;
|
||||
if (k >= n) return (k == n);
|
||||
if (k > n/2) k = n-k;
|
||||
for (d = 1; d <= k; d++) {
|
||||
if (r >= ULLONG_MAX/n) { /* Possible overflow */
|
||||
unsigned long long nr, dr; /* reduced numerator / denominator */
|
||||
g = gcd_ui(n, d); nr = n/g; dr = d/g;
|
||||
g = gcd_ui(r, dr); r = r/g; dr = dr/g;
|
||||
if (r >= ULLONG_MAX/nr) return 0; /* Unavoidable overflow */
|
||||
r *= nr;
|
||||
r /= dr;
|
||||
n--;
|
||||
} else {
|
||||
r *= n--;
|
||||
r /= d;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
unsigned long long binomial_(int *n, int *k)
|
||||
{
|
||||
// printf("n=%d k=%d %lu\n",*n,*k,binomial(*n,*k));
|
||||
return binomial(*n,*k);
|
||||
}
|
||||
|
||||
double hypergeo_(int *x, int *NN, int *XX, int *s)
|
||||
{
|
||||
double a,b,c;
|
||||
a=(double)binomial(*XX, *x);
|
||||
b=(double)binomial(*NN-*XX, *s-*x);
|
||||
c=(double)binomial(*NN, *s);
|
||||
return a*b/c;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_VIEW_FILTER_VIEW_DETAIL_VALUE_OF_DATA_IMPL_HPP
|
||||
#define BOOST_FUSION_VIEW_FILTER_VIEW_DETAIL_VALUE_OF_DATA_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/value_of_data.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct value_of_data_impl;
|
||||
|
||||
template <>
|
||||
struct value_of_data_impl<filter_view_iterator_tag>
|
||||
{
|
||||
template <typename It>
|
||||
struct apply
|
||||
: result_of::value_of_data<typename It::first_type>
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,220 @@
|
||||
// Copyright Vladimir Prus 2002-2004.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef BOOST_VARIABLES_MAP_VP_2003_05_19
|
||||
#define BOOST_VARIABLES_MAP_VP_2003_05_19
|
||||
|
||||
#include <boost/program_options/config.hpp>
|
||||
|
||||
#include <boost/any.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning (push)
|
||||
# pragma warning (disable:4251) // 'boost::program_options::variable_value::v' : class 'boost::any' needs to have dll-interface to be used by clients of class 'boost::program_options::variable_value
|
||||
#endif
|
||||
|
||||
namespace boost { namespace program_options {
|
||||
|
||||
template<class charT>
|
||||
class basic_parsed_options;
|
||||
|
||||
class value_semantic;
|
||||
class variables_map;
|
||||
|
||||
// forward declaration
|
||||
|
||||
/** Stores in 'm' all options that are defined in 'options'.
|
||||
If 'm' already has a non-defaulted value of an option, that value
|
||||
is not changed, even if 'options' specify some value.
|
||||
*/
|
||||
BOOST_PROGRAM_OPTIONS_DECL
|
||||
void store(const basic_parsed_options<char>& options, variables_map& m,
|
||||
bool utf8 = false);
|
||||
|
||||
/** Stores in 'm' all options that are defined in 'options'.
|
||||
If 'm' already has a non-defaulted value of an option, that value
|
||||
is not changed, even if 'options' specify some value.
|
||||
This is wide character variant.
|
||||
*/
|
||||
BOOST_PROGRAM_OPTIONS_DECL
|
||||
void store(const basic_parsed_options<wchar_t>& options,
|
||||
variables_map& m);
|
||||
|
||||
|
||||
/** Runs all 'notify' function for options in 'm'. */
|
||||
BOOST_PROGRAM_OPTIONS_DECL void notify(variables_map& m);
|
||||
|
||||
/** Class holding value of option. Contains details about how the
|
||||
value is set and allows to conveniently obtain the value.
|
||||
*/
|
||||
class BOOST_PROGRAM_OPTIONS_DECL variable_value {
|
||||
public:
|
||||
variable_value() : m_defaulted(false) {}
|
||||
variable_value(const boost::any& xv, bool xdefaulted)
|
||||
: v(xv), m_defaulted(xdefaulted)
|
||||
{}
|
||||
|
||||
/** If stored value if of type T, returns that value. Otherwise,
|
||||
throws boost::bad_any_cast exception. */
|
||||
template<class T>
|
||||
const T& as() const {
|
||||
return boost::any_cast<const T&>(v);
|
||||
}
|
||||
/** @overload */
|
||||
template<class T>
|
||||
T& as() {
|
||||
return boost::any_cast<T&>(v);
|
||||
}
|
||||
|
||||
/// Returns true if no value is stored.
|
||||
bool empty() const;
|
||||
/** Returns true if the value was not explicitly
|
||||
given, but has default value. */
|
||||
bool defaulted() const;
|
||||
/** Returns the contained value. */
|
||||
const boost::any& value() const;
|
||||
|
||||
/** Returns the contained value. */
|
||||
boost::any& value();
|
||||
private:
|
||||
boost::any v;
|
||||
bool m_defaulted;
|
||||
// Internal reference to value semantic. We need to run
|
||||
// notifications when *final* values of options are known, and
|
||||
// they are known only after all sources are stored. By that
|
||||
// time options_description for the first source might not
|
||||
// be easily accessible, so we need to store semantic here.
|
||||
shared_ptr<const value_semantic> m_value_semantic;
|
||||
|
||||
friend BOOST_PROGRAM_OPTIONS_DECL
|
||||
void store(const basic_parsed_options<char>& options,
|
||||
variables_map& m, bool);
|
||||
|
||||
friend class BOOST_PROGRAM_OPTIONS_DECL variables_map;
|
||||
};
|
||||
|
||||
/** Implements string->string mapping with convenient value casting
|
||||
facilities. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL abstract_variables_map {
|
||||
public:
|
||||
abstract_variables_map();
|
||||
abstract_variables_map(const abstract_variables_map* next);
|
||||
|
||||
virtual ~abstract_variables_map() {}
|
||||
|
||||
/** Obtains the value of variable 'name', from *this and
|
||||
possibly from the chain of variable maps.
|
||||
|
||||
- if there's no value in *this.
|
||||
- if there's next variable map, returns value from it
|
||||
- otherwise, returns empty value
|
||||
|
||||
- if there's defaulted value
|
||||
- if there's next variable map, which has a non-defaulted
|
||||
value, return that
|
||||
- otherwise, return value from *this
|
||||
|
||||
- if there's a non-defaulted value, returns it.
|
||||
*/
|
||||
const variable_value& operator[](const std::string& name) const;
|
||||
|
||||
/** Sets next variable map, which will be used to find
|
||||
variables not found in *this. */
|
||||
void next(abstract_variables_map* next);
|
||||
|
||||
private:
|
||||
/** Returns value of variable 'name' stored in *this, or
|
||||
empty value otherwise. */
|
||||
virtual const variable_value& get(const std::string& name) const = 0;
|
||||
|
||||
const abstract_variables_map* m_next;
|
||||
};
|
||||
|
||||
/** Concrete variables map which store variables in real map.
|
||||
|
||||
This class is derived from std::map<std::string, variable_value>,
|
||||
so you can use all map operators to examine its content.
|
||||
*/
|
||||
class BOOST_PROGRAM_OPTIONS_DECL variables_map : public abstract_variables_map,
|
||||
public std::map<std::string, variable_value>
|
||||
{
|
||||
public:
|
||||
variables_map();
|
||||
variables_map(const abstract_variables_map* next);
|
||||
|
||||
// Resolve conflict between inherited operators.
|
||||
const variable_value& operator[](const std::string& name) const
|
||||
{ return abstract_variables_map::operator[](name); }
|
||||
|
||||
// Override to clear some extra fields.
|
||||
void clear();
|
||||
|
||||
void notify();
|
||||
|
||||
private:
|
||||
/** Implementation of abstract_variables_map::get
|
||||
which does 'find' in *this. */
|
||||
const variable_value& get(const std::string& name) const;
|
||||
|
||||
/** Names of option with 'final' values \-- which should not
|
||||
be changed by subsequence assignments. */
|
||||
std::set<std::string> m_final;
|
||||
|
||||
friend BOOST_PROGRAM_OPTIONS_DECL
|
||||
void store(const basic_parsed_options<char>& options,
|
||||
variables_map& xm,
|
||||
bool utf8);
|
||||
|
||||
/** Names of required options, filled by parser which has
|
||||
access to options_description.
|
||||
The map values are the "canonical" names for each corresponding option.
|
||||
This is useful in creating diagnostic messages when the option is absent. */
|
||||
std::map<std::string, std::string> m_required;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Templates/inlines
|
||||
*/
|
||||
|
||||
inline bool
|
||||
variable_value::empty() const
|
||||
{
|
||||
return v.empty();
|
||||
}
|
||||
|
||||
inline bool
|
||||
variable_value::defaulted() const
|
||||
{
|
||||
return m_defaulted;
|
||||
}
|
||||
|
||||
inline
|
||||
const boost::any&
|
||||
variable_value::value() const
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
inline
|
||||
boost::any&
|
||||
variable_value::value()
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,178 @@
|
||||
#ifndef POSIX_TIME_CONFIG_HPP___
|
||||
#define POSIX_TIME_CONFIG_HPP___
|
||||
|
||||
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
* Author: Jeff Garland, Bart Garst
|
||||
* $Date$
|
||||
*/
|
||||
|
||||
#include <cstdlib> //for MCW 7.2 std::abs(long long)
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/date_time/time_duration.hpp>
|
||||
#include <boost/date_time/time_resolution_traits.hpp>
|
||||
#include <boost/date_time/gregorian/gregorian_types.hpp>
|
||||
#include <boost/date_time/wrapping_int.hpp>
|
||||
#include <boost/date_time/compiler_config.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace posix_time {
|
||||
|
||||
//Remove the following line if you want 64 bit millisecond resolution time
|
||||
//#define BOOST_GDTL_POSIX_TIME_STD_CONFIG
|
||||
|
||||
#ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
|
||||
// set up conditional test compilations
|
||||
#define BOOST_DATE_TIME_HAS_MILLISECONDS
|
||||
#define BOOST_DATE_TIME_HAS_MICROSECONDS
|
||||
#define BOOST_DATE_TIME_HAS_NANOSECONDS
|
||||
typedef date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::nano,
|
||||
1000000000, 9 > time_res_traits;
|
||||
#else
|
||||
// set up conditional test compilations
|
||||
#define BOOST_DATE_TIME_HAS_MILLISECONDS
|
||||
#define BOOST_DATE_TIME_HAS_MICROSECONDS
|
||||
#undef BOOST_DATE_TIME_HAS_NANOSECONDS
|
||||
typedef date_time::time_resolution_traits<
|
||||
boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::micro,
|
||||
1000000, 6 > time_res_traits;
|
||||
|
||||
|
||||
// #undef BOOST_DATE_TIME_HAS_MILLISECONDS
|
||||
// #undef BOOST_DATE_TIME_HAS_MICROSECONDS
|
||||
// #undef BOOST_DATE_TIME_HAS_NANOSECONDS
|
||||
// typedef date_time::time_resolution_traits<boost::int64_t, boost::date_time::tenth,
|
||||
// 10, 0 > time_res_traits;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//! Base time duration type
|
||||
/*! \ingroup time_basics
|
||||
*/
|
||||
class time_duration :
|
||||
public date_time::time_duration<time_duration, time_res_traits>
|
||||
{
|
||||
public:
|
||||
typedef time_res_traits rep_type;
|
||||
typedef time_res_traits::day_type day_type;
|
||||
typedef time_res_traits::hour_type hour_type;
|
||||
typedef time_res_traits::min_type min_type;
|
||||
typedef time_res_traits::sec_type sec_type;
|
||||
typedef time_res_traits::fractional_seconds_type fractional_seconds_type;
|
||||
typedef time_res_traits::tick_type tick_type;
|
||||
typedef time_res_traits::impl_type impl_type;
|
||||
time_duration(hour_type hour,
|
||||
min_type min,
|
||||
sec_type sec,
|
||||
fractional_seconds_type fs=0) :
|
||||
date_time::time_duration<time_duration, time_res_traits>(hour,min,sec,fs)
|
||||
{}
|
||||
time_duration() :
|
||||
date_time::time_duration<time_duration, time_res_traits>(0,0,0)
|
||||
{}
|
||||
//! Construct from special_values
|
||||
time_duration(boost::date_time::special_values sv) :
|
||||
date_time::time_duration<time_duration, time_res_traits>(sv)
|
||||
{}
|
||||
//Give duration access to ticks constructor -- hide from users
|
||||
friend class date_time::time_duration<time_duration, time_res_traits>;
|
||||
protected:
|
||||
explicit time_duration(impl_type tick_count) :
|
||||
date_time::time_duration<time_duration, time_res_traits>(tick_count)
|
||||
{}
|
||||
};
|
||||
|
||||
#ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
|
||||
|
||||
//! Simple implementation for the time rep
|
||||
struct simple_time_rep
|
||||
{
|
||||
typedef gregorian::date date_type;
|
||||
typedef time_duration time_duration_type;
|
||||
simple_time_rep(date_type d, time_duration_type tod) :
|
||||
day(d),
|
||||
time_of_day(tod)
|
||||
{
|
||||
// make sure we have sane values for date & time
|
||||
if(!day.is_special() && !time_of_day.is_special()){
|
||||
if(time_of_day >= time_duration_type(24,0,0)) {
|
||||
while(time_of_day >= time_duration_type(24,0,0)) {
|
||||
day += date_type::duration_type(1);
|
||||
time_of_day -= time_duration_type(24,0,0);
|
||||
}
|
||||
}
|
||||
else if(time_of_day.is_negative()) {
|
||||
while(time_of_day.is_negative()) {
|
||||
day -= date_type::duration_type(1);
|
||||
time_of_day += time_duration_type(24,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
date_type day;
|
||||
time_duration_type time_of_day;
|
||||
bool is_special()const
|
||||
{
|
||||
return(is_pos_infinity() || is_neg_infinity() || is_not_a_date_time());
|
||||
}
|
||||
bool is_pos_infinity()const
|
||||
{
|
||||
return(day.is_pos_infinity() || time_of_day.is_pos_infinity());
|
||||
}
|
||||
bool is_neg_infinity()const
|
||||
{
|
||||
return(day.is_neg_infinity() || time_of_day.is_neg_infinity());
|
||||
}
|
||||
bool is_not_a_date_time()const
|
||||
{
|
||||
return(day.is_not_a_date() || time_of_day.is_not_a_date_time());
|
||||
}
|
||||
};
|
||||
|
||||
class posix_time_system_config
|
||||
{
|
||||
public:
|
||||
typedef simple_time_rep time_rep_type;
|
||||
typedef gregorian::date date_type;
|
||||
typedef gregorian::date_duration date_duration_type;
|
||||
typedef time_duration time_duration_type;
|
||||
typedef time_res_traits::tick_type int_type;
|
||||
typedef time_res_traits resolution_traits;
|
||||
#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000000);
|
||||
#endif
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
class millisec_posix_time_system_config
|
||||
{
|
||||
public:
|
||||
typedef boost::int64_t time_rep_type;
|
||||
//typedef time_res_traits::tick_type time_rep_type;
|
||||
typedef gregorian::date date_type;
|
||||
typedef gregorian::date_duration date_duration_type;
|
||||
typedef time_duration time_duration_type;
|
||||
typedef time_res_traits::tick_type int_type;
|
||||
typedef time_res_traits::impl_type impl_type;
|
||||
typedef time_res_traits resolution_traits;
|
||||
#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} }//namespace posix_time
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002.
|
||||
# * 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)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/slot/detail/shared.hpp>
|
||||
#
|
||||
# undef BOOST_PP_ITERATION_START_1
|
||||
#
|
||||
# undef BOOST_PP_ITERATION_START_1_DIGIT_1
|
||||
# undef BOOST_PP_ITERATION_START_1_DIGIT_2
|
||||
# undef BOOST_PP_ITERATION_START_1_DIGIT_3
|
||||
# undef BOOST_PP_ITERATION_START_1_DIGIT_4
|
||||
# undef BOOST_PP_ITERATION_START_1_DIGIT_5
|
||||
# undef BOOST_PP_ITERATION_START_1_DIGIT_6
|
||||
# undef BOOST_PP_ITERATION_START_1_DIGIT_7
|
||||
# undef BOOST_PP_ITERATION_START_1_DIGIT_8
|
||||
# undef BOOST_PP_ITERATION_START_1_DIGIT_9
|
||||
# undef BOOST_PP_ITERATION_START_1_DIGIT_10
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_3 == 0
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_3 0
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 1
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_3 1
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 2
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_3 2
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 3
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_3 3
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 4
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_3 4
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 5
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_3 5
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 6
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_3 6
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 7
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_3 7
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 8
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_3 8
|
||||
# elif BOOST_PP_SLOT_TEMP_3 == 9
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_3 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_2 == 0
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_2 0
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 1
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_2 1
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 2
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_2 2
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 3
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_2 3
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 4
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_2 4
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 5
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_2 5
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 6
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_2 6
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 7
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_2 7
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 8
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_2 8
|
||||
# elif BOOST_PP_SLOT_TEMP_2 == 9
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_2 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_SLOT_TEMP_1 == 0
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_1 0
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 1
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_1 1
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 2
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_1 2
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 3
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_1 3
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 4
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_1 4
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 5
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_1 5
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 6
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_1 6
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 7
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_1 7
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 8
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_1 8
|
||||
# elif BOOST_PP_SLOT_TEMP_1 == 9
|
||||
# define BOOST_PP_ITERATION_START_1_DIGIT_1 9
|
||||
# endif
|
||||
#
|
||||
# if BOOST_PP_ITERATION_START_1_DIGIT_3
|
||||
# define BOOST_PP_ITERATION_START_1 BOOST_PP_SLOT_CC_3(BOOST_PP_ITERATION_START_1_DIGIT_3, BOOST_PP_ITERATION_START_1_DIGIT_2, BOOST_PP_ITERATION_START_1_DIGIT_1)
|
||||
# elif BOOST_PP_ITERATION_START_1_DIGIT_2
|
||||
# define BOOST_PP_ITERATION_START_1 BOOST_PP_SLOT_CC_2(BOOST_PP_ITERATION_START_1_DIGIT_2, BOOST_PP_ITERATION_START_1_DIGIT_1)
|
||||
# else
|
||||
# define BOOST_PP_ITERATION_START_1 BOOST_PP_ITERATION_START_1_DIGIT_1
|
||||
# endif
|
||||
@@ -0,0 +1,41 @@
|
||||
program prob
|
||||
|
||||
implicit real*8 (a-h,o-z)
|
||||
integer*8 binomial
|
||||
integer x,s,XX,NN
|
||||
real*8 hypergeo
|
||||
character arg*8
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.4) then
|
||||
print*,'Usage: prob x N X s'
|
||||
print*,'Example: prob 35 63 40 40'
|
||||
go to 999
|
||||
endif
|
||||
call getarg(1,arg)
|
||||
read(arg,*) x
|
||||
call getarg(2,arg)
|
||||
read(arg,*) NN
|
||||
call getarg(3,arg)
|
||||
read(arg,*) XX
|
||||
call getarg(4,arg)
|
||||
read(arg,*) s
|
||||
|
||||
! print*,binomial(5, 3) ! 10
|
||||
! print*,binomial(40, 19) ! 131282408400
|
||||
|
||||
write(*,1010) x,NN,XX,s
|
||||
1010 format(//' x=',i2,' N=',i2,' X=',i2,' s=',i2)
|
||||
write(*,1012)
|
||||
1012 format(/' x P(x|N,X,s) P(>=x|N,X,s) '/ &
|
||||
'-------------------------------')
|
||||
|
||||
hsum=0.d0
|
||||
do ix=x,XX
|
||||
h=hypergeo(ix,NN,XX,s)
|
||||
hsum=hsum + h
|
||||
write(*,1020) ix,h,hsum
|
||||
1020 format(i3,2d13.4)
|
||||
enddo
|
||||
|
||||
999 end program prob
|
||||
@@ -0,0 +1,17 @@
|
||||
/*=============================================================================
|
||||
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(FUSION_TUPLE_10032005_0806)
|
||||
#define FUSION_TUPLE_10032005_0806
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/tuple/tuple.hpp>
|
||||
#include <boost/fusion/tuple/make_tuple.hpp>
|
||||
#include <boost/fusion/tuple/tuple_tie.hpp>
|
||||
#include <boost/fusion/container/generation/ignore.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#ifndef BORROWED_PTR_DWA20020601_HPP
|
||||
# define BORROWED_PTR_DWA20020601_HPP
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/python/tag.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
template<class T> class borrowed
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_borrowed_ptr
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
# if !defined(__MWERKS__) || __MWERKS__ > 0x3000
|
||||
template<typename T>
|
||||
struct is_borrowed_ptr<borrowed<T>*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_borrowed_ptr<borrowed<T> const*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_borrowed_ptr<borrowed<T> volatile*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_borrowed_ptr<borrowed<T> const volatile*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
# else
|
||||
template<typename T>
|
||||
struct is_borrowed
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
template<typename T>
|
||||
struct is_borrowed<borrowed<T> >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
template<typename T>
|
||||
struct is_borrowed_ptr<T*>
|
||||
: is_borrowed<typename remove_cv<T>::type>
|
||||
{
|
||||
};
|
||||
# endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T* get_managed_object(detail::borrowed<T> const volatile* p, tag_t)
|
||||
{
|
||||
return (T*)p;
|
||||
}
|
||||
|
||||
}} // namespace boost::python::detail
|
||||
|
||||
#endif // #ifndef BORROWED_PTR_DWA20020601_HPP
|
||||
@@ -0,0 +1,15 @@
|
||||
// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
|
||||
// Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
|
||||
#ifndef BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED
|
||||
#define BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
|
||||
#endif // BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED
|
||||
@@ -0,0 +1,328 @@
|
||||
#include "Modulator.hpp"
|
||||
#include <limits>
|
||||
#include <qmath.h>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include "mainwindow.h"
|
||||
#include "soundout.h"
|
||||
|
||||
#include "moc_Modulator.cpp"
|
||||
|
||||
extern float gran(); // Noise generator (for tests only)
|
||||
|
||||
#define RAMP_INCREMENT 64 // MUST be an integral factor of 2^16
|
||||
|
||||
#if defined (WSJT_SOFT_KEYING)
|
||||
# define SOFT_KEYING WSJT_SOFT_KEYING
|
||||
#else
|
||||
# define SOFT_KEYING 1
|
||||
#endif
|
||||
|
||||
double constexpr Modulator::m_twoPi;
|
||||
|
||||
// float wpm=20.0;
|
||||
// unsigned m_nspd=1.2*48000.0/wpm;
|
||||
// m_nspd=3072; //18.75 WPM
|
||||
|
||||
Modulator::Modulator (unsigned frameRate, unsigned periodLengthInSeconds,
|
||||
QObject * parent)
|
||||
: AudioDevice {parent}
|
||||
, m_quickClose {false}
|
||||
, m_phi {0.0}
|
||||
, m_toneSpacing {0.0}
|
||||
, m_fSpread {0.0}
|
||||
, m_frameRate {frameRate}
|
||||
, m_period {periodLengthInSeconds}
|
||||
, m_state {Idle}
|
||||
, m_tuning {false}
|
||||
, m_cwLevel {false}
|
||||
, m_j0 {-1}
|
||||
, m_toneFrequency0 {1500.0}
|
||||
{
|
||||
}
|
||||
|
||||
void Modulator::start (unsigned symbolsLength, double framesPerSymbol,
|
||||
double frequency, double toneSpacing,
|
||||
SoundOutput * stream, Channel channel,
|
||||
bool synchronize, bool fastMode, double dBSNR, int TRperiod)
|
||||
{
|
||||
Q_ASSERT (stream);
|
||||
// Time according to this computer which becomes our base time
|
||||
qint64 ms0 = QDateTime::currentMSecsSinceEpoch() % 86400000;
|
||||
|
||||
if (m_state != Idle)
|
||||
{
|
||||
stop ();
|
||||
}
|
||||
|
||||
m_quickClose = false;
|
||||
|
||||
m_symbolsLength = symbolsLength;
|
||||
m_isym0 = std::numeric_limits<unsigned>::max (); // big number
|
||||
m_frequency0 = 0.;
|
||||
m_phi = 0.;
|
||||
m_addNoise = dBSNR < 0.;
|
||||
m_nsps = framesPerSymbol;
|
||||
m_frequency = frequency;
|
||||
m_amp = std::numeric_limits<qint16>::max ();
|
||||
m_toneSpacing = toneSpacing;
|
||||
m_bFastMode=fastMode;
|
||||
m_TRperiod=TRperiod;
|
||||
|
||||
// noise generator parameters
|
||||
if (m_addNoise) {
|
||||
m_snr = qPow (10.0, 0.05 * (dBSNR - 6.0));
|
||||
m_fac = 3000.0;
|
||||
if (m_snr > 1.0) m_fac = 3000.0 / m_snr;
|
||||
}
|
||||
|
||||
unsigned mstr = ms0 % (1000 * m_period); // ms in period
|
||||
m_ic = (mstr / 1000) * m_frameRate; // we start exactly N seconds
|
||||
// into period where N is the next whole second
|
||||
if(m_bFastMode) m_ic=0;
|
||||
|
||||
m_silentFrames = 0;
|
||||
// calculate number of silent frames to send
|
||||
if (synchronize && !m_tuning && !m_bFastMode) {
|
||||
m_silentFrames = m_ic + m_frameRate - (mstr * m_frameRate / 1000);
|
||||
}
|
||||
if(m_ic==0 and (m_silentFrames/48000.0 > 0.6) and m_nsps==2048 and m_period==15) {
|
||||
// FT8 mode: Start audio at t=0.5 s rather than t=1.0 s.
|
||||
m_silentFrames=m_silentFrames-24000;
|
||||
}
|
||||
|
||||
initialize (QIODevice::ReadOnly, channel);
|
||||
Q_EMIT stateChanged ((m_state = (synchronize && m_silentFrames) ?
|
||||
Synchronizing : Active));
|
||||
m_stream = stream;
|
||||
if (m_stream) m_stream->restart (this);
|
||||
}
|
||||
|
||||
void Modulator::tune (bool newState)
|
||||
{
|
||||
m_tuning = newState;
|
||||
if (!m_tuning) stop (true);
|
||||
}
|
||||
|
||||
void Modulator::stop (bool quick)
|
||||
{
|
||||
m_quickClose = quick;
|
||||
close ();
|
||||
}
|
||||
|
||||
void Modulator::close ()
|
||||
{
|
||||
if (m_stream)
|
||||
{
|
||||
if (m_quickClose)
|
||||
{
|
||||
m_stream->reset ();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stream->stop ();
|
||||
}
|
||||
}
|
||||
if (m_state != Idle)
|
||||
{
|
||||
Q_EMIT stateChanged ((m_state = Idle));
|
||||
}
|
||||
AudioDevice::close ();
|
||||
}
|
||||
|
||||
qint64 Modulator::readData (char * data, qint64 maxSize)
|
||||
{
|
||||
double toneFrequency=1500.0;
|
||||
if(m_nsps==6) {
|
||||
toneFrequency=1000.0;
|
||||
m_frequency=1000.0;
|
||||
m_frequency0=1000.0;
|
||||
}
|
||||
if(maxSize==0) return 0;
|
||||
Q_ASSERT (!(maxSize % qint64 (bytesPerFrame ()))); // no torn frames
|
||||
Q_ASSERT (isOpen ());
|
||||
|
||||
qint64 numFrames (maxSize / bytesPerFrame ());
|
||||
qint16 * samples (reinterpret_cast<qint16 *> (data));
|
||||
qint16 * end (samples + numFrames * (bytesPerFrame () / sizeof (qint16)));
|
||||
qint64 framesGenerated (0);
|
||||
|
||||
switch (m_state)
|
||||
{
|
||||
case Synchronizing:
|
||||
{
|
||||
if (m_silentFrames) { // send silence up to first second
|
||||
framesGenerated = qMin (m_silentFrames, numFrames);
|
||||
for ( ; samples != end; samples = load (0, samples)) { // silence
|
||||
}
|
||||
m_silentFrames -= framesGenerated;
|
||||
return framesGenerated * bytesPerFrame ();
|
||||
}
|
||||
|
||||
Q_EMIT stateChanged ((m_state = Active));
|
||||
m_cwLevel = false;
|
||||
m_ramp = 0; // prepare for CW wave shaping
|
||||
}
|
||||
// fall through
|
||||
|
||||
case Active:
|
||||
{
|
||||
unsigned int isym=0;
|
||||
if(!m_tuning) isym=m_ic/(4.0*m_nsps); // Actual fsample=48000
|
||||
bool slowCwId=((isym >= m_symbolsLength) && (icw[0] > 0)) && (!m_bFastMode);
|
||||
if(m_TRperiod==3) slowCwId=false;
|
||||
bool fastCwId=false;
|
||||
static bool bCwId=false;
|
||||
qint64 ms = QDateTime::currentMSecsSinceEpoch();
|
||||
float tsec=0.001*(ms % (1000*m_TRperiod));
|
||||
if(m_bFastMode and (icw[0]>0) and (tsec>(m_TRperiod-5.0))) fastCwId=true;
|
||||
if(!m_bFastMode) m_nspd=2560; // 22.5 WPM
|
||||
|
||||
if(slowCwId or fastCwId) { // Transmit CW ID?
|
||||
m_dphi = m_twoPi*m_frequency/m_frameRate;
|
||||
if(m_bFastMode and !bCwId) {
|
||||
m_frequency=1500; // Set params for CW ID
|
||||
m_dphi = m_twoPi*m_frequency/m_frameRate;
|
||||
m_symbolsLength=126;
|
||||
m_nsps=4096.0*12000.0/11025.0;
|
||||
m_ic=2246949;
|
||||
m_nspd=2560; // 22.5 WPM
|
||||
if(icw[0]*m_nspd/48000.0 > 4.0) m_nspd=4.0*48000.0/icw[0]; //Faster CW for long calls
|
||||
}
|
||||
bCwId=true;
|
||||
unsigned ic0 = m_symbolsLength * 4 * m_nsps;
|
||||
unsigned j(0);
|
||||
|
||||
while (samples != end) {
|
||||
j = (m_ic - ic0)/m_nspd + 1; // symbol of this sample
|
||||
bool level {bool (icw[j])};
|
||||
m_phi += m_dphi;
|
||||
if (m_phi > m_twoPi) m_phi -= m_twoPi;
|
||||
qint16 sample=0;
|
||||
float amp=32767.0;
|
||||
float x=0;
|
||||
if(m_ramp!=0) {
|
||||
x=qSin(float(m_phi));
|
||||
if(SOFT_KEYING) {
|
||||
amp=qAbs(qint32(m_ramp));
|
||||
if(amp>32767.0) amp=32767.0;
|
||||
}
|
||||
sample=round(amp*x);
|
||||
}
|
||||
if(m_bFastMode) {
|
||||
sample=0;
|
||||
if(level) sample=32767.0*x;
|
||||
}
|
||||
if (int (j) <= icw[0] && j < NUM_CW_SYMBOLS) { // stop condition
|
||||
samples = load (postProcessSample (sample), samples);
|
||||
++framesGenerated;
|
||||
++m_ic;
|
||||
} else {
|
||||
Q_EMIT stateChanged ((m_state = Idle));
|
||||
return framesGenerated * bytesPerFrame ();
|
||||
}
|
||||
|
||||
// adjust ramp
|
||||
if ((m_ramp != 0 && m_ramp != std::numeric_limits<qint16>::min ()) || level != m_cwLevel) {
|
||||
// either ramp has terminated at max/min or direction has changed
|
||||
m_ramp += RAMP_INCREMENT; // ramp
|
||||
}
|
||||
m_cwLevel = level;
|
||||
}
|
||||
return framesGenerated * bytesPerFrame ();
|
||||
} else {
|
||||
bCwId=false;
|
||||
} //End of code for CW ID
|
||||
|
||||
double const baud (12000.0 / m_nsps);
|
||||
// fade out parameters (no fade out for tuning)
|
||||
unsigned int i0,i1;
|
||||
if(m_tuning) {
|
||||
i1 = i0 = (m_bFastMode ? 999999 : 9999) * m_nsps;
|
||||
} else {
|
||||
i0=(m_symbolsLength - 0.017) * 4.0 * m_nsps;
|
||||
i1= m_symbolsLength * 4.0 * m_nsps;
|
||||
}
|
||||
if(m_bFastMode and !m_tuning) {
|
||||
i1=m_TRperiod*48000 - 24000;
|
||||
i0=i1-816;
|
||||
}
|
||||
|
||||
|
||||
for (unsigned i = 0; i < numFrames && m_ic <= i1; ++i) {
|
||||
isym=0;
|
||||
if(!m_tuning and m_TRperiod!=3) isym=m_ic / (4.0 * m_nsps); //Actual fsample=48000
|
||||
if(m_bFastMode) isym=isym%m_symbolsLength;
|
||||
if (isym != m_isym0 || m_frequency != m_frequency0) {
|
||||
if(itone[0]>=100) {
|
||||
m_toneFrequency0=itone[0];
|
||||
} else {
|
||||
if(m_toneSpacing==0.0) {
|
||||
m_toneFrequency0=m_frequency + itone[isym]*baud;
|
||||
} else {
|
||||
m_toneFrequency0=m_frequency + itone[isym]*m_toneSpacing;
|
||||
}
|
||||
}
|
||||
// qDebug() << "B" << m_bFastMode << m_ic << numFrames << isym << itone[isym]
|
||||
// << m_toneFrequency0 << m_nsps;
|
||||
m_dphi = m_twoPi * m_toneFrequency0 / m_frameRate;
|
||||
m_isym0 = isym;
|
||||
m_frequency0 = m_frequency; //???
|
||||
}
|
||||
|
||||
int j=m_ic/480;
|
||||
if(m_fSpread>0.0 and j!=m_j0) {
|
||||
float x1=(float)qrand()/RAND_MAX;
|
||||
float x2=(float)qrand()/RAND_MAX;
|
||||
toneFrequency = m_toneFrequency0 + 0.5*m_fSpread*(x1+x2-1.0);
|
||||
m_dphi = m_twoPi * toneFrequency / m_frameRate;
|
||||
m_j0=j;
|
||||
}
|
||||
|
||||
m_phi += m_dphi;
|
||||
if (m_phi > m_twoPi) m_phi -= m_twoPi;
|
||||
if (m_ic > i0) m_amp = 0.98 * m_amp;
|
||||
if (m_ic > i1) m_amp = 0.0;
|
||||
|
||||
samples = load (postProcessSample (m_amp * qSin (m_phi)), samples);
|
||||
++framesGenerated;
|
||||
++m_ic;
|
||||
}
|
||||
|
||||
if (m_amp == 0.0) { // TODO G4WJS: compare double with zero might not be wise
|
||||
if (icw[0] == 0) {
|
||||
// no CW ID to send
|
||||
Q_EMIT stateChanged ((m_state = Idle));
|
||||
return framesGenerated * bytesPerFrame ();
|
||||
}
|
||||
m_phi = 0.0;
|
||||
}
|
||||
|
||||
m_frequency0 = m_frequency;
|
||||
// done for this chunk - continue on next call
|
||||
return framesGenerated * bytesPerFrame ();
|
||||
}
|
||||
// fall through
|
||||
|
||||
case Idle:
|
||||
break;
|
||||
}
|
||||
|
||||
Q_ASSERT (Idle == m_state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
qint16 Modulator::postProcessSample (qint16 sample) const
|
||||
{
|
||||
if (m_addNoise) { // Test frame, we'll add noise
|
||||
qint32 s = m_fac * (gran () + sample * m_snr / 32768.0);
|
||||
if (s > std::numeric_limits<qint16>::max ()) {
|
||||
s = std::numeric_limits<qint16>::max ();
|
||||
}
|
||||
if (s < std::numeric_limits<qint16>::min ()) {
|
||||
s = std::numeric_limits<qint16>::min ();
|
||||
}
|
||||
sample = s;
|
||||
}
|
||||
return sample;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
#if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
#ifndef BOOST_PHOENIX_OBJECT_DETAIL_NEW_EVAL_HPP
|
||||
#define BOOST_PHOENIX_OBJECT_DETAIL_NEW_EVAL_HPP
|
||||
|
||||
#include <boost/phoenix/object/detail/cpp03/preprocessed/new_eval.hpp>
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
||||
#if !BOOST_PHOENIX_IS_ITERATING
|
||||
|
||||
#ifndef BOOST_PHOENIX_OBJECT_DETAIL_NEW_EVAL_HPP
|
||||
#define BOOST_PHOENIX_OBJECT_DETAIL_NEW_EVAL_HPP
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_shifted_binary_params.hpp>
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/new_eval_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
||||
#endif
|
||||
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
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(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PHOENIX_ITERATION_PARAMS \
|
||||
(3, (2, BOOST_PHOENIX_COMPOSITE_LIMIT, \
|
||||
<boost/phoenix/object/detail/cpp03/new_eval.hpp>))
|
||||
#include BOOST_PHOENIX_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template <typename This, BOOST_PHOENIX_typename_A, typename Context>
|
||||
struct result<This(BOOST_PHOENIX_A, Context)>
|
||||
{
|
||||
typedef
|
||||
typename proto::detail::uncvref<
|
||||
typename proto::result_of::value<A0>::type
|
||||
>::type
|
||||
target_type;
|
||||
typedef typename target_type::type construct_type;
|
||||
typedef typename target_type::type * type;
|
||||
};
|
||||
|
||||
template <BOOST_PHOENIX_typename_A, typename Context>
|
||||
typename result<new_eval(BOOST_PHOENIX_A_const_ref, Context &)>::type
|
||||
operator()(
|
||||
A0 const&
|
||||
, BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(
|
||||
BOOST_PHOENIX_ITERATION
|
||||
, A
|
||||
, const& a
|
||||
)
|
||||
, Context const & ctx
|
||||
) const
|
||||
{
|
||||
#define EVAL_a(_,n,__) \
|
||||
BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) boost::phoenix::eval(a ## n, ctx)
|
||||
return
|
||||
new typename result<
|
||||
new_eval(BOOST_PHOENIX_A_const_ref, Context &)
|
||||
>::construct_type(
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
1
|
||||
, BOOST_PHOENIX_ITERATION
|
||||
, EVAL_a
|
||||
, _
|
||||
)
|
||||
);
|
||||
#undef EVAL_a
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,74 @@
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// (C) Copyright Jeremy Siek 2002.
|
||||
// (C) Copyright Thomas Witt 2002.
|
||||
// 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)
|
||||
#ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
||||
#define BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
||||
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace iterators {
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
template <class Iterator>
|
||||
class reverse_iterator
|
||||
: public iterator_adaptor< reverse_iterator<Iterator>, Iterator >
|
||||
{
|
||||
typedef iterator_adaptor< reverse_iterator<Iterator>, Iterator > super_t;
|
||||
|
||||
friend class iterator_core_access;
|
||||
|
||||
public:
|
||||
reverse_iterator() {}
|
||||
|
||||
explicit reverse_iterator(Iterator x)
|
||||
: super_t(x) {}
|
||||
|
||||
template<class OtherIterator>
|
||||
reverse_iterator(
|
||||
reverse_iterator<OtherIterator> const& r
|
||||
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
|
||||
)
|
||||
: super_t(r.base())
|
||||
{}
|
||||
|
||||
private:
|
||||
typename super_t::reference dereference() const { return *boost::prior(this->base()); }
|
||||
|
||||
void increment() { --this->base_reference(); }
|
||||
void decrement() { ++this->base_reference(); }
|
||||
|
||||
void advance(typename super_t::difference_type n)
|
||||
{
|
||||
this->base_reference() += -n;
|
||||
}
|
||||
|
||||
template <class OtherIterator>
|
||||
typename super_t::difference_type
|
||||
distance_to(reverse_iterator<OtherIterator> const& y) const
|
||||
{
|
||||
return this->base_reference() - y.base();
|
||||
}
|
||||
};
|
||||
|
||||
template <class BidirectionalIterator>
|
||||
inline reverse_iterator<BidirectionalIterator> make_reverse_iterator(BidirectionalIterator x)
|
||||
{
|
||||
return reverse_iterator<BidirectionalIterator>(x);
|
||||
}
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
using iterators::reverse_iterator;
|
||||
using iterators::make_reverse_iterator;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
||||
@@ -0,0 +1,18 @@
|
||||
/*=============================================================================
|
||||
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)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct void_;
|
||||
struct set_tag;
|
||||
struct set_iterator_tag;
|
||||
template <
|
||||
typename T0 = void_ , typename T1 = void_ , typename T2 = void_ , typename T3 = void_ , typename T4 = void_ , typename T5 = void_ , typename T6 = void_ , typename T7 = void_ , typename T8 = void_ , typename T9 = void_ , typename T10 = void_ , typename T11 = void_ , typename T12 = void_ , typename T13 = void_ , typename T14 = void_ , typename T15 = void_ , typename T16 = void_ , typename T17 = void_ , typename T18 = void_ , typename T19 = void_ , typename T20 = void_ , typename T21 = void_ , typename T22 = void_ , typename T23 = void_ , typename T24 = void_ , typename T25 = void_ , typename T26 = void_ , typename T27 = void_ , typename T28 = void_ , typename T29 = void_ , typename T30 = void_ , typename T31 = void_ , typename T32 = void_ , typename T33 = void_ , typename T34 = void_ , typename T35 = void_ , typename T36 = void_ , typename T37 = void_ , typename T38 = void_ , typename T39 = void_
|
||||
>
|
||||
struct set;
|
||||
}}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
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)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_COMPILER_EDG_H
|
||||
#define BOOST_PREDEF_COMPILER_EDG_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_COMP_EDG`]
|
||||
|
||||
[@http://en.wikipedia.org/wiki/Edison_Design_Group EDG C++ Frontend] compiler.
|
||||
Version number available as major, minor, and patch.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__EDG__`] [__predef_detection__]]
|
||||
|
||||
[[`__EDG_VERSION__`] [V.R.0]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_COMP_EDG BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__EDG__)
|
||||
# define BOOST_COMP_EDG_DETECTION BOOST_PREDEF_MAKE_10_VRR(__EDG_VERSION__)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_COMP_EDG_DETECTION
|
||||
# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
|
||||
# define BOOST_COMP_EDG_EMULATED BOOST_COMP_EDG_DETECTION
|
||||
# else
|
||||
# undef BOOST_COMP_EDG
|
||||
# define BOOST_COMP_EDG BOOST_COMP_EDG_DETECTION
|
||||
# endif
|
||||
# define BOOST_COMP_EDG_AVAILABLE
|
||||
# include <boost/predef/detail/comp_detected.h>
|
||||
#endif
|
||||
|
||||
#define BOOST_COMP_EDG_NAME "EDG C++ Frontend"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_EDG,BOOST_COMP_EDG_NAME)
|
||||
|
||||
#ifdef BOOST_COMP_EDG_EMULATED
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_EDG_EMULATED,BOOST_COMP_EDG_NAME)
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
|
||||
* 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)
|
||||
*
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_ARGS_HPP
|
||||
#define BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_ARGS_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/aux_/na.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/multi_index/tag.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* Oredered index specifiers can be instantiated in two forms:
|
||||
*
|
||||
* (ordered_unique|ordered_non_unique)<
|
||||
* KeyFromValue,Compare=std::less<KeyFromValue::result_type> >
|
||||
* (ordered_unique|ordered_non_unique)<
|
||||
* TagList,KeyFromValue,Compare=std::less<KeyFromValue::result_type> >
|
||||
*
|
||||
* index_args implements the machinery to accept this argument-dependent
|
||||
* polymorphism.
|
||||
*/
|
||||
|
||||
template<typename KeyFromValue>
|
||||
struct index_args_default_compare
|
||||
{
|
||||
typedef std::less<typename KeyFromValue::result_type> type;
|
||||
};
|
||||
|
||||
template<typename Arg1,typename Arg2,typename Arg3>
|
||||
struct ordered_index_args
|
||||
{
|
||||
typedef is_tag<Arg1> full_form;
|
||||
|
||||
typedef typename mpl::if_<
|
||||
full_form,
|
||||
Arg1,
|
||||
tag< > >::type tag_list_type;
|
||||
typedef typename mpl::if_<
|
||||
full_form,
|
||||
Arg2,
|
||||
Arg1>::type key_from_value_type;
|
||||
typedef typename mpl::if_<
|
||||
full_form,
|
||||
Arg3,
|
||||
Arg2>::type supplied_compare_type;
|
||||
typedef typename mpl::eval_if<
|
||||
mpl::is_na<supplied_compare_type>,
|
||||
index_args_default_compare<key_from_value_type>,
|
||||
mpl::identity<supplied_compare_type>
|
||||
>::type compare_type;
|
||||
|
||||
BOOST_STATIC_ASSERT(is_tag<tag_list_type>::value);
|
||||
BOOST_STATIC_ASSERT(!mpl::is_na<key_from_value_type>::value);
|
||||
BOOST_STATIC_ASSERT(!mpl::is_na<compare_type>::value);
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
subroutine hash(string,len,ihash)
|
||||
use iso_c_binding, only: c_loc,c_size_t
|
||||
use hashing
|
||||
parameter (MASK15=32767)
|
||||
! character*(*), target :: string
|
||||
character*1, target :: string
|
||||
i=nhash(c_loc(string),int(len,c_size_t),146)
|
||||
ihash=iand(i,MASK15)
|
||||
return
|
||||
end subroutine hash
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes,
|
||||
// Howard Hinnant and John Maddock 2000.
|
||||
// (C) Copyright Mat Marcus, Jesse Jones and Adobe Systems Inc 2001
|
||||
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
// Fixed is_pointer, is_reference, is_const, is_volatile, is_same,
|
||||
// is_member_pointer based on the Simulated Partial Specialization work
|
||||
// of Mat Marcus and Jesse Jones. See http://opensource.adobe.com or
|
||||
// http://groups.yahoo.com/group/boost/message/5441
|
||||
// Some workarounds in here use ideas suggested from "Generic<Programming>:
|
||||
// Mappings between Types and Values"
|
||||
// by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html).
|
||||
|
||||
|
||||
#ifndef BOOST_TT_IS_POINTER_HPP_INCLUDED
|
||||
#define BOOST_TT_IS_POINTER_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if defined( __CODEGEARC__ )
|
||||
template <class T> struct is_pointer : public integral_constant<bool, __is_pointer(T)>{};
|
||||
#else
|
||||
template <class T> struct is_pointer : public false_type{};
|
||||
template <class T> struct is_pointer<T*> : public true_type{};
|
||||
template <class T> struct is_pointer<T*const> : public true_type{};
|
||||
template <class T> struct is_pointer<T*const volatile> : public true_type{};
|
||||
template <class T> struct is_pointer<T*volatile> : public true_type{};
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
template <class T> struct is_pointer<T const> : public is_pointer<T>{};
|
||||
template <class T> struct is_pointer<T const volatile> : public is_pointer<T>{};
|
||||
template <class T> struct is_pointer<T volatile> : public is_pointer<T>{};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_IS_POINTER_HPP_INCLUDED
|
||||
@@ -0,0 +1,99 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
// Copyright Jaap Suter 2003
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
// *Preprocessed* version of the main "shift_right.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Tag1
|
||||
, typename Tag2
|
||||
>
|
||||
struct shift_right_impl
|
||||
: if_c<
|
||||
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
|
||||
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
|
||||
)
|
||||
|
||||
, aux::cast2nd_impl< shift_right_impl< Tag1,Tag1 >,Tag1, Tag2 >
|
||||
, aux::cast1st_impl< shift_right_impl< Tag2,Tag2 >,Tag1, Tag2 >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
/// for Digital Mars C++/compilers with no CTPS/TTP support
|
||||
template<> struct shift_right_impl< na,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename Tag > struct shift_right_impl< na,Tag >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename Tag > struct shift_right_impl< Tag,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct shift_right_tag
|
||||
{
|
||||
typedef typename T::tag type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct shift_right
|
||||
|
||||
: shift_right_impl<
|
||||
typename shift_right_tag<N1>::type
|
||||
, typename shift_right_tag<N2>::type
|
||||
>::template apply< N1,N2 >::type
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, shift_right, (N1, N2))
|
||||
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 2, shift_right)
|
||||
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
template<>
|
||||
struct shift_right_impl< integral_c_tag,integral_c_tag >
|
||||
{
|
||||
template< typename N, typename S > struct apply
|
||||
|
||||
: integral_c<
|
||||
typename N::value_type
|
||||
, ( BOOST_MPL_AUX_VALUE_WKND(N)::value
|
||||
>> BOOST_MPL_AUX_VALUE_WKND(S)::value
|
||||
)
|
||||
>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,94 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/greater_equal.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Tag1
|
||||
, typename Tag2
|
||||
>
|
||||
struct greater_equal_impl
|
||||
: if_c<
|
||||
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
|
||||
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
|
||||
)
|
||||
|
||||
, aux::cast2nd_impl< greater_equal_impl< Tag1,Tag1 >,Tag1, Tag2 >
|
||||
, aux::cast1st_impl< greater_equal_impl< Tag2,Tag2 >,Tag1, Tag2 >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
/// for Digital Mars C++/compilers with no CTPS/TTP support
|
||||
template<> struct greater_equal_impl< na,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct greater_equal_impl< na,integral_c_tag >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct greater_equal_impl< integral_c_tag,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct greater_equal_tag
|
||||
{
|
||||
typedef typename T::tag type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct greater_equal
|
||||
|
||||
: greater_equal_impl<
|
||||
typename greater_equal_tag<N1>::type
|
||||
, typename greater_equal_tag<N2>::type
|
||||
>::template apply< N1,N2 >::type
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, greater_equal, (N1, N2))
|
||||
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 2, greater_equal)
|
||||
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct greater_equal_impl< integral_c_tag,integral_c_tag >
|
||||
{
|
||||
template< typename N1, typename N2 > struct apply
|
||||
|
||||
: bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value >= BOOST_MPL_AUX_VALUE_WKND(N2)::value ) >
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,78 @@
|
||||
subroutine ft8b(s,nfqso,f1,xdt,nharderrors,dmin,nbadcrc,message)
|
||||
|
||||
include 'ft8_params.f90'
|
||||
parameter(NRECENT=10)
|
||||
character*12 recent_calls(NRECENT)
|
||||
character message*22
|
||||
real s(NH1,NHSYM)
|
||||
real s1(0:7,ND)
|
||||
real ps(0:7)
|
||||
real rxdata(3*ND),llr(3*ND) !Soft symbols
|
||||
integer*1 decoded(KK),apmask(3*ND),cw(3*ND)
|
||||
|
||||
max_iterations=40
|
||||
norder=2
|
||||
if(abs(nfqso-f1).lt.10.0) norder=3
|
||||
tstep=0.5*NSPS/12000.0
|
||||
df=12000.0/NFFT1
|
||||
|
||||
i0=nint(f1/df)
|
||||
j0=nint(xdt/tstep)
|
||||
|
||||
j=0
|
||||
ia=i0
|
||||
ib=i0+14
|
||||
do k=1,NN
|
||||
if(k.le.7) cycle
|
||||
if(k.ge.37 .and. k.le.43) cycle
|
||||
if(k.gt.72) cycle
|
||||
n=j0+2*(k-1)+1
|
||||
if(n.lt.1) cycle
|
||||
j=j+1
|
||||
s1(0:7,j)=s(ia:ib:2,n)
|
||||
enddo
|
||||
do j=1,ND
|
||||
ps=s1(0:7,j)
|
||||
where (ps.gt.0.0) ps=log(ps)
|
||||
r1=max(ps(1),ps(3),ps(5),ps(7))-max(ps(0),ps(2),ps(4),ps(6))
|
||||
r2=max(ps(2),ps(3),ps(6),ps(7))-max(ps(0),ps(1),ps(4),ps(5))
|
||||
r4=max(ps(4),ps(5),ps(6),ps(7))-max(ps(0),ps(1),ps(2),ps(3))
|
||||
rxdata(3*j-2)=r4
|
||||
rxdata(3*j-1)=r2
|
||||
rxdata(3*j)=r1
|
||||
enddo
|
||||
|
||||
rxav=sum(rxdata)/(3.0*ND)
|
||||
rx2av=sum(rxdata*rxdata)/(3.0*ND)
|
||||
var=rx2av-rxav*rxav
|
||||
if( var .gt. 0.0 ) then
|
||||
rxsig=sqrt(var)
|
||||
else
|
||||
rxsig=sqrt(rx2av)
|
||||
endif
|
||||
rxdata=rxdata/rxsig
|
||||
ss=0.84
|
||||
llr=2.0*rxdata/(ss*ss)
|
||||
apmask=0
|
||||
cw=0
|
||||
! cw will be needed for subtraction.
|
||||
! dmin is the correlation discrepancy of a returned codeword - it is
|
||||
! used to select the best codeword within osd174.
|
||||
call bpdecode174(llr,apmask,max_iterations,decoded,cw,nharderrors)
|
||||
dmin=0.0
|
||||
if(nharderrors.lt.0) then
|
||||
call osd174(llr,norder,decoded,cw,nharderrors,dmin)
|
||||
! This threshold needs to be tuned. 99.0 should pass everything.
|
||||
if( dmin .gt. 99.0 ) nharderrors=-1
|
||||
endif
|
||||
nbadcrc=1
|
||||
message=' '
|
||||
if(count(cw.eq.0).eq.174) go to 900 !Reject the all-zero codeword
|
||||
if(nharderrors.ge.0) call chkcrc12a(decoded,nbadcrc)
|
||||
if(nbadcrc.eq.0) then
|
||||
call extractmessage174(decoded,message,ncrcflag,recent_calls,nrecent)
|
||||
endif
|
||||
900 continue
|
||||
|
||||
return
|
||||
end subroutine ft8b
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,105 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2001-2004
|
||||
// Copyright Peter Dimov 2001-2003
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/placeholders.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
|
||||
typedef arg< -1 > _;
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_)
|
||||
|
||||
namespace placeholders {
|
||||
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
/// agurt, 17/mar/02: one more placeholder for the last 'apply#'
|
||||
/// specialization
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
|
||||
typedef arg<1> _1;
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_1)
|
||||
|
||||
namespace placeholders {
|
||||
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_1;
|
||||
}
|
||||
|
||||
}}
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
|
||||
typedef arg<2> _2;
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_2)
|
||||
|
||||
namespace placeholders {
|
||||
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_2;
|
||||
}
|
||||
|
||||
}}
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
|
||||
typedef arg<3> _3;
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_3)
|
||||
|
||||
namespace placeholders {
|
||||
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_3;
|
||||
}
|
||||
|
||||
}}
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
|
||||
typedef arg<4> _4;
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_4)
|
||||
|
||||
namespace placeholders {
|
||||
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_4;
|
||||
}
|
||||
|
||||
}}
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
|
||||
typedef arg<5> _5;
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_5)
|
||||
|
||||
namespace placeholders {
|
||||
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_5;
|
||||
}
|
||||
|
||||
}}
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
|
||||
typedef arg<6> _6;
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_6)
|
||||
|
||||
namespace placeholders {
|
||||
using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_6;
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2006. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_FUNCTIONS_HPP
|
||||
#define BOOST_RANGE_FUNCTIONS_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/size.hpp>
|
||||
#include <boost/range/distance.hpp>
|
||||
#include <boost/range/empty.hpp>
|
||||
#include <boost/range/rbegin.hpp>
|
||||
#include <boost/range/rend.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
// Copyright Kevlin Henney, 2000-2005.
|
||||
// Copyright Alexander Nasonov, 2006-2010.
|
||||
// Copyright Antony Polukhin, 2011-2014.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// what: lexical_cast custom keyword cast
|
||||
// who: contributed by Kevlin Henney,
|
||||
// enhanced with contributions from Terje Slettebo,
|
||||
// with additional fixes and suggestions from Gennaro Prota,
|
||||
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
|
||||
// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann,
|
||||
// Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters
|
||||
// when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2014
|
||||
|
||||
#ifndef BOOST_LEXICAL_CAST_INCLUDED
|
||||
#define BOOST_LEXICAL_CAST_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING)
|
||||
#define BOOST_LCAST_NO_WCHAR_T
|
||||
#endif
|
||||
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/lexical_cast/bad_lexical_cast.hpp>
|
||||
#include <boost/lexical_cast/try_lexical_convert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <typename Target, typename Source>
|
||||
inline Target lexical_cast(const Source &arg)
|
||||
{
|
||||
Target result = Target();
|
||||
|
||||
if (!boost::conversion::detail::try_lexical_convert(arg, result)) {
|
||||
boost::conversion::detail::throw_bad_cast<Source, Target>();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Target>
|
||||
inline Target lexical_cast(const char* chars, std::size_t count)
|
||||
{
|
||||
return ::boost::lexical_cast<Target>(
|
||||
::boost::iterator_range<const char*>(chars, chars + count)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Target>
|
||||
inline Target lexical_cast(const unsigned char* chars, std::size_t count)
|
||||
{
|
||||
return ::boost::lexical_cast<Target>(
|
||||
::boost::iterator_range<const unsigned char*>(chars, chars + count)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Target>
|
||||
inline Target lexical_cast(const signed char* chars, std::size_t count)
|
||||
{
|
||||
return ::boost::lexical_cast<Target>(
|
||||
::boost::iterator_range<const signed char*>(chars, chars + count)
|
||||
);
|
||||
}
|
||||
|
||||
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||
template <typename Target>
|
||||
inline Target lexical_cast(const wchar_t* chars, std::size_t count)
|
||||
{
|
||||
return ::boost::lexical_cast<Target>(
|
||||
::boost::iterator_range<const wchar_t*>(chars, chars + count)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_CHAR16_T
|
||||
template <typename Target>
|
||||
inline Target lexical_cast(const char16_t* chars, std::size_t count)
|
||||
{
|
||||
return ::boost::lexical_cast<Target>(
|
||||
::boost::iterator_range<const char16_t*>(chars, chars + count)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_NO_CXX11_CHAR32_T
|
||||
template <typename Target>
|
||||
inline Target lexical_cast(const char32_t* chars, std::size_t count)
|
||||
{
|
||||
return ::boost::lexical_cast<Target>(
|
||||
::boost::iterator_range<const char32_t*>(chars, chars + count)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_LCAST_NO_WCHAR_T
|
||||
|
||||
#endif // BOOST_LEXICAL_CAST_INCLUDED
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
_WSJT-X_ is programmed to cooperate closely with several other useful
|
||||
programs.
|
||||
|
||||
* {dxlsuite}, {omnirig}, and {hrd} were described in the section on
|
||||
<<RADIO,rig control>>.
|
||||
|
||||
* {pskreporter}, by Philip Gladstone, is a web server that gathers
|
||||
reception reports sent by various other programs, including _WSJT-X_.
|
||||
The information is made available in near real time on a world map,
|
||||
and also as statistical summaries of various kinds. A number of
|
||||
options are available to the user; for example, you can request a map
|
||||
showing world-wide JT65 activity on all amateur bands over the
|
||||
past hour. Such a map might look like this, where different colors
|
||||
represent different bands:
|
||||
|
||||
image::psk-reporter.png[align="left",alt="PSK Reporter"]
|
||||
|
||||
The following screen shot shows the PSK Reporter map configured to
|
||||
show MSK144 reports:
|
||||
|
||||
image::psk-reporter_2.png[align="left",alt="PSK Reporter"]
|
||||
|
||||
* {jtalert}, by VK3AMA, is available only for Windows. It provides
|
||||
many operating aids including automatic logging to several third-party
|
||||
logging programs, audio and visual alerts following a number of
|
||||
optional alert conditions (decoding of a new DXCC, new state, etc.),
|
||||
and convenient direct access to web services such as callsign lookup.
|
||||
|
||||
image::jtalert.png[align="left",alt="JTAlert-X image"]
|
||||
|
||||
* {alarmejt}, by F5JMH, is available only for Linux. The program keeps
|
||||
its own logbook. It fetches contact information from _WSJT-X_ and
|
||||
provides visual alerts for new DXCC entities and grid squares on the
|
||||
current band, as well as other options.
|
||||
|
||||
* {jtbridge}, by SM0THU, is available for OS X. It works together with
|
||||
logging applications Aether, MacLoggerDX, RUMlog or RUMlogNG. It
|
||||
checks QSO and QSL status of the call and DXCC entity, as well as many
|
||||
other features.
|
||||
@@ -0,0 +1,80 @@
|
||||
// (C) Copyright John Maddock 2007.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// This file is machine generated, do not edit by hand
|
||||
|
||||
// Polynomial evaluation using second order Horners rule
|
||||
#ifndef BOOST_MATH_TOOLS_RAT_EVAL_6_HPP
|
||||
#define BOOST_MATH_TOOLS_RAT_EVAL_6_HPP
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{ namespace detail{
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(0);
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[0]) / static_cast<V>(b[0]);
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x));
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
return static_cast<V>(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
{
|
||||
V x2 = x * x;
|
||||
return static_cast<V>((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
V z2 = 1 / (x * x);
|
||||
return static_cast<V>((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,319 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// feed_args.hpp : functions for processing each argument
|
||||
// (feed, feed_manip, and distribute)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/format for library home page
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_FORMAT_FEED_ARGS_HPP
|
||||
#define BOOST_FORMAT_FEED_ARGS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <boost/format/format_class.hpp>
|
||||
#include <boost/format/group.hpp>
|
||||
#include <boost/format/detail/msvc_disambiguater.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace io {
|
||||
namespace detail {
|
||||
|
||||
template<class Ch, class Tr, class Alloc>
|
||||
void mk_str( std::basic_string<Ch,Tr, Alloc> & res,
|
||||
const Ch * beg,
|
||||
typename std::basic_string<Ch,Tr,Alloc>::size_type size,
|
||||
std::streamsize w,
|
||||
const Ch fill_char,
|
||||
std::ios_base::fmtflags f,
|
||||
const Ch prefix_space, // 0 if no space-padding
|
||||
bool center)
|
||||
// applies centered/left/right padding to the string [beg, beg+size[
|
||||
// Effects : the result is placed in res.
|
||||
{
|
||||
typedef typename std::basic_string<Ch,Tr,Alloc>::size_type size_type;
|
||||
res.resize(0);
|
||||
if(w<=0 || static_cast<size_type>(w) <=size) {
|
||||
// no need to pad.
|
||||
res.reserve(size + !!prefix_space);
|
||||
if(prefix_space)
|
||||
res.append(1, prefix_space);
|
||||
if (size)
|
||||
res.append(beg, size);
|
||||
}
|
||||
else {
|
||||
std::streamsize n=static_cast<std::streamsize>(w-size-!!prefix_space);
|
||||
std::streamsize n_after = 0, n_before = 0;
|
||||
res.reserve(static_cast<size_type>(w)); // allocate once for the 2 inserts
|
||||
if(center)
|
||||
n_after = n/2, n_before = n - n_after;
|
||||
else
|
||||
if(f & std::ios_base::left)
|
||||
n_after = n;
|
||||
else
|
||||
n_before = n;
|
||||
// now make the res string :
|
||||
if(n_before) res.append(static_cast<size_type>(n_before), fill_char);
|
||||
if(prefix_space)
|
||||
res.append(1, prefix_space);
|
||||
if (size)
|
||||
res.append(beg, size);
|
||||
if(n_after) res.append(static_cast<size_type>(n_after), fill_char);
|
||||
}
|
||||
} // -mk_str(..)
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
|
||||
// __DECCXX needs to be tricked to disambiguate this simple overload..
|
||||
// the trick is in "boost/format/msvc_disambiguater.hpp"
|
||||
|
||||
template< class Ch, class Tr, class T> inline
|
||||
void put_head (BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) {
|
||||
disambiguater<Ch, Tr, T>::put_head(os, x, 1L);
|
||||
}
|
||||
template< class Ch, class Tr, class T> inline
|
||||
void put_last (BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) {
|
||||
disambiguater<Ch, Tr, T>::put_last(os, x, 1L);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template< class Ch, class Tr, class T> inline
|
||||
void put_head (BOOST_IO_STD basic_ostream<Ch, Tr> &, const T& ) {
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class T> inline
|
||||
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const group1<T>& x ) {
|
||||
os << group_head(x.a1_); // send the first N-1 items, not the last
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class T> inline
|
||||
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) {
|
||||
os << x ;
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class T> inline
|
||||
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const group1<T>& x ) {
|
||||
os << group_last(x.a1_); // this selects the last element
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
|
||||
template< class Ch, class Tr, class T> inline
|
||||
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr> &, T& ) {
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class T> inline
|
||||
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, T& x) {
|
||||
os << x ;
|
||||
}
|
||||
#endif
|
||||
#endif // -__DECCXX workaround
|
||||
|
||||
template< class Ch, class Tr, class T>
|
||||
void call_put_head(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x) {
|
||||
put_head(os, *(typename ::boost::remove_reference<T>::type*)x);
|
||||
}
|
||||
|
||||
template< class Ch, class Tr, class T>
|
||||
void call_put_last(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x) {
|
||||
put_last(os, *(T*)x);
|
||||
}
|
||||
|
||||
template< class Ch, class Tr>
|
||||
struct put_holder {
|
||||
template<class T>
|
||||
put_holder(T& t)
|
||||
: arg(&t),
|
||||
put_head(&call_put_head<Ch, Tr, T>),
|
||||
put_last(&call_put_last<Ch, Tr, T>)
|
||||
{}
|
||||
const void* arg;
|
||||
void (*put_head)(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x);
|
||||
void (*put_last)(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x);
|
||||
};
|
||||
|
||||
template< class Ch, class Tr> inline
|
||||
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const put_holder<Ch, Tr>& t) {
|
||||
t.put_head(os, t.arg);
|
||||
}
|
||||
|
||||
template< class Ch, class Tr> inline
|
||||
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const put_holder<Ch, Tr>& t) {
|
||||
t.put_last(os, t.arg);
|
||||
}
|
||||
|
||||
|
||||
template< class Ch, class Tr, class Alloc, class T>
|
||||
void put( T x,
|
||||
const format_item<Ch, Tr, Alloc>& specs,
|
||||
typename basic_format<Ch, Tr, Alloc>::string_type& res,
|
||||
typename basic_format<Ch, Tr, Alloc>::internal_streambuf_t & buf,
|
||||
io::detail::locale_t *loc_p = NULL)
|
||||
{
|
||||
#ifdef BOOST_MSVC
|
||||
// If std::min<unsigned> or std::max<unsigned> are already instantiated
|
||||
// at this point then we get a blizzard of warning messages when we call
|
||||
// those templates with std::size_t as arguments. Weird and very annoyning...
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4267)
|
||||
#endif
|
||||
// does the actual conversion of x, with given params, into a string
|
||||
// using the supplied stringbuf.
|
||||
|
||||
typedef typename basic_format<Ch, Tr, Alloc>::string_type string_type;
|
||||
typedef typename basic_format<Ch, Tr, Alloc>::format_item_t format_item_t;
|
||||
typedef typename string_type::size_type size_type;
|
||||
|
||||
basic_oaltstringstream<Ch, Tr, Alloc> oss( &buf);
|
||||
|
||||
if(loc_p != NULL)
|
||||
oss.imbue(*loc_p);
|
||||
|
||||
specs.fmtstate_.apply_on(oss, loc_p);
|
||||
|
||||
// the stream format state can be modified by manipulators in the argument :
|
||||
put_head( oss, x );
|
||||
// in case x is a group, apply the manip part of it,
|
||||
// in order to find width
|
||||
|
||||
const std::ios_base::fmtflags fl=oss.flags();
|
||||
const bool internal = (fl & std::ios_base::internal) != 0;
|
||||
const std::streamsize w = oss.width();
|
||||
const bool two_stepped_padding= internal && (w!=0);
|
||||
|
||||
res.resize(0);
|
||||
if(! two_stepped_padding) {
|
||||
if(w>0) // handle padding via mk_str, not natively in stream
|
||||
oss.width(0);
|
||||
put_last( oss, x);
|
||||
const Ch * res_beg = buf.pbase();
|
||||
Ch prefix_space = 0;
|
||||
if(specs.pad_scheme_ & format_item_t::spacepad)
|
||||
if(buf.pcount()== 0 ||
|
||||
(res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') ))
|
||||
prefix_space = oss.widen(' ');
|
||||
size_type res_size = (std::min)(
|
||||
static_cast<size_type>(specs.truncate_ - !!prefix_space),
|
||||
buf.pcount() );
|
||||
mk_str(res, res_beg, res_size, w, oss.fill(), fl,
|
||||
prefix_space, (specs.pad_scheme_ & format_item_t::centered) !=0 );
|
||||
}
|
||||
else { // 2-stepped padding
|
||||
// internal can be implied by zeropad, or user-set.
|
||||
// left, right, and centered alignment overrule internal,
|
||||
// but spacepad or truncate might be mixed with internal (using manipulator)
|
||||
put_last( oss, x); // may pad
|
||||
const Ch * res_beg = buf.pbase();
|
||||
size_type res_size = buf.pcount();
|
||||
bool prefix_space=false;
|
||||
if(specs.pad_scheme_ & format_item_t::spacepad)
|
||||
if(buf.pcount()== 0 ||
|
||||
(res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') ))
|
||||
prefix_space = true;
|
||||
if(res_size == static_cast<size_type>(w) && w<=specs.truncate_ && !prefix_space) {
|
||||
// okay, only one thing was printed and padded, so res is fine
|
||||
res.assign(res_beg, res_size);
|
||||
}
|
||||
else { // length w exceeded
|
||||
// either it was multi-output with first output padding up all width..
|
||||
// either it was one big arg and we are fine.
|
||||
// Note that res_size<w is possible (in case of bad user-defined formatting)
|
||||
res.assign(res_beg, res_size);
|
||||
res_beg=NULL; // invalidate pointers.
|
||||
|
||||
// make a new stream, to start re-formatting from scratch :
|
||||
buf.clear_buffer();
|
||||
basic_oaltstringstream<Ch, Tr, Alloc> oss2( &buf);
|
||||
specs.fmtstate_.apply_on(oss2, loc_p);
|
||||
put_head( oss2, x );
|
||||
|
||||
oss2.width(0);
|
||||
if(prefix_space)
|
||||
oss2 << ' ';
|
||||
put_last(oss2, x );
|
||||
if(buf.pcount()==0 && specs.pad_scheme_ & format_item_t::spacepad) {
|
||||
prefix_space =true;
|
||||
oss2 << ' ';
|
||||
}
|
||||
// we now have the minimal-length output
|
||||
const Ch * tmp_beg = buf.pbase();
|
||||
size_type tmp_size = (std::min)(static_cast<size_type>(specs.truncate_),
|
||||
buf.pcount() );
|
||||
|
||||
|
||||
if(static_cast<size_type>(w) <= tmp_size) {
|
||||
// minimal length is already >= w, so no padding (cool!)
|
||||
res.assign(tmp_beg, tmp_size);
|
||||
}
|
||||
else { // hum.. we need to pad (multi_output, or spacepad present)
|
||||
//find where we should pad
|
||||
size_type sz = (std::min)(res_size + (prefix_space ? 1 : 0), tmp_size);
|
||||
size_type i = prefix_space;
|
||||
for(; i<sz && tmp_beg[i] == res[i - (prefix_space ? 1 : 0)]; ++i) {}
|
||||
if(i>=tmp_size) i=prefix_space;
|
||||
res.assign(tmp_beg, i);
|
||||
std::streamsize d = w - static_cast<std::streamsize>(tmp_size);
|
||||
BOOST_ASSERT(d>0);
|
||||
res.append(static_cast<size_type>( d ), oss2.fill());
|
||||
res.append(tmp_beg+i, tmp_size-i);
|
||||
BOOST_ASSERT(i+(tmp_size-i)+(std::max)(d,(std::streamsize)0)
|
||||
== static_cast<size_type>(w));
|
||||
BOOST_ASSERT(res.size() == static_cast<size_type>(w));
|
||||
}
|
||||
}
|
||||
}
|
||||
buf.clear_buffer();
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
} // end- put(..)
|
||||
|
||||
|
||||
template< class Ch, class Tr, class Alloc, class T>
|
||||
void distribute (basic_format<Ch,Tr, Alloc>& self, T x) {
|
||||
// call put(x, ..) on every occurrence of the current argument :
|
||||
if(self.cur_arg_ >= self.num_args_) {
|
||||
if( self.exceptions() & too_many_args_bit )
|
||||
boost::throw_exception(too_many_args(self.cur_arg_, self.num_args_));
|
||||
else return;
|
||||
}
|
||||
for(unsigned long i=0; i < self.items_.size(); ++i) {
|
||||
if(self.items_[i].argN_ == self.cur_arg_) {
|
||||
put<Ch, Tr, Alloc, T> (x, self.items_[i], self.items_[i].res_,
|
||||
self.buf_, boost::get_pointer(self.loc_) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class Ch, class Tr, class Alloc, class T>
|
||||
basic_format<Ch, Tr, Alloc>&
|
||||
feed_impl (basic_format<Ch,Tr, Alloc>& self, T x) {
|
||||
if(self.dumped_) self.clear();
|
||||
distribute<Ch, Tr, Alloc, T> (self, x);
|
||||
++self.cur_arg_;
|
||||
if(self.bound_.size() != 0) {
|
||||
while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] )
|
||||
++self.cur_arg_;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
template<class Ch, class Tr, class Alloc, class T> inline
|
||||
basic_format<Ch, Tr, Alloc>&
|
||||
feed (basic_format<Ch,Tr, Alloc>& self, T x) {
|
||||
return feed_impl<Ch, Tr, Alloc, const put_holder<Ch, Tr>&>(self, put_holder<Ch, Tr>(x));
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace io
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_FORMAT_FEED_ARGS_HPP
|
||||
@@ -0,0 +1,74 @@
|
||||
// (C) Copyright Gennadiy Rozental 2001.
|
||||
// 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)
|
||||
|
||||
// See http://www.boost.org/libs/test for the library home page.
|
||||
//
|
||||
// File : $RCSfile$
|
||||
//
|
||||
// Version : $Revision: 74248 $
|
||||
//
|
||||
// Description : support for backward compatible collection comparison interface
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER
|
||||
#define BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER
|
||||
|
||||
#ifdef BOOST_TEST_NO_OLD_TOOLS
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace boost {
|
||||
namespace test_tools {
|
||||
namespace tt_detail {
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** backward compatibility support ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
template<typename It>
|
||||
struct it_pair {
|
||||
typedef It const_iterator;
|
||||
typedef typename std::iterator_traits<It>::value_type value_type;
|
||||
|
||||
it_pair( It const& b, It const& e ) : m_begin( b ), m_size( 0 )
|
||||
{
|
||||
It tmp = b;
|
||||
while( tmp != e ) { ++m_size; ++tmp; }
|
||||
}
|
||||
|
||||
It begin() const { return m_begin; }
|
||||
It end() const { return m_begin + m_size; }
|
||||
size_t size() const { return m_size; }
|
||||
|
||||
private:
|
||||
It m_begin;
|
||||
size_t m_size;
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename It>
|
||||
it_pair<It>
|
||||
make_it_pair( It const& b, It const& e ) { return it_pair<It>( b, e ); }
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename T>
|
||||
it_pair<T const*>
|
||||
make_it_pair( T const* b, T const* e ) { return it_pair<T const*>( b, e ); }
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
} // namespace tt_detail
|
||||
} // namespace test_tools
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_NO_OLD_TOOLS
|
||||
|
||||
#endif // BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER
|
||||
@@ -0,0 +1,25 @@
|
||||
// (C) Copyright 2009-2011 Frederic Bron.
|
||||
//
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_HAS_UNARY_MINUS_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_UNARY_MINUS_HPP_INCLUDED
|
||||
|
||||
#define BOOST_TT_TRAIT_NAME has_unary_minus
|
||||
#define BOOST_TT_TRAIT_OP -
|
||||
#define BOOST_TT_FORBIDDEN_IF\
|
||||
/* pointer */\
|
||||
::boost::is_pointer< Rhs_noref >::value
|
||||
|
||||
|
||||
#include <boost/type_traits/detail/has_prefix_operator.hpp>
|
||||
|
||||
#undef BOOST_TT_TRAIT_NAME
|
||||
#undef BOOST_TT_TRAIT_OP
|
||||
#undef BOOST_TT_FORBIDDEN_IF
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user