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,78 @@
#ifndef BOOST_MPL_DISTANCE_HPP_INCLUDED
#define BOOST_MPL_DISTANCE_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/distance_fwd.hpp>
#include <boost/mpl/iter_fold.hpp>
#include <boost/mpl/iterator_range.hpp>
#include <boost/mpl/long.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/tag.hpp>
#include <boost/mpl/apply_wrap.hpp>
#include <boost/mpl/aux_/msvc_eti_base.hpp>
#include <boost/mpl/aux_/value_wknd.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/config/forwarding.hpp>
#include <boost/mpl/aux_/config/static_constant.hpp>
namespace boost { namespace mpl {
// default implementation for forward/bidirectional iterators
template< typename Tag > struct distance_impl
{
template< typename First, typename Last > struct apply
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
: aux::msvc_eti_base< typename iter_fold<
iterator_range<First,Last>
, mpl::long_<0>
, next<>
>::type >
{
#else
{
typedef typename iter_fold<
iterator_range<First,Last>
, mpl::long_<0>
, next<>
>::type type;
BOOST_STATIC_CONSTANT(long, value =
(iter_fold<
iterator_range<First,Last>
, mpl::long_<0>
, next<>
>::type::value)
);
#endif
};
};
template<
typename BOOST_MPL_AUX_NA_PARAM(First)
, typename BOOST_MPL_AUX_NA_PARAM(Last)
>
struct distance
: distance_impl< typename tag<First>::type >
::template apply<First, Last>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, distance, (First, Last))
};
BOOST_MPL_AUX_NA_SPEC(2, distance)
}}
#endif // BOOST_MPL_DISTANCE_HPP_INCLUDED
@@ -0,0 +1,41 @@
// Copyright Neil Groves 2009. 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_ALGORITHM_COPY_HPP_INCLUDED
#define BOOST_RANGE_ALGORITHM_COPY_HPP_INCLUDED
#include <boost/concept_check.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/iterator_range.hpp>
#include <algorithm>
namespace boost
{
namespace range
{
/// \brief template function copy
///
/// range-based version of the copy std algorithm
///
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
/// \pre OutputIterator is a model of the OutputIteratorConcept
template< class SinglePassRange, class OutputIterator >
inline OutputIterator copy(const SinglePassRange& rng, OutputIterator out)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
return std::copy(boost::begin(rng),boost::end(rng),out);
}
} // namespace range
using range::copy;
} // namespace boost
#endif // include guard
@@ -0,0 +1,72 @@
subroutine polyfit(x,y,sigmay,npts,nterms,mode,a,chisqr)
implicit real*8 (a-h,o-z)
real*8 x(npts), y(npts), sigmay(npts), a(nterms)
real*8 sumx(10), sumy(10), array(10,10)
! Accumulate weighted sums
nmax = 2*nterms-1
sumx=0.
sumy=0.
chisq=0.
do i=1,npts
xi=x(i)
yi=y(i)
if(mode.lt.0) then
weight=1./abs(yi)
else if(mode.eq.0) then
weight=1
else
weight=1./sigmay(i)**2
end if
xterm=weight
do n=1,nmax
sumx(n)=sumx(n)+xterm
xterm=xterm*xi
enddo
yterm=weight*yi
do n=1,nterms
sumy(n)=sumy(n)+yterm
yterm=yterm*xi
enddo
chisq=chisq+weight*yi**2
enddo
! Construct matrices and calculate coefficients
do j=1,nterms
do k=1,nterms
n=j+k-1
array(j,k)=sumx(n)
enddo
enddo
delta=determ(array,nterms)
if(delta.eq.0) then
chisqr=0.
a=0.
else
do l=1,nterms
do j=1,nterms
do k=1,nterms
n=j+k-1
array(j,k)=sumx(n)
enddo
array(j,l)=sumy(j)
enddo
a(l)=determ(array,nterms)/delta
enddo
! Calculate chi square
do j=1,nterms
chisq=chisq-2*a(j)*sumy(j)
do k=1,nterms
n=j+k-1
chisq=chisq+a(j)*a(k)*sumx(n)
enddo
enddo
free=npts-nterms
chisqr=chisq/free
end if
return
end subroutine polyfit
@@ -0,0 +1,124 @@
/* the routine unpk() is not in wsprd_utils.c */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
#include "wsprd_utils.h"
unsigned int nhash_( const void *key, size_t length, uint32_t initval);
void unpk_(signed char message[], int *nhashtab, char call_loc_pow[])
{
int i,n1,n2,n3,ndbm,ihash,nadd,noprint,nh;
char callsign[13],grid[5],grid6[7],cdbm[3];
static char hashtab[32768][13];
FILE *fhash;
if(*nhashtab==1) {
char line[80], hcall[12];
if( (fhash=fopen("hashtable.txt","r+")) ) {
while (fgets(line, sizeof(line), fhash) != NULL) {
sscanf(line,"%d %s",&nh,hcall);
strcpy(*hashtab+nh*13,hcall);
}
} else {
fhash=fopen("hashtable.txt","w+");
}
fclose(fhash);
return;
}
if(*nhashtab==2) {
fhash=fopen("hashtable.txt","w");
for (i=0; i<32768; i++) {
if( strncmp(hashtab[i],"\0",1) != 0 ) {
fprintf(fhash,"%5d %s\n",i,*hashtab+i*13);
}
}
fclose(fhash);
return;
}
unpack50(message,&n1,&n2);
unpackcall(n1,callsign);
unpackgrid(n2, grid);
int ntype = (n2&127) - 64;
callsign[12]=0;
grid[4]=0;
/*
Based on the value of ntype, decide whether this is a Type 1, 2, or
3 message.
* Type 1: 6 digit call, grid, power - ntype is positive and is a member
of the set {0,3,7,10,13,17,20...60}
* Type 2: extended callsign, power - ntype is positive but not
a member of the set of allowed powers
* Type 3: hash, 6 digit grid, power - ntype is negative.
*/
if( (ntype >= 0) && (ntype <= 62) ) {
int nu=ntype%10;
if( nu == 0 || nu == 3 || nu == 7 ) {
ndbm=ntype;
memset(call_loc_pow,0,sizeof(char)*23);
sprintf(cdbm,"%2d",ndbm);
strncat(call_loc_pow,callsign,strlen(callsign));
strncat(call_loc_pow," ",1);
strncat(call_loc_pow,grid,4);
strncat(call_loc_pow," ",1);
strncat(call_loc_pow,cdbm,2);
strncat(call_loc_pow,"\0",1);
ihash=nhash_(callsign,strlen(callsign),(uint32_t)146);
strcpy(*hashtab+ihash*13,callsign);
} else {
nadd=nu;
if( nu > 3 ) nadd=nu-3;
if( nu > 7 ) nadd=nu-7;
n3=n2/128+32768*(nadd-1);
unpackpfx(n3,callsign);
ndbm=ntype-nadd;
memset(call_loc_pow,0,sizeof(char)*23);
sprintf(cdbm,"%2d",ndbm);
strncat(call_loc_pow,callsign,strlen(callsign));
strncat(call_loc_pow," ",1);
strncat(call_loc_pow,cdbm,2);
strncat(call_loc_pow,"\0",1);
ihash=nhash_(callsign,strlen(callsign),(uint32_t)146);
strcpy(*hashtab+ihash*13,callsign);
noprint=0;
}
} else if ( ntype < 0 ) {
ndbm=-(ntype+1);
memset(grid6,0,sizeof(char)*7);
strncat(grid6,callsign+5,1);
strncat(grid6,callsign,5);
ihash=(n2-ntype-64)/128;
if( strncmp(hashtab[ihash],"\0",1) != 0 ) {
sprintf(callsign,"<%s>",hashtab[ihash]);
} else {
sprintf(callsign,"%5s","<...>");
}
memset(call_loc_pow,0,sizeof(char)*23);
sprintf(cdbm,"%2d",ndbm);
strncat(call_loc_pow,callsign,strlen(callsign));
strncat(call_loc_pow," ",1);
strncat(call_loc_pow,grid6,strlen(grid6));
strncat(call_loc_pow," ",1);
strncat(call_loc_pow,cdbm,2);
strncat(call_loc_pow,"\0",1);
noprint=0;
// I don't know what to do with these... They show up as "A000AA" grids.
if( ntype == -64 ) noprint=1;
}
// printf("\nUnpacked in C: %s\n",call_loc_pow);
}
@@ -0,0 +1,30 @@
// static_assert.hpp --------------------------------------------------------------//
// Copyright 2009-2010 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP
#define BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP
#include <boost/chrono/config.hpp>
#ifndef BOOST_NO_CXX11_STATIC_ASSERT
#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG)
#elif defined(BOOST_CHRONO_USES_STATIC_ASSERT)
#include <boost/static_assert.hpp>
#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND)
#elif defined(BOOST_CHRONO_USES_MPL_ASSERT)
#include <boost/mpl/assert.hpp>
#include <boost/mpl/bool.hpp>
#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) \
BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES)
#else
//~ #elif defined(BOOST_CHRONO_USES_ARRAY_ASSERT)
#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_JOIN(boost_chrono_test_,__LINE__)[(CND)?1:-1]
//~ #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES)
#endif
#endif // BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP
@@ -0,0 +1,478 @@
/*=============================================================================
Copyright (c) 1998-2003 Joel de Guzman
Copyright (c) 2001-2003 Hartmut Kaiser
http://spirit.sourceforge.net/
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)
=============================================================================*/
#ifndef BOOST_SPIRIT_NUMERICS_IPP
#define BOOST_SPIRIT_NUMERICS_IPP
#include <boost/config/no_tr1/cmath.hpp>
#include <limits>
namespace boost { namespace spirit {
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
struct sign_parser; // forward declaration only
namespace impl
{
///////////////////////////////////////////////////////////////////////
//
// Extract the prefix sign (- or +)
//
///////////////////////////////////////////////////////////////////////
template <typename ScannerT>
bool
extract_sign(ScannerT const& scan, std::size_t& count)
{
// Extract the sign
count = 0;
bool neg = *scan == '-';
if (neg || (*scan == '+'))
{
++scan;
++count;
return neg;
}
return false;
}
///////////////////////////////////////////////////////////////////////
//
// Traits class for radix specific number conversion
//
// Convert a digit from character representation, ch, to binary
// representation, returned in val.
// Returns whether the conversion was successful.
//
// template<typename CharT> static bool digit(CharT ch, T& val);
//
///////////////////////////////////////////////////////////////////////
template<const int Radix>
struct radix_traits;
////////////////////////////////// Binary
template<>
struct radix_traits<2>
{
template<typename CharT, typename T>
static bool digit(CharT ch, T& val)
{
val = ch - '0';
return ('0' == ch || '1' == ch);
}
};
////////////////////////////////// Octal
template<>
struct radix_traits<8>
{
template<typename CharT, typename T>
static bool digit(CharT ch, T& val)
{
val = ch - '0';
return ('0' <= ch && ch <= '7');
}
};
////////////////////////////////// Decimal
template<>
struct radix_traits<10>
{
template<typename CharT, typename T>
static bool digit(CharT ch, T& val)
{
val = ch - '0';
return impl::isdigit_(ch);
}
};
////////////////////////////////// Hexadecimal
template<>
struct radix_traits<16>
{
template<typename CharT, typename T>
static bool digit(CharT ch, T& val)
{
if (radix_traits<10>::digit(ch, val))
return true;
CharT lc = impl::tolower_(ch);
if ('a' <= lc && lc <= 'f')
{
val = lc - 'a' + 10;
return true;
}
return false;
}
};
///////////////////////////////////////////////////////////////////////
//
// Helper templates for encapsulation of radix specific
// conversion of an input string to an integral value.
//
// main entry point:
//
// extract_int<Radix, MinDigits, MaxDigits, Accumulate>
// ::f(first, last, n, count);
//
// The template parameter Radix represents the radix of the
// number contained in the parsed string. The template
// parameter MinDigits specifies the minimum digits to
// accept. The template parameter MaxDigits specifies the
// maximum digits to parse. A -1 value for MaxDigits will
// make it parse an arbitrarilly large number as long as the
// numeric type can hold it. Accumulate is either
// positive_accumulate<Radix> (default) for parsing positive
// numbers or negative_accumulate<Radix> otherwise.
// Checking is only performed when std::numeric_limits<T>::
// is_specialized is true. Otherwise, there's no way to
// do the check.
//
// scan.first and scan.last are iterators as usual (i.e.
// first is mutable and is moved forward when a match is
// found), n is a variable that holds the number (passed by
// reference). The number of parsed characters is added to
// count (also passed by reference)
//
// NOTE:
// Returns a non-match, if the number to parse
// overflows (or underflows) the used type.
//
// BEWARE:
// the parameters 'n' and 'count' should be properly
// initialized before calling this function.
//
///////////////////////////////////////////////////////////////////////
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4127) //conditional expression is constant
#endif
template <typename T, int Radix>
struct positive_accumulate
{
// Use this accumulator if number is positive
static bool add(T& n, T digit)
{
if (std::numeric_limits<T>::is_specialized)
{
static T const max = (std::numeric_limits<T>::max)();
static T const max_div_radix = max/Radix;
if (n > max_div_radix)
return false;
n *= Radix;
if (n > max - digit)
return false;
n += digit;
return true;
}
else
{
n *= Radix;
n += digit;
return true;
}
}
};
template <typename T, int Radix>
struct negative_accumulate
{
// Use this accumulator if number is negative
static bool add(T& n, T digit)
{
if (std::numeric_limits<T>::is_specialized)
{
typedef std::numeric_limits<T> num_limits;
static T const min =
(!num_limits::is_integer && num_limits::is_signed && num_limits::has_denorm) ?
-(num_limits::max)() : (num_limits::min)();
static T const min_div_radix = min/Radix;
if (n < min_div_radix)
return false;
n *= Radix;
if (n < min + digit)
return false;
n -= digit;
return true;
}
else
{
n *= Radix;
n -= digit;
return true;
}
}
};
template <int MaxDigits>
inline bool allow_more_digits(std::size_t i)
{
return i < MaxDigits;
}
template <>
inline bool allow_more_digits<-1>(std::size_t)
{
return true;
}
//////////////////////////////////
template <
int Radix, unsigned MinDigits, int MaxDigits,
typename Accumulate
>
struct extract_int
{
template <typename ScannerT, typename T>
static bool
f(ScannerT& scan, T& n, std::size_t& count)
{
std::size_t i = 0;
T digit;
while( allow_more_digits<MaxDigits>(i) && !scan.at_end() &&
radix_traits<Radix>::digit(*scan, digit) )
{
if (!Accumulate::add(n, digit))
return false; // Overflow
++i, ++scan, ++count;
}
return i >= MinDigits;
}
};
///////////////////////////////////////////////////////////////////////
//
// uint_parser_impl class
//
///////////////////////////////////////////////////////////////////////
template <
typename T = unsigned,
int Radix = 10,
unsigned MinDigits = 1,
int MaxDigits = -1
>
struct uint_parser_impl
: parser<uint_parser_impl<T, Radix, MinDigits, MaxDigits> >
{
typedef uint_parser_impl<T, Radix, MinDigits, MaxDigits> self_t;
template <typename ScannerT>
struct result
{
typedef typename match_result<ScannerT, T>::type type;
};
template <typename ScannerT>
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const& scan) const
{
if (!scan.at_end())
{
T n = 0;
std::size_t count = 0;
typename ScannerT::iterator_t save = scan.first;
if (extract_int<Radix, MinDigits, MaxDigits,
positive_accumulate<T, Radix> >::f(scan, n, count))
{
return scan.create_match(count, n, save, scan.first);
}
// return no-match if number overflows
}
return scan.no_match();
}
};
///////////////////////////////////////////////////////////////////////
//
// int_parser_impl class
//
///////////////////////////////////////////////////////////////////////
template <
typename T = unsigned,
int Radix = 10,
unsigned MinDigits = 1,
int MaxDigits = -1
>
struct int_parser_impl
: parser<int_parser_impl<T, Radix, MinDigits, MaxDigits> >
{
typedef int_parser_impl<T, Radix, MinDigits, MaxDigits> self_t;
template <typename ScannerT>
struct result
{
typedef typename match_result<ScannerT, T>::type type;
};
template <typename ScannerT>
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const& scan) const
{
typedef extract_int<Radix, MinDigits, MaxDigits,
negative_accumulate<T, Radix> > extract_int_neg_t;
typedef extract_int<Radix, MinDigits, MaxDigits,
positive_accumulate<T, Radix> > extract_int_pos_t;
if (!scan.at_end())
{
T n = 0;
std::size_t count = 0;
typename ScannerT::iterator_t save = scan.first;
bool hit = impl::extract_sign(scan, count);
if (hit)
hit = extract_int_neg_t::f(scan, n, count);
else
hit = extract_int_pos_t::f(scan, n, count);
if (hit)
return scan.create_match(count, n, save, scan.first);
else
scan.first = save;
// return no-match if number overflows or underflows
}
return scan.no_match();
}
};
///////////////////////////////////////////////////////////////////////
//
// real_parser_impl class
//
///////////////////////////////////////////////////////////////////////
template <typename RT, typename T, typename RealPoliciesT>
struct real_parser_impl
{
typedef real_parser_impl<RT, T, RealPoliciesT> self_t;
template <typename ScannerT>
RT parse_main(ScannerT const& scan) const
{
if (scan.at_end())
return scan.no_match();
typename ScannerT::iterator_t save = scan.first;
typedef typename parser_result<sign_parser, ScannerT>::type
sign_match_t;
typedef typename parser_result<chlit<>, ScannerT>::type
exp_match_t;
sign_match_t sign_match = RealPoliciesT::parse_sign(scan);
std::size_t count = sign_match ? sign_match.length() : 0;
bool neg = sign_match.has_valid_attribute() ?
sign_match.value() : false;
RT n_match = RealPoliciesT::parse_n(scan);
T n = n_match.has_valid_attribute() ?
n_match.value() : T(0);
bool got_a_number = n_match;
exp_match_t e_hit;
if (!got_a_number && !RealPoliciesT::allow_leading_dot)
return scan.no_match();
else
count += n_match.length();
if (neg)
n = -n;
if (RealPoliciesT::parse_dot(scan))
{
// We got the decimal point. Now we will try to parse
// the fraction if it is there. If not, it defaults
// to zero (0) only if we already got a number.
if (RT hit = RealPoliciesT::parse_frac_n(scan))
{
#if !defined(BOOST_NO_STDC_NAMESPACE)
using namespace std; // allow for ADL to find pow()
#endif
hit.value(hit.value()
* pow(T(10), T(-hit.length())));
if (neg)
n -= hit.value();
else
n += hit.value();
count += hit.length() + 1;
}
else if (!got_a_number ||
!RealPoliciesT::allow_trailing_dot)
return scan.no_match();
e_hit = RealPoliciesT::parse_exp(scan);
}
else
{
// We have reached a point where we
// still haven't seen a number at all.
// We return early with a no-match.
if (!got_a_number)
return scan.no_match();
// If we must expect a dot and we didn't see
// an exponent, return early with a no-match.
e_hit = RealPoliciesT::parse_exp(scan);
if (RealPoliciesT::expect_dot && !e_hit)
return scan.no_match();
}
if (e_hit)
{
// We got the exponent prefix. Now we will try to parse the
// actual exponent. It is an error if it is not there.
if (RT e_n_hit = RealPoliciesT::parse_exp_n(scan))
{
#if !defined(BOOST_NO_STDC_NAMESPACE)
using namespace std; // allow for ADL to find pow()
#endif
n *= pow(T(10), T(e_n_hit.value()));
count += e_n_hit.length() + e_hit.length();
}
else
{
// Oops, no exponent, return a no-match
return scan.no_match();
}
}
return scan.create_match(count, n, save, scan.first);
}
template <typename ScannerT>
static RT parse(ScannerT const& scan)
{
static self_t this_;
return impl::implicit_lexeme_parse<RT>(this_, scan, scan);
}
};
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
} // namespace impl
///////////////////////////////////////////////////////////////////////////////
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
}} // namespace boost::spirit
#endif
@@ -0,0 +1,334 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
// no include guards, this file is intended for multiple inclusion
// input: BOOST_FT_syntax type macro to use
// input: BOOST_FT_cc empty or cc specifier
// input: BOOST_FT_ell empty or "..."
// input: BOOST_FT_cv empty or cv qualifiers
// input: BOOST_FT_flags single decimal integer encoding the flags
// output: BOOST_FT_n number of component types (arity+1)
// output: BOOST_FT_arity current arity
// output: BOOST_FT_type macro that expands to the type
// output: BOOST_FT_tplargs(p) template arguments with given prefix
// output: BOOST_FT_params(p) parameters with given prefix
# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity)
# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity
template< typename R >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,0)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (BOOST_FT_nullary_param BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 1 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,0)
< typename mpl::deref< iter_0 > ::type
> ::type type;
};
};
template< typename R , typename T0 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,1)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 2 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,1)
< typename mpl::deref< iter_0 > ::type
, typename mpl::deref< iter_1 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,2)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 3 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,2)
< typename mpl::deref< iter_0 > ::type
, typename mpl::deref< iter_1 > ::type
, typename mpl::deref< iter_2 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,3)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 4 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,3)
< typename mpl::deref< iter_0 > ::type
, typename mpl::deref< iter_1 > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,4)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 5 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,4)
< typename mpl::deref< iter_0 > ::type
, typename mpl::deref< iter_1 > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,5)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 6 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,5)
< typename mpl::deref< iter_0 > ::type
, typename mpl::deref< iter_1 > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,6)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 7 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,6)
< typename mpl::deref< iter_0 > ::type
, typename mpl::deref< iter_1 > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,7)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 8 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,7)
< typename mpl::deref< iter_0 > ::type
, typename mpl::deref< iter_1 > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,8)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 9 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,8)
< typename mpl::deref< iter_0 > ::type
, typename mpl::deref< iter_1 > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,9)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 10 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,9)
< typename mpl::deref< iter_0 > ::type
, typename mpl::deref< iter_1 > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
> ::type type;
};
};
template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 >
struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,10)
{
typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 BOOST_FT_ell) BOOST_FT_cv ;
};
template< >
struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 11 >
{
template<typename S> struct synthesize_impl_i
{
private:
typedef typename mpl::begin<S> ::type iter_0;
typedef typename mpl::next< iter_0 > ::type iter_1;
typedef typename mpl::next< iter_1 > ::type iter_2;
typedef typename mpl::next< iter_2 > ::type iter_3;
typedef typename mpl::next< iter_3 > ::type iter_4;
typedef typename mpl::next< iter_4 > ::type iter_5;
typedef typename mpl::next< iter_5 > ::type iter_6;
typedef typename mpl::next< iter_6 > ::type iter_7;
typedef typename mpl::next< iter_7 > ::type iter_8;
typedef typename mpl::next< iter_8 > ::type iter_9;
typedef typename mpl::next< iter_9 > ::type iter_10;
public:
typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,10)
< typename mpl::deref< iter_0 > ::type
, typename mpl::deref< iter_1 > ::type
, typename mpl::deref< iter_2 > ::type
, typename mpl::deref< iter_3 > ::type
, typename mpl::deref< iter_4 > ::type
, typename mpl::deref< iter_5 > ::type
, typename mpl::deref< iter_6 > ::type
, typename mpl::deref< iter_7 > ::type
, typename mpl::deref< iter_8 > ::type
, typename mpl::deref< iter_9 > ::type
, typename mpl::deref< iter_10 > ::type
> ::type type;
};
};
# undef BOOST_FT_make_type
# undef BOOST_FT_make_type_impl
@@ -0,0 +1,24 @@
module timer_module
implicit none
abstract interface
subroutine timer_callback (dname, k)
character(len=8), intent(in) :: dname
integer, intent(in) :: k
end subroutine timer_callback
end interface
public :: null_timer
procedure(timer_callback), pointer :: timer => null_timer
contains
!
! default Fortran implementation which does nothing
!
subroutine null_timer (dname, k)
implicit none
character(len=8), intent(in) :: dname
integer, intent(in) :: k
if(dname.eq.'99999999' .and. k.eq.9999) stop !Silence compiler warnings
end subroutine null_timer
end module timer_module
@@ -0,0 +1,304 @@
/*==============================================================================
Copyright (c) 2005-2010 Joel de Guzman
Copyright (c) 2010 Thomas Heller
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
template <typename This, typename A0 , typename A1, typename Context>
struct result<This(A0 , A1, Context)>
{
typedef
typename proto::detail::uncvref<
typename proto::result_of::value<A0>::type
>::type
target_type;
typedef typename target_type::type construct_type;
typedef typename target_type::type * type;
};
template <typename A0 , typename A1, typename Context>
typename result<new_eval(A0 const& , A1 const&, Context &)>::type
operator()(
A0 const&
, A1 const& a1
, Context const & ctx
) const
{
return
new typename result<
new_eval(A0 const& , A1 const&, Context &)
>::construct_type(
boost::phoenix::eval(a1, ctx)
);
}
template <typename This, typename A0 , typename A1 , typename A2, typename Context>
struct result<This(A0 , A1 , A2, Context)>
{
typedef
typename proto::detail::uncvref<
typename proto::result_of::value<A0>::type
>::type
target_type;
typedef typename target_type::type construct_type;
typedef typename target_type::type * type;
};
template <typename A0 , typename A1 , typename A2, typename Context>
typename result<new_eval(A0 const& , A1 const& , A2 const&, Context &)>::type
operator()(
A0 const&
, A1 const& a1 , A2 const& a2
, Context const & ctx
) const
{
return
new typename result<
new_eval(A0 const& , A1 const& , A2 const&, Context &)
>::construct_type(
boost::phoenix::eval(a1, ctx) , boost::phoenix::eval(a2, ctx)
);
}
template <typename This, typename A0 , typename A1 , typename A2 , typename A3, typename Context>
struct result<This(A0 , A1 , A2 , A3, Context)>
{
typedef
typename proto::detail::uncvref<
typename proto::result_of::value<A0>::type
>::type
target_type;
typedef typename target_type::type construct_type;
typedef typename target_type::type * type;
};
template <typename A0 , typename A1 , typename A2 , typename A3, typename Context>
typename result<new_eval(A0 const& , A1 const& , A2 const& , A3 const&, Context &)>::type
operator()(
A0 const&
, A1 const& a1 , A2 const& a2 , A3 const& a3
, Context const & ctx
) const
{
return
new typename result<
new_eval(A0 const& , A1 const& , A2 const& , A3 const&, Context &)
>::construct_type(
boost::phoenix::eval(a1, ctx) , boost::phoenix::eval(a2, ctx) , boost::phoenix::eval(a3, ctx)
);
}
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4, typename Context>
struct result<This(A0 , A1 , A2 , A3 , A4, Context)>
{
typedef
typename proto::detail::uncvref<
typename proto::result_of::value<A0>::type
>::type
target_type;
typedef typename target_type::type construct_type;
typedef typename target_type::type * type;
};
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4, typename Context>
typename result<new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const&, Context &)>::type
operator()(
A0 const&
, A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4
, Context const & ctx
) const
{
return
new typename result<
new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const&, Context &)
>::construct_type(
boost::phoenix::eval(a1, ctx) , boost::phoenix::eval(a2, ctx) , boost::phoenix::eval(a3, ctx) , boost::phoenix::eval(a4, ctx)
);
}
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5, typename Context>
struct result<This(A0 , A1 , A2 , A3 , A4 , A5, Context)>
{
typedef
typename proto::detail::uncvref<
typename proto::result_of::value<A0>::type
>::type
target_type;
typedef typename target_type::type construct_type;
typedef typename target_type::type * type;
};
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5, typename Context>
typename result<new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const&, Context &)>::type
operator()(
A0 const&
, A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5
, Context const & ctx
) const
{
return
new typename result<
new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const&, Context &)
>::construct_type(
boost::phoenix::eval(a1, ctx) , boost::phoenix::eval(a2, ctx) , boost::phoenix::eval(a3, ctx) , boost::phoenix::eval(a4, ctx) , boost::phoenix::eval(a5, ctx)
);
}
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6, typename Context>
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6, Context)>
{
typedef
typename proto::detail::uncvref<
typename proto::result_of::value<A0>::type
>::type
target_type;
typedef typename target_type::type construct_type;
typedef typename target_type::type * type;
};
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6, typename Context>
typename result<new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const&, Context &)>::type
operator()(
A0 const&
, A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6
, Context const & ctx
) const
{
return
new typename result<
new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const&, Context &)
>::construct_type(
boost::phoenix::eval(a1, ctx) , boost::phoenix::eval(a2, ctx) , boost::phoenix::eval(a3, ctx) , boost::phoenix::eval(a4, ctx) , boost::phoenix::eval(a5, ctx) , boost::phoenix::eval(a6, ctx)
);
}
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7, typename Context>
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7, Context)>
{
typedef
typename proto::detail::uncvref<
typename proto::result_of::value<A0>::type
>::type
target_type;
typedef typename target_type::type construct_type;
typedef typename target_type::type * type;
};
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7, typename Context>
typename result<new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const&, Context &)>::type
operator()(
A0 const&
, A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7
, Context const & ctx
) const
{
return
new typename result<
new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const&, Context &)
>::construct_type(
boost::phoenix::eval(a1, ctx) , boost::phoenix::eval(a2, ctx) , boost::phoenix::eval(a3, ctx) , boost::phoenix::eval(a4, ctx) , boost::phoenix::eval(a5, ctx) , boost::phoenix::eval(a6, ctx) , boost::phoenix::eval(a7, ctx)
);
}
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8, typename Context>
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8, Context)>
{
typedef
typename proto::detail::uncvref<
typename proto::result_of::value<A0>::type
>::type
target_type;
typedef typename target_type::type construct_type;
typedef typename target_type::type * type;
};
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8, typename Context>
typename result<new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const& , A8 const&, Context &)>::type
operator()(
A0 const&
, A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8
, Context const & ctx
) const
{
return
new typename result<
new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const& , A8 const&, Context &)
>::construct_type(
boost::phoenix::eval(a1, ctx) , boost::phoenix::eval(a2, ctx) , boost::phoenix::eval(a3, ctx) , boost::phoenix::eval(a4, ctx) , boost::phoenix::eval(a5, ctx) , boost::phoenix::eval(a6, ctx) , boost::phoenix::eval(a7, ctx) , boost::phoenix::eval(a8, ctx)
);
}
template <typename This, typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9, typename Context>
struct result<This(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9, Context)>
{
typedef
typename proto::detail::uncvref<
typename proto::result_of::value<A0>::type
>::type
target_type;
typedef typename target_type::type construct_type;
typedef typename target_type::type * type;
};
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9, typename Context>
typename result<new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const& , A8 const& , A9 const&, Context &)>::type
operator()(
A0 const&
, A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9
, Context const & ctx
) const
{
return
new typename result<
new_eval(A0 const& , A1 const& , A2 const& , A3 const& , A4 const& , A5 const& , A6 const& , A7 const& , A8 const& , A9 const&, Context &)
>::construct_type(
boost::phoenix::eval(a1, ctx) , boost::phoenix::eval(a2, ctx) , boost::phoenix::eval(a3, ctx) , boost::phoenix::eval(a4, ctx) , boost::phoenix::eval(a5, ctx) , boost::phoenix::eval(a6, ctx) , boost::phoenix::eval(a7, ctx) , boost::phoenix::eval(a8, ctx) , boost::phoenix::eval(a9, ctx)
);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,54 @@
#ifndef BIGGIRTH
#define BIGGIRTH 1
#include <cstdlib>
#include <iostream> // C++ I/O library header
#include "Random.h"
class NodesInGraph{
public:
int numOfConnectionParityBit;
int *connectionParityBit;
int numOfConnectionSymbolBit;
int *connectionSymbolBit;
int maxDegParity;
NodesInGraph(void);
~NodesInGraph(void);
void setNumOfConnectionSymbolBit(int deg);
void initConnectionParityBit(void);
void initConnectionParityBit(int deg);
};
class BigGirth {
public:
int M, N;
int K;
int EXPAND_DEPTH;
const char *filename;
int *(*H);
int *localGirth;
NodesInGraph *nodesInGraph;
Random *myrandom;
BigGirth(int m, int n, int *symbolDegSequence, const char *filename, int sglConcent, int tgtGirth, bool verbose_ = true);
BigGirth(void);
void writeToFile_Hcompressed(void);
void writeToFile_Hmatrix(void);
void writeToFile(void);
void loadH(void);
~BigGirth(void);
private:
int selectParityConnect(int kthSymbol, int mthConnection, int & cycle);
void updateConnection(int kthSymbol);
bool verbose;
};
#endif
@@ -0,0 +1,147 @@
// Copyright Aleksey Gurtovoy 2000-2004
// Copyright Jaap Suter 2003
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/bitxor.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
>
struct bitxor_impl
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
, aux::cast2nd_impl< bitxor_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< bitxor_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct bitxor_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct bitxor_impl< na,Tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct bitxor_impl< Tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct bitxor_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
, typename N3 = na, typename N4 = na, typename N5 = na
>
struct bitxor_
: bitxor_< bitxor_< bitxor_< bitxor_< N1,N2 >, N3>, N4>, N5>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(
5
, bitxor_
, ( N1, N2, N3, N4, N5 )
)
};
template<
typename N1, typename N2, typename N3, typename N4
>
struct bitxor_< N1,N2,N3,N4,na >
: bitxor_< bitxor_< bitxor_< N1,N2 >, N3>, N4>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, bitxor_
, ( N1, N2, N3, N4, na )
)
};
template<
typename N1, typename N2, typename N3
>
struct bitxor_< N1,N2,N3,na,na >
: bitxor_< bitxor_< N1,N2 >, N3>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, bitxor_
, ( N1, N2, N3, na, na )
)
};
template<
typename N1, typename N2
>
struct bitxor_< N1,N2,na,na,na >
: bitxor_impl<
typename bitxor_tag<N1>::type
, typename bitxor_tag<N2>::type
>::template apply< N1,N2 >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, bitxor_
, ( N1, N2, na, na, na )
)
};
BOOST_MPL_AUX_NA_SPEC2(2, 5, bitxor_)
}}
namespace boost { namespace mpl {
template<>
struct bitxor_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: integral_c<
typename aux::largest_int<
typename N1::value_type
, typename N2::value_type
>::type
, ( BOOST_MPL_AUX_VALUE_WKND(N1)::value
^ BOOST_MPL_AUX_VALUE_WKND(N2)::value
)
>
{
};
};
}}
@@ -0,0 +1,466 @@
/* boost random/linear_congruential.hpp header file
*
* Copyright Jens Maurer 2000-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 for most recent version including documentation.
*
* $Id$
*
* Revision history
* 2001-02-18 moved to individual header files
*/
#ifndef BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP
#define BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP
#include <iostream>
#include <stdexcept>
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/limits.hpp>
#include <boost/static_assert.hpp>
#include <boost/integer/static_log2.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_arithmetic.hpp>
#include <boost/random/detail/config.hpp>
#include <boost/random/detail/const_mod.hpp>
#include <boost/random/detail/seed.hpp>
#include <boost/random/detail/seed_impl.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/random/detail/disable_warnings.hpp>
namespace boost {
namespace random {
/**
* Instantiations of class template linear_congruential_engine model a
* \pseudo_random_number_generator. Linear congruential pseudo-random
* number generators are described in:
*
* @blockquote
* "Mathematical methods in large-scale computing units", D. H. Lehmer,
* Proc. 2nd Symposium on Large-Scale Digital Calculating Machines,
* Harvard University Press, 1951, pp. 141-146
* @endblockquote
*
* Let x(n) denote the sequence of numbers returned by some pseudo-random
* number generator. Then for the linear congruential generator,
* x(n+1) := (a * x(n) + c) mod m. Parameters for the generator are
* x(0), a, c, m. The template parameter IntType shall denote an integral
* type. It must be large enough to hold values a, c, and m. The template
* parameters a and c must be smaller than m.
*
* Note: The quality of the generator crucially depends on the choice of
* the parameters. User code should use one of the sensibly parameterized
* generators such as minstd_rand instead.
*/
template<class IntType, IntType a, IntType c, IntType m>
class linear_congruential_engine
{
public:
typedef IntType result_type;
// Required for old Boost.Random concept
BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
BOOST_STATIC_CONSTANT(IntType, multiplier = a);
BOOST_STATIC_CONSTANT(IntType, increment = c);
BOOST_STATIC_CONSTANT(IntType, modulus = m);
BOOST_STATIC_CONSTANT(IntType, default_seed = 1);
BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer);
BOOST_STATIC_ASSERT(m == 0 || a < m);
BOOST_STATIC_ASSERT(m == 0 || c < m);
/**
* Constructs a @c linear_congruential_engine, using the default seed
*/
linear_congruential_engine() { seed(); }
/**
* Constructs a @c linear_congruential_engine, seeding it with @c x0.
*/
BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(linear_congruential_engine,
IntType, x0)
{ seed(x0); }
/**
* Constructs a @c linear_congruential_engine, seeding it with values
* produced by a call to @c seq.generate().
*/
BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(linear_congruential_engine,
SeedSeq, seq)
{ seed(seq); }
/**
* Constructs a @c linear_congruential_engine and seeds it
* with values taken from the itrator range [first, last)
* and adjusts first to point to the element after the last one
* used. If there are not enough elements, throws @c std::invalid_argument.
*
* first and last must be input iterators.
*/
template<class It>
linear_congruential_engine(It& first, It last)
{
seed(first, last);
}
// compiler-generated copy constructor and assignment operator are fine
/**
* Calls seed(default_seed)
*/
void seed() { seed(default_seed); }
/**
* If c mod m is zero and x0 mod m is zero, changes the current value of
* the generator to 1. Otherwise, changes it to x0 mod m. If c is zero,
* distinct seeds in the range [1,m) will leave the generator in distinct
* states. If c is not zero, the range is [0,m).
*/
BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(linear_congruential_engine, IntType, x0)
{
// wrap _x if it doesn't fit in the destination
if(modulus == 0) {
_x = x0;
} else {
_x = x0 % modulus;
}
// handle negative seeds
if(_x <= 0 && _x != 0) {
_x += modulus;
}
// adjust to the correct range
if(increment == 0 && _x == 0) {
_x = 1;
}
BOOST_ASSERT(_x >= (min)());
BOOST_ASSERT(_x <= (max)());
}
/**
* Seeds a @c linear_congruential_engine using values from a SeedSeq.
*/
BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(linear_congruential_engine, SeedSeq, seq)
{ seed(detail::seed_one_int<IntType, m>(seq)); }
/**
* seeds a @c linear_congruential_engine with values taken
* from the itrator range [first, last) and adjusts @c first to
* point to the element after the last one used. If there are
* not enough elements, throws @c std::invalid_argument.
*
* @c first and @c last must be input iterators.
*/
template<class It>
void seed(It& first, It last)
{ seed(detail::get_one_int<IntType, m>(first, last)); }
/**
* Returns the smallest value that the @c linear_congruential_engine
* can produce.
*/
static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{ return c == 0 ? 1 : 0; }
/**
* Returns the largest value that the @c linear_congruential_engine
* can produce.
*/
static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{ return modulus-1; }
/** Returns the next value of the @c linear_congruential_engine. */
IntType operator()()
{
_x = const_mod<IntType, m>::mult_add(a, _x, c);
return _x;
}
/** Fills a range with random values */
template<class Iter>
void generate(Iter first, Iter last)
{ detail::generate_from_int(*this, first, last); }
/** Advances the state of the generator by @c z. */
void discard(boost::uintmax_t z)
{
typedef const_mod<IntType, m> mod_type;
IntType b_inv = mod_type::invert(a-1);
IntType b_gcd = mod_type::mult(a-1, b_inv);
if(b_gcd == 1) {
IntType a_z = mod_type::pow(a, z);
_x = mod_type::mult_add(a_z, _x,
mod_type::mult(mod_type::mult(c, b_inv), a_z - 1));
} else {
// compute (a^z - 1)*c % (b_gcd * m) / (b / b_gcd) * inv(b / b_gcd)
// we're storing the intermediate result / b_gcd
IntType a_zm1_over_gcd = 0;
IntType a_km1_over_gcd = (a - 1) / b_gcd;
boost::uintmax_t exponent = z;
while(exponent != 0) {
if(exponent % 2 == 1) {
a_zm1_over_gcd =
mod_type::mult_add(
b_gcd,
mod_type::mult(a_zm1_over_gcd, a_km1_over_gcd),
mod_type::add(a_zm1_over_gcd, a_km1_over_gcd));
}
a_km1_over_gcd = mod_type::mult_add(
b_gcd,
mod_type::mult(a_km1_over_gcd, a_km1_over_gcd),
mod_type::add(a_km1_over_gcd, a_km1_over_gcd));
exponent /= 2;
}
IntType a_z = mod_type::mult_add(b_gcd, a_zm1_over_gcd, 1);
IntType num = mod_type::mult(c, a_zm1_over_gcd);
b_inv = mod_type::invert((a-1)/b_gcd);
_x = mod_type::mult_add(a_z, _x, mod_type::mult(b_inv, num));
}
}
friend bool operator==(const linear_congruential_engine& x,
const linear_congruential_engine& y)
{ return x._x == y._x; }
friend bool operator!=(const linear_congruential_engine& x,
const linear_congruential_engine& y)
{ return !(x == y); }
#if !defined(BOOST_RANDOM_NO_STREAM_OPERATORS)
/** Writes a @c linear_congruential_engine to a @c std::ostream. */
template<class CharT, class Traits>
friend std::basic_ostream<CharT,Traits>&
operator<<(std::basic_ostream<CharT,Traits>& os,
const linear_congruential_engine& lcg)
{
return os << lcg._x;
}
/** Reads a @c linear_congruential_engine from a @c std::istream. */
template<class CharT, class Traits>
friend std::basic_istream<CharT,Traits>&
operator>>(std::basic_istream<CharT,Traits>& is,
linear_congruential_engine& lcg)
{
lcg.read(is);
return is;
}
#endif
private:
/// \cond show_private
template<class CharT, class Traits>
void read(std::basic_istream<CharT, Traits>& is) {
IntType x;
if(is >> x) {
if(x >= (min)() && x <= (max)()) {
_x = x;
} else {
is.setstate(std::ios_base::failbit);
}
}
}
/// \endcond
IntType _x;
};
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
// A definition is required even for integral static constants
template<class IntType, IntType a, IntType c, IntType m>
const bool linear_congruential_engine<IntType, a, c, m>::has_fixed_range;
template<class IntType, IntType a, IntType c, IntType m>
const IntType linear_congruential_engine<IntType,a,c,m>::multiplier;
template<class IntType, IntType a, IntType c, IntType m>
const IntType linear_congruential_engine<IntType,a,c,m>::increment;
template<class IntType, IntType a, IntType c, IntType m>
const IntType linear_congruential_engine<IntType,a,c,m>::modulus;
template<class IntType, IntType a, IntType c, IntType m>
const IntType linear_congruential_engine<IntType,a,c,m>::default_seed;
#endif
/// \cond show_deprecated
// provided for backwards compatibility
template<class IntType, IntType a, IntType c, IntType m, IntType val = 0>
class linear_congruential : public linear_congruential_engine<IntType, a, c, m>
{
typedef linear_congruential_engine<IntType, a, c, m> base_type;
public:
linear_congruential(IntType x0 = 1) : base_type(x0) {}
template<class It>
linear_congruential(It& first, It last) : base_type(first, last) {}
};
/// \endcond
/**
* The specialization \minstd_rand0 was originally suggested in
*
* @blockquote
* A pseudo-random number generator for the System/360, P.A. Lewis,
* A.S. Goodman, J.M. Miller, IBM Systems Journal, Vol. 8, No. 2,
* 1969, pp. 136-146
* @endblockquote
*
* It is examined more closely together with \minstd_rand in
*
* @blockquote
* "Random Number Generators: Good ones are hard to find",
* Stephen K. Park and Keith W. Miller, Communications of
* the ACM, Vol. 31, No. 10, October 1988, pp. 1192-1201
* @endblockquote
*/
typedef linear_congruential_engine<uint32_t, 16807, 0, 2147483647> minstd_rand0;
/** The specialization \minstd_rand was suggested in
*
* @blockquote
* "Random Number Generators: Good ones are hard to find",
* Stephen K. Park and Keith W. Miller, Communications of
* the ACM, Vol. 31, No. 10, October 1988, pp. 1192-1201
* @endblockquote
*/
typedef linear_congruential_engine<uint32_t, 48271, 0, 2147483647> minstd_rand;
#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T)
/**
* Class @c rand48 models a \pseudo_random_number_generator. It uses
* the linear congruential algorithm with the parameters a = 0x5DEECE66D,
* c = 0xB, m = 2**48. It delivers identical results to the @c lrand48()
* function available on some systems (assuming lcong48 has not been called).
*
* It is only available on systems where @c uint64_t is provided as an
* integral type, so that for example static in-class constants and/or
* enum definitions with large @c uint64_t numbers work.
*/
class rand48
{
public:
typedef boost::uint32_t result_type;
BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
/**
* Returns the smallest value that the generator can produce
*/
static uint32_t min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }
/**
* Returns the largest value that the generator can produce
*/
static uint32_t max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{ return 0x7FFFFFFF; }
/** Seeds the generator with the default seed. */
rand48() : lcf(cnv(static_cast<uint32_t>(1))) {}
/**
* Constructs a \rand48 generator with x(0) := (x0 << 16) | 0x330e.
*/
BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(rand48, result_type, x0)
{ seed(x0); }
/**
* Seeds the generator with values produced by @c seq.generate().
*/
BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(rand48, SeedSeq, seq)
{ seed(seq); }
/**
* Seeds the generator using values from an iterator range,
* and updates first to point one past the last value consumed.
*/
template<class It> rand48(It& first, It last) : lcf(first, last) { }
// compiler-generated copy ctor and assignment operator are fine
/** Seeds the generator with the default seed. */
void seed() { seed(static_cast<uint32_t>(1)); }
/**
* Changes the current value x(n) of the generator to (x0 << 16) | 0x330e.
*/
BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(rand48, result_type, x0)
{ lcf.seed(cnv(x0)); }
/**
* Seeds the generator using values from an iterator range,
* and updates first to point one past the last value consumed.
*/
template<class It> void seed(It& first, It last) { lcf.seed(first,last); }
/**
* Seeds the generator with values produced by @c seq.generate().
*/
BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(rand48, SeedSeq, seq)
{ lcf.seed(seq); }
/** Returns the next value of the generator. */
uint32_t operator()() { return static_cast<uint32_t>(lcf() >> 17); }
/** Advances the state of the generator by @c z. */
void discard(boost::uintmax_t z) { lcf.discard(z); }
/** Fills a range with random values */
template<class Iter>
void generate(Iter first, Iter last)
{
for(; first != last; ++first) {
*first = (*this)();
}
}
#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
/** Writes a @c rand48 to a @c std::ostream. */
template<class CharT,class Traits>
friend std::basic_ostream<CharT,Traits>&
operator<<(std::basic_ostream<CharT,Traits>& os, const rand48& r)
{ os << r.lcf; return os; }
/** Reads a @c rand48 from a @c std::istream. */
template<class CharT,class Traits>
friend std::basic_istream<CharT,Traits>&
operator>>(std::basic_istream<CharT,Traits>& is, rand48& r)
{ is >> r.lcf; return is; }
#endif
/**
* Returns true if the two generators will produce identical
* sequences of values.
*/
friend bool operator==(const rand48& x, const rand48& y)
{ return x.lcf == y.lcf; }
/**
* Returns true if the two generators will produce different
* sequences of values.
*/
friend bool operator!=(const rand48& x, const rand48& y)
{ return !(x == y); }
private:
/// \cond show_private
typedef random::linear_congruential_engine<uint64_t,
// xxxxULL is not portable
uint64_t(0xDEECE66DUL) | (uint64_t(0x5) << 32),
0xB, uint64_t(1)<<48> lcf_t;
lcf_t lcf;
static boost::uint64_t cnv(boost::uint32_t x)
{ return (static_cast<uint64_t>(x) << 16) | 0x330e; }
/// \endcond
};
#endif /* !BOOST_NO_INT64_T && !BOOST_NO_INTEGRAL_INT64_T */
} // namespace random
using random::minstd_rand0;
using random::minstd_rand;
using random::rand48;
} // namespace boost
#include <boost/random/detail/enable_warnings.hpp>
#endif // BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP
@@ -0,0 +1,161 @@
/*==============================================================================
Copyright (c) 2005-2010 Joel de Guzman
Copyright (c) 2010 Thomas Heller
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_PHOENIX_CORE_FUNCTION_EQUAL_HPP
#define BOOST_PHOENIX_CORE_FUNCTION_EQUAL_HPP
#include <boost/phoenix/core/limits.hpp>
#include <boost/is_placeholder.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/phoenix/core/terminal.hpp>
#include <boost/proto/matches.hpp>
#ifndef BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EQUAL
# include <boost/phoenix/core/detail/index_sequence.hpp>
#endif
namespace boost
{
template <typename> class weak_ptr;
}
namespace boost { namespace phoenix
{
template <typename>
struct actor;
namespace detail
{
struct compare
: proto::callable
{
typedef bool result_type;
template <typename A0, typename A1>
result_type operator()(A0 const & a0, A1 const & a1) const
{
return a0 == a1;
}
// hard wiring reference_wrapper and weak_ptr here ...
// **TODO** find out why boost bind does this ...
template <typename A0, typename A1>
result_type
operator()(
reference_wrapper<A0> const & a0
, reference_wrapper<A1> const & a1
) const
{
return a0.get_pointer() == a1.get_pointer();
}
template <typename A0, typename A1>
result_type
operator()(weak_ptr<A0> const & a0, weak_ptr<A1> const & a1) const
{
return !(a0 < a1) && !(a1 < a0);
}
};
struct function_equal_otherwise;
struct function_equal_
: proto::when<
proto::if_<
proto::matches<proto::_, proto::_state>()
, proto::or_<
proto::when<
proto::terminal<proto::_>
, compare(
proto::_value
, proto::call<
proto::_value(proto::_state)
>
)
>
, proto::otherwise<function_equal_otherwise(proto::_, proto::_state)>
>
, proto::call<function_equal_otherwise()>
>
>
{};
struct function_equal_otherwise
: proto::callable
{
typedef bool result_type;
result_type operator()() const
{
return false;
}
#ifdef BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EQUAL
template <typename Expr1>
result_type operator()(Expr1 const& e1, Expr1 const& e2) const
{
return
this->evaluate(
e1
, e2
, typename proto::arity_of<Expr1>::type()
);
}
private:
#include <boost/phoenix/core/detail/cpp03/function_equal.hpp>
#else
template <typename Expr1>
result_type operator()(Expr1 const& e1, Expr1 const& e2) const
{
return
this->evaluate(
e1
, e2
, typename make_index_sequence<proto::arity_of<Expr1>::value>::type()
);
}
private:
template <typename Expr1>
result_type
evaluate(Expr1 const& /*e1*/, Expr1 const& /*e2*/, index_sequence<>) const
{
return true;
}
template <typename Expr1, std::size_t Head, std::size_t... Tail>
result_type
evaluate(Expr1 const& e1, Expr1 const& e2, index_sequence<Head, Tail...>) const
{
return
function_equal_()(proto::child_c<Head>(e1), proto::child_c<Head>(e2)) &&
this->evaluate(
e1
, e2
, index_sequence<Tail...>()
);
}
#endif
};
}
template <typename Expr1, typename Expr2>
inline bool function_equal_impl(actor<Expr1> const& a1, actor<Expr2> const& a2)
{
return detail::function_equal_()(a1, a2);
}
template <typename Expr1, typename Expr2>
inline bool function_equal(actor<Expr1> const& a1, actor<Expr2> const& a2)
{
return function_equal_impl(a1, a2);
}
}}
#endif
@@ -0,0 +1,46 @@
/*=============================================================================
Copyright (c) 2011 Eric Niebler
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_SINGLE_VIEW_AT_IMPL_JUL_07_2011_1348PM)
#define BOOST_FUSION_SINGLE_VIEW_AT_IMPL_JUL_07_2011_1348PM
#include <boost/fusion/support/config.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/equal_to.hpp>
namespace boost { namespace fusion
{
struct single_view_tag;
namespace extension
{
template<typename Tag>
struct at_impl;
template<>
struct at_impl<single_view_tag>
{
template<typename Sequence, typename N>
struct apply
{
BOOST_MPL_ASSERT((mpl::equal_to<N, mpl::int_<0> >));
typedef typename Sequence::value_type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& seq)
{
return seq.val;
}
};
};
}
}}
#endif
@@ -0,0 +1,97 @@
// Boost common_factor_ct.hpp header file ----------------------------------//
// (C) Copyright Daryle Walker and Stephen Cleary 2001-2002.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_MATH_COMMON_FACTOR_CT_HPP
#define BOOST_MATH_COMMON_FACTOR_CT_HPP
#include <boost/math_fwd.hpp> // self include
#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT, etc.
#include <boost/mpl/integral_c.hpp>
namespace boost
{
namespace math
{
// Implementation details --------------------------------------------------//
namespace detail
{
// Build GCD with Euclid's recursive algorithm
template < static_gcd_type Value1, static_gcd_type Value2 >
struct static_gcd_helper_t
{
private:
BOOST_STATIC_CONSTANT( static_gcd_type, new_value1 = Value2 );
BOOST_STATIC_CONSTANT( static_gcd_type, new_value2 = Value1 % Value2 );
#ifndef __BORLANDC__
#define BOOST_DETAIL_GCD_HELPER_VAL(Value) static_cast<static_gcd_type>(Value)
#else
typedef static_gcd_helper_t self_type;
#define BOOST_DETAIL_GCD_HELPER_VAL(Value) (self_type:: Value )
#endif
typedef static_gcd_helper_t< BOOST_DETAIL_GCD_HELPER_VAL(new_value1),
BOOST_DETAIL_GCD_HELPER_VAL(new_value2) > next_step_type;
#undef BOOST_DETAIL_GCD_HELPER_VAL
public:
BOOST_STATIC_CONSTANT( static_gcd_type, value = next_step_type::value );
};
// Non-recursive case
template < static_gcd_type Value1 >
struct static_gcd_helper_t< Value1, 0UL >
{
BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 );
};
// Build the LCM from the GCD
template < static_gcd_type Value1, static_gcd_type Value2 >
struct static_lcm_helper_t
{
typedef static_gcd_helper_t<Value1, Value2> gcd_type;
BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 / gcd_type::value
* Value2 );
};
// Special case for zero-GCD values
template < >
struct static_lcm_helper_t< 0UL, 0UL >
{
BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL );
};
} // namespace detail
// Compile-time greatest common divisor evaluator class declaration --------//
template < static_gcd_type Value1, static_gcd_type Value2 >
struct static_gcd : public mpl::integral_c<static_gcd_type, (detail::static_gcd_helper_t<Value1, Value2>::value) >
{
}; // boost::math::static_gcd
// Compile-time least common multiple evaluator class declaration ----------//
template < static_gcd_type Value1, static_gcd_type Value2 >
struct static_lcm : public mpl::integral_c<static_gcd_type, (detail::static_lcm_helper_t<Value1, Value2>::value) >
{
}; // boost::math::static_lcm
} // namespace math
} // namespace boost
#endif // BOOST_MATH_COMMON_FACTOR_CT_HPP
@@ -0,0 +1,48 @@
#ifndef BOOST_MPL_RANGE_C_HPP_INCLUDED
#define BOOST_MPL_RANGE_C_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/integral_c.hpp>
#include <boost/mpl/aux_/range_c/front.hpp>
#include <boost/mpl/aux_/range_c/back.hpp>
#include <boost/mpl/aux_/range_c/size.hpp>
#include <boost/mpl/aux_/range_c/O1_size.hpp>
#include <boost/mpl/aux_/range_c/empty.hpp>
#include <boost/mpl/aux_/range_c/iterator.hpp>
#include <boost/mpl/aux_/range_c/tag.hpp>
namespace boost { namespace mpl {
template<
typename T
, T Start
, T Finish
>
struct range_c
{
typedef aux::half_open_range_tag tag;
typedef T value_type;
typedef range_c type;
typedef integral_c<T,Start> start;
typedef integral_c<T,Finish> finish;
typedef r_iter<start> begin;
typedef r_iter<finish> end;
};
}}
#endif // BOOST_MPL_RANGE_C_HPP_INCLUDED
@@ -0,0 +1,55 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_ARRAY_INSERT_HPP
# define BOOST_PREPROCESSOR_ARRAY_INSERT_HPP
#
# include <boost/preprocessor/arithmetic/inc.hpp>
# include <boost/preprocessor/array/elem.hpp>
# include <boost/preprocessor/array/push_back.hpp>
# include <boost/preprocessor/array/size.hpp>
# include <boost/preprocessor/comparison/not_equal.hpp>
# include <boost/preprocessor/control/deduce_d.hpp>
# include <boost/preprocessor/control/iif.hpp>
# include <boost/preprocessor/control/while.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
#
# /* BOOST_PP_ARRAY_INSERT */
#
# define BOOST_PP_ARRAY_INSERT(array, i, elem) BOOST_PP_ARRAY_INSERT_I(BOOST_PP_DEDUCE_D(), array, i, elem)
# define BOOST_PP_ARRAY_INSERT_I(d, array, i, elem) BOOST_PP_ARRAY_INSERT_D(d, array, i, elem)
#
# /* BOOST_PP_ARRAY_INSERT_D */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_ARRAY_INSERT_D(d, array, i, elem) BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_INSERT_P, BOOST_PP_ARRAY_INSERT_O, (0, i, elem, (0, ()), array)))
# else
# define BOOST_PP_ARRAY_INSERT_D(d, array, i, elem) BOOST_PP_ARRAY_INSERT_D_I(d, array, i, elem)
# define BOOST_PP_ARRAY_INSERT_D_I(d, array, i, elem) BOOST_PP_TUPLE_ELEM(5, 3, BOOST_PP_WHILE_ ## d(BOOST_PP_ARRAY_INSERT_P, BOOST_PP_ARRAY_INSERT_O, (0, i, elem, (0, ()), array)))
# endif
#
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
# define BOOST_PP_ARRAY_INSERT_P(d, state) BOOST_PP_ARRAY_INSERT_P_I state
# else
# define BOOST_PP_ARRAY_INSERT_P(d, state) BOOST_PP_ARRAY_INSERT_P_I(nil, nil, nil, BOOST_PP_TUPLE_ELEM(5, 3, state), BOOST_PP_TUPLE_ELEM(5, 4, state))
# endif
#
# define BOOST_PP_ARRAY_INSERT_P_I(_i, _ii, _iii, res, arr) BOOST_PP_NOT_EQUAL(BOOST_PP_ARRAY_SIZE(res), BOOST_PP_INC(BOOST_PP_ARRAY_SIZE(arr)))
#
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
# define BOOST_PP_ARRAY_INSERT_O(d, state) BOOST_PP_ARRAY_INSERT_O_I state
# else
# define BOOST_PP_ARRAY_INSERT_O(d, state) BOOST_PP_ARRAY_INSERT_O_I(BOOST_PP_TUPLE_ELEM(5, 0, state), BOOST_PP_TUPLE_ELEM(5, 1, state), BOOST_PP_TUPLE_ELEM(5, 2, state), BOOST_PP_TUPLE_ELEM(5, 3, state), BOOST_PP_TUPLE_ELEM(5, 4, state))
# endif
#
# define BOOST_PP_ARRAY_INSERT_O_I(n, i, elem, res, arr) (BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(BOOST_PP_ARRAY_SIZE(res), i), BOOST_PP_INC(n), n), i, elem, BOOST_PP_ARRAY_PUSH_BACK(res, BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(BOOST_PP_ARRAY_SIZE(res), i), BOOST_PP_ARRAY_ELEM(n, arr), elem)), arr)
#
# endif
@@ -0,0 +1,58 @@
//-----------------------------------------------------------------------------
// boost variant/detail/over_sequence.hpp header file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003
// Eric Friedman
//
// Portions Copyright (C) 2002 David Abrahams
//
// 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_VARIANT_DETAIL_OVER_SEQUENCE_HPP
#define BOOST_VARIANT_DETAIL_OVER_SEQUENCE_HPP
#include <boost/mpl/aux_/config/ctps.hpp>
namespace boost {
namespace detail { namespace variant {
///////////////////////////////////////////////////////////////////////////////
// (detail) class over_sequence
//
// Wrapper used to indicate bounded types for variant are from type sequence.
//
template <typename Types>
struct over_sequence
{
typedef Types type;
};
///////////////////////////////////////////////////////////////////////////////
// (detail) metafunction is_over_sequence (modeled on code by David Abrahams)
//
// Indicates whether the specified type is of form over_sequence<...> or not.
//
template <typename T>
struct is_over_sequence
: mpl::false_
{
};
template <typename Types>
struct is_over_sequence< over_sequence<Types> >
: mpl::true_
{
};
}} // namespace detail::variant
} // namespace boost
#endif // BOOST_VARIANT_DETAIL_OVER_SEQUENCE_HPP
@@ -0,0 +1,23 @@
# gnuplot script for "Percent copy" figure
# run: gnuplot fig_wer.gnuplot
# then: pdflatex fig_wer.tex
#
set term epslatex standalone size 6in,4in
set output "fig_wer.tex"
set xlabel "$E_b/N_0$ (dB)"
set ylabel "Word Error Rate"
set style func linespoints
set key off
set tics in
set mxtics 2
set mytics 10
set grid
set logscale y
plot [3:7] "ftdata-100000.dat" using ($1+29.1):(1-$2) with linespoints lt 1 pt 7 title 'FT-100K', \
"ftdata-10000.dat" using ($1+29.1):(1-$2) with linespoints lt 1 pt 7 title 'FT-10K', \
"ftdata-1000.dat" using ($1+29.1):(1-$2) with linespoints lt 1 pt 7 title 'FT-1K', \
"kvasd-8.dat" using ($1+29.1):(1-$2) with linespoints lt 2 pt 8 title 'KV-8', \
"kvasd-12.dat" using ($1+29.1):(1-$2) with linespoints lt 2 pt 8 title 'KV-12', \
"kvasd-15.dat" using ($1+29.1):(1-$2) with linespoints lt 2 pt 8 title 'KV-15', \
"bmdata.dat" using ($1+29.1):(1-$2) with linespoints pt 7 title 'BM', \
"wer.lab" with labels
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,39 @@
#ifndef BOOST_MPL_CLEAR_HPP_INCLUDED
#define BOOST_MPL_CLEAR_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/clear_fwd.hpp>
#include <boost/mpl/aux_/clear_impl.hpp>
#include <boost/mpl/sequence_tag.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
namespace boost { namespace mpl {
template<
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
>
struct clear
: clear_impl< typename sequence_tag<Sequence>::type >
::template apply< Sequence >
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,clear,(Sequence))
};
BOOST_MPL_AUX_NA_SPEC(1, clear)
}}
#endif // BOOST_MPL_CLEAR_HPP_INCLUDED
@@ -0,0 +1,124 @@
/*=============================================================================
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_TRANSFORM_VIEW_07162005_1037)
#define FUSION_TRANSFORM_VIEW_07162005_1037
#include <boost/fusion/support/config.hpp>
#include <boost/static_assert.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/is_view.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/view/transform_view/transform_view_iterator.hpp>
#include <boost/fusion/view/transform_view/transform_view_fwd.hpp>
#include <boost/fusion/view/transform_view/detail/begin_impl.hpp>
#include <boost/fusion/view/transform_view/detail/end_impl.hpp>
#include <boost/fusion/view/transform_view/detail/at_impl.hpp>
#include <boost/fusion/view/transform_view/detail/value_at_impl.hpp>
#include <boost/fusion/view/detail/strictest_traversal.hpp>
#include <boost/fusion/container/vector/vector10.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct void_;
struct transform_view_tag;
struct transform_view2_tag;
struct fusion_sequence_tag;
// Binary Version
template <typename Sequence1, typename Sequence2, typename F>
struct transform_view : sequence_base<transform_view<Sequence1, Sequence2, F> >
{
BOOST_STATIC_ASSERT(result_of::size<Sequence1>::value == result_of::size<Sequence2>::value);
typedef transform_view2_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef typename traits::category_of<Sequence1>::type category1;
typedef typename traits::category_of<Sequence2>::type category2;
typedef typename detail::strictest_traversal<
fusion::vector2<Sequence1, Sequence2> >::type category;
typedef typename result_of::begin<Sequence1>::type first1_type;
typedef typename result_of::begin<Sequence2>::type first2_type;
typedef typename result_of::end<Sequence1>::type last1_type;
typedef typename result_of::end<Sequence2>::type last2_type;
typedef typename result_of::size<Sequence1>::type size;
typedef Sequence1 sequence1_type;
typedef Sequence2 sequence2_type;
typedef F transform_type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
transform_view(Sequence1& in_seq1, Sequence2& in_seq2, F const& binop)
: f(binop)
, seq1(in_seq1)
, seq2(in_seq2)
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
first1_type first1() const { return fusion::begin(seq1); }
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
first2_type first2() const { return fusion::begin(seq2); }
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
last1_type last1() const { return fusion::end(seq1); }
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
last2_type last2() const { return fusion::end(seq2); }
transform_type f;
typename mpl::if_<traits::is_view<Sequence1>, Sequence1, Sequence1&>::type seq1;
typename mpl::if_<traits::is_view<Sequence2>, Sequence2, Sequence2&>::type seq2;
private:
// silence MSVC warning C4512: assignment operator could not be generated
transform_view& operator= (transform_view const&);
};
// Unary Version
template <typename Sequence, typename F>
#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
struct transform_view<Sequence, F, void_> : sequence_base<transform_view<Sequence, F, void_> >
#else
struct transform_view<Sequence, F> : sequence_base<transform_view<Sequence, F> >
#endif
{
typedef transform_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef typename traits::category_of<Sequence>::type category;
typedef typename result_of::begin<Sequence>::type first_type;
typedef typename result_of::end<Sequence>::type last_type;
typedef typename result_of::size<Sequence>::type size;
typedef Sequence sequence_type;
typedef F transform_type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
transform_view(Sequence& in_seq, F const& in_f)
: seq(in_seq)
, f(in_f)
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
first_type first() const { return fusion::begin(seq); }
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
last_type last() const { return fusion::end(seq); }
typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq;
transform_type f;
private:
// silence MSVC warning C4512: assignment operator could not be generated
transform_view& operator= (transform_view const&);
};
}}
#endif
@@ -0,0 +1,844 @@
// Boost string_algo library erase.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2006.
//
// 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 updates, documentation, and revision history.
#ifndef BOOST_STRING_ERASE_HPP
#define BOOST_STRING_ERASE_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/algorithm/string/find_format.hpp>
#include <boost/algorithm/string/finder.hpp>
#include <boost/algorithm/string/formatter.hpp>
/*! \file
Defines various erase algorithms. Each algorithm removes
part(s) of the input according to a searching criteria.
*/
namespace boost {
namespace algorithm {
// erase_range -------------------------------------------------------//
//! Erase range algorithm
/*!
Remove the given range from the input. The result is a modified copy of
the input. It is returned as a sequence or copied to the output iterator.
\param Output An output iterator to which the result will be copied
\param Input An input sequence
\param SearchRange A range in the input to be removed
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<typename OutputIteratorT, typename RangeT>
inline OutputIteratorT erase_range_copy(
OutputIteratorT Output,
const RangeT& Input,
const iterator_range<
BOOST_STRING_TYPENAME
range_const_iterator<RangeT>::type>& SearchRange )
{
return ::boost::algorithm::find_format_copy(
Output,
Input,
::boost::algorithm::range_finder(SearchRange),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase range algorithm
/*!
\overload
*/
template<typename SequenceT>
inline SequenceT erase_range_copy(
const SequenceT& Input,
const iterator_range<
BOOST_STRING_TYPENAME
range_const_iterator<SequenceT>::type>& SearchRange )
{
return ::boost::algorithm::find_format_copy(
Input,
::boost::algorithm::range_finder(SearchRange),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase range algorithm
/*!
Remove the given range from the input.
The input sequence is modified in-place.
\param Input An input sequence
\param SearchRange A range in the input to be removed
*/
template<typename SequenceT>
inline void erase_range(
SequenceT& Input,
const iterator_range<
BOOST_STRING_TYPENAME
range_iterator<SequenceT>::type>& SearchRange )
{
::boost::algorithm::find_format(
Input,
::boost::algorithm::range_finder(SearchRange),
::boost::algorithm::empty_formatter(Input) );
}
// erase_first --------------------------------------------------------//
//! Erase first algorithm
/*!
Remove the first occurrence of the substring from the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
\param Output An output iterator to which the result will be copied
\param Input An input string
\param Search A substring to be searched for
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<
typename OutputIteratorT,
typename Range1T,
typename Range2T>
inline OutputIteratorT erase_first_copy(
OutputIteratorT Output,
const Range1T& Input,
const Range2T& Search )
{
return ::boost::algorithm::find_format_copy(
Output,
Input,
::boost::algorithm::first_finder(Search),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase first algorithm
/*!
\overload
*/
template<typename SequenceT, typename RangeT>
inline SequenceT erase_first_copy(
const SequenceT& Input,
const RangeT& Search )
{
return ::boost::algorithm::find_format_copy(
Input,
::boost::algorithm::first_finder(Search),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase first algorithm
/*!
Remove the first occurrence of the substring from the input.
The input sequence is modified in-place.
\param Input An input string
\param Search A substring to be searched for.
*/
template<typename SequenceT, typename RangeT>
inline void erase_first(
SequenceT& Input,
const RangeT& Search )
{
::boost::algorithm::find_format(
Input,
::boost::algorithm::first_finder(Search),
::boost::algorithm::empty_formatter(Input) );
}
// erase_first ( case insensitive ) ------------------------------------//
//! Erase first algorithm ( case insensitive )
/*!
Remove the first occurrence of the substring from the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
Searching is case insensitive.
\param Output An output iterator to which the result will be copied
\param Input An input string
\param Search A substring to be searched for
\param Loc A locale used for case insensitive comparison
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<
typename OutputIteratorT,
typename Range1T,
typename Range2T>
inline OutputIteratorT ierase_first_copy(
OutputIteratorT Output,
const Range1T& Input,
const Range2T& Search,
const std::locale& Loc=std::locale() )
{
return ::boost::algorithm::find_format_copy(
Output,
Input,
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase first algorithm ( case insensitive )
/*!
\overload
*/
template<typename SequenceT, typename RangeT>
inline SequenceT ierase_first_copy(
const SequenceT& Input,
const RangeT& Search,
const std::locale& Loc=std::locale() )
{
return ::boost::algorithm::find_format_copy(
Input,
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase first algorithm ( case insensitive )
/*!
Remove the first occurrence of the substring from the input.
The input sequence is modified in-place. Searching is case insensitive.
\param Input An input string
\param Search A substring to be searched for
\param Loc A locale used for case insensitive comparison
*/
template<typename SequenceT, typename RangeT>
inline void ierase_first(
SequenceT& Input,
const RangeT& Search,
const std::locale& Loc=std::locale() )
{
::boost::algorithm::find_format(
Input,
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
// erase_last --------------------------------------------------------//
//! Erase last algorithm
/*!
Remove the last occurrence of the substring from the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
\param Output An output iterator to which the result will be copied
\param Input An input string
\param Search A substring to be searched for.
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<
typename OutputIteratorT,
typename Range1T,
typename Range2T>
inline OutputIteratorT erase_last_copy(
OutputIteratorT Output,
const Range1T& Input,
const Range2T& Search )
{
return ::boost::algorithm::find_format_copy(
Output,
Input,
::boost::algorithm::last_finder(Search),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase last algorithm
/*!
\overload
*/
template<typename SequenceT, typename RangeT>
inline SequenceT erase_last_copy(
const SequenceT& Input,
const RangeT& Search )
{
return ::boost::algorithm::find_format_copy(
Input,
::boost::algorithm::last_finder(Search),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase last algorithm
/*!
Remove the last occurrence of the substring from the input.
The input sequence is modified in-place.
\param Input An input string
\param Search A substring to be searched for
*/
template<typename SequenceT, typename RangeT>
inline void erase_last(
SequenceT& Input,
const RangeT& Search )
{
::boost::algorithm::find_format(
Input,
::boost::algorithm::last_finder(Search),
::boost::algorithm::empty_formatter(Input) );
}
// erase_last ( case insensitive ) ------------------------------------//
//! Erase last algorithm ( case insensitive )
/*!
Remove the last occurrence of the substring from the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
Searching is case insensitive.
\param Output An output iterator to which the result will be copied
\param Input An input string
\param Search A substring to be searched for
\param Loc A locale used for case insensitive comparison
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<
typename OutputIteratorT,
typename Range1T,
typename Range2T>
inline OutputIteratorT ierase_last_copy(
OutputIteratorT Output,
const Range1T& Input,
const Range2T& Search,
const std::locale& Loc=std::locale() )
{
return ::boost::algorithm::find_format_copy(
Output,
Input,
::boost::algorithm::last_finder(Search, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase last algorithm ( case insensitive )
/*!
\overload
*/
template<typename SequenceT, typename RangeT>
inline SequenceT ierase_last_copy(
const SequenceT& Input,
const RangeT& Search,
const std::locale& Loc=std::locale() )
{
return ::boost::algorithm::find_format_copy(
Input,
::boost::algorithm::last_finder(Search, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase last algorithm ( case insensitive )
/*!
Remove the last occurrence of the substring from the input.
The input sequence is modified in-place. Searching is case insensitive.
\param Input An input string
\param Search A substring to be searched for
\param Loc A locale used for case insensitive comparison
*/
template<typename SequenceT, typename RangeT>
inline void ierase_last(
SequenceT& Input,
const RangeT& Search,
const std::locale& Loc=std::locale() )
{
::boost::algorithm::find_format(
Input,
::boost::algorithm::last_finder(Search, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
// erase_nth --------------------------------------------------------------------//
//! Erase nth algorithm
/*!
Remove the Nth occurrence of the substring in the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
\param Output An output iterator to which the result will be copied
\param Input An input string
\param Search A substring to be searched for
\param Nth An index of the match to be replaced. The index is 0-based.
For negative N, matches are counted from the end of string.
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<
typename OutputIteratorT,
typename Range1T,
typename Range2T>
inline OutputIteratorT erase_nth_copy(
OutputIteratorT Output,
const Range1T& Input,
const Range2T& Search,
int Nth )
{
return ::boost::algorithm::find_format_copy(
Output,
Input,
::boost::algorithm::nth_finder(Search, Nth),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase nth algorithm
/*!
\overload
*/
template<typename SequenceT, typename RangeT>
inline SequenceT erase_nth_copy(
const SequenceT& Input,
const RangeT& Search,
int Nth )
{
return ::boost::algorithm::find_format_copy(
Input,
::boost::algorithm::nth_finder(Search, Nth),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase nth algorithm
/*!
Remove the Nth occurrence of the substring in the input.
The input sequence is modified in-place.
\param Input An input string
\param Search A substring to be searched for.
\param Nth An index of the match to be replaced. The index is 0-based.
For negative N, matches are counted from the end of string.
*/
template<typename SequenceT, typename RangeT>
inline void erase_nth(
SequenceT& Input,
const RangeT& Search,
int Nth )
{
::boost::algorithm::find_format(
Input,
::boost::algorithm::nth_finder(Search, Nth),
::boost::algorithm::empty_formatter(Input) );
}
// erase_nth ( case insensitive ) ---------------------------------------------//
//! Erase nth algorithm ( case insensitive )
/*!
Remove the Nth occurrence of the substring in the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
Searching is case insensitive.
\param Output An output iterator to which the result will be copied
\param Input An input string
\param Search A substring to be searched for.
\param Nth An index of the match to be replaced. The index is 0-based.
For negative N, matches are counted from the end of string.
\param Loc A locale used for case insensitive comparison
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<
typename OutputIteratorT,
typename Range1T,
typename Range2T>
inline OutputIteratorT ierase_nth_copy(
OutputIteratorT Output,
const Range1T& Input,
const Range2T& Search,
int Nth,
const std::locale& Loc=std::locale() )
{
return ::boost::algorithm::find_format_copy(
Output,
Input,
::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase nth algorithm
/*!
\overload
*/
template<typename SequenceT, typename RangeT>
inline SequenceT ierase_nth_copy(
const SequenceT& Input,
const RangeT& Search,
int Nth,
const std::locale& Loc=std::locale() )
{
return ::boost::algorithm::find_format_copy(
Input,
::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
empty_formatter(Input) );
}
//! Erase nth algorithm
/*!
Remove the Nth occurrence of the substring in the input.
The input sequence is modified in-place. Searching is case insensitive.
\param Input An input string
\param Search A substring to be searched for.
\param Nth An index of the match to be replaced. The index is 0-based.
For negative N, matches are counted from the end of string.
\param Loc A locale used for case insensitive comparison
*/
template<typename SequenceT, typename RangeT>
inline void ierase_nth(
SequenceT& Input,
const RangeT& Search,
int Nth,
const std::locale& Loc=std::locale() )
{
::boost::algorithm::find_format(
Input,
::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
// erase_all --------------------------------------------------------//
//! Erase all algorithm
/*!
Remove all the occurrences of the string from the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
\param Output An output iterator to which the result will be copied
\param Input An input sequence
\param Search A substring to be searched for.
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<
typename OutputIteratorT,
typename Range1T,
typename Range2T>
inline OutputIteratorT erase_all_copy(
OutputIteratorT Output,
const Range1T& Input,
const Range2T& Search )
{
return ::boost::algorithm::find_format_all_copy(
Output,
Input,
::boost::algorithm::first_finder(Search),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase all algorithm
/*!
\overload
*/
template<typename SequenceT, typename RangeT>
inline SequenceT erase_all_copy(
const SequenceT& Input,
const RangeT& Search )
{
return ::boost::algorithm::find_format_all_copy(
Input,
::boost::algorithm::first_finder(Search),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase all algorithm
/*!
Remove all the occurrences of the string from the input.
The input sequence is modified in-place.
\param Input An input string
\param Search A substring to be searched for.
*/
template<typename SequenceT, typename RangeT>
inline void erase_all(
SequenceT& Input,
const RangeT& Search )
{
::boost::algorithm::find_format_all(
Input,
::boost::algorithm::first_finder(Search),
::boost::algorithm::empty_formatter(Input) );
}
// erase_all ( case insensitive ) ------------------------------------//
//! Erase all algorithm ( case insensitive )
/*!
Remove all the occurrences of the string from the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
Searching is case insensitive.
\param Output An output iterator to which the result will be copied
\param Input An input string
\param Search A substring to be searched for
\param Loc A locale used for case insensitive comparison
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<
typename OutputIteratorT,
typename Range1T,
typename Range2T>
inline OutputIteratorT ierase_all_copy(
OutputIteratorT Output,
const Range1T& Input,
const Range2T& Search,
const std::locale& Loc=std::locale() )
{
return ::boost::algorithm::find_format_all_copy(
Output,
Input,
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase all algorithm ( case insensitive )
/*!
\overload
*/
template<typename SequenceT, typename RangeT>
inline SequenceT ierase_all_copy(
const SequenceT& Input,
const RangeT& Search,
const std::locale& Loc=std::locale() )
{
return ::boost::algorithm::find_format_all_copy(
Input,
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
//! Erase all algorithm ( case insensitive )
/*!
Remove all the occurrences of the string from the input.
The input sequence is modified in-place. Searching is case insensitive.
\param Input An input string
\param Search A substring to be searched for.
\param Loc A locale used for case insensitive comparison
*/
template<typename SequenceT, typename RangeT>
inline void ierase_all(
SequenceT& Input,
const RangeT& Search,
const std::locale& Loc=std::locale() )
{
::boost::algorithm::find_format_all(
Input,
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
::boost::algorithm::empty_formatter(Input) );
}
// erase_head --------------------------------------------------------------------//
//! Erase head algorithm
/*!
Remove the head from the input. The head is a prefix of a sequence of given size.
If the sequence is shorter then required, the whole string is
considered to be the head. The result is a modified copy of the input.
It is returned as a sequence or copied to the output iterator.
\param Output An output iterator to which the result will be copied
\param Input An input string
\param N Length of the head.
For N>=0, at most N characters are extracted.
For N<0, size(Input)-|N| characters are extracted.
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<
typename OutputIteratorT,
typename RangeT>
inline OutputIteratorT erase_head_copy(
OutputIteratorT Output,
const RangeT& Input,
int N )
{
return ::boost::algorithm::find_format_copy(
Output,
Input,
::boost::algorithm::head_finder(N),
::boost::algorithm::empty_formatter( Input ) );
}
//! Erase head algorithm
/*!
\overload
*/
template<typename SequenceT>
inline SequenceT erase_head_copy(
const SequenceT& Input,
int N )
{
return ::boost::algorithm::find_format_copy(
Input,
::boost::algorithm::head_finder(N),
::boost::algorithm::empty_formatter( Input ) );
}
//! Erase head algorithm
/*!
Remove the head from the input. The head is a prefix of a sequence of given size.
If the sequence is shorter then required, the whole string is
considered to be the head. The input sequence is modified in-place.
\param Input An input string
\param N Length of the head
For N>=0, at most N characters are extracted.
For N<0, size(Input)-|N| characters are extracted.
*/
template<typename SequenceT>
inline void erase_head(
SequenceT& Input,
int N )
{
::boost::algorithm::find_format(
Input,
::boost::algorithm::head_finder(N),
::boost::algorithm::empty_formatter( Input ) );
}
// erase_tail --------------------------------------------------------------------//
//! Erase tail algorithm
/*!
Remove the tail from the input. The tail is a suffix of a sequence of given size.
If the sequence is shorter then required, the whole string is
considered to be the tail.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
\param Output An output iterator to which the result will be copied
\param Input An input string
\param N Length of the tail.
For N>=0, at most N characters are extracted.
For N<0, size(Input)-|N| characters are extracted.
\return An output iterator pointing just after the last inserted character or
a modified copy of the input
\note The second variant of this function provides the strong exception-safety guarantee
*/
template<
typename OutputIteratorT,
typename RangeT>
inline OutputIteratorT erase_tail_copy(
OutputIteratorT Output,
const RangeT& Input,
int N )
{
return ::boost::algorithm::find_format_copy(
Output,
Input,
::boost::algorithm::tail_finder(N),
::boost::algorithm::empty_formatter( Input ) );
}
//! Erase tail algorithm
/*!
\overload
*/
template<typename SequenceT>
inline SequenceT erase_tail_copy(
const SequenceT& Input,
int N )
{
return ::boost::algorithm::find_format_copy(
Input,
::boost::algorithm::tail_finder(N),
::boost::algorithm::empty_formatter( Input ) );
}
//! Erase tail algorithm
/*!
Remove the tail from the input. The tail is a suffix of a sequence of given size.
If the sequence is shorter then required, the whole string is
considered to be the tail. The input sequence is modified in-place.
\param Input An input string
\param N Length of the tail
For N>=0, at most N characters are extracted.
For N<0, size(Input)-|N| characters are extracted.
*/
template<typename SequenceT>
inline void erase_tail(
SequenceT& Input,
int N )
{
::boost::algorithm::find_format(
Input,
::boost::algorithm::tail_finder(N),
::boost::algorithm::empty_formatter( Input ) );
}
} // namespace algorithm
// pull names into the boost namespace
using algorithm::erase_range_copy;
using algorithm::erase_range;
using algorithm::erase_first_copy;
using algorithm::erase_first;
using algorithm::ierase_first_copy;
using algorithm::ierase_first;
using algorithm::erase_last_copy;
using algorithm::erase_last;
using algorithm::ierase_last_copy;
using algorithm::ierase_last;
using algorithm::erase_nth_copy;
using algorithm::erase_nth;
using algorithm::ierase_nth_copy;
using algorithm::ierase_nth;
using algorithm::erase_all_copy;
using algorithm::erase_all;
using algorithm::ierase_all_copy;
using algorithm::ierase_all;
using algorithm::erase_head_copy;
using algorithm::erase_head;
using algorithm::erase_tail_copy;
using algorithm::erase_tail;
} // namespace boost
#endif // BOOST_ERASE_HPP
@@ -0,0 +1,137 @@
module ft8_decode
type :: ft8_decoder
procedure(ft8_decode_callback), pointer :: callback
contains
procedure :: decode
end type ft8_decoder
abstract interface
subroutine ft8_decode_callback (this,sync,snr,dt,freq,decoded,nap,qual)
import ft8_decoder
implicit none
class(ft8_decoder), intent(inout) :: this
real, intent(in) :: sync
integer, intent(in) :: snr
real, intent(in) :: dt
real, intent(in) :: freq
character(len=22), intent(in) :: decoded
integer, intent(in) :: nap
real, intent(in) :: qual
end subroutine ft8_decode_callback
end interface
contains
subroutine decode(this,callback,iwave,nQSOProgress,nfqso,nftx,newdat, &
nutc,nfa,nfb,nexp_decode,ndepth,nagain,lapon,napwid,mycall12, &
mygrid6,hiscall12,hisgrid6)
! use wavhdr
use timer_module, only: timer
include 'fsk4hf/ft8_params.f90'
! type(hdr) h
class(ft8_decoder), intent(inout) :: this
procedure(ft8_decode_callback) :: callback
real s(NH1,NHSYM)
real candidate(3,200)
real dd(15*12000)
logical, intent(in) :: lapon,nagain
logical newdat,lsubtract,ldupe,bcontest
character*12 mycall12, hiscall12
character*6 mygrid6,hisgrid6
integer*2 iwave(15*12000)
integer apsym(KK)
character datetime*13,message*22
character*22 allmessages(100)
integer allsnrs(100)
save s,dd
bcontest=iand(nexp_decode,128).ne.0
this%callback => callback
write(datetime,1001) nutc !### TEMPORARY ###
1001 format("000000_",i6.6)
call ft8apset(mycall12,mygrid6,hiscall12,hisgrid6,bcontest,apsym,iaptype)
dd=iwave
ndecodes=0
allmessages=' '
allsnrs=0
ifa=nfa
ifb=nfb
if(nagain) then
ifa=nfqso-10
ifb=nfqso+10
endif
! For now:
! ndepth=1: no subtraction, 1 pass, belief propagation only
! ndepth=2: subtraction, 2 passes, belief propagation only
! ndepth=3: subtraction, 2 passes, bp+osd
if(ndepth.eq.1) npass=1
if(ndepth.ge.2) npass=3
do ipass=1,npass
newdat=.true. ! Is this a problem? I hijacked newdat.
syncmin=1.5
if(ipass.eq.1) then
lsubtract=.true.
if(ndepth.eq.1) lsubtract=.false.
elseif(ipass.eq.2) then
n2=ndecodes
if(ndecodes.eq.0) cycle
lsubtract=.true.
elseif(ipass.eq.3) then
if((ndecodes-n2).eq.0) cycle
lsubtract=.false.
endif
call timer('sync8 ',0)
call sync8(dd,ifa,ifb,syncmin,nfqso,s,candidate,ncand)
call timer('sync8 ',1)
do icand=1,ncand
sync=candidate(3,icand)
f1=candidate(1,icand)
xdt=candidate(2,icand)
nsnr0=min(99,nint(10.0*log10(sync) - 25.5)) !### empirical ###
call timer('ft8b ',0)
call ft8b(dd,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,napwid, &
lsubtract,nagain,iaptype,mygrid6,bcontest,sync,f1,xdt,apsym, &
nharderrors,dmin,nbadcrc,iappass,iera,message,xsnr)
nsnr=nint(xsnr)
xdt=xdt-0.5
hd=nharderrors+dmin
call timer('ft8b ',1)
if(nbadcrc.eq.0) then
! call jtmsg(message,iflag)
if(bcontest) call fix_contest_msg(mygrid6,message)
! if(iand(iflag,31).ne.0) message(22:22)='?'
ldupe=.false.
do id=1,ndecodes
if(message.eq.allmessages(id).and.nsnr.le.allsnrs(id)) ldupe=.true.
enddo
if(.not.ldupe) then
ndecodes=ndecodes+1
allmessages(ndecodes)=message
allsnrs(ndecodes)=nsnr
endif
! write(81,1004) nutc,ncand,icand,ipass,iaptype,iappass, &
! nharderrors,dmin,hd,min(sync,999.0),nint(xsnr), &
! xdt,nint(f1),message
!1004 format(i6.6,2i4,3i2,i3,3f6.1,i4,f6.2,i5,2x,a22)
! flush(81)
if(.not.ldupe .and. associated(this%callback)) then
qual=1.0-(nharderrors+dmin)/60.0 ! scale qual to [0.0,1.0]
call this%callback(sync,nsnr,xdt,f1,message,iaptype,qual)
endif
endif
enddo
! h=default_header(12000,NMAX)
! open(10,file='subtract.wav',status='unknown',access='stream')
! iwave=nint(dd)
! write(10) h,iwave
! close(10)
enddo
return
end subroutine decode
end module ft8_decode
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,151 @@
#ifndef BOOST_CORE_TYPEINFO_HPP_INCLUDED
#define BOOST_CORE_TYPEINFO_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// core::typeinfo, BOOST_CORE_TYPEID
//
// Copyright 2007, 2014 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp>
#if defined( BOOST_NO_TYPEID )
#include <boost/current_function.hpp>
#include <functional>
namespace boost
{
namespace core
{
class typeinfo
{
private:
typeinfo( typeinfo const& );
typeinfo& operator=( typeinfo const& );
char const * name_;
public:
explicit typeinfo( char const * name ): name_( name )
{
}
bool operator==( typeinfo const& rhs ) const
{
return this == &rhs;
}
bool operator!=( typeinfo const& rhs ) const
{
return this != &rhs;
}
bool before( typeinfo const& rhs ) const
{
return std::less< typeinfo const* >()( this, &rhs );
}
char const* name() const
{
return name_;
}
};
inline char const * demangled_name( core::typeinfo const & ti )
{
return ti.name();
}
} // namespace core
namespace detail
{
template<class T> struct core_typeid_
{
static boost::core::typeinfo ti_;
static char const * name()
{
return BOOST_CURRENT_FUNCTION;
}
};
#if defined(__SUNPRO_CC)
// see #4199, the Sun Studio compiler gets confused about static initialization
// constructor arguments. But an assignment works just fine.
template<class T> boost::core::typeinfo core_typeid_< T >::ti_ = core_typeid_< T >::name();
#else
template<class T> boost::core::typeinfo core_typeid_< T >::ti_(core_typeid_< T >::name());
#endif
template<class T> struct core_typeid_< T & >: core_typeid_< T >
{
};
template<class T> struct core_typeid_< T const >: core_typeid_< T >
{
};
template<class T> struct core_typeid_< T volatile >: core_typeid_< T >
{
};
template<class T> struct core_typeid_< T const volatile >: core_typeid_< T >
{
};
} // namespace detail
} // namespace boost
#define BOOST_CORE_TYPEID(T) (boost::detail::core_typeid_<T>::ti_)
#else
#include <boost/core/demangle.hpp>
#include <typeinfo>
namespace boost
{
namespace core
{
#if defined( BOOST_NO_STD_TYPEINFO )
typedef ::type_info typeinfo;
#else
typedef std::type_info typeinfo;
#endif
inline std::string demangled_name( core::typeinfo const & ti )
{
return core::demangle( ti.name() );
}
} // namespace core
} // namespace boost
#define BOOST_CORE_TYPEID(T) typeid(T)
#endif
#endif // #ifndef BOOST_CORE_TYPEINFO_HPP_INCLUDED
@@ -0,0 +1,38 @@
/*=============================================================================
Copyright (c) 2011 Eric Niebler
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_ITERATOR_RANGE_SIZE_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_ITERATOR_RANGE_SIZE_IMPL_HPP_INCLUDED
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/distance.hpp>
namespace boost { namespace fusion
{
struct iterator_range_tag;
namespace extension
{
template <typename Tag>
struct size_impl;
template <>
struct size_impl<iterator_range_tag>
{
template <typename Seq>
struct apply
: result_of::distance<
typename Seq::begin_type,
typename Seq::end_type
>
{};
};
}
}}
#endif
@@ -0,0 +1,24 @@
#ifndef BOOST_MPL_EMPTY_FWD_HPP_INCLUDED
#define BOOST_MPL_EMPTY_FWD_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$
namespace boost { namespace mpl {
template< typename Tag > struct empty_impl;
template< typename Sequence > struct empty;
}}
#endif // BOOST_MPL_EMPTY_FWD_HPP_INCLUDED
@@ -0,0 +1,76 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// 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://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_ALGORITHM_TRANSFORM_HPP
#define BOOST_COMPUTE_ALGORITHM_TRANSFORM_HPP
#include <boost/compute/system.hpp>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/algorithm/copy.hpp>
#include <boost/compute/iterator/transform_iterator.hpp>
#include <boost/compute/iterator/zip_iterator.hpp>
#include <boost/compute/functional/detail/unpack.hpp>
namespace boost {
namespace compute {
/// Transforms the elements in the range [\p first, \p last) using
/// operator \p op and stores the results in the range beginning at
/// \p result.
///
/// For example, to calculate the absolute value for each element in a vector:
///
/// \snippet test/test_transform.cpp transform_abs
///
/// \see copy()
template<class InputIterator, class OutputIterator, class UnaryOperator>
inline OutputIterator transform(InputIterator first,
InputIterator last,
OutputIterator result,
UnaryOperator op,
command_queue &queue = system::default_queue())
{
return copy(
::boost::compute::make_transform_iterator(first, op),
::boost::compute::make_transform_iterator(last, op),
result,
queue
);
}
/// \overload
template<class InputIterator1,
class InputIterator2,
class OutputIterator,
class BinaryOperator>
inline OutputIterator transform(InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
OutputIterator result,
BinaryOperator op,
command_queue &queue = system::default_queue())
{
typedef typename std::iterator_traits<InputIterator1>::difference_type difference_type;
difference_type n = std::distance(first1, last1);
return transform(
make_zip_iterator(boost::make_tuple(first1, first2)),
make_zip_iterator(boost::make_tuple(last1, first2 + n)),
result,
detail::unpack(op),
queue
);
}
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_TRANSFORM_HPP
@@ -0,0 +1,83 @@
/* MOD2CONVERT.C - Routines converting between sparse and dense mod2 matrices.*/
/* Copyright (c) 1995-2012 by Radford M. Neal.
*
* Permission is granted for anyone to copy, use, modify, and distribute
* these programs and accompanying documents for any purpose, provided
* this copyright notice is retained and prominently displayed, and note
* is made of any changes made to these programs. These programs and
* documents are distributed without any warranty, express or implied.
* As the programs were written for research purposes only, they have not
* been tested to the degree that would be advisable in any important
* application. All use of these programs is entirely at the user's own
* risk.
*/
/* NOTE: See mod2convert.html for documentation on these procedures. */
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "mod2dense.h"
#include "mod2sparse.h"
#include "mod2convert.h"
/* CONVERT A MOD2 MATRIX FROM SPARSE TO DENSE FORM. */
void mod2sparse_to_dense
( mod2sparse *m, /* Sparse matrix to convert */
mod2dense *r /* Place to store result */
)
{
mod2entry *e;
int i;
if (mod2sparse_rows(m)>mod2dense_rows(r)
|| mod2sparse_cols(m)>mod2dense_cols(r))
{ fprintf(stderr,
"mod2sparse_to_dense: Dimension of result matrix is less than source\n");
exit(1);
}
mod2dense_clear(r);
for (i = 0; i<mod2sparse_rows(m); i++)
{ e = mod2sparse_first_in_row(m,i);
while (!mod2sparse_at_end(e))
{ mod2dense_set(r,i,mod2sparse_col(e),1);
e = mod2sparse_next_in_row(e);
}
}
}
/* CONVERT A MOD2 MATRIX FROM DENSE TO SPARSE FORM. */
void mod2dense_to_sparse
( mod2dense *m, /* Dense matrix to convert */
mod2sparse *r /* Place to store result */
)
{
int i, j;
if (mod2dense_rows(m)>mod2sparse_rows(r)
|| mod2dense_cols(m)>mod2sparse_cols(r))
{ fprintf(stderr,
"mod2dense_to_sparse: Dimension of result matrix is less than source\n");
exit(1);
}
mod2sparse_clear(r);
for (i = 0; i<mod2dense_rows(m); i++)
{ for (j = 0; j<mod2dense_cols(m); j++)
{ if (mod2dense_get(m,i,j))
{ mod2sparse_insert(r,i,j);
}
}
}
}
@@ -0,0 +1,21 @@
# gnuplot script for "Percent copy" figure
# run: gnuplot fig_wer3.gnuplot
# then: pdflatex fig_wer3.tex
#
set term epslatex standalone size 6in,6*2/3in
set output "fig_wer3.tex"
set xlabel "SNR in 2500 Hz Bandwidth (dB)"
set ylabel "Percent Copy"
set style func linespoints
set key off
set tics in
set mxtics 2
set mytics 10
set grid
set label "r6315" at -25.25,30
set label "r6330" at -26.0,30
set label "$T=10^5$" at -22.8,15
set label "$d=0.0$" at -22.8,10
plot [-27:-22] [0:110] \
"ftdata-100000.dat" using 1:(100*$3) with linespoints lt 1 pt 7 title 'FT-100K', \
"ftdata-100000.dat" using 1:(100*$2) with linespoints lt 1 pt 7 title 'FT-100K'
@@ -0,0 +1,54 @@
// ----------------------------------------------------------------------------
// msvc_disambiguater.hpp : msvc workarounds. (for put_{head|last} overloads)
// the trick was described in boost's list by Aleksey Gurtovoy
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_MSVC_DISAMBIGUATER_HPP
#define BOOST_MSVC_DISAMBIGUATER_HPP
#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
#include <boost/format/group.hpp>
#include <ostream>
namespace boost {
namespace io {
namespace detail {
template< class Ch, class Tr, class T >
struct disambiguater
{
template< typename U >
static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long)
{
os << group_head(x.a1_);
}
static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int)
{
}
template< typename U >
static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long)
{
os << group_last(x.a1_);
}
static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int)
{
os << x;
}
};
} // namespace detail
} // namespace io
} // namespace boost
#endif // -__DECCXX_VER
#endif // -BOOST_MSVC_DISAMBIGUATER_HPP
@@ -0,0 +1,100 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
This is an auto-generated file. Do not edit!
==============================================================================*/
namespace boost { namespace fusion
{
struct nil_;
struct void_;
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9>
struct list
: detail::list_to_cons<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9>::type
{
private:
typedef
detail::list_to_cons<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9>
list_to_cons;
typedef typename list_to_cons::type inherited_type;
public:
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list()
: inherited_type() {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(list<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9> const& rhs)
: inherited_type(rhs) {}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
list(Sequence const& rhs
, typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler)
: inherited_type(rhs) {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit
list(typename detail::call_param<T0 >::type arg0)
: inherited_type(list_to_cons::call(arg0))
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(typename detail::call_param<T0 >::type arg0 , typename detail::call_param<T1 >::type arg1)
: inherited_type(list_to_cons::call(arg0 , arg1))
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(typename detail::call_param<T0 >::type arg0 , typename detail::call_param<T1 >::type arg1 , typename detail::call_param<T2 >::type arg2)
: inherited_type(list_to_cons::call(arg0 , arg1 , arg2))
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(typename detail::call_param<T0 >::type arg0 , typename detail::call_param<T1 >::type arg1 , typename detail::call_param<T2 >::type arg2 , typename detail::call_param<T3 >::type arg3)
: inherited_type(list_to_cons::call(arg0 , arg1 , arg2 , arg3))
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(typename detail::call_param<T0 >::type arg0 , typename detail::call_param<T1 >::type arg1 , typename detail::call_param<T2 >::type arg2 , typename detail::call_param<T3 >::type arg3 , typename detail::call_param<T4 >::type arg4)
: inherited_type(list_to_cons::call(arg0 , arg1 , arg2 , arg3 , arg4))
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(typename detail::call_param<T0 >::type arg0 , typename detail::call_param<T1 >::type arg1 , typename detail::call_param<T2 >::type arg2 , typename detail::call_param<T3 >::type arg3 , typename detail::call_param<T4 >::type arg4 , typename detail::call_param<T5 >::type arg5)
: inherited_type(list_to_cons::call(arg0 , arg1 , arg2 , arg3 , arg4 , arg5))
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(typename detail::call_param<T0 >::type arg0 , typename detail::call_param<T1 >::type arg1 , typename detail::call_param<T2 >::type arg2 , typename detail::call_param<T3 >::type arg3 , typename detail::call_param<T4 >::type arg4 , typename detail::call_param<T5 >::type arg5 , typename detail::call_param<T6 >::type arg6)
: inherited_type(list_to_cons::call(arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6))
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(typename detail::call_param<T0 >::type arg0 , typename detail::call_param<T1 >::type arg1 , typename detail::call_param<T2 >::type arg2 , typename detail::call_param<T3 >::type arg3 , typename detail::call_param<T4 >::type arg4 , typename detail::call_param<T5 >::type arg5 , typename detail::call_param<T6 >::type arg6 , typename detail::call_param<T7 >::type arg7)
: inherited_type(list_to_cons::call(arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7))
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(typename detail::call_param<T0 >::type arg0 , typename detail::call_param<T1 >::type arg1 , typename detail::call_param<T2 >::type arg2 , typename detail::call_param<T3 >::type arg3 , typename detail::call_param<T4 >::type arg4 , typename detail::call_param<T5 >::type arg5 , typename detail::call_param<T6 >::type arg6 , typename detail::call_param<T7 >::type arg7 , typename detail::call_param<T8 >::type arg8)
: inherited_type(list_to_cons::call(arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8))
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(typename detail::call_param<T0 >::type arg0 , typename detail::call_param<T1 >::type arg1 , typename detail::call_param<T2 >::type arg2 , typename detail::call_param<T3 >::type arg3 , typename detail::call_param<T4 >::type arg4 , typename detail::call_param<T5 >::type arg5 , typename detail::call_param<T6 >::type arg6 , typename detail::call_param<T7 >::type arg7 , typename detail::call_param<T8 >::type arg8 , typename detail::call_param<T9 >::type arg9)
: inherited_type(list_to_cons::call(arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 , arg9))
{}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list&
operator=(list<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9> const& rhs)
{
inherited_type::operator=(rhs);
return *this;
}
template <typename Sequence>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename boost::enable_if<traits::is_sequence<Sequence>, list&>::type
operator=(Sequence const& rhs)
{
inherited_type::operator=(rhs);
return *this;
}
};
}}
@@ -0,0 +1,207 @@
// (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$
//
// Description : plain report formatter definition
// ***************************************************************************
#ifndef BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER
#define BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER
// Boost.Test
#include <boost/test/output/plain_report_formatter.hpp>
#include <boost/test/utils/custom_manip.hpp>
#include <boost/test/results_collector.hpp>
#include <boost/test/unit_test_parameters.hpp>
#include <boost/test/tree/test_unit.hpp>
#include <boost/test/utils/basic_cstring/io.hpp>
#include <boost/test/utils/setcolor.hpp>
// STL
#include <iomanip>
#include <boost/config/no_tr1/cmath.hpp>
#include <iostream>
#include <boost/test/detail/suppress_warnings.hpp>
# ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::log10; }
# endif
//____________________________________________________________________________//
namespace boost {
namespace unit_test {
namespace output {
namespace {
typedef utils::custom_manip<struct quote_t> quote;
template<typename T>
inline std::ostream&
operator<<( utils::custom_printer<quote> const& p, T const& value )
{
*p << '"' << value << '"';
return *p;
}
//____________________________________________________________________________//
void
print_stat_value( std::ostream& ostr, counter_t v, counter_t indent, counter_t total, const_string name, const_string res )
{
if( v == 0 )
return;
if( total > 0 )
ostr << std::setw( static_cast<int>(indent) ) << "" << v << ' ' << name << ( v != 1 ? "s" : "" )
<< " out of " << total << ' ' << res << '\n';
else
ostr << std::setw( static_cast<int>(indent) ) << "" << v << ' ' << res << ' ' << name << ( v != 1 ? "s" : "" ) << '\n';
}
//____________________________________________________________________________//
} // local namespace
// ************************************************************************** //
// ************** plain_report_formatter ************** //
// ************************************************************************** //
void
plain_report_formatter::results_report_start( std::ostream& ostr )
{
m_indent = 0;
m_color_output = runtime_config::get<bool>( runtime_config::COLOR_OUTPUT );
ostr << '\n';
}
//____________________________________________________________________________//
void
plain_report_formatter::results_report_finish( std::ostream& ostr )
{
ostr.flush();
}
//____________________________________________________________________________//
void
plain_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream& ostr )
{
test_results const& tr = results_collector.results( tu.p_id );
const_string descr;
if( tr.passed() )
descr = "has passed";
else if( tr.p_skipped )
descr = "was skipped";
else if( tr.p_aborted )
descr = "was aborted";
else
descr = "has failed";
ostr << std::setw( static_cast<int>(m_indent) ) << ""
<< "Test " << tu.p_type_name << ' ' << quote() << tu.full_name() << ' ' << descr;
if( tr.p_skipped ) {
ostr << "\n";
m_indent += 2;
return;
}
counter_t total_assertions = tr.p_assertions_passed + tr.p_assertions_failed;
counter_t total_tc = tr.p_test_cases_passed + tr.p_test_cases_warned + tr.p_test_cases_failed + tr.p_test_cases_skipped;
if( total_assertions > 0 || total_tc > 0 || tr.p_warnings_failed > 0)
ostr << " with:";
ostr << '\n';
m_indent += 2;
print_stat_value( ostr, tr.p_test_cases_passed , m_indent, total_tc , "test case", "passed" );
print_stat_value( ostr, tr.p_test_cases_warned , m_indent, total_tc , "test case", "passed with warnings" );
print_stat_value( ostr, tr.p_test_cases_failed , m_indent, total_tc , "test case", "failed" );
print_stat_value( ostr, tr.p_test_cases_skipped, m_indent, total_tc , "test case", "skipped" );
print_stat_value( ostr, tr.p_test_cases_aborted, m_indent, total_tc , "test case", "aborted" );
print_stat_value( ostr, tr.p_assertions_passed , m_indent, total_assertions, "assertion", "passed" );
print_stat_value( ostr, tr.p_assertions_failed , m_indent, total_assertions, "assertion", "failed" );
print_stat_value( ostr, tr.p_warnings_failed , m_indent, 0 , "warning" , "failed" );
print_stat_value( ostr, tr.p_expected_failures , m_indent, 0 , "failure" , "expected" );
ostr << '\n';
}
//____________________________________________________________________________//
void
plain_report_formatter::test_unit_report_finish( test_unit const&, std::ostream& )
{
m_indent -= 2;
}
//____________________________________________________________________________//
void
plain_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr )
{
test_results const& tr = results_collector.results( tu.p_id );
if( tr.passed() ) {
BOOST_TEST_SCOPE_SETCOLOR( m_color_output, ostr, term_attr::BRIGHT, term_color::GREEN );
ostr << "*** No errors detected\n";
return;
}
BOOST_TEST_SCOPE_SETCOLOR( m_color_output, ostr, term_attr::BRIGHT, term_color::RED );
if( tr.p_skipped ) {
ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " was skipped"
<< "; see standard output for details\n";
return;
}
if( tr.p_aborted ) {
ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " was aborted"
<< "; see standard output for details\n";
}
if( tr.p_assertions_failed == 0 ) {
if( !tr.p_aborted )
ostr << "*** Errors were detected in the test " << tu.p_type_name << ' ' << quote() << tu.full_name()
<< "; see standard output for details\n";
return;
}
counter_t num_failures = tr.p_assertions_failed;
ostr << "*** " << num_failures << " failure" << ( num_failures != 1 ? "s are" : " is" ) << " detected";
if( tr.p_expected_failures > 0 )
ostr << " (" << tr.p_expected_failures << " failure" << ( tr.p_expected_failures != 1 ? "s are" : " is" ) << " expected)";
ostr << " in the test " << tu.p_type_name << " " << quote() << tu.full_name() << "\n";
}
//____________________________________________________________________________//
} // namespace output
} // namespace unit_test
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,41 @@
// Boost.Range library
//
// Copyright Neil Groves 2009. 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_ALGORITHM_EXT_PUSH_BACK_HPP_INCLUDED
#define BOOST_RANGE_ALGORITHM_EXT_PUSH_BACK_HPP_INCLUDED
#include <boost/range/config.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/difference_type.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/detail/implementation_help.hpp>
#include <boost/assert.hpp>
namespace boost
{
namespace range
{
template< class Container, class Range >
inline Container& push_back( Container& on, const Range& from )
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<Container> ));
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const Range> ));
BOOST_ASSERT_MSG(!range_detail::is_same_object(on, from),
"cannot copy from a container to itself");
on.insert( on.end(), boost::begin(from), boost::end(from) );
return on;
}
} // namespace range
using range::push_back;
} // namespace boost
#endif // include guard
@@ -0,0 +1,72 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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_ADVANCE_IMPL_20061024_2021)
#define FUSION_ADVANCE_IMPL_20061024_2021
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost { namespace fusion {
struct zip_view_iterator_tag;
namespace detail
{
template<typename N>
struct poly_advance
{
template<typename Sig>
struct result;
template<typename N1, typename It>
struct result<poly_advance<N1>(It)>
{
typedef typename remove_reference<It>::type it;
typedef typename result_of::advance<it,N>::type type;
};
template<typename It>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename result<poly_advance(It)>::type
operator()(const It& it) const
{
return fusion::advance<N>(it);
}
};
}
namespace extension
{
template<typename Tag>
struct advance_impl;
template<>
struct advance_impl<zip_view_iterator_tag>
{
template<typename It, typename N>
struct apply
{
typedef zip_view_iterator<
typename result_of::transform<typename It::iterators, detail::poly_advance<N> >::type> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(It const& it)
{
return type(
fusion::transform(it.iterators_, detail::poly_advance<N>()));
}
};
};
}
}}
#endif
@@ -0,0 +1,68 @@
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* See http://www.boost.org/libs/multi_index for library home page.
*/
#ifndef BOOST_MULTI_INDEX_INDEXED_BY_HPP
#define BOOST_MULTI_INDEX_INDEXED_BY_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <boost/mpl/vector.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
/* An alias to mpl::vector used to hide MPL from the user.
* indexed_by contains the index specifiers for instantiation
* of a multi_index_container.
*/
/* This user_definable macro limits the number of elements of an index list;
* useful for shortening resulting symbol names (MSVC++ 6.0, for instance,
* has problems coping with very long symbol names.)
*/
#if !defined(BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE)
#define BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE BOOST_MPL_LIMIT_VECTOR_SIZE
#endif
#if BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE<BOOST_MPL_LIMIT_VECTOR_SIZE
#define BOOST_MULTI_INDEX_INDEXED_BY_SIZE \
BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE
#else
#define BOOST_MULTI_INDEX_INDEXED_BY_SIZE BOOST_MPL_LIMIT_VECTOR_SIZE
#endif
#define BOOST_MULTI_INDEX_INDEXED_BY_TEMPLATE_PARM(z,n,var) \
typename BOOST_PP_CAT(var,n) BOOST_PP_EXPR_IF(n,=mpl::na)
namespace boost{
namespace multi_index{
template<
BOOST_PP_ENUM(
BOOST_MULTI_INDEX_INDEXED_BY_SIZE,
BOOST_MULTI_INDEX_INDEXED_BY_TEMPLATE_PARM,T)
>
struct indexed_by:
mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_MULTI_INDEX_INDEXED_BY_SIZE,T)>
{
};
} /* namespace multi_index */
} /* namespace boost */
#undef BOOST_MULTI_INDEX_INDEXED_BY_TEMPLATE_PARM
#undef BOOST_MULTI_INDEX_INDEXED_BY_SIZE
#endif
@@ -0,0 +1,937 @@
!-------------------------------------------------------------------------------
!
! This file is part of the WSPR application, Weak Signal Propagation Reporter
!
! File Name: wspr_old_subs.f90
! Description: Utility subroutines from WSPR 2.0
!
! Copyright (C) 2001-2014 Joseph Taylor, K1JT
! License: GPL-3
!
! This program is free software; you can redistribute it and/or modify it under
! the terms of the GNU General Public License as published by the Free Software
! Foundation; either version 3 of the License, or (at your option) any later
! version.
!
! This program is distributed in the hope that it will be useful, but WITHOUT
! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
! FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
! details.
!
! You should have received a copy of the GNU General Public License along with
! this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
! Street, Fifth Floor, Boston, MA 02110-1301, USA.
!
!-------------------------------------------------------------------------------
subroutine deg2grid(dlong0,dlat,grid)
real dlong !West longitude (deg)
real dlat !Latitude (deg)
character grid*6
dlong=dlong0
if(dlong.lt.-180.0) dlong=dlong+360.0
if(dlong.gt.180.0) dlong=dlong-360.0
! Convert to units of 5 min of longitude, working east from 180 deg.
nlong=60.0*(180.0-dlong)/5.0
n1=nlong/240 !20-degree field
n2=(nlong-240*n1)/24 !2 degree square
n3=nlong-240*n1-24*n2 !5 minute subsquare
grid(1:1)=char(ichar('A')+n1)
grid(3:3)=char(ichar('0')+n2)
grid(5:5)=char(ichar('a')+n3)
! Convert to units of 2.5 min of latitude, working north from -90 deg.
nlat=60.0*(dlat+90)/2.5
n1=nlat/240 !10-degree field
n2=(nlat-240*n1)/24 !1 degree square
n3=nlat-240*n1-24*n2 !2.5 minuts subsquare
grid(2:2)=char(ichar('A')+n1)
grid(4:4)=char(ichar('0')+n2)
grid(6:6)=char(ichar('a')+n3)
return
end subroutine deg2grid
subroutine encode232(dat,nbytes,symbol,maxsym)
! Convolutional encoder for a K=32, r=1/2 code.
integer*1 dat(nbytes) !User data, packed 8 bits per byte
integer*1 symbol(maxsym) !Channel symbols, one bit per byte
integer*1 i1
! Layland-Lushbaugh polynomials for a K=32, r=1/2 convolutional code,
! and 8-bit parity lookup table.
data npoly1/-221228207/,npoly2/-463389625/
integer*1 partab(0:255)
data partab/ &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0/
nstate=0
k=0
do j=1,nbytes
do i=7,0,-1
i1=dat(j)
i4=i1
if (i4.lt.0) i4=i4+256
nstate=ior(ishft(nstate,1),iand(ishft(i4,-i),1))
n=iand(nstate,npoly1)
n=ieor(n,ishft(n,-16))
k=k+1
symbol(k)=partab(iand(ieor(n,ishft(n,-8)),255))
n=iand(nstate,npoly2)
n=ieor(n,ishft(n,-16))
k=k+1
symbol(k)=partab(iand(ieor(n,ishft(n,-8)),255))
enddo
enddo
return
end subroutine encode232
subroutine fano232(symbol,nbits,mettab,ndelta,maxcycles,dat,ncycles,metric,ierr)
! Sequential decoder for K=32, r=1/2 convolutional code using
! the Fano algorithm. Translated from C routine for same purpose
! written by Phil Karn, KA9Q.
parameter (MAXBITS=103)
parameter (MAXDAT=(MAXBITS+7)/8)
integer*1 symbol(0:2*MAXBITS-1)
integer*1 dat(MAXDAT) !Decoded user data, 8 bits per byte
integer mettab(0:255,0:1) !Metric table
! These were the "node" structure in Karn's C code:
integer nstate(0:MAXBITS-1) !Encoder state of next node
integer gamma(0:MAXBITS-1) !Cumulative metric to this node
integer metrics(0:3,0:MAXBITS-1) !Metrics indexed by all possible Tx syms
integer tm(0:1,0:MAXBITS-1) !Sorted metrics for current hypotheses
integer ii(0:MAXBITS-1) !Current branch being tested
logical noback
! Layland-Lushbaugh polynomials for a K=32, r=1/2 convolutional code,
! and 8-bit parity lookup table.
data npoly1/-221228207/,npoly2/-463389625/
integer*1 partab(0:255)
data partab/ &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0, &
0, 1, 1, 0, 1, 0, 0, 1, &
0, 1, 1, 0, 1, 0, 0, 1, &
1, 0, 0, 1, 0, 1, 1, 0/
ntail=nbits-31
! Compute all possible branch metrics for each symbol pair.
! This is the only place we actually look at the raw input symbols
i4a=0
i4b=0
do np=0,nbits-1
j=2*np
i4a=symbol(j)
i4b=symbol(j+1)
if (i4a.lt.0) i4a=i4a+256
if (i4b.lt.0) i4b=i4b+256
metrics(0,np) = mettab(i4a,0) + mettab(i4b,0)
metrics(1,np) = mettab(i4a,0) + mettab(i4b,1)
metrics(2,np) = mettab(i4a,1) + mettab(i4b,0)
metrics(3,np) = mettab(i4a,1) + mettab(i4b,1)
enddo
np=0
nstate(np)=0
! Compute and sort branch metrics from the root node
n=iand(nstate(np),npoly1)
n=ieor(n,ishft(n,-16))
lsym=partab(iand(ieor(n,ishft(n,-8)),255))
n=iand(nstate(np),npoly2)
n=ieor(n,ishft(n,-16))
lsym=lsym+lsym+partab(iand(ieor(n,ishft(n,-8)),255))
m0=metrics(lsym,np)
m1=metrics(ieor(3,lsym),np)
if(m0.gt.m1) then
tm(0,np)=m0 !0-branch has better metric
tm(1,np)=m1
else
tm(0,np)=m1 !1-branch is better
tm(1,np)=m0
nstate(np)=nstate(np) + 1 !Set low bit
endif
! Start with best branch
ii(np)=0
gamma(np)=0
nt=0
! Start the Fano decoder
do i=1,nbits*maxcycles
! Look forward
ngamma=gamma(np) + tm(ii(np),np)
if(ngamma.ge.nt) then
! Node is acceptable. If first time visiting this node, tighten threshold:
if(gamma(np).lt.(nt+ndelta)) nt=nt + &
ndelta * ((ngamma-nt)/ndelta)
! Move forward
gamma(np+1)=ngamma
nstate(np+1)=ishft(nstate(np),1)
np=np+1
if(np.eq.nbits-1) go to 100 !We're done!
n=iand(nstate(np),npoly1)
n=ieor(n,ishft(n,-16))
lsym=partab(iand(ieor(n,ishft(n,-8)),255))
n=iand(nstate(np),npoly2)
n=ieor(n,ishft(n,-16))
lsym=lsym+lsym+partab(iand(ieor(n,ishft(n,-8)),255))
if(np.ge.ntail) then
tm(0,np)=metrics(lsym,np) !We're in the tail, all zeros
else
m0=metrics(lsym,np)
m1=metrics(ieor(3,lsym),np)
if(m0.gt.m1) then
tm(0,np)=m0 !0-branch has better metric
tm(1,np)=m1
else
tm(0,np)=m1 !1-branch is better
tm(1,np)=m0
nstate(np)=nstate(np) + 1 !Set low bit
endif
endif
ii(np)=0 !Start with best branch
go to 99
endif
! Threshold violated, can't go forward
10 noback=.false.
if(np.eq.0) noback=.true.
if(np.gt.0) then
if(gamma(np-1).lt.nt) noback=.true.
endif
if(noback) then
! Can't back up, either. Relax threshold and look forward again
! to a better branch.
nt=nt-ndelta
if(ii(np).ne.0) then
ii(np)=0
nstate(np)=ieor(nstate(np),1)
endif
go to 99
endif
! Back up
np=np-1
if(np.lt.ntail .and. ii(np).ne.1) then
! Search the next best branch
ii(np)=ii(np)+1
nstate(np)=ieor(nstate(np),1)
go to 99
endif
go to 10
99 continue
enddo
i=nbits*maxcycles
100 metric=gamma(np) !Final path metric
! Copy decoded data to user's buffer
nbytes=(nbits+7)/8
np=7
do j=1,nbytes-1
i4a=nstate(np)
dat(j)=i4a
np=np+8
enddo
dat(nbytes)=0
ncycles=i+1
ierr=0
if(i.ge.maxcycles*nbits) ierr=-1
return
end subroutine fano232
subroutine grid2deg(grid0,dlong,dlat)
! Converts Maidenhead grid locator to degrees of West longitude
! and North latitude.
character*6 grid0,grid
character*1 g1,g2,g3,g4,g5,g6
grid=grid0
i=ichar(grid(5:5))
if(grid(5:5).eq.' ' .or. i.le.64 .or. i.ge.128) grid(5:6)='mm'
if(grid(1:1).ge.'a' .and. grid(1:1).le.'z') grid(1:1)= &
char(ichar(grid(1:1))+ichar('A')-ichar('a'))
if(grid(2:2).ge.'a' .and. grid(2:2).le.'z') grid(2:2)= &
char(ichar(grid(2:2))+ichar('A')-ichar('a'))
if(grid(5:5).ge.'A' .and. grid(5:5).le.'Z') grid(5:5)= &
char(ichar(grid(5:5))-ichar('A')+ichar('a'))
if(grid(6:6).ge.'A' .and. grid(6:6).le.'Z') grid(6:6)= &
char(ichar(grid(6:6))-ichar('A')+ichar('a'))
g1=grid(1:1)
g2=grid(2:2)
g3=grid(3:3)
g4=grid(4:4)
g5=grid(5:5)
g6=grid(6:6)
nlong = 180 - 20*(ichar(g1)-ichar('A'))
n20d = 2*(ichar(g3)-ichar('0'))
xminlong = 5*(ichar(g5)-ichar('a')+0.5)
dlong = nlong - n20d - xminlong/60.0
nlat = -90+10*(ichar(g2)-ichar('A')) + ichar(g4)-ichar('0')
xminlat = 2.5*(ichar(g6)-ichar('a')+0.5)
dlat = nlat + xminlat/60.0
return
end subroutine grid2deg
subroutine hash(string,len,ihash)
parameter (MASK15=32767)
character*(*) string
integer*1 ic(12)
do i=1,len
ic(i)=ichar(string(i:i))
enddo
i=nhash(ic,len,146)
ihash=iand(i,MASK15)
! print*,'C',ihash,len,string
return
end subroutine hash
subroutine inter_mept(id,ndir)
! Interleave (ndir=1) or de-interleave (ndir=-1) the array id.
integer*1 id(0:161),itmp(0:161)
integer j0(0:161)
logical first
data first/.true./
save
if(first) then
! Compute the interleave table using bit reversal.
k=-1
do i=0,255
n=0
ii=i
do j=0,7
n=n+n
if(iand(ii,1).ne.0) n=n+1
ii=ii/2
enddo
if(n.le.161) then
k=k+1
j0(k)=n
endif
enddo
first=.false.
endif
if(ndir.eq.1) then
do i=0,161
itmp(j0(i))=id(i)
enddo
else
do i=0,161
itmp(i)=id(j0(i))
enddo
endif
do i=0,161
id(i)=itmp(i)
enddo
return
end subroutine inter_mept
function nchar(c)
! Convert ASCII number, letter, or space to 0-36 for callsign packing.
character c*1
data n/0/ !Silence compiler warning
if(c.ge.'0' .and. c.le.'9') then
n=ichar(c)-ichar('0')
else if(c.ge.'A' .and. c.le.'Z') then
n=ichar(c)-ichar('A') + 10
else if(c.ge.'a' .and. c.le.'z') then
n=ichar(c)-ichar('a') + 10
else if(c.ge.' ') then
n=36
else
Print*,'Invalid character in callsign ',c,' ',ichar(c)
stop
endif
nchar=n
return
end function nchar
subroutine pack50(n1,n2,dat)
integer*1 dat(11),i1
i1=iand(ishft(n1,-20),255) !8 bits
dat(1)=i1
i1=iand(ishft(n1,-12),255) !8 bits
dat(2)=i1
i1=iand(ishft(n1, -4),255) !8 bits
dat(3)=i1
i1=16*iand(n1,15)+iand(ishft(n2,-18),15) !4+4 bits
dat(4)=i1
i1=iand(ishft(n2,-10),255) !8 bits
dat(5)=i1
i1=iand(ishft(n2, -2),255) !8 bits
dat(6)=i1
i1=64*iand(n2,3) !2 bits
dat(7)=i1
dat(8)=0
dat(9)=0
dat(10)=0
dat(11)=0
return
end subroutine pack50
subroutine packcall(callsign,ncall,text)
! Pack a valid callsign into a 28-bit integer.
parameter (NBASE=37*36*10*27*27*27)
character callsign*6,c*1,tmp*6,digit*10
logical text
data digit/'0123456789'/
text=.false.
! Work-around for Swaziland prefix:
if(callsign(1:4).eq.'3DA0') callsign='3D0'//callsign(5:6)
if(callsign(1:3).eq.'CQ ') then
ncall=NBASE + 1
if(callsign(4:4).ge.'0' .and. callsign(4:4).le.'9' .and. &
callsign(5:5).ge.'0' .and. callsign(5:5).le.'9' .and. &
callsign(6:6).ge.'0' .and. callsign(6:6).le.'9') then
nfreq=100*(ichar(callsign(4:4))-48) + &
10*(ichar(callsign(5:5))-48) + &
ichar(callsign(6:6))-48
ncall=NBASE + 3 + nfreq
endif
return
else if(callsign(1:4).eq.'QRZ ') then
ncall=NBASE + 2
return
endif
tmp=' '
if(callsign(3:3).ge.'0' .and. callsign(3:3).le.'9') then
tmp=callsign
else if(callsign(2:2).ge.'0' .and. callsign(2:2).le.'9') then
if(callsign(6:6).ne.' ') then
text=.true.
return
endif
tmp=' '//callsign
else
text=.true.
return
endif
do i=1,6
c=tmp(i:i)
if(c.ge.'a' .and. c.le.'z') &
tmp(i:i)=char(ichar(c)-ichar('a')+ichar('A'))
enddo
n1=0
if((tmp(1:1).ge.'A'.and.tmp(1:1).le.'Z').or.tmp(1:1).eq.' ') n1=1
if(tmp(1:1).ge.'0' .and. tmp(1:1).le.'9') n1=1
n2=0
if(tmp(2:2).ge.'A' .and. tmp(2:2).le.'Z') n2=1
if(tmp(2:2).ge.'0' .and. tmp(2:2).le.'9') n2=1
n3=0
if(tmp(3:3).ge.'0' .and. tmp(3:3).le.'9') n3=1
n4=0
if((tmp(4:4).ge.'A'.and.tmp(4:4).le.'Z').or.tmp(4:4).eq.' ') n4=1
n5=0
if((tmp(5:5).ge.'A'.and.tmp(5:5).le.'Z').or.tmp(5:5).eq.' ') n5=1
n6=0
if((tmp(6:6).ge.'A'.and.tmp(6:6).le.'Z').or.tmp(6:6).eq.' ') n6=1
if(n1+n2+n3+n4+n5+n6 .ne. 6) then
text=.true.
return
endif
ncall=nchar(tmp(1:1))
ncall=36*ncall+nchar(tmp(2:2))
ncall=10*ncall+nchar(tmp(3:3))
ncall=27*ncall+nchar(tmp(4:4))-10
ncall=27*ncall+nchar(tmp(5:5))-10
ncall=27*ncall+nchar(tmp(6:6))-10
return
end subroutine packcall
subroutine packgrid(grid,ng,text)
parameter (NGBASE=180*180)
character*4 grid
logical text
text=.false.
if(grid.eq.' ') go to 90 !Blank grid is OK
! Test for numerical signal report, etc.
if(grid(1:1).eq.'-') then
n=10*(ichar(grid(2:2))-48) + ichar(grid(3:3)) - 48
ng=NGBASE+1+n
go to 100
else if(grid(1:2).eq.'R-') then
n=10*(ichar(grid(3:3))-48) + ichar(grid(4:4)) - 48
if(n.eq.0) go to 90
ng=NGBASE+31+n
go to 100
else if(grid(1:2).eq.'RO') then
ng=NGBASE+62
go to 100
else if(grid(1:3).eq.'RRR') then
ng=NGBASE+63
go to 100
else if(grid(1:2).eq.'73') then
ng=NGBASE+64
go to 100
endif
if(grid(1:1).lt.'A' .or. grid(1:1).gt.'R') text=.true.
if(grid(2:2).lt.'A' .or. grid(2:2).gt.'R') text=.true.
if(grid(3:3).lt.'0' .or. grid(3:3).gt.'9') text=.true.
if(grid(4:4).lt.'0' .or. grid(4:4).gt.'9') text=.true.
if(text) go to 100
call grid2deg(grid//'mm',dlong,dlat)
long=dlong
lat=dlat+ 90.0
ng=((long+180)/2)*180 + lat
go to 100
90 ng=NGBASE + 1
100 return
end subroutine packgrid
subroutine packpfx(call1,n1,ng,nadd)
character*12 call1,call0
character*3 pfx
logical text
i1=index(call1,'/')
if(call1(i1+2:i1+2).eq.' ') then
! Single-character add-on suffix (maybe also fourth suffix letter?)
call0=call1(:i1-1)
call packcall(call0,n1,text)
nadd=1
nc=ichar(call1(i1+1:i1+1))
if(nc.ge.48 .and. nc.le.57) then
n=nc-48
else if(nc.ge.65 .and. nc.le.90) then
n=nc-65+10
else
n=38
endif
nadd=1
ng=60000-32768+n
else if(call1(i1+3:i1+3).eq.' ') then
! Two-character numerical suffix, /10 to /99
call0=call1(:i1-1)
call packcall(call0,n1,text)
nadd=1
n=10*(ichar(call1(i1+1:i1+1))-48) + ichar(call1(i1+2:i1+2)) - 48
nadd=1
ng=60000 + 26 + n
else
! Prefix of 1 to 3 characters
pfx=call1(:i1-1)
if(pfx(3:3).eq.' ') pfx=' '//pfx
if(pfx(3:3).eq.' ') pfx=' '//pfx
call0=call1(i1+1:)
call packcall(call0,n1,text)
ng=0
do i=1,3
nc=ichar(pfx(i:i))
if(nc.ge.48 .and. nc.le.57) then
n=nc-48
else if(nc.ge.65 .and. nc.le.90) then
n=nc-65+10
else
n=36
endif
ng=37*ng + n
enddo
nadd=0
if(ng.ge.32768) then
ng=ng-32768
nadd=1
endif
endif
return
end subroutine packpfx
subroutine unpack50(dat,n1,n2)
integer*1 dat(11)
i=dat(1)
i4=iand(i,255)
n1=ishft(i4,20)
i=dat(2)
i4=iand(i,255)
n1=n1 + ishft(i4,12)
i=dat(3)
i4=iand(i,255)
n1=n1 + ishft(i4,4)
i=dat(4)
i4=iand(i,255)
n1=n1 + iand(ishft(i4,-4),15)
n2=ishft(iand(i4,15),18)
i=dat(5)
i4=iand(i,255)
n2=n2 + ishft(i4,10)
i=dat(6)
i4=iand(i,255)
n2=n2 + ishft(i4,2)
i=dat(7)
i4=iand(i,255)
n2=n2 + iand(ishft(i4,-6),3)
return
end subroutine unpack50
subroutine unpackcall(ncall,word)
character word*12,c*37
data c/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ '/
n=ncall
word='......'
if(n.ge.262177560) go to 999 !Plain text message ...
i=mod(n,27)+11
word(6:6)=c(i:i)
n=n/27
i=mod(n,27)+11
word(5:5)=c(i:i)
n=n/27
i=mod(n,27)+11
word(4:4)=c(i:i)
n=n/27
i=mod(n,10)+1
word(3:3)=c(i:i)
n=n/10
i=mod(n,36)+1
word(2:2)=c(i:i)
n=n/36
i=n+1
word(1:1)=c(i:i)
do i=1,4
if(word(i:i).ne.' ') go to 10
enddo
go to 999
10 word=word(i:)
999 if(word(1:3).eq.'3D0') word='3DA0'//word(4:)
return
end subroutine unpackcall
subroutine unpackgrid(ng,grid)
parameter (NGBASE=180*180)
character grid*4,grid6*6,digit*10
data digit/'0123456789'/
grid=' '
if(ng.ge.32400) go to 10
dlat=mod(ng,180)-90
dlong=(ng/180)*2 - 180 + 2
call deg2grid(dlong,dlat,grid6)
grid=grid6(1:4) !XXX explicitly truncate this -db
go to 100
10 n=ng-NGBASE-1
if(n.ge.1 .and.n.le.30) then
grid(1:1)='-'
grid(2:2)=char(48+n/10)
grid(3:3)=char(48+mod(n,10))
else if(n.ge.31 .and.n.le.60) then
n=n-30
grid(1:2)='R-'
grid(3:3)=char(48+n/10)
grid(4:4)=char(48+mod(n,10))
else if(n.eq.61) then
grid='RO'
else if(n.eq.62) then
grid='RRR'
else if(n.eq.63) then
grid='73'
endif
100 return
end subroutine unpackgrid
subroutine unpackpfx(ng,call1)
character*12 call1
character*3 pfx
if(ng.lt.60000) then
! Add-on prefix of 1 to 3 characters
n=ng
do i=3,1,-1
nc=mod(n,37)
if(nc.ge.0 .and. nc.le.9) then
pfx(i:i)=char(nc+48)
else if(nc.ge.10 .and. nc.le.35) then
pfx(i:i)=char(nc+55)
else
pfx(i:i)=' '
endif
n=n/37
enddo
call1=pfx//'/'//call1
if(call1(1:1).eq.' ') call1=call1(2:)
if(call1(1:1).eq.' ') call1=call1(2:)
else
! Add-on suffix, one or teo characters
i1=index(call1,' ')
nc=ng-60000
if(nc.ge.0 .and. nc.le.9) then
call1=call1(:i1-1)//'/'//char(nc+48)
else if(nc.ge.10 .and. nc.le.35) then
call1=call1(:i1-1)//'/'//char(nc+55)
else if(nc.ge.36 .and. nc.le.125) then
nc1=(nc-26)/10
nc2=mod(nc-26,10)
call1=call1(:i1-1)//'/'//char(nc1+48)//char(nc2+48)
endif
endif
return
end subroutine unpackpfx
subroutine wqdecode(data0,message,ntype)
parameter (N15=32768)
integer*1 data0(11)
character*22 message
character*12 callsign
character*3 cdbm
character grid4*4,grid6*6
logical first
character*12 dcall(0:N15-1)
data first/.true./
save first,dcall
! May want to have a timeout (say, one hour?) on calls fetched
! from the hash table.
if(first) then
dcall=' '
first=.false.
endif
message=' '
call unpack50(data0,n1,n2)
call unpackcall(n1,callsign)
i1=index(callsign,' ')
call unpackgrid(n2/128,grid4)
ntype=iand(n2,127) -64
! Standard WSPR message (types 0 3 7 10 13 17 ... 60)
if(ntype.ge.0 .and. ntype.le.62) then
nu=mod(ntype,10)
if(nu.eq.0 .or. nu.eq.3 .or. nu.eq.7) then
write(cdbm,'(i3)'),ntype
if(cdbm(1:1).eq.' ') cdbm=cdbm(2:)
if(cdbm(1:1).eq.' ') cdbm=cdbm(2:)
message=callsign(1:i1)//grid4//' '//cdbm
call hash(callsign,i1-1,ih)
dcall(ih)=callsign(:i1)
else
nadd=nu
if(nu.gt.3) nadd=nu-3
if(nu.gt.7) nadd=nu-7
ng=n2/128 + 32768*(nadd-1)
call unpackpfx(ng,callsign)
ndbm=ntype-nadd
write(cdbm,'(i3)'),ndbm
if(cdbm(1:1).eq.' ') cdbm=cdbm(2:)
if(cdbm(1:1).eq.' ') cdbm=cdbm(2:)
i2=index(callsign,' ')
message=callsign(:i2)//cdbm
call hash(callsign,i2-1,ih)
dcall(ih)=callsign(:i2)
endif
else if(ntype.lt.0) then
ndbm=-(ntype+1)
grid6=callsign(6:6)//callsign(1:5)
ih=(n2-ntype-64)/128
callsign=dcall(ih)
write(cdbm,'(i3)'),ndbm
if(cdbm(1:1).eq.' ') cdbm=cdbm(2:)
if(cdbm(1:1).eq.' ') cdbm=cdbm(2:)
i2=index(callsign,' ')
if(dcall(ih)(1:1).ne.' ') then
message='<'//callsign(:i2-1)//'> '//grid6//' '//cdbm
else
message='<...> '//grid6//' '//cdbm
endif
endif
return
end subroutine wqdecode
subroutine wqencode(msg,ntype,data0)
! Parse and encode a WSPR message.
parameter (MASK15=32767)
character*22 msg
character*12 call1,call2
character grid4*4,grid6*6
logical lbad1,lbad2
integer*1 data0(11)
integer nu(0:9)
data nu/0,-1,1,0,-1,2,1,0,-1,1/
! Standard WSPR message (types 0 3 7 10 13 17 ... 60)
i1=index(msg,' ')
i2=index(msg,'/')
i3=index(msg,'<')
call1=msg(:i1-1)
if(i1.lt.3 .or. i1.gt.7 .or. i2.gt.0 .or. i3.gt.0) go to 10
grid4=msg(i1+1:i1+4)
call packcall(call1,n1,lbad1)
call packgrid(grid4,ng,lbad2)
if(lbad1 .or. lbad2) go to 10
ndbm=0
read(msg(i1+5:),*) ndbm
if(ndbm.lt.0) ndbm=0
if(ndbm.gt.60) ndbm=60
ndbm=ndbm+nu(mod(ndbm,10))
n2=128*ng + (ndbm+64)
call pack50(n1,n2,data0)
ntype=ndbm
go to 900
10 if(i2.ge.2 .and. i3.lt.1) then
call packpfx(call1,n1,ng,nadd)
ndbm=0
read(msg(i1+1:),*) ndbm
if(ndbm.lt.0) ndbm=0
if(ndbm.gt.60) ndbm=60
ndbm=ndbm+nu(mod(ndbm,10))
ntype=ndbm + 1 + nadd
n2=128*ng + ntype + 64
call pack50(n1,n2,data0)
else if(i3.eq.1) then
i4=index(msg,'>')
call1=msg(2:i4-1)
call hash(call1,i4-2,ih)
grid6=msg(i1+1:i1+6)
call2=grid6(2:6)//grid6(1:1)//' '
call packcall(call2,n1,lbad1)
ndbm=0
read(msg(i1+8:),*) ndbm
if(ndbm.lt.0) ndbm=0
if(ndbm.gt.60) ndbm=60
ndbm=ndbm+nu(mod(ndbm,10))
ntype=-(ndbm+1)
n2=128*ih + ntype + 64
call pack50(n1,n2,data0)
endif
go to 900
900 continue
return
end subroutine wqencode