Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
@@ -0,0 +1,23 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2011. *
# * (C) Copyright Paul Mensonides 2011. *
# * 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. */
#
# ifndef BOOST_PREPROCESSOR_VARIADIC_HPP
# define BOOST_PREPROCESSOR_VARIADIC_HPP
#
# include <boost/preprocessor/variadic/elem.hpp>
# include <boost/preprocessor/variadic/size.hpp>
# include <boost/preprocessor/variadic/to_array.hpp>
# include <boost/preprocessor/variadic/to_list.hpp>
# include <boost/preprocessor/variadic/to_seq.hpp>
# include <boost/preprocessor/variadic/to_tuple.hpp>
#
# endif
@@ -0,0 +1,65 @@
// (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 : test tools context interfaces
// ***************************************************************************
#ifndef BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER
#define BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER
// Boost.Test
#include <boost/test/utils/lazy_ostream.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
namespace test_tools {
namespace tt_detail {
// ************************************************************************** //
// ************** context_frame ************** //
// ************************************************************************** //
struct BOOST_TEST_DECL context_frame {
explicit context_frame( ::boost::unit_test::lazy_ostream const& context_descr );
~context_frame();
operator bool();
private:
// Data members
int m_frame_id;
};
//____________________________________________________________________________//
#define BOOST_TEST_INFO( context_descr ) \
::boost::unit_test::framework::add_context( BOOST_TEST_LAZY_MSG( context_descr ) , false ) \
/**/
//____________________________________________________________________________//
#define BOOST_TEST_CONTEXT( context_descr ) \
if( ::boost::test_tools::tt_detail::context_frame BOOST_JOIN( context_frame_, __LINE__ ) = \
::boost::test_tools::tt_detail::context_frame( BOOST_TEST_LAZY_MSG( context_descr ) ) ) \
/**/
//____________________________________________________________________________//
} // namespace tt_detail
} // namespace test_tools
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,14 @@
// Status=review
- SSB transceiver and antenna
- Computer running Windows (XP or later), Linux, or OS X
- 1.5 GHz or faster CPU and 200 MB of available memory. (MSK144
especially benefits from a multi-core CPU)
- Monitor with at least 1024 x 780 resolution
- Computer-to-radio interface using a serial port or equivalent USB
device for T/R switching, or CAT control, or VOX, as required for
your radio-to-computer connections
- Audio input and output devices supported by the operating system and
configured for sample rate 48000 Hz.
- Audio or equivalent USB connections between transceiver and computer
- A means for synchronizing the computer clock to UTC within ±1 second
@@ -0,0 +1,135 @@
#ifndef DATE_TIME_DATE_FORMATTING_HPP___
#define DATE_TIME_DATE_FORMATTING_HPP___
/* Copyright (c) 2002-2004 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 "boost/date_time/iso_format.hpp"
#include "boost/date_time/compiler_config.hpp"
#include <string>
#include <sstream>
#include <iomanip>
/* NOTE: "formatter" code for older compilers, ones that define
* BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in
* date_formatting_limited.hpp
*/
namespace boost {
namespace date_time {
//! Formats a month as as string into an ostream
template<class month_type, class format_type, class charT=char>
class month_formatter
{
typedef std::basic_ostream<charT> ostream_type;
public:
//! Formats a month as as string into an ostream
/*! This function demands that month_type provide
* functions for converting to short and long strings
* if that capability is used.
*/
static ostream_type& format_month(const month_type& month,
ostream_type &os)
{
switch (format_type::month_format())
{
case month_as_short_string:
{
os << month.as_short_string();
break;
}
case month_as_long_string:
{
os << month.as_long_string();
break;
}
case month_as_integer:
{
os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number();
break;
}
default:
break;
}
return os;
} // format_month
};
//! Convert ymd to a standard string formatting policies
template<class ymd_type, class format_type, class charT=char>
class ymd_formatter
{
public:
//! Convert ymd to a standard string formatting policies
/*! This is standard code for handling date formatting with
* year-month-day based date information. This function
* uses the format_type to control whether the string will
* contain separator characters, and if so what the character
* will be. In addtion, it can format the month as either
* an integer or a string as controled by the formatting
* policy
*/
static std::basic_string<charT> ymd_to_string(ymd_type ymd)
{
typedef typename ymd_type::month_type month_type;
std::basic_ostringstream<charT> ss;
// Temporarily switch to classic locale to prevent possible formatting
// of year with comma or other character (for example 2,008).
ss.imbue(std::locale::classic());
ss << ymd.year;
ss.imbue(std::locale());
if (format_type::has_date_sep_chars()) {
ss << format_type::month_sep_char();
}
//this name is a bit ugly, oh well....
month_formatter<month_type,format_type,charT>::format_month(ymd.month, ss);
if (format_type::has_date_sep_chars()) {
ss << format_type::day_sep_char();
}
ss << std::setw(2) << std::setfill(ss.widen('0'))
<< ymd.day;
return ss.str();
}
};
//! Convert a date to string using format policies
template<class date_type, class format_type, class charT=char>
class date_formatter
{
public:
typedef std::basic_string<charT> string_type;
//! Convert to a date to standard string using format policies
static string_type date_to_string(date_type d)
{
typedef typename date_type::ymd_type ymd_type;
if (d.is_not_a_date()) {
return string_type(format_type::not_a_date());
}
if (d.is_neg_infinity()) {
return string_type(format_type::neg_infinity());
}
if (d.is_pos_infinity()) {
return string_type(format_type::pos_infinity());
}
ymd_type ymd = d.year_month_day();
return ymd_formatter<ymd_type, format_type, charT>::ymd_to_string(ymd);
}
};
} } //namespace date_time
#endif
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2014 Glen Joseph Fernandes
* glenfe at live dot com
*
* Distributed under the Boost Software License,
* Version 1.0. (See accompanying file LICENSE_1_0.txt
* or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_SMART_PTR_DETAIL_ARRAY_COUNT_IMPL_HPP
#define BOOST_SMART_PTR_DETAIL_ARRAY_COUNT_IMPL_HPP
#include <boost/smart_ptr/detail/array_allocator.hpp>
#include <boost/smart_ptr/detail/sp_counted_impl.hpp>
namespace boost {
namespace detail {
template<class P, class A>
class sp_counted_impl_pda<P, ms_in_allocator_tag, A>
: public sp_counted_base {
typedef ms_in_allocator_tag D;
typedef sp_counted_impl_pda<P, D, A> Y;
public:
sp_counted_impl_pda(P, D, const A& allocator_)
: allocator(allocator_) {
}
virtual void dispose() {
allocator();
}
virtual void destroy() {
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
typedef typename std::allocator_traits<A>::
template rebind_alloc<Y> YA;
typedef typename std::allocator_traits<A>::
template rebind_traits<Y> YT;
#else
typedef typename A::template rebind<Y>::other YA;
#endif
YA a1(allocator);
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
YT::destroy(a1, this);
YT::deallocate(a1, this, 1);
#else
this->~Y();
a1.deallocate(this, 1);
#endif
}
virtual void* get_deleter(const sp_typeinfo&) {
return &reinterpret_cast<char&>(allocator);
}
virtual void* get_untyped_deleter() {
return &reinterpret_cast<char&>(allocator);
}
private:
sp_counted_impl_pda(const sp_counted_impl_pda&);
sp_counted_impl_pda& operator=(const sp_counted_impl_pda&);
A allocator;
};
}
}
#endif
@@ -0,0 +1,419 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-2013. 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/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_CONTAINER_DETAIL_NODE_ALLOC_HPP_
#define BOOST_CONTAINER_DETAIL_NODE_ALLOC_HPP_
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
// container
#include <boost/container/allocator_traits.hpp>
// container/detail
#include <boost/container/detail/addressof.hpp>
#include <boost/container/detail/alloc_helpers.hpp>
#include <boost/container/detail/allocator_version_traits.hpp>
#include <boost/container/detail/construct_in_place.hpp>
#include <boost/container/detail/destroyers.hpp>
#include <boost/container/detail/iterator_to_raw_pointer.hpp>
#include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/placement_new.hpp>
#include <boost/container/detail/to_raw_pointer.hpp>
#include <boost/container/detail/type_traits.hpp>
#include <boost/container/detail/version_type.hpp>
// intrusive
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/options.hpp>
// move
#include <boost/move/utility_core.hpp>
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#include <boost/move/detail/fwd_macros.hpp>
#endif
// other
#include <boost/core/no_exceptions_support.hpp>
namespace boost {
namespace container {
namespace container_detail {
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(value_compare)
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(predicate_type)
template<class Allocator, class ICont>
struct node_alloc_holder
{
//If the intrusive container is an associative container, obtain the predicate, which will
//be of type node_compare<>. If not an associative container value_compare will be a "nat" type.
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
( boost::container::container_detail::
, ICont, value_compare, container_detail::nat) intrusive_value_compare;
//In that case obtain the value predicate from the node predicate via predicate_type
//if intrusive_value_compare is node_compare<>, nat otherwise
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
( boost::container::container_detail::
, intrusive_value_compare
, predicate_type, container_detail::nat) value_compare;
typedef allocator_traits<Allocator> allocator_traits_type;
typedef typename allocator_traits_type::value_type value_type;
typedef ICont intrusive_container;
typedef typename ICont::value_type Node;
typedef typename allocator_traits_type::template
portable_rebind_alloc<Node>::type NodeAlloc;
typedef allocator_traits<NodeAlloc> node_allocator_traits_type;
typedef container_detail::allocator_version_traits<NodeAlloc> node_allocator_version_traits_type;
typedef Allocator ValAlloc;
typedef typename node_allocator_traits_type::pointer NodePtr;
typedef container_detail::scoped_deallocator<NodeAlloc> Deallocator;
typedef typename node_allocator_traits_type::size_type size_type;
typedef typename node_allocator_traits_type::difference_type difference_type;
typedef container_detail::integral_constant<unsigned,
boost::container::container_detail::
version<NodeAlloc>::value> alloc_version;
typedef typename ICont::iterator icont_iterator;
typedef typename ICont::const_iterator icont_citerator;
typedef allocator_destroyer<NodeAlloc> Destroyer;
typedef allocator_traits<NodeAlloc> NodeAllocTraits;
typedef allocator_version_traits<NodeAlloc> AllocVersionTraits;
private:
BOOST_COPYABLE_AND_MOVABLE(node_alloc_holder)
public:
//Constructors for sequence containers
node_alloc_holder()
: members_()
{}
explicit node_alloc_holder(const ValAlloc &a)
: members_(a)
{}
explicit node_alloc_holder(const node_alloc_holder &x)
: members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()))
{}
explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x)
: members_(boost::move(x.node_alloc()))
{ this->icont().swap(x.icont()); }
//Constructors for associative containers
explicit node_alloc_holder(const value_compare &c, const ValAlloc &a)
: members_(a, c)
{}
explicit node_alloc_holder(const value_compare &c, const node_alloc_holder &x)
: members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()), c)
{}
explicit node_alloc_holder(const value_compare &c)
: members_(c)
{}
//helpers for move assignments
explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x, const value_compare &c)
: members_(boost::move(x.node_alloc()), c)
{ this->icont().swap(x.icont()); }
void copy_assign_alloc(const node_alloc_holder &x)
{
container_detail::bool_<allocator_traits_type::propagate_on_container_copy_assignment::value> flag;
container_detail::assign_alloc( static_cast<NodeAlloc &>(this->members_)
, static_cast<const NodeAlloc &>(x.members_), flag);
}
void move_assign_alloc( node_alloc_holder &x)
{
container_detail::bool_<allocator_traits_type::propagate_on_container_move_assignment::value> flag;
container_detail::move_alloc( static_cast<NodeAlloc &>(this->members_)
, static_cast<NodeAlloc &>(x.members_), flag);
}
~node_alloc_holder()
{ this->clear(alloc_version()); }
size_type max_size() const
{ return allocator_traits_type::max_size(this->node_alloc()); }
NodePtr allocate_one()
{ return AllocVersionTraits::allocate_one(this->node_alloc()); }
void deallocate_one(const NodePtr &p)
{ AllocVersionTraits::deallocate_one(this->node_alloc(), p); }
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class ...Args>
NodePtr create_node(Args &&...args)
{
NodePtr p = this->allocate_one();
Deallocator node_deallocator(p, this->node_alloc());
allocator_traits<NodeAlloc>::construct
( this->node_alloc()
, container_detail::addressof(p->m_data), boost::forward<Args>(args)...);
node_deallocator.release();
//This does not throw
typedef typename Node::hook_type hook_type;
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;
return (p);
}
#else //defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_CONTAINER_NODE_ALLOC_HOLDER_CONSTRUCT_IMPL(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
NodePtr create_node(BOOST_MOVE_UREF##N)\
{\
NodePtr p = this->allocate_one();\
Deallocator node_deallocator(p, this->node_alloc());\
allocator_traits<NodeAlloc>::construct\
( this->node_alloc()\
, container_detail::addressof(p->m_data)\
BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
node_deallocator.release();\
typedef typename Node::hook_type hook_type;\
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;\
return (p);\
}\
//
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_NODE_ALLOC_HOLDER_CONSTRUCT_IMPL)
#undef BOOST_CONTAINER_NODE_ALLOC_HOLDER_CONSTRUCT_IMPL
#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class It>
NodePtr create_node_from_it(const It &it)
{
NodePtr p = this->allocate_one();
Deallocator node_deallocator(p, this->node_alloc());
::boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), it);
node_deallocator.release();
//This does not throw
typedef typename Node::hook_type hook_type;
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;
return (p);
}
template<class KeyConvertible>
NodePtr create_node_from_key(BOOST_FWD_REF(KeyConvertible) key)
{
NodePtr p = this->allocate_one();
NodeAlloc &na = this->node_alloc();
Deallocator node_deallocator(p, this->node_alloc());
node_allocator_traits_type::construct
(na, container_detail::addressof(p->m_data.first), boost::forward<KeyConvertible>(key));
BOOST_TRY{
node_allocator_traits_type::construct(na, container_detail::addressof(p->m_data.second));
}
BOOST_CATCH(...){
node_allocator_traits_type::destroy(na, container_detail::addressof(p->m_data.first));
BOOST_RETHROW;
}
BOOST_CATCH_END
node_deallocator.release();
//This does not throw
typedef typename Node::hook_type hook_type;
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;
return (p);
}
void destroy_node(const NodePtr &nodep)
{
allocator_traits<NodeAlloc>::destroy(this->node_alloc(), container_detail::to_raw_pointer(nodep));
this->deallocate_one(nodep);
}
void swap(node_alloc_holder &x)
{
this->icont().swap(x.icont());
container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
container_detail::swap_alloc(this->node_alloc(), x.node_alloc(), flag);
}
template<class FwdIterator, class Inserter>
void allocate_many_and_construct
(FwdIterator beg, difference_type n, Inserter inserter)
{
if(n){
typedef typename node_allocator_version_traits_type::multiallocation_chain multiallocation_chain;
//Try to allocate memory in a single block
typedef typename multiallocation_chain::iterator multialloc_iterator;
multiallocation_chain mem;
NodeAlloc &nalloc = this->node_alloc();
node_allocator_version_traits_type::allocate_individual(nalloc, n, mem);
multialloc_iterator itbeg(mem.begin()), itlast(mem.last());
mem.clear();
Node *p = 0;
BOOST_TRY{
Deallocator node_deallocator(NodePtr(), nalloc);
container_detail::scoped_destructor<NodeAlloc> sdestructor(nalloc, 0);
while(n--){
p = container_detail::iterator_to_raw_pointer(itbeg);
node_deallocator.set(p);
++itbeg;
//This can throw
boost::container::construct_in_place(nalloc, container_detail::addressof(p->m_data), beg);
sdestructor.set(p);
++beg;
//This does not throw
typedef typename Node::hook_type hook_type;
::new(static_cast<hook_type*>(p), boost_container_new_t()) hook_type;
//This can throw in some containers (predicate might throw).
//(sdestructor will destruct the node and node_deallocator will deallocate it in case of exception)
inserter(*p);
sdestructor.set(0);
}
sdestructor.release();
node_deallocator.release();
}
BOOST_CATCH(...){
mem.incorporate_after(mem.last(), &*itbeg, &*itlast, n);
node_allocator_version_traits_type::deallocate_individual(this->node_alloc(), mem);
BOOST_RETHROW
}
BOOST_CATCH_END
}
}
void clear(version_1)
{ this->icont().clear_and_dispose(Destroyer(this->node_alloc())); }
void clear(version_2)
{
typename NodeAlloc::multiallocation_chain chain;
allocator_destroyer_and_chain_builder<NodeAlloc> builder(this->node_alloc(), chain);
this->icont().clear_and_dispose(builder);
//BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled<typename NodeAlloc::multiallocation_chain>::value == true));
if(!chain.empty())
this->node_alloc().deallocate_individual(chain);
}
icont_iterator erase_range(const icont_iterator &first, const icont_iterator &last, version_1)
{ return this->icont().erase_and_dispose(first, last, Destroyer(this->node_alloc())); }
icont_iterator erase_range(const icont_iterator &first, const icont_iterator &last, version_2)
{
typedef typename NodeAlloc::multiallocation_chain multiallocation_chain;
NodeAlloc & nalloc = this->node_alloc();
multiallocation_chain chain;
allocator_destroyer_and_chain_builder<NodeAlloc> chain_builder(nalloc, chain);
icont_iterator ret_it = this->icont().erase_and_dispose(first, last, chain_builder);
nalloc.deallocate_individual(chain);
return ret_it;
}
template<class Key, class Comparator>
size_type erase_key(const Key& k, const Comparator &comp, version_1)
{ return this->icont().erase_and_dispose(k, comp, Destroyer(this->node_alloc())); }
template<class Key, class Comparator>
size_type erase_key(const Key& k, const Comparator &comp, version_2)
{
allocator_multialloc_chain_node_deallocator<NodeAlloc> chain_holder(this->node_alloc());
return this->icont().erase_and_dispose(k, comp, chain_holder.get_chain_builder());
}
protected:
struct cloner
{
explicit cloner(node_alloc_holder &holder)
: m_holder(holder)
{}
NodePtr operator()(const Node &other) const
{ return m_holder.create_node(other.m_data); }
node_alloc_holder &m_holder;
};
struct move_cloner
{
move_cloner(node_alloc_holder &holder)
: m_holder(holder)
{}
NodePtr operator()(Node &other)
{ //Use m_data instead of get_data to allow moving const key in [multi]map
return m_holder.create_node(::boost::move(other.m_data));
}
node_alloc_holder &m_holder;
};
struct members_holder
: public NodeAlloc
{
private:
members_holder(const members_holder&);
members_holder & operator=(const members_holder&);
public:
members_holder()
: NodeAlloc(), m_icont()
{}
template<class ConvertibleToAlloc>
explicit members_holder(BOOST_FWD_REF(ConvertibleToAlloc) c2alloc)
: NodeAlloc(boost::forward<ConvertibleToAlloc>(c2alloc))
, m_icont()
{}
template<class ConvertibleToAlloc>
members_holder(BOOST_FWD_REF(ConvertibleToAlloc) c2alloc, const value_compare &c)
: NodeAlloc(boost::forward<ConvertibleToAlloc>(c2alloc))
, m_icont(typename ICont::key_compare(c))
{}
explicit members_holder(const value_compare &c)
: NodeAlloc()
, m_icont(typename ICont::key_compare(c))
{}
//The intrusive container
ICont m_icont;
};
ICont &non_const_icont() const
{ return const_cast<ICont&>(this->members_.m_icont); }
NodeAlloc &node_alloc()
{ return static_cast<NodeAlloc &>(this->members_); }
const NodeAlloc &node_alloc() const
{ return static_cast<const NodeAlloc &>(this->members_); }
members_holder members_;
public:
ICont &icont()
{ return this->members_.m_icont; }
const ICont &icont() const
{ return this->members_.m_icont; }
};
} //namespace container_detail {
} //namespace container {
} //namespace boost {
#include <boost/container/detail/config_end.hpp>
#endif // BOOST_CONTAINER_DETAIL_NODE_ALLOC_HPP_
@@ -0,0 +1,238 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FastGraph</class>
<widget class="QDialog" name="FastGraph">
<property name="windowTitle">
<string>Fast Graph</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="FPlotter" name="fastPlot">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>703</width>
<height>220</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>703</width>
<height>220</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="controls_widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>99</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="gainSlider">
<property name="toolTip">
<string>Waterfall gain</string>
</property>
<property name="minimum">
<number>-60</number>
</property>
<property name="maximum">
<number>140</number>
</property>
<property name="pageStep">
<number>40</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="zeroSlider">
<property name="toolTip">
<string>Waterfall zero</string>
</property>
<property name="minimum">
<number>-60</number>
</property>
<property name="maximum">
<number>120</number>
</property>
<property name="value">
<number>60</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="greenZeroSlider">
<property name="toolTip">
<string>Spectrum zero</string>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>160</number>
</property>
<property name="value">
<number>30</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbAutoLevel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set reasonable levels for gain and zero sliders.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Auto Level</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>99</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>FPlotter</class>
<extends>QFrame</extends>
<header>fastplot.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,30 @@
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
// unit/quantity manipulation and conversion
//
// Copyright (C) 2003-2008 Matthias Christian Schabel
// Copyright (C) 2008 Steven Watanabe
//
// 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_UNITS_ELECTRIC_CHARGE_DERIVED_DIMENSION_HPP
#define BOOST_UNITS_ELECTRIC_CHARGE_DERIVED_DIMENSION_HPP
#include <boost/units/derived_dimension.hpp>
#include <boost/units/physical_dimensions/time.hpp>
#include <boost/units/physical_dimensions/current.hpp>
namespace boost {
namespace units {
/// derived dimension for electric charge : T^1 I^1
typedef derived_dimension<time_base_dimension,1,
current_base_dimension,1>::type electric_charge_dimension;
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_ELECTRIC_CHARGE_DERIVED_DIMENSION_HPP
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

@@ -0,0 +1,3 @@
4
2 3 4 11
0.450013 0.370771 0.0307238 0.1484922
@@ -0,0 +1,15 @@
make-pchk ex-ham7b.pchk 3 7 0:0 0:3 0:4 0:5 1:1 1:3 1:4 1:6 2:2 2:4 2:5 2:6
make-gen ex-ham7b.pchk ex-ham7b.gen dense
Number of 1s per check in Inv(A) X B is 3.0
rand-src ex-ham7b.src 1 4x1000
encode ex-ham7b.pchk ex-ham7b.gen ex-ham7b.src ex-ham7b.enc
Encoded 1000 blocks, source block size 4, encoded block size 7
transmit ex-ham7b.enc ex-ham7b.rec 1 bsc 0.05
Transmitted 7000 bits
decode ex-ham7b.pchk ex-ham7b.rec ex-ham7b.dec bsc 0.05 enum-bit ex-ham7b.gen
Decoded 1000 blocks, 1000 valid. Average 16.0 iterations, 4% bit changes
verify ex-ham7b.pchk ex-ham7b.dec ex-ham7b.gen ex-ham7b.src
Block counts: tot 1000, with chk errs 0, with src errs 47, both 0
Bit error rate (on message bits only): 2.000e-02
extract ex-ham7b.gen ex-ham7b.dec ex-ham7b.ext
@@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2001-2007 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_INCLUDE_PUSH_BACK)
#define FUSION_INCLUDE_PUSH_BACK
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/algorithm/transformation/push_back.hpp>
#endif
@@ -0,0 +1,242 @@
#include "TransceiverBase.hpp"
#include <exception>
#include <QString>
#include <QTimer>
#include <QThread>
#include <QDebug>
#include "moc_TransceiverBase.cpp"
namespace
{
auto const unexpected = TransceiverBase::tr ("Unexpected rig error");
}
void TransceiverBase::start (unsigned sequence_number) noexcept
{
QString message;
try
{
may_update u {this, true};
shutdown ();
startup ();
last_sequence_number_ = sequence_number;
}
catch (std::exception const& e)
{
message = e.what ();
}
catch (...)
{
message = unexpected;
}
if (!message.isEmpty ())
{
offline (message);
}
}
void TransceiverBase::set (TransceiverState const& s,
unsigned sequence_number) noexcept
{
TRACE_CAT ("TransceiverBase", "#:" << sequence_number << s);
QString message;
try
{
may_update u {this, true};
bool was_online {requested_.online ()};
if (!s.online () && was_online)
{
shutdown ();
}
else if (s.online () && !was_online)
{
shutdown ();
startup ();
}
if (requested_.online ())
{
bool ptt_on {false};
bool ptt_off {false};
if (s.ptt () != requested_.ptt ())
{
ptt_on = s.ptt ();
ptt_off = !s.ptt ();
}
if (ptt_off)
{
do_ptt (false);
do_post_ptt (false);
QThread::msleep (100); // some rigs cannot process CAT
// commands while switching from
// Tx to Rx
}
if (s.frequency () // ignore bogus zero frequencies
&& ((s.frequency () != requested_.frequency () // and QSY
|| (s.mode () != UNK && s.mode () != requested_.mode ())) // or mode change
|| ptt_off)) // or just returned to rx
{
do_frequency (s.frequency (), s.mode (), ptt_off);
do_post_frequency (s.frequency (), s.mode ());
// record what actually changed
requested_.frequency (actual_.frequency ());
requested_.mode (actual_.mode ());
}
if (!s.tx_frequency ()
|| (s.tx_frequency () > 10000 // ignore bogus startup values
&& s.tx_frequency () < std::numeric_limits<Frequency>::max () - 10000))
{
if ((s.tx_frequency () != requested_.tx_frequency () // and QSY
|| (s.mode () != UNK && s.mode () != requested_.mode ())) // or mode change
// || s.split () != requested_.split ())) // or split change
|| (s.tx_frequency () && ptt_on)) // or about to tx split
{
do_tx_frequency (s.tx_frequency (), s.mode (), ptt_on);
do_post_tx_frequency (s.tx_frequency (), s.mode ());
// record what actually changed
requested_.tx_frequency (actual_.tx_frequency ());
requested_.split (actual_.split ());
}
}
if (ptt_on)
{
do_ptt (true);
do_post_ptt (true);
QThread::msleep (100); // some rigs cannot process CAT
// commands while switching from
// Rx to Tx
}
// record what actually changed
requested_.ptt (actual_.ptt ());
}
last_sequence_number_ = sequence_number;
}
catch (std::exception const& e)
{
message = e.what ();
}
catch (...)
{
message = unexpected;
}
if (!message.isEmpty ())
{
offline (message);
}
}
void TransceiverBase::startup ()
{
Q_EMIT resolution (do_start ());
do_post_start ();
actual_.online (true);
requested_.online (true);
}
void TransceiverBase::shutdown ()
{
may_update u {this};
if (requested_.online ())
{
try
{
// try and ensure PTT isn't left set
do_ptt (false);
do_post_ptt (false);
if (requested_.split ())
{
// try and reset split mode
do_tx_frequency (0, UNK, true);
do_post_tx_frequency (0, UNK);
}
}
catch (...)
{
// don't care about exceptions
}
}
do_stop ();
do_post_stop ();
actual_.online (false);
requested_.online (false);
}
void TransceiverBase::stop () noexcept
{
QString message;
try
{
shutdown ();
}
catch (std::exception const& e)
{
message = e.what ();
}
catch (...)
{
message = unexpected;
}
if (!message.isEmpty ())
{
offline (message);
}
else
{
Q_EMIT finished ();
}
}
void TransceiverBase::update_rx_frequency (Frequency rx)
{
actual_.frequency (rx);
requested_.frequency (rx); // track rig changes
}
void TransceiverBase::update_other_frequency (Frequency tx)
{
actual_.tx_frequency (tx);
}
void TransceiverBase::update_split (bool state)
{
actual_.split (state);
}
void TransceiverBase::update_mode (MODE m)
{
actual_.mode (m);
requested_.mode (m); // track rig changes
}
void TransceiverBase::update_PTT (bool state)
{
actual_.ptt (state);
}
void TransceiverBase::update_complete (bool force_signal)
{
if ((do_pre_update () && actual_ != last_) || force_signal)
{
Q_EMIT update (actual_, last_sequence_number_);
last_ = actual_;
}
}
void TransceiverBase::offline (QString const& reason)
{
Q_EMIT failure (reason);
try
{
shutdown ();
}
catch (...)
{
// don't care
}
}
@@ -0,0 +1,93 @@
/*
[auto_generated]
boost/numeric/odeint/util/resizer.hpp
[begin_description]
Implementation of the resizers.
[end_description]
Copyright 2011-2012 Mario Mulansky
Copyright 2011 Karsten Ahnert
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_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED
#include <boost/numeric/odeint/util/is_resizeable.hpp>
#include <boost/numeric/odeint/util/same_size.hpp>
#include <boost/numeric/odeint/util/resize.hpp>
namespace boost {
namespace numeric {
namespace odeint {
template< class ResizeWrappedState , class State >
bool adjust_size_by_resizeability( ResizeWrappedState &x , const State &y , boost::true_type )
{
if ( !same_size( x.m_v , y ) )
{
resize( x.m_v , y );
return true;
}
else
return false;
}
template< class ResizeWrappedState , class State >
bool adjust_size_by_resizeability( ResizeWrappedState & /* x */ , const State & /* y */ , boost::false_type )
{
return false;
}
struct always_resizer
{
template< class State , class ResizeFunction >
bool adjust_size( const State &x , ResizeFunction f )
{
return f( x );
}
};
struct initially_resizer
{
bool m_initialized;
initially_resizer() : m_initialized( false )
{ }
template< class State , class ResizeFunction >
bool adjust_size( const State &x , ResizeFunction f )
{
if( !m_initialized )
{
m_initialized = true;
return f( x );
} else
return false;
}
};
struct never_resizer
{
template< class State , class ResizeFunction >
bool adjust_size( const State &/*x*/ , ResizeFunction /*f*/ )
{
return false;
}
};
}
}
}
#endif // BOOST_NUMERIC_ODEINT_UTIL_RESIZER_HPP_INCLUDED
@@ -0,0 +1,35 @@
/*
*
* Copyright (c) 1998-2002
* John Maddock
*
* 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)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE regex_traits.hpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: Declares regular expression traits classes.
*/
#ifndef BOOST_REGEX_TRAITS_HPP
#define BOOST_REGEX_TRAITS_HPP
#ifndef BOOST_REGEX_CONFIG_HPP
# include <boost/regex/config.hpp>
#endif
# ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED
# include <boost/regex/v4/regex_traits.hpp>
# endif
#endif // include
@@ -0,0 +1,348 @@
subroutine pltanh(x,y)
isign=+1
z=x
if( x.lt.0 ) then
isign=-1
z=abs(x)
endif
if( z.le. 0.8 ) then
y=0.83*x
return
elseif( z.le. 1.6 ) then
y=isign*(0.322*z+0.4064)
return
elseif( z.le. 3.0 ) then
y=isign*(0.0524*z+0.8378)
return
elseif( z.lt. 7.0 ) then
y=isign*(0.0012*z+0.9914)
return
else
y=isign*0.9998
return
endif
end subroutine pltanh
subroutine platanh(x,y)
isign=+1
z=x
if( x.lt.0 ) then
isign=-1
z=abs(x)
endif
if( z.le. 0.664 ) then
y=x/0.83
return
elseif( z.le. 0.9217 ) then
y=isign*(z-0.4064)/0.322
return
elseif( z.le. 0.9951 ) then
y=isign*(z-0.8378)/0.0524
return
elseif( z.le. 0.9998 ) then
y=isign*(z-0.9914)/0.0012
return
else
y=isign*7.0
return
endif
end subroutine platanh
subroutine bpdecode144(llr,maxiterations,decoded,niterations)
!
! A log-domain belief propagation decoder for the msk144 code.
! The code is a regular (128,80) code with column weight 3 and row weight 8.
! k9an August, 2016
!
integer, parameter:: N=128, K=80, M=N-K
integer*1 codeword(N),cw(N)
integer*1 colorder(N)
integer*1 decoded(K)
integer Nm(8,M) ! 8 bits per check
integer Mn(3,N) ! 3 checks per bit
integer synd(M)
real tov(3,N) ! single precision seems to be adequate in log-domain
real toc(8,M)
real tanhtoc(8,M)
real zn(N)
real llr(N)
real Tmn
data colorder/0,1,2,3,4,5,6,7,8,9, &
10,11,12,13,14,15,24,26,29,30, &
32,43,44,47,60,77,79,97,101,111, &
96,38,64,53,93,34,59,94,74,90, &
108,123,85,57,70,25,69,62,48,49, &
50,51,52,33,54,55,56,21,58,36, &
16,61,23,63,20,65,66,67,68,46, &
22,71,72,73,31,75,76,45,78,17, &
80,81,82,83,84,42,86,87,88,89, &
39,91,92,35,37,95,19,27,98,99, &
100,28,102,103,104,105,106,107,40,109, &
110,18,112,113,114,115,116,117,118,119, &
120,121,122,41,124,125,126,127/
data Mn/ &
1, 14, 38, &
2, 4, 41, &
3, 19, 39, &
5, 29, 34, &
6, 35, 40, &
7, 20, 45, &
8, 28, 48, &
9, 22, 25, &
10, 24, 36, &
11, 12, 37, &
13, 43, 44, &
15, 18, 46, &
16, 17, 47, &
21, 32, 33, &
23, 30, 31, &
26, 27, 42, &
1, 12, 46, &
2, 36, 38, &
3, 5, 10, &
4, 9, 23, &
6, 13, 39, &
7, 15, 17, &
8, 18, 27, &
11, 33, 40, &
14, 28, 44, &
16, 29, 31, &
19, 20, 22, &
21, 30, 42, &
24, 26, 47, &
25, 37, 48, &
32, 34, 45, &
8, 35, 41, &
12, 31, 43, &
1, 19, 21, &
2, 43, 45, &
3, 4, 11, &
5, 18, 33, &
6, 25, 47, &
7, 28, 30, &
9, 14, 34, &
10, 35, 42, &
13, 15, 22, &
16, 37, 38, &
17, 41, 44, &
20, 24, 29, &
18, 23, 39, &
12, 26, 32, &
27, 38, 40, &
15, 36, 48, &
2, 30, 46, &
1, 4, 13, &
3, 28, 32, &
5, 43, 47, &
6, 34, 46, &
7, 9, 40, &
8, 11, 45, &
10, 17, 23, &
14, 31, 35, &
16, 22, 42, &
19, 37, 44, &
20, 33, 48, &
21, 24, 41, &
25, 27, 29, &
26, 39, 48, &
19, 31, 36, &
1, 5, 7, &
2, 29, 39, &
3, 16, 46, &
4, 26, 37, &
6, 28, 45, &
8, 22, 33, &
9, 21, 43, &
10, 25, 38, &
11, 14, 24, &
12, 17, 40, &
13, 27, 30, &
15, 32, 35, &
18, 44, 47, &
20, 23, 36, &
34, 41, 42, &
1, 32, 48, &
2, 3, 33, &
4, 29, 42, &
5, 14, 37, &
6, 7, 36, &
8, 9, 39, &
10, 13, 19, &
11, 18, 30, &
12, 16, 20, &
15, 29, 44, &
17, 34, 38, &
6, 21, 22, &
23, 32, 40, &
24, 27, 46, &
25, 41, 45, &
7, 26, 43, &
28, 31, 47, &
20, 35, 38, &
1, 33, 41, &
2, 42, 44, &
3, 23, 48, &
4, 31, 45, &
5, 8, 30, &
9, 16, 36, &
10, 40, 47, &
11, 17, 46, &
12, 21, 34, &
13, 24, 28, &
14, 18, 43, &
15, 25, 26, &
19, 27, 35, &
22, 37, 39, &
1, 16, 18, &
2, 6, 20, &
3, 30, 43, &
4, 28, 33, &
5, 22, 23, &
7, 39, 42, &
8, 12, 38, &
9, 35, 46, &
10, 27, 32, &
11, 15, 34, &
13, 36, 37, &
14, 41, 47, &
17, 21, 25, &
19, 29, 45, &
24, 31, 48, &
26, 40, 44/
data Nm/ &
1, 17, 34, 51, 66, 81, 99, 113, &
2, 18, 35, 50, 67, 82, 100, 114, &
3, 19, 36, 52, 68, 82, 101, 115, &
2, 20, 36, 51, 69, 83, 102, 116, &
4, 19, 37, 53, 66, 84, 103, 117, &
5, 21, 38, 54, 70, 85, 92, 114, &
6, 22, 39, 55, 66, 85, 96, 118, &
7, 23, 32, 56, 71, 86, 103, 119, &
8, 20, 40, 55, 72, 86, 104, 120, &
9, 19, 41, 57, 73, 87, 105, 121, &
10, 24, 36, 56, 74, 88, 106, 122, &
10, 17, 33, 47, 75, 89, 107, 119, &
11, 21, 42, 51, 76, 87, 108, 123, &
1, 25, 40, 58, 74, 84, 109, 124, &
12, 22, 42, 49, 77, 90, 110, 122, &
13, 26, 43, 59, 68, 89, 104, 113, &
13, 22, 44, 57, 75, 91, 106, 125, &
12, 23, 37, 46, 78, 88, 109, 113, &
3, 27, 34, 60, 65, 87, 111, 126, &
6, 27, 45, 61, 79, 89, 98, 114, &
14, 28, 34, 62, 72, 92, 107, 125, &
8, 27, 42, 59, 71, 92, 112, 117, &
15, 20, 46, 57, 79, 93, 101, 117, &
9, 29, 45, 62, 74, 94, 108, 127, &
8, 30, 38, 63, 73, 95, 110, 125, &
16, 29, 47, 64, 69, 96, 110, 128, &
16, 23, 48, 63, 76, 94, 111, 121, &
7, 25, 39, 52, 70, 97, 108, 116, &
4, 26, 45, 63, 67, 83, 90, 126, &
15, 28, 39, 50, 76, 88, 103, 115, &
15, 26, 33, 58, 65, 97, 102, 127, &
14, 31, 47, 52, 77, 81, 93, 121, &
14, 24, 37, 61, 71, 82, 99, 116, &
4, 31, 40, 54, 80, 91, 107, 122, &
5, 32, 41, 58, 77, 98, 111, 120, &
9, 18, 49, 65, 79, 85, 104, 123, &
10, 30, 43, 60, 69, 84, 112, 123, &
1, 18, 43, 48, 73, 91, 98, 119, &
3, 21, 46, 64, 67, 86, 112, 118, &
5, 24, 48, 55, 75, 93, 105, 128, &
2, 32, 44, 62, 80, 95, 99, 124, &
16, 28, 41, 59, 80, 83, 100, 118, &
11, 33, 35, 53, 72, 96, 109, 115, &
11, 25, 44, 60, 78, 90, 100, 128, &
6, 31, 35, 56, 70, 95, 102, 126, &
12, 17, 50, 54, 68, 94, 106, 120, &
13, 29, 38, 53, 78, 97, 105, 124, &
7, 30, 49, 61, 64, 81, 101, 127/
nrw=8
ncw=3
toc=0
tov=0
tanhtoc=0
! initial messages to checks
do j=1,M
do i=1,nrw
toc(i,j)=llr((Nm(i,j)))
enddo
enddo
ncnt=0
do iter=0,maxiterations
! Update bit log likelihood ratios
do i=1,N
zn(i)=llr(i)+sum(tov(1:ncw,i))
enddo
! Check to see if we have a codeword
cw=0
where( zn .gt. 0. ) cw=1
ncheck=0
do i=1,M
synd(i)=sum(cw(Nm(:,i)))
if( mod(synd(i),2) .ne. 0 ) ncheck=ncheck+1
enddo
if( ncheck .eq. 0 ) then ! we have a codeword
niterations=iter
codeword=cw(colorder+1)
decoded=codeword(M+1:N)
return
endif
if( iter.gt.0 ) then ! this code block implements an early stopping criterion
nd=ncheck-nclast
if( nd .lt. 0 ) then ! # of unsatisfied parity checks decreased
ncnt=0 ! reset counter
else
ncnt=ncnt+1
endif
! write(*,*) iter,ncheck,nd,ncnt
if( ncnt .ge. 3 .and. iter .ge. 5 .and. ncheck .gt. 10) then
niterations=-1
return
endif
endif
nclast=ncheck
! Send messages from bits to check nodes
do j=1,M
do i=1,nrw
ibj=Nm(i,j)
toc(i,j)=zn(ibj)
do kk=1,ncw ! subtract off what the bit had received from the check
if( Mn(kk,ibj) .eq. j ) then ! Mn(3,128)
toc(i,j)=toc(i,j)-tov(kk,ibj)
endif
enddo
enddo
enddo
! send messages from check nodes to variable nodes
do i=1,M
tanhtoc(1:nrw,i)=tanh(-toc(1:nrw,i)/2)
enddo
do j=1,N
do i=1,ncw
ichk=Mn(i,j) ! Mn(:,j) are the checks that include bit j
Tmn=product(tanhtoc(:,ichk),mask=Nm(:,ichk).ne.j)
call platanh(-Tmn,y)
tov(i,j)=2*y
enddo
enddo
enddo
niterations=-1
end subroutine bpdecode144
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1,71 @@
#ifndef BOOST_MPL_EVAL_IF_HPP_INCLUDED
#define BOOST_MPL_EVAL_IF_HPP_INCLUDED
// 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)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/if.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
#include <boost/mpl/aux_/config/msvc.hpp>
#include <boost/mpl/aux_/config/gcc.hpp>
#include <boost/mpl/aux_/config/workaround.hpp>
namespace boost { namespace mpl {
template<
typename BOOST_MPL_AUX_NA_PARAM(C)
, typename BOOST_MPL_AUX_NA_PARAM(F1)
, typename BOOST_MPL_AUX_NA_PARAM(F2)
>
struct eval_if
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|| ( BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, >= 0x0300) \
&& BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0304)) \
)
{
typedef typename if_<C,F1,F2>::type f_;
typedef typename f_::type type;
#else
: if_<C,F1,F2>::type
{
#endif
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,eval_if,(C,F1,F2))
};
// (almost) copy & paste in order to save one more
// recursively nested template instantiation to user
template<
bool C
, typename F1
, typename F2
>
struct eval_if_c
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|| ( BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, >= 0x0300) \
&& BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0304)) \
)
{
typedef typename if_c<C,F1,F2>::type f_;
typedef typename f_::type type;
#else
: if_c<C,F1,F2>::type
{
#endif
};
BOOST_MPL_AUX_NA_SPEC(3, eval_if)
}}
#endif // BOOST_MPL_EVAL_IF_HPP_INCLUDED
@@ -0,0 +1,192 @@
// (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_13_HPP
#define BOOST_MATH_TOOLS_RAT_EVAL_13_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]));
}
}
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_<7>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
{
V x2 = x * x;
return static_cast<V>((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + 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]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * 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_<8>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
{
V x2 = x * x;
return static_cast<V>(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + 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]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]));
}
}
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_<9>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
{
V x2 = x * x;
return static_cast<V>(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + 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]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * 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_<10>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
{
V x2 = x * x;
return static_cast<V>((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + 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]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]));
}
}
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_<11>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
{
V x2 = x * x;
return static_cast<V>((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + 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]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * 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_<12>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
{
V x2 = x * x;
return static_cast<V>(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + 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]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]));
}
}
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_<13>*) BOOST_MATH_NOEXCEPT(V)
{
if(x <= 1)
{
V x2 = x * x;
return static_cast<V>(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + 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]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z));
}
}
}}}} // namespaces
#endif // include guard
@@ -0,0 +1,53 @@
/*=============================================================================
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_SET_FORWARD_09162005_1102)
#define FUSION_SET_FORWARD_09162005_1102
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/set/detail/cpp03/limits.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
#include <boost/fusion/container/set/detail/cpp03/preprocessed/set_fwd.hpp>
#else
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/set" FUSION_MAX_SET_SIZE_STR "_fwd.hpp")
#endif
/*=============================================================================
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!
==============================================================================*/
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 1)
#endif
namespace boost { namespace fusion
{
struct void_;
struct set_tag;
struct set_iterator_tag;
template <
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
FUSION_MAX_SET_SIZE, typename T, void_)
>
struct set;
}}
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
#endif
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
#endif
@@ -0,0 +1,43 @@
#ifndef WSJTX_UDP_DECODES_MODEL_HPP__
#define WSJTX_UDP_DECODES_MODEL_HPP__
#include <QStandardItemModel>
#include "MessageServer.hpp"
using Frequency = MessageServer::Frequency;
class QTime;
class QString;
class QModelIndex;
//
// Decodes Model - simple data model for all decodes
//
// The model is a basic table with uniform row format. Rows consist of
// QStandardItem instances containing the string representation of the
// column data and if the underlying field is not a string then the
// UserRole+1 role contains the underlying data item.
//
// Three slots are provided to add a new decode, remove all decodes
// for a client and, to build a reply to CQ message for a given row
// which is emitted as a signal respectively.
//
class DecodesModel
: public QStandardItemModel
{
Q_OBJECT;
public:
explicit DecodesModel (QObject * parent = nullptr);
Q_SLOT void add_decode (bool is_new, QString const& client_id, QTime time, qint32 snr, float delta_time
, quint32 delta_frequency, QString const& mode, QString const& message, bool is_fast);
Q_SLOT void clear_decodes (QString const& client_id);
Q_SLOT void do_reply (QModelIndex const& source);
Q_SIGNAL void reply (QString const& id, QTime time, qint32 snr, float delta_time, quint32 delta_frequency
, QString const& mode, QString const& message);
};
#endif
@@ -0,0 +1,23 @@
// Status=review
A *Status Bar* at the bottom edge of the main window provides useful
information about operating conditions.
//.Status Bar
image::status-bar-a.png[align="left",alt="Status Bar"]
Labels on the *Status Bar* display such information as the program's
current operating state, configuration name, operating mode, and the
content of your most recent transmitted message. The first label
(operating state) can be Receiving, Tx (for Transmitting), Tune, or
the name of file opened from the *File* menu; this label is
highlighted in green for Receiving, yellow for Tx, red for Tune, and
light blue for a file name. When transmitting, the Tx message is
displayed exactly as it will be decoded by receiving stations. The
second label (as shown above) will be absent if you are using the
*Default* setting on the *Configurations* menu. A progress bar shows
the elapsed fraction of a Tx or Rx sequence. Finally, if the Watchdog
timer was enabled on the *settings | General* tab, a label in the
lower right-hand corner displays the number of minutes remaining
before timeout.
@@ -0,0 +1,422 @@
// 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)
#ifndef STR_20020703_HPP
#define STR_20020703_HPP
# include <boost/python/detail/prefix.hpp>
#include <boost/python/object.hpp>
#include <boost/python/list.hpp>
#include <boost/python/converter/pytype_object_mgr_traits.hpp>
// disable defines in <cctype> provided by some system libraries
#undef isspace
#undef islower
#undef isalpha
#undef isdigit
#undef isalnum
#undef isupper
namespace boost { namespace python {
class str;
namespace detail
{
struct BOOST_PYTHON_DECL str_base : object
{
str capitalize() const;
str center(object_cref width) const;
long count(object_cref sub) const;
long count(object_cref sub, object_cref start) const;
long count(object_cref sub, object_cref start, object_cref end) const;
#if PY_VERSION_HEX < 0x03000000
object decode() const;
object decode(object_cref encoding) const;
object decode(object_cref encoding, object_cref errors) const;
#endif
object encode() const;
object encode(object_cref encoding) const;
object encode(object_cref encoding, object_cref errors) const;
bool endswith(object_cref suffix) const;
bool endswith(object_cref suffix, object_cref start) const;
bool endswith(object_cref suffix, object_cref start, object_cref end) const;
str expandtabs() const;
str expandtabs(object_cref tabsize) const;
long find(object_cref sub) const;
long find(object_cref sub, object_cref start) const;
long find(object_cref sub, object_cref start, object_cref end) const;
long index(object_cref sub) const;
long index(object_cref sub, object_cref start) const;
long index(object_cref sub, object_cref start, object_cref end) const;
bool isalnum() const;
bool isalpha() const;
bool isdigit() const;
bool islower() const;
bool isspace() const;
bool istitle() const;
bool isupper() const;
str join(object_cref sequence) const;
str ljust(object_cref width) const;
str lower() const;
str lstrip() const;
str replace(object_cref old, object_cref new_) const;
str replace(object_cref old, object_cref new_, object_cref maxsplit) const;
long rfind(object_cref sub) const;
long rfind(object_cref sub, object_cref start) const;
long rfind(object_cref sub, object_cref start, object_cref end) const;
long rindex(object_cref sub) const;
long rindex(object_cref sub, object_cref start) const;
long rindex(object_cref sub, object_cref start, object_cref end) const;
str rjust(object_cref width) const;
str rstrip() const;
list split() const;
list split(object_cref sep) const;
list split(object_cref sep, object_cref maxsplit) const;
list splitlines() const;
list splitlines(object_cref keepends) const;
bool startswith(object_cref prefix) const;
bool startswith(object_cref prefix, object_cref start) const;
bool startswith(object_cref prefix, object_cref start, object_cref end) const;
str strip() const;
str swapcase() const;
str title() const;
str translate(object_cref table) const;
str translate(object_cref table, object_cref deletechars) const;
str upper() const;
protected:
str_base(); // new str
str_base(const char* s); // new str
str_base(char const* start, char const* finish);
str_base(char const* start, std::size_t length);
explicit str_base(object_cref other);
BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(str_base, object)
private:
static new_reference call(object const&);
};
}
class str : public detail::str_base
{
typedef detail::str_base base;
public:
str() {} // new str
str(const char* s) : base(s) {} // new str
str(char const* start, char const* finish) // new str
: base(start, finish)
{}
str(char const* start, std::size_t length) // new str
: base(start, length)
{}
template <class T>
explicit str(T const& other)
: base(object(other))
{
}
template <class T>
str center(T const& width) const
{
return base::center(object(width));
}
template<class T>
long count(T const& sub) const
{
return base::count(object(sub));
}
template<class T1, class T2>
long count(T1 const& sub,T2 const& start) const
{
return base::count(object(sub), object(start));
}
template<class T1, class T2, class T3>
long count(T1 const& sub,T2 const& start, T3 const& end) const
{
return base::count(object(sub), object(start), object(end));
}
#if PY_VERSION_HEX < 0x03000000
object decode() const { return base::decode(); }
template<class T>
object decode(T const& encoding) const
{
return base::decode(object(encoding));
}
template<class T1, class T2>
object decode(T1 const& encoding, T2 const& errors) const
{
return base::decode(object(encoding),object(errors));
}
#endif
object encode() const { return base::encode(); }
template <class T>
object encode(T const& encoding) const
{
return base::encode(object(encoding));
}
template <class T1, class T2>
object encode(T1 const& encoding, T2 const& errors) const
{
return base::encode(object(encoding),object(errors));
}
template <class T>
bool endswith(T const& suffix) const
{
return base::endswith(object(suffix));
}
template <class T1, class T2>
bool endswith(T1 const& suffix, T2 const& start) const
{
return base::endswith(object(suffix), object(start));
}
template <class T1, class T2, class T3>
bool endswith(T1 const& suffix, T2 const& start, T3 const& end) const
{
return base::endswith(object(suffix), object(start), object(end));
}
str expandtabs() const { return base::expandtabs(); }
template <class T>
str expandtabs(T const& tabsize) const
{
return base::expandtabs(object(tabsize));
}
template <class T>
long find(T const& sub) const
{
return base::find(object(sub));
}
template <class T1, class T2>
long find(T1 const& sub, T2 const& start) const
{
return base::find(object(sub), object(start));
}
template <class T1, class T2, class T3>
long find(T1 const& sub, T2 const& start, T3 const& end) const
{
return base::find(object(sub), object(start), object(end));
}
template <class T>
long index(T const& sub) const
{
return base::index(object(sub));
}
template <class T1, class T2>
long index(T1 const& sub, T2 const& start) const
{
return base::index(object(sub), object(start));
}
template <class T1, class T2, class T3>
long index(T1 const& sub, T2 const& start, T3 const& end) const
{
return base::index(object(sub), object(start), object(end));
}
template <class T>
str join(T const& sequence) const
{
return base::join(object(sequence));
}
template <class T>
str ljust(T const& width) const
{
return base::ljust(object(width));
}
template <class T1, class T2>
str replace(T1 const& old, T2 const& new_) const
{
return base::replace(object(old),object(new_));
}
template <class T1, class T2, class T3>
str replace(T1 const& old, T2 const& new_, T3 const& maxsplit) const
{
return base::replace(object(old),object(new_), object(maxsplit));
}
template <class T>
long rfind(T const& sub) const
{
return base::rfind(object(sub));
}
template <class T1, class T2>
long rfind(T1 const& sub, T2 const& start) const
{
return base::rfind(object(sub), object(start));
}
template <class T1, class T2, class T3>
long rfind(T1 const& sub, T2 const& start, T3 const& end) const
{
return base::rfind(object(sub), object(start), object(end));
}
template <class T>
long rindex(T const& sub) const
{
return base::rindex(object(sub));
}
template <class T1, class T2>
long rindex(T1 const& sub, T2 const& start) const
{
return base::rindex(object(sub), object(start));
}
template <class T1, class T2, class T3>
long rindex(T1 const& sub, T2 const& start, T3 const& end) const
{
return base::rindex(object(sub), object(start), object(end));
}
template <class T>
str rjust(T const& width) const
{
return base::rjust(object(width));
}
list split() const { return base::split(); }
template <class T>
list split(T const& sep) const
{
return base::split(object(sep));
}
template <class T1, class T2>
list split(T1 const& sep, T2 const& maxsplit) const
{
return base::split(object(sep), object(maxsplit));
}
list splitlines() const { return base::splitlines(); }
template <class T>
list splitlines(T const& keepends) const
{
return base::splitlines(object(keepends));
}
template <class T>
bool startswith(T const& prefix) const
{
return base::startswith(object(prefix));
}
template <class T1, class T2>
bool startswith(T1 const& prefix, T2 const& start) const
{
return base::startswith(object(prefix), object(start));
}
template <class T1, class T2, class T3>
bool startswith(T1 const& prefix, T2 const& start, T3 const& end) const
{
return base::startswith(object(prefix), object(start), object(end));
}
template <class T>
str translate(T const& table) const
{
return base::translate(object(table));
}
template <class T1, class T2>
str translate(T1 const& table, T2 const& deletechars) const
{
return base::translate(object(table), object(deletechars));
}
public: // implementation detail -- for internal use only
BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(str, base)
};
//
// Converter Specializations
//
namespace converter
{
template <>
struct object_manager_traits<str>
#if PY_VERSION_HEX >= 0x03000000
: pytype_object_manager_traits<&PyUnicode_Type,str>
#else
: pytype_object_manager_traits<&PyString_Type,str>
#endif
{
};
}
}} // namespace boost::python
#endif // STR_20020703_HPP
@@ -0,0 +1,56 @@
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2004. 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_CONFIG_HPP
#define BOOST_RANGE_CONFIG_HPP
#include <boost/detail/workaround.hpp>
#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/config.hpp>
#ifdef BOOST_RANGE_DEDUCED_TYPENAME
#error "macro already defined!"
#endif
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# define BOOST_RANGE_DEDUCED_TYPENAME typename
#else
#define BOOST_RANGE_DEDUCED_TYPENAME BOOST_DEDUCED_TYPENAME
#endif
#ifdef BOOST_RANGE_NO_ARRAY_SUPPORT
#error "macro already defined!"
#endif
#if BOOST_WORKAROUND( __MWERKS__, <= 0x3003 )
#define BOOST_RANGE_NO_ARRAY_SUPPORT 1
#endif
#ifdef BOOST_RANGE_NO_ARRAY_SUPPORT
#define BOOST_RANGE_ARRAY_REF() (boost_range_array)
#define BOOST_RANGE_NO_STATIC_ASSERT
#else
#define BOOST_RANGE_ARRAY_REF() (&boost_range_array)
#endif
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
# define BOOST_RANGE_UNUSED __attribute__((unused))
#else
# define BOOST_RANGE_UNUSED
#endif
#endif
@@ -0,0 +1,637 @@
// chrono_io
//
// (C) Copyright Howard Hinnant
// (C) Copyright 2010 Vicente J. Botet Escriba
// 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 code was adapted by Vicente from Howard Hinnant's experimental work
// on chrono i/o under lvm/libc++ to Boost
#ifndef BOOST_CHRONO_IO_V1_CHRONO_IO_HPP
#define BOOST_CHRONO_IO_V1_CHRONO_IO_HPP
#include <boost/chrono/chrono.hpp>
#include <boost/chrono/process_cpu_clocks.hpp>
#include <boost/chrono/thread_clock.hpp>
#include <boost/chrono/clock_string.hpp>
#include <boost/ratio/ratio_io.hpp>
#include <locale>
#include <boost/type_traits/is_scalar.hpp>
#include <boost/type_traits/is_signed.hpp>
#include <boost/mpl/if.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/chrono/detail/scan_keyword.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp>
namespace boost
{
namespace chrono
{
template <class CharT>
class duration_punct
: public std::locale::facet
{
public:
typedef std::basic_string<CharT> string_type;
enum {use_long, use_short};
private:
bool use_short_;
string_type long_seconds_;
string_type long_minutes_;
string_type long_hours_;
string_type short_seconds_;
string_type short_minutes_;
string_type short_hours_;
template <class Period>
string_type short_name(Period) const
{return ::boost::ratio_string<Period, CharT>::short_name() + short_seconds_;}
string_type short_name(ratio<1>) const {return short_seconds_;}
string_type short_name(ratio<60>) const {return short_minutes_;}
string_type short_name(ratio<3600>) const {return short_hours_;}
template <class Period>
string_type long_name(Period) const
{return ::boost::ratio_string<Period, CharT>::long_name() + long_seconds_;}
string_type long_name(ratio<1>) const {return long_seconds_;}
string_type long_name(ratio<60>) const {return long_minutes_;}
string_type long_name(ratio<3600>) const {return long_hours_;}
void init_C();
public:
static std::locale::id id;
explicit duration_punct(int use = use_long)
: use_short_(use==use_short) {init_C();}
duration_punct(int use,
const string_type& long_seconds, const string_type& long_minutes,
const string_type& long_hours, const string_type& short_seconds,
const string_type& short_minutes, const string_type& short_hours);
duration_punct(int use, const duration_punct& d);
template <class Period>
string_type short_name() const
{return short_name(typename Period::type());}
template <class Period>
string_type long_name() const
{return long_name(typename Period::type());}
template <class Period>
string_type plural() const
{return long_name(typename Period::type());}
template <class Period>
string_type singular() const
{
return string_type(long_name(typename Period::type()), 0, long_name(typename Period::type()).size()-1);
}
template <class Period>
string_type name() const
{
if (use_short_) return short_name<Period>();
else {
return long_name<Period>();
}
}
template <class Period, class D>
string_type name(D v) const
{
if (use_short_) return short_name<Period>();
else
{
if (v==-1 || v==1)
return singular<Period>();
else
return plural<Period>();
}
}
bool is_short_name() const {return use_short_;}
bool is_long_name() const {return !use_short_;}
};
template <class CharT>
std::locale::id
duration_punct<CharT>::id;
template <class CharT>
void
duration_punct<CharT>::init_C()
{
short_seconds_ = CharT('s');
short_minutes_ = CharT('m');
short_hours_ = CharT('h');
const CharT s[] = {'s', 'e', 'c', 'o', 'n', 'd', 's'};
const CharT m[] = {'m', 'i', 'n', 'u', 't', 'e', 's'};
const CharT h[] = {'h', 'o', 'u', 'r', 's'};
long_seconds_.assign(s, s + sizeof(s)/sizeof(s[0]));
long_minutes_.assign(m, m + sizeof(m)/sizeof(m[0]));
long_hours_.assign(h, h + sizeof(h)/sizeof(h[0]));
}
template <class CharT>
duration_punct<CharT>::duration_punct(int use,
const string_type& long_seconds, const string_type& long_minutes,
const string_type& long_hours, const string_type& short_seconds,
const string_type& short_minutes, const string_type& short_hours)
: use_short_(use==use_short),
long_seconds_(long_seconds),
long_minutes_(long_minutes),
long_hours_(long_hours),
short_seconds_(short_seconds),
short_minutes_(short_minutes),
short_hours_(short_hours)
{}
template <class CharT>
duration_punct<CharT>::duration_punct(int use, const duration_punct& d)
: use_short_(use==use_short),
long_seconds_(d.long_seconds_),
long_minutes_(d.long_minutes_),
long_hours_(d.long_hours_),
short_seconds_(d.short_seconds_),
short_minutes_(d.short_minutes_),
short_hours_(d.short_hours_)
{}
template <class CharT, class Traits>
std::basic_ostream<CharT, Traits>&
duration_short(std::basic_ostream<CharT, Traits>& os)
{
typedef duration_punct<CharT> Facet;
std::locale loc = os.getloc();
if (std::has_facet<Facet>(loc))
{
const Facet& f = std::use_facet<Facet>(loc);
if (f.is_long_name())
os.imbue(std::locale(loc, new Facet(Facet::use_short, f)));
}
else
os.imbue(std::locale(loc, new Facet(Facet::use_short)));
return os;
}
template <class CharT, class Traits>
std::basic_ostream<CharT, Traits>&
duration_long(std::basic_ostream<CharT, Traits>& os)
{
typedef duration_punct<CharT> Facet;
std::locale loc = os.getloc();
if (std::has_facet<Facet>(loc))
{
const Facet& f = std::use_facet<Facet>(loc);
if (f.is_short_name())
os.imbue(std::locale(loc, new Facet(Facet::use_long, f)));
}
return os;
}
template <class CharT, class Traits, class Rep, class Period>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os, const duration<Rep, Period>& d)
{
typedef duration_punct<CharT> Facet;
std::locale loc = os.getloc();
if (!std::has_facet<Facet>(loc))
os.imbue(std::locale(loc, new Facet));
const Facet& f = std::use_facet<Facet>(os.getloc());
return os << d.count() << ' ' << f.template name<Period>(d.count());
}
namespace chrono_detail {
template <class Rep, bool = is_scalar<Rep>::value>
struct duration_io_intermediate
{
typedef Rep type;
};
template <class Rep>
struct duration_io_intermediate<Rep, true>
{
typedef typename mpl::if_c
<
is_floating_point<Rep>::value,
long double,
typename mpl::if_c
<
is_signed<Rep>::value,
long long,
unsigned long long
>::type
>::type type;
};
template <typename intermediate_type>
typename enable_if<is_integral<intermediate_type>, bool>::type
reduce(intermediate_type& r, unsigned long long& den, std::ios_base::iostate& err)
{
typedef typename common_type<intermediate_type, unsigned long long>::type common_type_t;
// Reduce r * num / den
common_type_t t = integer::gcd<common_type_t>(common_type_t(r), common_type_t(den));
r /= t;
den /= t;
if (den != 1)
{
// Conversion to Period is integral and not exact
err |= std::ios_base::failbit;
return false;
}
return true;
}
template <typename intermediate_type>
typename disable_if<is_integral<intermediate_type>, bool>::type
reduce(intermediate_type& , unsigned long long& , std::ios_base::iostate& )
{
return true;
}
}
template <class CharT, class Traits, class Rep, class Period>
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is, duration<Rep, Period>& d)
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
typedef duration_punct<CharT> Facet;
std::locale loc = is.getloc();
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
if (!std::has_facet<Facet>(loc)) {
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
is.imbue(std::locale(loc, new Facet));
}
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
loc = is.getloc();
const Facet& f = std::use_facet<Facet>(loc);
typedef typename chrono_detail::duration_io_intermediate<Rep>::type intermediate_type;
intermediate_type r;
std::ios_base::iostate err = std::ios_base::goodbit;
// read value into r
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
is >> r;
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
if (is.good())
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
// now determine unit
typedef std::istreambuf_iterator<CharT, Traits> in_iterator;
in_iterator i(is);
in_iterator e;
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
if (i != e && *i == ' ') // mandatory ' ' after value
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
++i;
if (i != e)
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
// unit is num / den (yet to be determined)
unsigned long long num = 0;
unsigned long long den = 0;
if (*i == '[')
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
// parse [N/D]s or [N/D]seconds format
++i;
CharT x;
is >> num >> x >> den;
if (!is.good() || (x != '/'))
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
is.setstate(is.failbit);
return is;
}
i = in_iterator(is);
if (*i != ']')
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
is.setstate(is.failbit);
return is;
}
++i;
const std::basic_string<CharT> units[] =
{
f.template singular<ratio<1> >(),
f.template plural<ratio<1> >(),
f.template short_name<ratio<1> >()
};
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
const std::basic_string<CharT>* k = chrono_detail::scan_keyword(i, e,
units, units + sizeof(units)/sizeof(units[0]),
//~ std::use_facet<std::ctype<CharT> >(loc),
err);
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
is.setstate(err);
switch ((k - units) / 3)
{
case 0:
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
break;
default:
is.setstate(err);
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
return is;
}
}
else
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
// parse SI name, short or long
const std::basic_string<CharT> units[] =
{
f.template singular<atto>(),
f.template plural<atto>(),
f.template short_name<atto>(),
f.template singular<femto>(),
f.template plural<femto>(),
f.template short_name<femto>(),
f.template singular<pico>(),
f.template plural<pico>(),
f.template short_name<pico>(),
f.template singular<nano>(),
f.template plural<nano>(),
f.template short_name<nano>(),
f.template singular<micro>(),
f.template plural<micro>(),
f.template short_name<micro>(),
f.template singular<milli>(),
f.template plural<milli>(),
f.template short_name<milli>(),
f.template singular<centi>(),
f.template plural<centi>(),
f.template short_name<centi>(),
f.template singular<deci>(),
f.template plural<deci>(),
f.template short_name<deci>(),
f.template singular<deca>(),
f.template plural<deca>(),
f.template short_name<deca>(),
f.template singular<hecto>(),
f.template plural<hecto>(),
f.template short_name<hecto>(),
f.template singular<kilo>(),
f.template plural<kilo>(),
f.template short_name<kilo>(),
f.template singular<mega>(),
f.template plural<mega>(),
f.template short_name<mega>(),
f.template singular<giga>(),
f.template plural<giga>(),
f.template short_name<giga>(),
f.template singular<tera>(),
f.template plural<tera>(),
f.template short_name<tera>(),
f.template singular<peta>(),
f.template plural<peta>(),
f.template short_name<peta>(),
f.template singular<exa>(),
f.template plural<exa>(),
f.template short_name<exa>(),
f.template singular<ratio<1> >(),
f.template plural<ratio<1> >(),
f.template short_name<ratio<1> >(),
f.template singular<ratio<60> >(),
f.template plural<ratio<60> >(),
f.template short_name<ratio<60> >(),
f.template singular<ratio<3600> >(),
f.template plural<ratio<3600> >(),
f.template short_name<ratio<3600> >()
};
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
const std::basic_string<CharT>* k = chrono_detail::scan_keyword(i, e,
units, units + sizeof(units)/sizeof(units[0]),
//~ std::use_facet<std::ctype<CharT> >(loc),
err);
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
switch ((k - units) / 3)
{
case 0:
num = 1ULL;
den = 1000000000000000000ULL;
break;
case 1:
num = 1ULL;
den = 1000000000000000ULL;
break;
case 2:
num = 1ULL;
den = 1000000000000ULL;
break;
case 3:
num = 1ULL;
den = 1000000000ULL;
break;
case 4:
num = 1ULL;
den = 1000000ULL;
break;
case 5:
num = 1ULL;
den = 1000ULL;
break;
case 6:
num = 1ULL;
den = 100ULL;
break;
case 7:
num = 1ULL;
den = 10ULL;
break;
case 8:
num = 10ULL;
den = 1ULL;
break;
case 9:
num = 100ULL;
den = 1ULL;
break;
case 10:
num = 1000ULL;
den = 1ULL;
break;
case 11:
num = 1000000ULL;
den = 1ULL;
break;
case 12:
num = 1000000000ULL;
den = 1ULL;
break;
case 13:
num = 1000000000000ULL;
den = 1ULL;
break;
case 14:
num = 1000000000000000ULL;
den = 1ULL;
break;
case 15:
num = 1000000000000000000ULL;
den = 1ULL;
break;
case 16:
num = 1;
den = 1;
break;
case 17:
num = 60;
den = 1;
break;
case 18:
num = 3600;
den = 1;
break;
default:
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
is.setstate(err|is.failbit);
return is;
}
}
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
// unit is num/den
// r should be multiplied by (num/den) / Period
// Reduce (num/den) / Period to lowest terms
unsigned long long gcd_n1_n2 = integer::gcd<unsigned long long>(num, Period::num);
unsigned long long gcd_d1_d2 = integer::gcd<unsigned long long>(den, Period::den);
num /= gcd_n1_n2;
den /= gcd_d1_d2;
unsigned long long n2 = Period::num / gcd_n1_n2;
unsigned long long d2 = Period::den / gcd_d1_d2;
if (num > (std::numeric_limits<unsigned long long>::max)() / d2 ||
den > (std::numeric_limits<unsigned long long>::max)() / n2)
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
// (num/den) / Period overflows
is.setstate(err|is.failbit);
return is;
}
num *= d2;
den *= n2;
typedef typename common_type<intermediate_type, unsigned long long>::type common_type_t;
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
// num / den is now factor to multiply by r
if (!chrono_detail::reduce(r, den, err))
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
is.setstate(err|is.failbit);
return is;
}
//if (r > ((duration_values<common_type_t>::max)() / num))
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
if (chrono::detail::gt(r,((duration_values<common_type_t>::max)() / num)))
{
// Conversion to Period overflowed
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
is.setstate(err|is.failbit);
return is;
}
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
common_type_t t = r * num;
t /= den;
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
if (t > duration_values<common_type_t>::zero())
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
Rep pt = t;
if ( (duration_values<Rep>::max)() < pt)
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
// Conversion to Period overflowed
is.setstate(err|is.failbit);
return is;
}
}
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
// Success! Store it.
r = Rep(t);
d = duration<Rep, Period>(r);
is.setstate(err);
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
return is;
}
else {
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
is.setstate(is.failbit | is.eofbit);
return is;
}
}
else
{
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
if (i == e)
is.setstate(is.failbit|is.eofbit);
else
is.setstate(is.failbit);
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
return is;
}
}
else {
//std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
//is.setstate(is.failbit);
return is;
}
}
template <class CharT, class Traits, class Clock, class Duration>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,
const time_point<Clock, Duration>& tp)
{
return os << tp.time_since_epoch() << clock_string<Clock, CharT>::since();
}
template <class CharT, class Traits, class Clock, class Duration>
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is,
time_point<Clock, Duration>& tp)
{
Duration d;
is >> d;
if (is.good())
{
const std::basic_string<CharT> units=clock_string<Clock, CharT>::since();
std::ios_base::iostate err = std::ios_base::goodbit;
typedef std::istreambuf_iterator<CharT, Traits> in_iterator;
in_iterator i(is);
in_iterator e;
std::ptrdiff_t k = chrono_detail::scan_keyword(i, e,
&units, &units + 1,
//~ std::use_facet<std::ctype<CharT> >(is.getloc()),
err) - &units;
is.setstate(err);
if (k == 1)
{
is.setstate(err | is.failbit);
// failed to read epoch string
return is;
}
tp = time_point<Clock, Duration>(d);
}
else
is.setstate(is.failbit);
return is;
}
} // chrono
}
#endif // BOOST_CHRONO_CHRONO_IO_HPP
@@ -0,0 +1,33 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2009-2010 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_ADAPTED_STRUCT_DETAIL_IS_VIEW_IMPL_HPP
#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_IS_VIEW_IMPL_HPP
namespace boost { namespace fusion { namespace extension
{
template<typename>
struct is_view_impl;
template<>
struct is_view_impl<struct_tag>
{
template<typename Seq>
struct apply
: struct_is_view<typename remove_const<Seq>::type>
{};
};
template <>
struct is_view_impl<assoc_struct_tag>
: is_view_impl<struct_tag>
{};
}}}
#endif
@@ -0,0 +1,140 @@
/*=============================================================================
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_ERASE_07232005_0534)
#define FUSION_ERASE_07232005_0534
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/view/joint_view/joint_view.hpp>
#include <boost/fusion/view/iterator_range/iterator_range.hpp>
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, typename First>
struct compute_erase_last // put this in detail!!!
{
typedef typename result_of::end<Sequence>::type seq_last_type;
typedef typename convert_iterator<First>::type first_type;
typedef typename
mpl::if_<
result_of::equal_to<first_type, seq_last_type>
, first_type
, typename result_of::next<first_type>::type
>::type
type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(First const& first, mpl::false_)
{
return fusion::next(convert_iterator<First>::call(first));
}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(First const& first, mpl::true_)
{
return convert_iterator<First>::call(first);
}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(First const& first)
{
return call(first, result_of::equal_to<first_type, seq_last_type>());
}
};
struct use_default;
template <class T, class Default>
struct fusion_default_help
: mpl::if_<
is_same<T, use_default>
, Default
, T
>
{
};
template <
typename Sequence
, typename First
, typename Last = use_default>
struct erase
{
typedef typename result_of::begin<Sequence>::type seq_first_type;
typedef typename result_of::end<Sequence>::type seq_last_type;
BOOST_STATIC_ASSERT((!result_of::equal_to<seq_first_type, seq_last_type>::value));
typedef First FirstType;
typedef typename
fusion_default_help<
Last
, typename compute_erase_last<Sequence, First>::type
>::type
LastType;
typedef typename convert_iterator<FirstType>::type first_type;
typedef typename convert_iterator<LastType>::type last_type;
typedef iterator_range<seq_first_type, first_type> left_type;
typedef iterator_range<last_type, seq_last_type> right_type;
typedef joint_view<left_type, right_type> type;
};
}
template <typename Sequence, typename First>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename
lazy_enable_if<
traits::is_sequence<Sequence>
, typename result_of::erase<Sequence const, First>
>::type
erase(Sequence const& seq, First const& first)
{
typedef result_of::erase<Sequence const, First> result_of;
typedef typename result_of::left_type left_type;
typedef typename result_of::right_type right_type;
typedef typename result_of::type result_type;
left_type left(
fusion::begin(seq)
, convert_iterator<First>::call(first));
right_type right(
fusion::result_of::compute_erase_last<Sequence const, First>::call(first)
, fusion::end(seq));
return result_type(left, right);
}
template <typename Sequence, typename First, typename Last>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::erase<Sequence const, First, Last>::type
erase(Sequence const& seq, First const& first, Last const& last)
{
typedef result_of::erase<Sequence const, First, Last> result_of;
typedef typename result_of::left_type left_type;
typedef typename result_of::right_type right_type;
typedef typename result_of::type result_type;
left_type left(fusion::begin(seq), first);
right_type right(last, fusion::end(seq));
return result_type(left, right);
}
}}
#endif
@@ -0,0 +1,75 @@
#include "GetUserId.hpp"
#include <stdexcept>
#include <QApplication>
#include <QString>
#include <QDialog>
#include <QLineEdit>
#include <QRegExpValidator>
#include <QDialogButtonBox>
#include <QFormLayout>
#include <QVBoxLayout>
//
// Dialog to get callsign
//
class CallsignDialog final
: public QDialog
{
Q_OBJECT;
private:
Q_DISABLE_COPY (CallsignDialog);
public:
explicit CallsignDialog (QWidget * parent = nullptr)
: QDialog {parent}
{
setWindowTitle (QApplication::applicationName () + " - " + tr ("Callsign"));
callsign_.setValidator (new QRegExpValidator {QRegExp {"[A-Za-z0-9]+"}, this});
auto form_layout = new QFormLayout ();
form_layout->addRow ("&Callsign:", &callsign_);
auto main_layout = new QVBoxLayout (this);
main_layout->addLayout (form_layout);
auto button_box = new QDialogButtonBox {QDialogButtonBox::Ok | QDialogButtonBox::Cancel};
main_layout->addWidget (button_box);
connect (button_box, &QDialogButtonBox::accepted, this, &CallsignDialog::accept);
connect (button_box, &QDialogButtonBox::rejected, this, &CallsignDialog::reject);
}
QString callsign () const {return callsign_.text ();}
private:
QLineEdit callsign_;
};
#include "GetUserId.moc"
QString get_user_id ()
{
// get the users callsign so we can use it to persist the
// settings and log file against a unique tag
QString id;
{
CallsignDialog dialog;
while (id.isEmpty ())
{
if (QDialog::Accepted == dialog.exec ())
{
id = dialog.callsign ().toUpper ();
}
else
{
throw std::runtime_error ("Callsign required");
}
}
}
return id;
}
@@ -0,0 +1,30 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
// Copyright 2015 John Fletcher.
//
// 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
#ifndef BOOST_PHOENIX_ALGORITHM_DETAIL_BEGIN_HPP
#define BOOST_PHOENIX_ALGORITHM_DETAIL_BEGIN_HPP
//#include <boost/range/result_iterator.hpp> is deprecated
#include <boost/range/iterator.hpp>
#include <boost/range/begin.hpp>
namespace boost { namespace phoenix {
namespace detail
{
template<class R>
typename range_iterator<R>::type
begin_(R& r)
{
return boost::begin(r);
}
}
}}
#endif
@@ -0,0 +1,323 @@
// 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/vector.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename T0 = na, typename T1 = na, typename T2 = na, typename T3 = na
, typename T4 = na, typename T5 = na, typename T6 = na, typename T7 = na
, typename T8 = na, typename T9 = na, typename T10 = na, typename T11 = na
, typename T12 = na, typename T13 = na, typename T14 = na
, typename T15 = na, typename T16 = na, typename T17 = na
, typename T18 = na, typename T19 = na
>
struct vector;
template<
>
struct vector<
na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector0< >
{
typedef vector0< >::type type;
};
template<
typename T0
>
struct vector<
T0, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector1<T0>
{
typedef typename vector1<T0>::type type;
};
template<
typename T0, typename T1
>
struct vector<
T0, T1, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector2< T0,T1 >
{
typedef typename vector2< T0,T1 >::type type;
};
template<
typename T0, typename T1, typename T2
>
struct vector<
T0, T1, T2, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector3< T0,T1,T2 >
{
typedef typename vector3< T0,T1,T2 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3
>
struct vector<
T0, T1, T2, T3, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector4< T0,T1,T2,T3 >
{
typedef typename vector4< T0,T1,T2,T3 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
>
struct vector<
T0, T1, T2, T3, T4, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector5< T0,T1,T2,T3,T4 >
{
typedef typename vector5< T0,T1,T2,T3,T4 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5
>
struct vector<
T0, T1, T2, T3, T4, T5, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector6< T0,T1,T2,T3,T4,T5 >
{
typedef typename vector6< T0,T1,T2,T3,T4,T5 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector7< T0,T1,T2,T3,T4,T5,T6 >
{
typedef typename vector7< T0,T1,T2,T3,T4,T5,T6 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector8< T0,T1,T2,T3,T4,T5,T6,T7 >
{
typedef typename vector8< T0,T1,T2,T3,T4,T5,T6,T7 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, na, na, na, na, na, na, na, na
, na, na, na
>
: vector9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >
{
typedef typename vector9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, na, na, na, na, na, na, na
, na, na, na
>
: vector10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >
{
typedef typename vector10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, na, na, na, na, na, na
, na, na, na
>
: vector11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >
{
typedef typename vector11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, na, na, na, na
, na, na, na, na
>
: vector12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >
{
typedef typename vector12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, na, na, na
, na, na, na, na
>
: vector13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >
{
typedef typename vector13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, na, na
, na, na, na, na
>
: vector14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >
{
typedef typename vector14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, na
, na, na, na, na
>
: vector15<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
>
{
typedef typename vector15< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, na, na, na, na
>
: vector16<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15
>
{
typedef typename vector16< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, na, na, na
>
: vector17<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16
>
{
typedef typename vector17< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, na, na
>
: vector18<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17
>
{
typedef typename vector18< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18
>
struct vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, T18, na
>
: vector19<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, T18
>
{
typedef typename vector19< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18 >::type type;
};
/// primary template (not a specialization!)
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct vector
: vector20<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, T18, T19
>
{
typedef typename vector20< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19 >::type type;
};
}}
@@ -0,0 +1,12 @@
/*=============================================================================
Copyright (c) 2001-2008 Joel de Guzman
Copyright (c) 2001-2008 Hartmut Kaiser
http://spirit.sourceforge.net/
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_SPIRIT_INCLUDE_CLASSIC_CLASSIC_ACTIONS
#define BOOST_SPIRIT_INCLUDE_CLASSIC_CLASSIC_ACTIONS
#include <boost/spirit/home/classic/core/composite/actions.hpp>
#endif
@@ -0,0 +1,242 @@
/*
* 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)
*
* Copyright (c) 2010 Helge Bahmann
* Copyright (c) 2013 Tim Blechmann
* Copyright (c) 2014 Andrey Semashev
*/
/*!
* \file atomic/detail/ops_gcc_sparc.hpp
*
* This header contains implementation of the \c operations template.
*/
#ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_SPARC_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_OPS_GCC_SPARC_HPP_INCLUDED_
#include <boost/memory_order.hpp>
#include <boost/atomic/detail/config.hpp>
#include <boost/atomic/detail/storage_type.hpp>
#include <boost/atomic/detail/operations_fwd.hpp>
#include <boost/atomic/capabilities.hpp>
#include <boost/atomic/detail/ops_cas_based.hpp>
#include <boost/atomic/detail/ops_extending_cas_based.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
namespace atomics {
namespace detail {
struct gcc_sparc_cas_base
{
static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT
{
if (order == memory_order_seq_cst)
__asm__ __volatile__ ("membar #Sync" ::: "memory");
else if ((order & memory_order_release) != 0)
__asm__ __volatile__ ("membar #StoreStore | #LoadStore" ::: "memory");
}
static BOOST_FORCEINLINE void fence_after(memory_order order) BOOST_NOEXCEPT
{
if (order == memory_order_seq_cst)
__asm__ __volatile__ ("membar #Sync" ::: "memory");
else if ((order & (memory_order_consume | memory_order_acquire)) != 0)
__asm__ __volatile__ ("membar #StoreStore | #LoadStore" ::: "memory");
}
static BOOST_FORCEINLINE void fence_after_store(memory_order order) BOOST_NOEXCEPT
{
if (order == memory_order_seq_cst)
__asm__ __volatile__ ("membar #Sync" ::: "memory");
}
};
template< bool Signed >
struct gcc_sparc_cas32 :
public gcc_sparc_cas_base
{
typedef typename make_storage_type< 4u, Signed >::type storage_type;
typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type;
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
fence_before(order);
storage = v;
fence_after_store(order);
}
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
{
storage_type v = storage;
fence_after(order);
return v;
}
static BOOST_FORCEINLINE bool compare_exchange_strong(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
{
fence_before(success_order);
storage_type previous = expected;
__asm__ __volatile__
(
"cas [%1], %2, %0"
: "+r" (desired)
: "r" (&storage), "r" (previous)
: "memory"
);
const bool success = (desired == previous);
if (success)
fence_after(success_order);
else
fence_after(failure_order);
expected = desired;
return success;
}
static BOOST_FORCEINLINE bool compare_exchange_weak(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
{
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
}
static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
fence_before(order);
__asm__ __volatile__
(
"swap [%1], %0"
: "+r" (v)
: "r" (&storage)
: "memory"
);
fence_after(order);
return v;
}
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
{
return true;
}
};
template< bool Signed >
struct operations< 4u, Signed > :
public cas_based_operations< gcc_sparc_cas32< Signed > >
{
};
template< bool Signed >
struct operations< 1u, Signed > :
public extending_cas_based_operations< operations< 4u, Signed >, 1u, Signed >
{
};
template< bool Signed >
struct operations< 2u, Signed > :
public extending_cas_based_operations< operations< 4u, Signed >, 2u, Signed >
{
};
template< bool Signed >
struct gcc_sparc_cas64 :
public gcc_sparc_cas_base
{
typedef typename make_storage_type< 8u, Signed >::type storage_type;
typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type;
static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT
{
fence_before(order);
storage = v;
fence_after_store(order);
}
static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT
{
storage_type v = storage;
fence_after(order);
return v;
}
static BOOST_FORCEINLINE bool compare_exchange_strong(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
{
fence_before(success_order);
storage_type previous = expected;
__asm__ __volatile__
(
"casx [%1], %2, %0"
: "+r" (desired)
: "r" (&storage), "r" (previous)
: "memory"
);
const bool success = (desired == previous);
if (success)
fence_after(success_order);
else
fence_after(failure_order);
expected = desired;
return success;
}
static BOOST_FORCEINLINE bool compare_exchange_weak(
storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT
{
return compare_exchange_strong(storage, expected, desired, success_order, failure_order);
}
static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT
{
return true;
}
};
template< bool Signed >
struct operations< 8u, Signed > :
public cas_based_operations< cas_based_exchange< gcc_sparc_cas64< Signed > > >
{
};
BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
{
switch (order)
{
case memory_order_release:
__asm__ __volatile__ ("membar #StoreStore | #LoadStore" ::: "memory");
break;
case memory_order_consume:
case memory_order_acquire:
__asm__ __volatile__ ("membar #LoadLoad | #LoadStore" ::: "memory");
break;
case memory_order_acq_rel:
__asm__ __volatile__ ("membar #LoadLoad | #LoadStore | #StoreStore" ::: "memory");
break;
case memory_order_seq_cst:
__asm__ __volatile__ ("membar #Sync" ::: "memory");
break;
case memory_order_relaxed:
default:
break;
}
}
BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
{
if (order != memory_order_relaxed)
__asm__ __volatile__ ("" ::: "memory");
}
} // namespace detail
} // namespace atomics
} // namespace boost
#endif // BOOST_ATOMIC_DETAIL_OPS_GCC_SPARC_HPP_INCLUDED_