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,52 @@
/* Reed-Solomon encoder
* Copyright 2002, Phil Karn, KA9Q
* May be used under the terms of the GNU General Public License (GPL)
*/
#include <string.h>
#ifdef FIXED
#include "fixed.h"
#elif defined(BIGSYM)
#include "int.h"
#else
#include "char.h"
#endif
void ENCODE_RS(
#ifdef FIXED
DTYPE *data, DTYPE *bb,int pad){
#else
void *p,DTYPE *data, DTYPE *bb){
struct rs *rs = (struct rs *)p;
#endif
int i, j;
DTYPE feedback;
#ifdef FIXED
/* Check pad parameter for validity */
if(pad < 0 || pad >= NN)
return;
#endif
memset(bb,0,NROOTS*sizeof(DTYPE));
for(i=0;i<NN-NROOTS-PAD;i++){
feedback = INDEX_OF[data[i] ^ bb[0]];
if(feedback != A0){ /* feedback term is non-zero */
#ifdef UNNORMALIZED
/* This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
* always be for the polynomials constructed by init_rs()
*/
feedback = MODNN(NN - GENPOLY[NROOTS] + feedback);
#endif
for(j=1;j<NROOTS;j++)
bb[j] ^= ALPHA_TO[MODNN(feedback + GENPOLY[NROOTS-j])];
}
/* Shift */
memmove(&bb[0],&bb[1],sizeof(DTYPE)*(NROOTS-1));
if(feedback != A0)
bb[NROOTS-1] = ALPHA_TO[MODNN(feedback + GENPOLY[0])];
else
bb[NROOTS-1] = 0;
}
}
@@ -0,0 +1,196 @@
program msk144sd
!
! A simple decoder for slow msk144.
! Can be used as a (slow) brute-force multi-decoder by looping
! over a set of carrier frequencies.
!
use options
use timer_module, only: timer
use timer_impl, only: init_timer
use readwav
parameter (NRECENT=10)
parameter (NSPM=864)
parameter (NPATTERNS=4)
character ch
character*80 line
character*500 infile
character*12 mycall,hiscall
character*6 mygrid
character(len=500) optarg
character*22 msgreceived
character*12 recent_calls(NRECENT)
complex cdat(30*375)
complex c(NSPM)
complex ct(NSPM)
real softbits(144)
real xmc(NPATTERNS)
logical :: display_help=.false.
type(wav_header) :: wav
integer iavmask(8)
integer iavpatterns(8,NPATTERNS)
integer npkloc(10)
integer*2 id2(30*12000)
integer*2 ichunk(7*1024)
data iavpatterns/ &
1,1,1,1,0,0,0,0, &
0,0,1,1,1,1,0,0, &
1,1,1,1,1,0,0,0, &
1,1,1,1,1,1,0,0/
data xmc/2.0,4.5,2.5,3.0/
type (option) :: long_options(2) = [ &
option ('frequency',.true.,'f','rxfreq',''), &
option ('help',.false.,'h','Display this help message','') &
]
t0=0.0
ntol=100
nrxfreq=1500
do
call getopt('f:h',long_options,ch,optarg,narglen,nstat,noffset,nremain,.true.)
if( nstat .ne. 0 ) then
exit
end if
select case (ch)
case ('f')
read (optarg(:narglen), *) nrxfreq
case ('h')
display_help = .true.
end select
end do
if(display_help .or. nstat.lt.0 .or. nremain.lt.1) then
print *, ''
print *, 'Usage: msk144sd [OPTIONS] file1 [file2 ...]'
print *, ''
print *, ' decode pre-recorded .WAV file(s)'
print *, ''
print *, 'OPTIONS:'
do i = 1, size (long_options)
call long_options(i) % print (6)
end do
go to 999
endif
call init_timer ('timer.out')
call timer('msk144 ',0)
ndecoded=0
do ifile=noffset+1,noffset+nremain
call get_command_argument(ifile,optarg,narglen)
infile=optarg(:narglen)
call timer('read ',0)
call wav%read (infile)
i1=index(infile,'.wav')
if( i1 .eq. 0 ) i1=index(infile,'.WAV')
read(infile(i1-6:i1-1),*,err=998) nutc
inquire(FILE=infile,SIZE=isize)
npts=min((isize-216)/2,360000)
read(unit=wav%lun) id2(1:npts)
close(unit=wav%lun)
call timer('read ',1)
! do if=1,89 ! brute force multi-decoder
fo=nrxfreq
! fo=(if-1)*25.0+300.0
call msksddc(id2,npts,fo,cdat)
np=npts/32
ntol=200 ! actual ntol is ntol/32=6.25 Hz. Detection window is 12.5 Hz wide
fc=1500.0
call msk144spd(cdat,np,ntol,ndecodesuccess,msgreceived,fc,fest,tdec,navg,ct, &
softbits,recent_calls,nrecent)
nsnr=0 ! need an snr estimate
if( ndecodesuccess .eq. 1 ) then
fest=fo+fest-fc ! fudging because spd thinks input signal is at 1500 Hz
goto 900
endif
! If short ping decoder doesn't find a decode
npat=NPATTERNS
do iavg=1,npat
iavmask=iavpatterns(1:8,iavg)
navg=sum(iavmask)
deltaf=4.0/real(navg) ! search increment for frequency sync
npeaks=3
ntol=200
fc=1500.0
call msk144sync(cdat(1:6*NSPM),6,ntol,deltaf,iavmask,npeaks,fc, &
fest,npkloc,nsyncsuccess,xmax,c)
if( nsyncsuccess .eq. 0 ) cycle
do ipk=1,npeaks
do is=1,3
ic0=npkloc(ipk)
if(is.eq.2) ic0=max(1,ic0-1)
if(is.eq.3) ic0=min(NSPM,ic0+1)
ct=cshift(c,ic0-1)
call msk144decodeframe(ct,softbits,msgreceived,ndecodesuccess, &
recent_calls,nrecent)
if(ndecodesuccess .gt. 0) then
tdec=tsec+xmc(iavg)*tframe
fest=fo+(fest-fc)/32.0
goto 900
endif
enddo !Slicer dither
enddo !Peak loop
enddo
! enddo
900 continue
if( ndecodesuccess .gt. 0 ) then
write(*,1020) nutc,nsnr,tdec,nint(fest),' % ',msgreceived,navg
1020 format(i6.6,i4,f5.1,i5,a3,a22,i4)
endif
enddo
call timer('msk144 ',1)
call timer('msk144 ',101)
go to 999
998 print*,'Cannot read from file:'
print*,infile
999 continue
end program msk144sd
subroutine msksddc(id2,npts,fc,cdat)
! The msk144 detector/demodulator/decoder will decode signals
! with carrier frequency, fc, in the range fN/4 +/- 0.03333*fN.
!
! For slow MSK144 with nslow=32:
! fs=12000/32=375 Hz, fN=187.5 Hz
!
! This routine accepts input samples with fs=12000 Hz. It
! downconverts and decimates by 32 to center a signal with input carrier
! frequency fc at new carrier frequency 1500/32=46.875 Hz.
! The analytic signal is returned.
parameter (NFFT1=30*12000,NFFT2=30*375)
integer*2 id2(npts)
complex cx(0:NFFT1)
complex cdat(30*375)
dt=1.0/12000.0
df=1.0/(NFFT1*dt)
icenter=int(fc/df+0.5)
i46p875=int(46.875/df+0.5)
ishift=icenter-i46p875
cx=cmplx(0.0,0.0)
cx(1:npts)=id2
call four2a(cx,NFFT1,1,-1,1)
cx=cshift(cx,ishift)
cx(2*i46p875+1:)=cmplx(0.0,0.0)
call four2a(cx,NFFT2,1,1,1)
cdat(1:npts/32)=cx(0:npts/32-1)/NFFT1
return
end subroutine msksddc
@@ -0,0 +1,93 @@
// Copyright John Maddock 2008.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_SPECIAL_ROUND_FWD_HPP
#define BOOST_MATH_SPECIAL_ROUND_FWD_HPP
#include <boost/config.hpp>
#include <boost/math/tools/promotion.hpp>
#ifdef _MSC_VER
#pragma once
#endif
namespace boost
{
namespace math
{
template <class T, class Policy>
typename tools::promote_args<T>::type trunc(const T& v, const Policy& pol);
template <class T>
typename tools::promote_args<T>::type trunc(const T& v);
template <class T, class Policy>
int itrunc(const T& v, const Policy& pol);
template <class T>
int itrunc(const T& v);
template <class T, class Policy>
long ltrunc(const T& v, const Policy& pol);
template <class T>
long ltrunc(const T& v);
#ifdef BOOST_HAS_LONG_LONG
template <class T, class Policy>
boost::long_long_type lltrunc(const T& v, const Policy& pol);
template <class T>
boost::long_long_type lltrunc(const T& v);
#endif
template <class T, class Policy>
typename tools::promote_args<T>::type round(const T& v, const Policy& pol);
template <class T>
typename tools::promote_args<T>::type round(const T& v);
template <class T, class Policy>
int iround(const T& v, const Policy& pol);
template <class T>
int iround(const T& v);
template <class T, class Policy>
long lround(const T& v, const Policy& pol);
template <class T>
long lround(const T& v);
#ifdef BOOST_HAS_LONG_LONG
template <class T, class Policy>
boost::long_long_type llround(const T& v, const Policy& pol);
template <class T>
boost::long_long_type llround(const T& v);
#endif
template <class T, class Policy>
T modf(const T& v, T* ipart, const Policy& pol);
template <class T>
T modf(const T& v, T* ipart);
template <class T, class Policy>
T modf(const T& v, int* ipart, const Policy& pol);
template <class T>
T modf(const T& v, int* ipart);
template <class T, class Policy>
T modf(const T& v, long* ipart, const Policy& pol);
template <class T>
T modf(const T& v, long* ipart);
#ifdef BOOST_HAS_LONG_LONG
template <class T, class Policy>
T modf(const T& v, boost::long_long_type* ipart, const Policy& pol);
template <class T>
T modf(const T& v, boost::long_long_type* ipart);
#endif
}
}
#undef BOOST_MATH_STD_USING
#define BOOST_MATH_STD_USING BOOST_MATH_STD_USING_CORE\
using boost::math::round;\
using boost::math::iround;\
using boost::math::lround;\
using boost::math::trunc;\
using boost::math::itrunc;\
using boost::math::ltrunc;\
using boost::math::modf;
#endif // BOOST_MATH_SPECIAL_ROUND_FWD_HPP
@@ -0,0 +1,150 @@
subroutine sync8(dd,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase)
include 'ft8_params.f90'
! Search over +/- 1.5s relative to 0.5s TX start time.
parameter (JZ=38)
complex cx(0:NH1)
real s(NH1,NHSYM)
real savg(NH1)
real sbase(NH1)
real x(NFFT1)
real sync2d(NH1,-JZ:JZ)
real red(NH1)
real candidate0(3,200)
real candidate(3,200)
real dd(NMAX)
integer jpeak(NH1)
integer indx(NH1)
integer ii(1)
integer icos7(0:6)
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
equivalence (x,cx)
! Compute symbol spectra, stepping by NSTEP steps.
savg=0.
tstep=NSTEP/12000.0
df=12000.0/NFFT1 !3.125 Hz
fac=1.0/300.0
do j=1,NHSYM
ia=(j-1)*NSTEP + 1
ib=ia+NSPS-1
x(1:NSPS)=fac*dd(ia:ib)
x(NSPS+1:)=0.
call four2a(x,NFFT1,1,-1,0) !r2c FFT
do i=1,NH1
s(i,j)=real(cx(i))**2 + aimag(cx(i))**2
enddo
savg=savg + s(1:NH1,j) !Average spectrum
enddo
call baseline(savg,nfa,nfb,sbase)
! savg=savg/NHSYM
! do i=1,NH1
! write(51,3051) i*df,savg(i),db(savg(i))
!3051 format(f10.3,e12.3,f12.3)
! enddo
ia=max(1,nint(nfa/df))
ib=nint(nfb/df)
nssy=NSPS/NSTEP ! # steps per symbol
nfos=NFFT1/NSPS ! # frequency bin oversampling factor
jstrt=0.5/tstep
do i=ia,ib
do j=-JZ,+JZ
ta=0.
tb=0.
tc=0.
t0a=0.
t0b=0.
t0c=0.
do n=0,6
k=j+jstrt+nssy*n
if(k.ge.1.and.k.le.NHSYM) then
ta=ta + s(i+nfos*icos7(n),k)
t0a=t0a + sum(s(i:i+nfos*6:nfos,k))
endif
tb=tb + s(i+nfos*icos7(n),k+nssy*36)
t0b=t0b + sum(s(i:i+nfos*6:nfos,k+nssy*36))
if(k+nssy*72.le.NHSYM) then
tc=tc + s(i+nfos*icos7(n),k+nssy*72)
t0c=t0c + sum(s(i:i+nfos*6:nfos,k+nssy*72))
endif
enddo
t=ta+tb+tc
t0=t0a+t0b+t0c
t0=(t0-t)/6.0
sync_abc=t/t0
t=tb+tc
t0=t0b+t0c
t0=(t0-t)/6.0
sync_bc=t/t0
sync2d(i,j)=max(sync_abc,sync_bc)
enddo
enddo
red=0.
do i=ia,ib
ii=maxloc(sync2d(i,-JZ:JZ)) - 1 - JZ
j0=ii(1)
jpeak(i)=j0
red(i)=sync2d(i,j0)
! write(52,3052) i*df,red(i),db(red(i))
!3052 format(3f12.3)
enddo
iz=ib-ia+1
call indexx(red(ia:ib),iz,indx)
ibase=indx(nint(0.40*iz)) - 1 + ia
base=red(ibase)
red=red/base
candidate0=0.
k=0
do i=1,200
n=ia + indx(iz+1-i) - 1
if(red(n).lt.syncmin) exit
if(k.lt.200) k=k+1
candidate0(1,k)=n*df
candidate0(2,k)=(jpeak(n)-1)*tstep
candidate0(3,k)=red(n)
enddo
ncand=k
! Put nfqso at top of list, and save only the best of near-dupe freqs.
do i=1,ncand
if(abs(candidate0(1,i)-nfqso).lt.10.0) candidate0(1,i)=-candidate0(1,i)
if(i.ge.2) then
do j=1,i-1
fdiff=abs(candidate0(1,i))-abs(candidate0(1,j))
if(abs(fdiff).lt.4.0) then
if(candidate0(3,i).ge.candidate0(3,j)) candidate0(3,j)=0.
if(candidate0(3,i).lt.candidate0(3,j)) candidate0(3,i)=0.
endif
enddo
! write(*,3001) i,candidate0(1,i-1),candidate0(1,i),candidate0(3,i-1), &
! candidate0(3,i)
!3001 format(i2,4f8.1)
endif
enddo
fac=20.0/maxval(s)
s=fac*s
! Sort by sync
! call indexx(candidate0(3,1:ncand),ncand,indx)
! Sort by frequency
call indexx(candidate0(1,1:ncand),ncand,indx)
k=1
! do i=ncand,1,-1
do i=1,ncand
j=indx(i)
if( candidate0(3,j) .ge. syncmin .and. candidate0(2,j).ge.-1.5 ) then
candidate(1,k)=abs(candidate0(1,j))
candidate(2,k)=candidate0(2,j)
candidate(3,k)=candidate0(3,j)
k=k+1
endif
enddo
ncand=k-1
return
end subroutine sync8
@@ -0,0 +1,33 @@
# /* Copyright (C) 2001
# * Housemarque Oy
# * http://www.housemarque.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)
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_STRINGIZE_HPP
# define BOOST_PREPROCESSOR_STRINGIZE_HPP
#
# include <boost/preprocessor/config/config.hpp>
#
# /* BOOST_PP_STRINGIZE */
#
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_A((text))
# define BOOST_PP_STRINGIZE_A(arg) BOOST_PP_STRINGIZE_I arg
# elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_OO((text))
# define BOOST_PP_STRINGIZE_OO(par) BOOST_PP_STRINGIZE_I ## par
# else
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_I(text)
# endif
#
# define BOOST_PP_STRINGIZE_I(text) #text
#
# endif
@@ -0,0 +1,186 @@
White Paper: FT8 for DXpeditions
-----------------------------------
Joe Taylor, K1JT - October 27, 2017
Assumptions:
1. WSJT-X will have two distinct options that enable the maximum-rate
QSO exchanges described below. Fox must select "Fox"; all Hounds must
select "Hound".
2. There will be an announced basic dial frequency for each band, say
f0=14082 kHz for 20m. This is the basic Channel.
3. Fox always transmits in the 1st sequence, 200-800 Hz above f0.
4. Hounds call in 2nd sequence, 1000-5000 Hz above f0. Hounds
transmitting below f0+1000 Hz will not be answered.
5. If found necessary, additional Channels may be defined in which
Hounds can transmit. (However, I suggest that CQ-by-call-area may
be easier to implement and use; and the software could be made to
prevent Hounds in the wrong area from transmitting.)
6. Ideally, Fox and Hounds should all use CAT control configured with
*Split Operation* set to *Rig* or *Fake It*, and transceiver dial
frequencies should best be calibrated to within a few Hz. (WSJT-X
provides tools that make this fairly easy to do.)
When Fox is running a pileup, QSOs will look something like the
following exchanges. Here I've assumed the Fox callsign is KH1DX,
his locator AJ10:
------------------------------------------------------------------------
Fox Hounds
------------------------------------------------------------------------
1. CQ KH1DX AJ10
2. KH1DX K1ABC FN42, KH1DX W9XYZ EN37, ...
3. K1ABC KH1DX -13
4. KH1DX K1ABC R-11
5. K1ABC R 73; W9XYZ <KH1DX> -17
6. ... no copy from W9XYZ ...
7. W9XYZ KH1DX -17
8. ... no copy from W9XYZ ...
9. G4AAA KH1DX -11
10. KH1DX G4AAA R-03
11. G4AAA R 73; DL3BBB <KH1DX> -12
12. KH1DX DL3BBB R-09
13. DL3BBB R 73; DE <KH1DX>
14. ...
------------------------------------------------------------------------
All messages except those containing "<...>" are standard FT8 messages
(i3bit=0, iFreeText=0). Hounds transmit only standard messages.
Fox transmits standard messages and also special messages with
i3bit=1. The special messages contain a callsign whose completed QSO
is being acknowledged; a callsign for the next station to be worked; a
hash code corresponding to the Fox callsign; and a signal report.
Users will see the Fox callsign enclosed in angle brackets, <KH1DX>.
The 72-bit message payload contains two 28-bit callsigns, a 10-bit
hash code, and a 6-bit signal report. If no call has been queued up
by Fox for the next QSO, the acknowledgment message takes the
abbreviated form shown in line 13 above.
When a Hound receives a message with i3bit=1, the decoder interprets
the remaining 72 bits as described above. If the 10-bit hash code
matches that for Fox's callsign, the message is displayed as in the
QSO exchanges shown above. Otherwise the message is considered a
false decode and is not displayed.
Station Setup and Operation for FOX
-----------------------------------
A wide Rx bandwidth (up to 5 kHz) is selected. The basic dial
frequency is set 1 kHz above f0 (thus 14083 kHz in my example) and the
audio TxFreq somewhere between -200 and -800 Hz. (Yes, negative
numbers are OK. *Split Operation* will reset the Tx dial frequency as
needed and will keep the generated Tx audio frequency between 1500 and
2000 Hz.) Hounds with audio TxFreq set to N Hz will be received by Fox
at N-1000 Hz.
WSJT-X at Fox will maintain and display a list of all decoded Hounds
calling Fox in the past 2 to 4 Rx cycles. The list might look
something like this (but typically will be much longer):
----------------------------
Call Grid Rpt Freq
----------------------------
AA2UK FM29 -11 240
AD9H EN61 +02 1260
K0TPP EM48 -15 1980
N2BJ EN61 +11 540
N4NDR EL98 -17 4620
NX4E EM70 +00 3780
ON3LA JN29 -10 3300
PD9BG JO21 -21 2100
PJ4/KA1XYZ FK60 -07 1020
VE1SKY FN74 +03 1620
WB2REM EL97 -13 3060
...
----------------------------
Fox can choose to have the list sorted on any column.
Fox selects a Hound to call next by clicking on a line. Or he can hit
"F1" to have the program select a caller according to one of these
criteria (maybe others as well?):
- Weakest caller
- Strongest caller
- Strongest one below -N dB (with N selectable)
- Choose a call at random
- Random choice with S/N between snrMin and snrMax dB.
After a particular Hound has been called, Fox's Auto-Sequencer looks
for a response containing "R+rpt" originating from that same callsign.
If such a message is received, Fox's next transmission will be the
special "acknowledge-and-call-next" type, with i3bit=1. If the
expected message is not received, as in example line 6 above, the
report is sent to the same station again. If the second attempt fails
and another Hound callsign has been queued up, the QSO is aborted and
the next Hound is called.
Station Setup and Operation for Hounds
--------------------------------------
Dial frequency is set to f0, 14082 kHz in my example. Rx bandwidth and
displayed range on the Wide Graph can be anything convenient, say 200
to 2600 Hz. (Signal from Fox will be expected between 200 and 800
Hz.) Enter callsign and locator of Fox on WSJT-X main window as *DX
Call* and *DX Grid*. Choose a TxFreq offset of 1000 + 60*N for some N
in the range 1 to 80 (maybe even higher?). Move TxFreq as desired,
hoping to find a clear slot, by using Shift+F11 and Shift+F12.
- Hit F1 to call Fox in your next Tx sequence. Yes, you must hit F1
repeatedly, in order to keep calling.
- The Auto-sequencer will watch for a decoded message that contains
"MyCall DXcall rpt" or "MyCall <DXcall> rpt". When one of these is
received, your next transmission will be "DXcall MyCall R+rpt",
sent automatically.
- After you send the "R+rpt" message, AutoSeq will watch for a
message that starts with "MyCall R 73; ...". When that is
received, you're in his log, and you'll be prompted to log the QSO.
Random thoughts
---------------
Fox's decoder has access to signals in a 4 kHz (maybe even 5 kHz?)
window. At 60 Hz intervals, that's enough for around 65 (or 80?)
non-overlapping Hound signals. If the pileup becomes too deep, more
spectrum might be used; but note that WSJT-X can't access more than 5
kHz at one time. A better solution might be for Fox to call "CQ n
KH1DX AJ10", where n is a single digit indicating call area. The
decoder could then limit the list of eligible calls to those in the
specified call area. After decoding such a CQ, the software at Hound
could refuse to transmit unless MyCall falls in the specified call
area. (Other special CQ formats can be imagined that would limit the
eligible Hound callsigns even further.)
We haven't thought much, yet, about logging issues for Fox. I imagine
we could do what's necessary to join a N1MM+ logging network, if that's
deemed desirable.
A few questions:
Q1: Should the Auto-Sequencer allow for other cases in which a QSO has
been initiated by Fox, but one of next two messages is not copied by
either Fox or Hound? For example, what if K1ABC does not copy message
#5? Should he keep sending his message "KH1DX K1ABC R-11" ? If Fox
receives this message again, should he acknowledge again? And poor
W9XYZ, who never received an acknowledgment, will probably keep
sending "KH1DX W9XYZ R-19", or whatever. If Fox eventually copies the
message, should the program remember that W9XYZ had been called, and
thus send him an acknowledgment?
Q2: Should we provide a stack for several to-be-called callsigns,
rather than just one? Should re-ordering of calls in the stack be
permitted?
Q3: Can we handle WSJT-X "Type 1" and "Type 2" compound callsigns, for
Hounds?
@@ -0,0 +1,91 @@
#ifndef GREGORIAN_PARSERS_HPP___
#define GREGORIAN_PARSERS_HPP___
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/date_time/gregorian/gregorian_types.hpp"
#include "boost/date_time/date_parsing.hpp"
#include "boost/date_time/compiler_config.hpp"
#include "boost/date_time/parse_format_base.hpp"
#include <string>
#include <sstream>
namespace boost {
namespace gregorian {
//! Return special_value from string argument
/*! Return special_value from string argument. If argument is
* not one of the special value names (defined in src/gregorian/names.hpp),
* return 'not_special' */
BOOST_DATE_TIME_DECL special_values special_value_from_string(const std::string& s);
//! Deprecated: Use from_simple_string
inline date from_string(std::string s) {
return date_time::parse_date<date>(s);
}
//! From delimited date string where with order year-month-day eg: 2002-1-25 or 2003-Jan-25 (full month name is also accepted)
inline date from_simple_string(std::string s) {
return date_time::parse_date<date>(s, date_time::ymd_order_iso);
}
//! From delimited date string where with order year-month-day eg: 1-25-2003 or Jan-25-2003 (full month name is also accepted)
inline date from_us_string(std::string s) {
return date_time::parse_date<date>(s, date_time::ymd_order_us);
}
//! From delimited date string where with order day-month-year eg: 25-1-2002 or 25-Jan-2003 (full month name is also accepted)
inline date from_uk_string(std::string s) {
return date_time::parse_date<date>(s, date_time::ymd_order_dmy);
}
//! From iso type date string where with order year-month-day eg: 20020125
inline date from_undelimited_string(std::string s) {
return date_time::parse_undelimited_date<date>(s);
}
//! From iso type date string where with order year-month-day eg: 20020125
inline date date_from_iso_string(const std::string& s) {
return date_time::parse_undelimited_date<date>(s);
}
#if !(defined(BOOST_NO_STD_ITERATOR_TRAITS))
//! Stream should hold a date in the form of: 2002-1-25. Month number, abbrev, or name are accepted
/* Arguments passed in by-value for convertability of char[]
* to iterator_type. Calls to from_stream_type are by-reference
* since conversion is already done */
template<class iterator_type>
inline date from_stream(iterator_type beg, iterator_type end) {
if(beg == end)
{
return date(not_a_date_time);
}
typedef typename std::iterator_traits<iterator_type>::value_type value_type;
return date_time::from_stream_type<date>(beg, end, value_type());
}
#endif //BOOST_NO_STD_ITERATOR_TRAITS
#if (defined(_MSC_VER) && (_MSC_VER < 1300))
// This function cannot be compiled with MSVC 6.0 due to internal compiler shorcomings
#else
//! Function to parse a date_period from a string (eg: [2003-Oct-31/2003-Dec-25])
inline date_period date_period_from_string(const std::string& s){
return date_time::from_simple_string_type<date,char>(s);
}
# if !defined(BOOST_NO_STD_WSTRING)
//! Function to parse a date_period from a wstring (eg: [2003-Oct-31/2003-Dec-25])
inline date_period date_period_from_wstring(const std::wstring& s){
return date_time::from_simple_string_type<date,wchar_t>(s);
}
# endif // BOOST_NO_STD_WSTRING
#endif
} } //namespace gregorian
#endif
@@ -0,0 +1,40 @@
#ifndef BOOST_MPL_AUX_CONFIG_ADL_HPP_INCLUDED
#define BOOST_MPL_AUX_CONFIG_ADL_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2002-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/aux_/config/msvc.hpp>
#include <boost/mpl/aux_/config/intel.hpp>
#include <boost/mpl/aux_/config/gcc.hpp>
#include <boost/mpl/aux_/config/workaround.hpp>
// agurt, 25/apr/04: technically, the ADL workaround is only needed for GCC,
// but putting everything expect public, user-specializable metafunctions into
// a separate global namespace has a nice side effect of reducing the length
// of template instantiation symbols, so we apply the workaround on all
// platforms that can handle it
#if !defined(BOOST_MPL_CFG_NO_ADL_BARRIER_NAMESPACE) \
&& ( BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
|| BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) \
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
|| BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, BOOST_TESTED_AT(810)) \
)
# define BOOST_MPL_CFG_NO_ADL_BARRIER_NAMESPACE
#endif
#endif // BOOST_MPL_AUX_CONFIG_ADL_HPP_INCLUDED
@@ -0,0 +1,19 @@
# /* **************************************************************************
# * *
# * (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_ITERATION_SELF_HPP
# define BOOST_PREPROCESSOR_ITERATION_SELF_HPP
#
# /* BOOST_PP_INCLUDE_SELF */
#
# define BOOST_PP_INCLUDE_SELF() <boost/preprocessor/iteration/detail/self.hpp>
#
# endif
@@ -0,0 +1,323 @@
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// *Preprocessed* version of the main "deque.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename T0 = na, typename T1 = na, typename T2 = na, typename T3 = na
, typename T4 = na, typename T5 = na, typename T6 = na, typename T7 = na
, typename T8 = na, typename T9 = na, typename T10 = na, typename T11 = na
, typename T12 = na, typename T13 = na, typename T14 = na
, typename T15 = na, typename T16 = na, typename T17 = na
, typename T18 = na, typename T19 = na
>
struct deque;
template<
>
struct deque<
na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector0< >
{
typedef vector0< >::type type;
};
template<
typename T0
>
struct deque<
T0, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector1<T0>
{
typedef typename vector1<T0>::type type;
};
template<
typename T0, typename T1
>
struct deque<
T0, T1, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector2< T0,T1 >
{
typedef typename vector2< T0,T1 >::type type;
};
template<
typename T0, typename T1, typename T2
>
struct deque<
T0, T1, T2, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector3< T0,T1,T2 >
{
typedef typename vector3< T0,T1,T2 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3
>
struct deque<
T0, T1, T2, T3, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector4< T0,T1,T2,T3 >
{
typedef typename vector4< T0,T1,T2,T3 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
>
struct deque<
T0, T1, T2, T3, T4, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector5< T0,T1,T2,T3,T4 >
{
typedef typename vector5< T0,T1,T2,T3,T4 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5
>
struct deque<
T0, T1, T2, T3, T4, T5, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector6< T0,T1,T2,T3,T4,T5 >
{
typedef typename vector6< T0,T1,T2,T3,T4,T5 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector7< T0,T1,T2,T3,T4,T5,T6 >
{
typedef typename vector7< T0,T1,T2,T3,T4,T5,T6 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, na, na, na, na, na, na, na, na, na
, na, na, na
>
: vector8< T0,T1,T2,T3,T4,T5,T6,T7 >
{
typedef typename vector8< T0,T1,T2,T3,T4,T5,T6,T7 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, na, na, na, na, na, na, na, na
, na, na, na
>
: vector9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >
{
typedef typename vector9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, na, na, na, na, na, na, na
, na, na, na
>
: vector10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >
{
typedef typename vector10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, na, na, na, na, na, na
, na, na, na
>
: vector11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >
{
typedef typename vector11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, na, na, na, na
, na, na, na, na
>
: vector12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >
{
typedef typename vector12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, na, na, na
, na, na, na, na
>
: vector13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >
{
typedef typename vector13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, na, na
, na, na, na, na
>
: vector14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >
{
typedef typename vector14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, na
, na, na, na, na
>
: vector15<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
>
{
typedef typename vector15< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, na, na, na, na
>
: vector16<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15
>
{
typedef typename vector16< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, na, na, na
>
: vector17<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16
>
{
typedef typename vector17< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, na, na
>
: vector18<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17
>
{
typedef typename vector18< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18
>
struct deque<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, T18, na
>
: vector19<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, T18
>
{
typedef typename vector19< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18 >::type type;
};
/// primary template (not a specialization!)
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct deque
: vector20<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, T18, T19
>
{
typedef typename vector20< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19 >::type type;
};
}}
@@ -0,0 +1,123 @@
// Copyright Peter Dimov 2001-2002
// Copyright Aleksey Gurtovoy 2001-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/arg.hpp" header
// -- DO NOT modify by hand!
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
template<> struct arg< -1 >
{
BOOST_STATIC_CONSTANT(int, value = -1);
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U1 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
template<> struct arg<1>
{
BOOST_STATIC_CONSTANT(int, value = 1);
typedef arg<2> next;
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U1 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
template<> struct arg<2>
{
BOOST_STATIC_CONSTANT(int, value = 2);
typedef arg<3> next;
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U2 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
template<> struct arg<3>
{
BOOST_STATIC_CONSTANT(int, value = 3);
typedef arg<4> next;
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U3 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
template<> struct arg<4>
{
BOOST_STATIC_CONSTANT(int, value = 4);
typedef arg<5> next;
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U4 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
template<> struct arg<5>
{
BOOST_STATIC_CONSTANT(int, value = 5);
typedef arg<6> next;
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U5 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(1,int, arg)
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
@@ -0,0 +1,304 @@
subroutine syncmsk(cdat,npts,jpk,ipk,idf,rmax,snr,metric,decoded)
! Attempt synchronization, and if successful decode using Viterbi algorithm.
use iso_c_binding, only: c_loc,c_size_t
use packjt
use hashing
use timer_module, only: timer
parameter (NSPM=1404,NSAVE=2000)
complex cdat(npts) !Analytic signal
complex cb(66) !Complex waveform for Barker-11 code
complex cd(0:11,0:3)
complex c(0:NSPM-1) !Complex data for one message length
complex c2(0:NSPM-1)
complex cb3(1:NSPM,3)
real r(12000)
real rdat(12000)
real ss1(12000)
real symbol(234)
real rdata(198)
real rd2(198)
real rsave(NSAVE)
real xp(29)
complex z,z0,z1,z2,z3,cfac
integer*1 e1(198)
integer*1, target :: d8(13)
integer*1 i1hash(4)
integer*1 i1
integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words
integer mettab(0:255,0:1) !Metric table for BPSK modulation
integer ipksave(NSAVE)
integer jpksave(NSAVE)
integer indx(NSAVE)
integer b11(11) !Barker-11 code
character*22 decoded
character*72 c72
logical first
equivalence (i1,i4)
equivalence (ihash,i1hash)
data xp/0.500000, 0.401241, 0.309897, 0.231832, 0.168095, &
0.119704, 0.083523, 0.057387, 0.039215, 0.026890, &
0.018084, 0.012184, 0.008196, 0.005475, 0.003808, &
0.002481, 0.001710, 0.001052, 0.000789, 0.000469, &
0.000329, 0.000225, 0.000187, 0.000086, 0.000063, &
0.000017, 0.000091, 0.000032, 0.000045/
data first/.true./
data b11/1,1,1,0,0,0,1,0,0,1,0/
save first,cb,cd,twopi,dt,f0,f1,mettab
phi=0.
if(first) then
! Get the metric table
bias=0.0
scale=20.0
xln2=log(2.0)
mettab=0
do i=128,156
x0=log(max(0.001,2.0*xp(i-127)))/xln2
x1=log(max(0.001,2.0*(1.0-xp(i-127))))/xln2
mettab(i,0)=nint(scale*(x0-bias))
mettab(i,1)=nint(scale*(x1-bias))
mettab(256-i,0)=mettab(i,1)
mettab(256-i,1)=mettab(i,0)
enddo
do i=157,255
mettab(i,0)=mettab(156,0)
mettab(i,1)=mettab(156,1)
mettab(256-i,0)=mettab(i,1)
mettab(256-i,1)=mettab(i,0)
enddo
j=0
twopi=8.0*atan(1.0)
dt=1.0/12000.0
f0=1000.0
f1=2000.0
dphi=0
do i=1,11
if(b11(i).eq.0) dphi=twopi*f0*dt
if(b11(i).eq.1) dphi=twopi*f1*dt
do n=1,6
j=j+1
phi=phi+dphi
cb(j)=cmplx(cos(phi),sin(phi))
enddo
enddo
cb3=0.
cb3(1:66,1)=cb
cb3(283:348,1)=cb
cb3(769:834,1)=cb
cb3(1:66,2)=cb
cb3(487:552,2)=cb
cb3(1123:1188,2)=cb
cb3(1:66,3)=cb
cb3(637:702,3)=cb
cb3(919:984,3)=cb
phi=0.
do n=0,3
k=-1
dphi=twopi*f0*dt
if(n.ge.2) dphi=twopi*f1*dt
do i=0,5
k=k+1
phi=phi+dphi
if(phi.gt.twopi) phi=phi-twopi
cd(k,n)=cmplx(cos(phi),sin(phi))
enddo
dphi=twopi*f0*dt
if(mod(n,2).eq.1) dphi=twopi*f1*dt
do i=6,11
k=k+1
phi=phi+dphi
if(phi.gt.twopi) phi=phi-twopi
cd(k,n)=cmplx(cos(phi),sin(phi))
enddo
enddo
first=.false.
endif
nfft=NSPM
jz=npts-nfft
decoded=" "
ipk=0
jpk=0
metric=-9999
r=0.
call timer('sync1 ',0)
do j=1,jz !Find the Barker-11 sync vectors
z=0.
ss=0.
do i=1,66
ss=ss + real(cdat(j+i-1))**2 + aimag(cdat(j+i-1))**2
z=z + cdat(j+i-1)*conjg(cb(i)) !Signal matching Barker 11
enddo
ss=sqrt(ss/66.0)*66.0
r(j)=abs(z)/(0.908*ss) !Goodness-of-fit to Barker 11
ss1(j)=ss
enddo
call timer('sync1 ',1)
call timer('sync2 ',0)
jz=npts-nfft
rmax=0.
! n1=35, n2=69, n3=94
k=0
do j=1,jz !Find best full-message sync
if(ss1(j).lt.85.0) cycle
r1=r(j) + r(j+282) + r(j+768) ! 6*(12+n1) 6*(24+n1+n2)
r2=r(j) + r(j+486) + r(j+1122) ! 6*(12+n2) 6*(24+n2+n3)
r3=r(j) + r(j+636) + r(j+918) ! 6*(12+n3) 6*(24+n3+n1)
if(r1.gt.rmax) then
rmax=r1
jpk=j
ipk=1
endif
if(r2.gt.rmax) then
rmax=r2
jpk=j
ipk=2
endif
if(r3.gt.rmax) then
rmax=r3
jpk=j
ipk=3
endif
rrmax=max(r1,r2,r3)
if(rrmax.gt.1.9) then
k=min(k+1,NSAVE)
if(r1.eq.rrmax) ipksave(k)=1
if(r2.eq.rrmax) ipksave(k)=2
if(r3.eq.rrmax) ipksave(k)=3
jpksave(k)=j
rsave(k)=rrmax
endif
enddo
call timer('sync2 ',1)
kmax=k
call indexx(rsave,kmax,indx)
call timer('sync3 ',0)
do kk=1,kmax
k=indx(kmax+1-kk)
ipk=ipksave(k)
jpk=jpksave(k)
rmax=rsave(k)
c=conjg(cb3(1:NSPM,ipk))*cdat(jpk:jpk+nfft-1)
smax=0.
dfx=0.
idfbest=0
do itry=1,25
idf=itry/2
if(mod(itry,2).eq.0) idf=-idf
idf=4*idf
twk=idf
call tweak1(c,NSPM,-twk,c2)
z=sum(c2)
if(abs(z).gt.smax) then
dfx=twk
smax=abs(z)
phi=atan2(aimag(z),real(z)) !Carrier phase offset
idfbest=idf
endif
enddo
idf=idfbest
call tweak1(cdat,npts,-dfx,cdat)
cfac=cmplx(cos(phi),-sin(phi))
cdat=cfac*cdat
sig=0.
ref=0.
rdat(1:npts)=cdat
iz=11
do k=1,234 !Compute soft symbols
j=jpk+6*(k-1)
z0=2.0*dot_product(cdat(j:j+iz),cd(0:iz,0))
z1=2.0*dot_product(cdat(j:j+iz),cd(0:iz,1))
z2=2.0*dot_product(cdat(j:j+iz),cd(0:iz,2))
z3=2.0*dot_product(cdat(j:j+iz),cd(0:iz,3))
!### Maybe these should be weighted by yellow() ?
if(j+1404+iz.lt.npts) then
z0=z0 + dot_product(cdat(j+1404:j+1404+iz),cd(0:iz,0))
z1=z1 + dot_product(cdat(j+1404:j+1404+iz),cd(0:iz,1))
z2=z2 + dot_product(cdat(j+1404:j+1404+iz),cd(0:iz,2))
z3=z3 + dot_product(cdat(j+1404:j+1404+iz),cd(0:iz,3))
endif
if(j-1404.ge.1) then
z0=z0 + dot_product(cdat(j-1404:j-1404+iz),cd(0:iz,0))
z1=z1 + dot_product(cdat(j-1404:j-1404+iz),cd(0:iz,1))
z2=z2 + dot_product(cdat(j-1404:j-1404+iz),cd(0:iz,2))
z3=z3 + dot_product(cdat(j-1404:j-1404+iz),cd(0:iz,3))
endif
sym=max(abs(real(z2)),abs(real(z3))) - max(abs(real(z0)),abs(real(z1)))
if(sym.lt.0.0) then
phi=atan2(aimag(z0),real(z0))
sig=sig + real(z0)**2
ref=ref + aimag(z0)**2
else
phi=atan2(aimag(z1),real(z1))
sig=sig + real(z1)**2
ref=ref + aimag(z1)**2
endif
n=k
if(ipk.eq.2) n=k+47
if(ipk.eq.3) n=k+128
if(n.gt.234) n=n-234
ibit=0
if(sym.ge.0) ibit=1
symbol(n)=sym
enddo
snr=db(sig/ref-1.0)
rdata(1:35)=symbol(12:46)
rdata(36:104)=symbol(59:127)
rdata(105:198)=symbol(140:233)
! Re-order the symbols and make them i*1
j=0
do i=1,99
i4=128+rdata(i) !### Should be nint() ??? ###
if(i4.gt.255) i4=255
if(i4.lt.0) i4=0
j=j+1
e1(j)=i1
rd2(j)=rdata(i)
i4=128+rdata(i+99)
if(i4.gt.255) i4=255
if(i4.lt.0) i4=0
j=j+1
e1(j)=i1
rd2(j)=rdata(i+99)
enddo
! Decode the message
nb1=87
call vit213(e1,nb1,mettab,d8,metric)
ihash=nhash(c_loc(d8),int(9,c_size_t),146)
ihash=2*iand(ihash,32767)
decoded=' '
if(d8(10).eq.i1hash(2) .and. d8(11).eq.i1hash(1)) then
write(c72,1012) d8(1:9)
1012 format(9b8.8)
read(c72,1014) i4Msg6BitWords
1014 format(12b6.6)
call unpackmsg(i4Msg6BitWords,decoded) !Unpack to get msgsent
endif
if(decoded.ne.' ') exit
enddo
call timer('sync3 ',1)
return
end subroutine syncmsk
@@ -0,0 +1,583 @@
// - lambda_traits.hpp --- Boost Lambda Library ----------------------------
//
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
//
// 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)
//
// For more information, see www.boost.org
// -------------------------------------------------------------------------
#ifndef BOOST_LAMBDA_LAMBDA_TRAITS_HPP
#define BOOST_LAMBDA_LAMBDA_TRAITS_HPP
#include "boost/type_traits/transform_traits.hpp"
#include "boost/type_traits/cv_traits.hpp"
#include "boost/type_traits/function_traits.hpp"
#include "boost/type_traits/object_traits.hpp"
#include "boost/tuple/tuple.hpp"
namespace boost {
namespace lambda {
// -- if construct ------------------------------------------------
// Proposed by Krzysztof Czarnecki and Ulrich Eisenecker
namespace detail {
template <bool If, class Then, class Else> struct IF { typedef Then RET; };
template <class Then, class Else> struct IF<false, Then, Else> {
typedef Else RET;
};
// An if construct that doesn't instantiate the non-matching template:
// Called as:
// IF_type<condition, A, B>::type
// The matching template must define the typeded 'type'
// I.e. A::type if condition is true, B::type if condition is false
// Idea from Vesa Karvonen (from C&E as well I guess)
template<class T>
struct IF_type_
{
typedef typename T::type type;
};
template<bool C, class T, class E>
struct IF_type
{
typedef typename
IF_type_<typename IF<C, T, E>::RET >::type type;
};
// helper that can be used to give typedef T to some type
template <class T> struct identity_mapping { typedef T type; };
// An if construct for finding an integral constant 'value'
// Does not instantiate the non-matching branch
// Called as IF_value<condition, A, B>::value
// If condition is true A::value must be defined, otherwise B::value
template<class T>
struct IF_value_
{
BOOST_STATIC_CONSTANT(int, value = T::value);
};
template<bool C, class T, class E>
struct IF_value
{
BOOST_STATIC_CONSTANT(int, value = (IF_value_<typename IF<C, T, E>::RET>::value));
};
// --------------------------------------------------------------
// removes reference from other than function types:
template<class T> class remove_reference_if_valid
{
typedef typename boost::remove_reference<T>::type plainT;
public:
typedef typename IF<
boost::is_function<plainT>::value,
T,
plainT
>::RET type;
};
template<class T> struct remove_reference_and_cv {
typedef typename boost::remove_cv<
typename boost::remove_reference<T>::type
>::type type;
};
// returns a reference to the element of tuple T
template<int N, class T> struct tuple_element_as_reference {
typedef typename
boost::tuples::access_traits<
typename boost::tuples::element<N, T>::type
>::non_const_type type;
};
// returns the cv and reverence stripped type of a tuple element
template<int N, class T> struct tuple_element_stripped {
typedef typename
remove_reference_and_cv<
typename boost::tuples::element<N, T>::type
>::type type;
};
// is_lambda_functor -------------------------------------------------
template <class T> struct is_lambda_functor_ {
BOOST_STATIC_CONSTANT(bool, value = false);
};
template <class Arg> struct is_lambda_functor_<lambda_functor<Arg> > {
BOOST_STATIC_CONSTANT(bool, value = true);
};
} // end detail
template <class T> struct is_lambda_functor {
BOOST_STATIC_CONSTANT(bool,
value =
detail::is_lambda_functor_<
typename detail::remove_reference_and_cv<T>::type
>::value);
};
namespace detail {
// -- parameter_traits_ ---------------------------------------------
// An internal parameter type traits class that respects
// the reference_wrapper class.
// The conversions performed are:
// references -> compile_time_error
// T1 -> T2,
// reference_wrapper<T> -> T&
// const array -> ref to const array
// array -> ref to array
// function -> ref to function
// ------------------------------------------------------------------------
template<class T1, class T2>
struct parameter_traits_ {
typedef T2 type;
};
// Do not instantiate with reference types
template<class T, class Any> struct parameter_traits_<T&, Any> {
typedef typename
generate_error<T&>::
parameter_traits_class_instantiated_with_reference_type type;
};
// Arrays can't be stored as plain types; convert them to references
template<class T, int n, class Any> struct parameter_traits_<T[n], Any> {
typedef T (&type)[n];
};
template<class T, int n, class Any>
struct parameter_traits_<const T[n], Any> {
typedef const T (&type)[n];
};
template<class T, int n, class Any>
struct parameter_traits_<volatile T[n], Any> {
typedef volatile T (&type)[n];
};
template<class T, int n, class Any>
struct parameter_traits_<const volatile T[n], Any> {
typedef const volatile T (&type)[n];
};
template<class T, class Any>
struct parameter_traits_<boost::reference_wrapper<T>, Any >{
typedef T& type;
};
template<class T, class Any>
struct parameter_traits_<const boost::reference_wrapper<T>, Any >{
typedef T& type;
};
template<class T, class Any>
struct parameter_traits_<volatile boost::reference_wrapper<T>, Any >{
typedef T& type;
};
template<class T, class Any>
struct parameter_traits_<const volatile boost::reference_wrapper<T>, Any >{
typedef T& type;
};
template<class Any>
struct parameter_traits_<void, Any> {
typedef void type;
};
template<class Arg, class Any>
struct parameter_traits_<lambda_functor<Arg>, Any > {
typedef lambda_functor<Arg> type;
};
template<class Arg, class Any>
struct parameter_traits_<const lambda_functor<Arg>, Any > {
typedef lambda_functor<Arg> type;
};
// Are the volatile versions needed?
template<class Arg, class Any>
struct parameter_traits_<volatile lambda_functor<Arg>, Any > {
typedef lambda_functor<Arg> type;
};
template<class Arg, class Any>
struct parameter_traits_<const volatile lambda_functor<Arg>, Any > {
typedef lambda_functor<Arg> type;
};
} // end namespace detail
// ------------------------------------------------------------------------
// traits classes for lambda expressions (bind functions, operators ...)
// must be instantiated with non-reference types
// The default is const plain type -------------------------
// const T -> const T,
// T -> const T,
// references -> compile_time_error
// reference_wrapper<T> -> T&
// array -> const ref array
template<class T>
struct const_copy_argument {
typedef typename
detail::parameter_traits_<
T,
typename detail::IF<boost::is_function<T>::value, T&, const T>::RET
>::type type;
};
// T may be a function type. Without the IF test, const would be added
// to a function type, which is illegal.
// all arrays are converted to const.
// This traits template is used for 'const T&' parameter passing
// and thus the knowledge of the potential
// non-constness of an actual argument is lost.
template<class T, int n> struct const_copy_argument <T[n]> {
typedef const T (&type)[n];
};
template<class T, int n> struct const_copy_argument <volatile T[n]> {
typedef const volatile T (&type)[n];
};
template<class T>
struct const_copy_argument<T&> {};
// do not instantiate with references
// typedef typename detail::generate_error<T&>::references_not_allowed type;
template<>
struct const_copy_argument<void> {
typedef void type;
};
template<>
struct const_copy_argument<void const> {
typedef void type;
};
// Does the same as const_copy_argument, but passes references through as such
template<class T>
struct bound_argument_conversion {
typedef typename const_copy_argument<T>::type type;
};
template<class T>
struct bound_argument_conversion<T&> {
typedef T& type;
};
// The default is non-const reference -------------------------
// const T -> const T&,
// T -> T&,
// references -> compile_time_error
// reference_wrapper<T> -> T&
template<class T>
struct reference_argument {
typedef typename detail::parameter_traits_<T, T&>::type type;
};
template<class T>
struct reference_argument<T&> {
typedef typename detail::generate_error<T&>::references_not_allowed type;
};
template<class Arg>
struct reference_argument<lambda_functor<Arg> > {
typedef lambda_functor<Arg> type;
};
template<class Arg>
struct reference_argument<const lambda_functor<Arg> > {
typedef lambda_functor<Arg> type;
};
// Are the volatile versions needed?
template<class Arg>
struct reference_argument<volatile lambda_functor<Arg> > {
typedef lambda_functor<Arg> type;
};
template<class Arg>
struct reference_argument<const volatile lambda_functor<Arg> > {
typedef lambda_functor<Arg> type;
};
template<>
struct reference_argument<void> {
typedef void type;
};
namespace detail {
// Array to pointer conversion
template <class T>
struct array_to_pointer {
typedef T type;
};
template <class T, int N>
struct array_to_pointer <const T[N]> {
typedef const T* type;
};
template <class T, int N>
struct array_to_pointer <T[N]> {
typedef T* type;
};
template <class T, int N>
struct array_to_pointer <const T (&) [N]> {
typedef const T* type;
};
template <class T, int N>
struct array_to_pointer <T (&) [N]> {
typedef T* type;
};
// ---------------------------------------------------------------------------
// The call_traits for bind
// Respects the reference_wrapper class.
// These templates are used outside of bind functions as well.
// the bind_tuple_mapper provides a shorter notation for default
// bound argument storing semantics, if all arguments are treated
// uniformly.
// from template<class T> foo(const T& t) : bind_traits<const T>::type
// from template<class T> foo(T& t) : bind_traits<T>::type
// Conversions:
// T -> const T,
// cv T -> cv T,
// T& -> T&
// reference_wrapper<T> -> T&
// const reference_wrapper<T> -> T&
// array -> const ref array
// make bound arguments const, this is a deliberate design choice, the
// purpose is to prevent side effects to bound arguments that are stored
// as copies
template<class T>
struct bind_traits {
typedef const T type;
};
template<class T>
struct bind_traits<T&> {
typedef T& type;
};
// null_types are an exception, we always want to store them as non const
// so that other templates can assume that null_type is always without const
template<>
struct bind_traits<null_type> {
typedef null_type type;
};
// the bind_tuple_mapper, bind_type_generators may
// introduce const to null_type
template<>
struct bind_traits<const null_type> {
typedef null_type type;
};
// Arrays can't be stored as plain types; convert them to references.
// All arrays are converted to const. This is because bind takes its
// parameters as const T& and thus the knowledge of the potential
// non-constness of actual argument is lost.
template<class T, int n> struct bind_traits <T[n]> {
typedef const T (&type)[n];
};
template<class T, int n>
struct bind_traits<const T[n]> {
typedef const T (&type)[n];
};
template<class T, int n> struct bind_traits<volatile T[n]> {
typedef const volatile T (&type)[n];
};
template<class T, int n>
struct bind_traits<const volatile T[n]> {
typedef const volatile T (&type)[n];
};
template<class R>
struct bind_traits<R()> {
typedef R(&type)();
};
template<class R, class Arg1>
struct bind_traits<R(Arg1)> {
typedef R(&type)(Arg1);
};
template<class R, class Arg1, class Arg2>
struct bind_traits<R(Arg1, Arg2)> {
typedef R(&type)(Arg1, Arg2);
};
template<class R, class Arg1, class Arg2, class Arg3>
struct bind_traits<R(Arg1, Arg2, Arg3)> {
typedef R(&type)(Arg1, Arg2, Arg3);
};
template<class R, class Arg1, class Arg2, class Arg3, class Arg4>
struct bind_traits<R(Arg1, Arg2, Arg3, Arg4)> {
typedef R(&type)(Arg1, Arg2, Arg3, Arg4);
};
template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5>
struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5)> {
typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5);
};
template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6>
struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6);
};
template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7>
struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7);
};
template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8>
struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8);
};
template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9>
struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> {
typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9);
};
template<class T>
struct bind_traits<reference_wrapper<T> >{
typedef T& type;
};
template<class T>
struct bind_traits<const reference_wrapper<T> >{
typedef T& type;
};
template<>
struct bind_traits<void> {
typedef void type;
};
template <
class T0 = null_type, class T1 = null_type, class T2 = null_type,
class T3 = null_type, class T4 = null_type, class T5 = null_type,
class T6 = null_type, class T7 = null_type, class T8 = null_type,
class T9 = null_type
>
struct bind_tuple_mapper {
typedef
tuple<typename bind_traits<T0>::type,
typename bind_traits<T1>::type,
typename bind_traits<T2>::type,
typename bind_traits<T3>::type,
typename bind_traits<T4>::type,
typename bind_traits<T5>::type,
typename bind_traits<T6>::type,
typename bind_traits<T7>::type,
typename bind_traits<T8>::type,
typename bind_traits<T9>::type> type;
};
// bind_traits, except map const T& -> const T
// this is needed e.g. in currying. Const reference arguments can
// refer to temporaries, so it is not safe to store them as references.
template <class T> struct remove_const_reference {
typedef typename bind_traits<T>::type type;
};
template <class T> struct remove_const_reference<const T&> {
typedef const T type;
};
// maps the bind argument types to the resulting lambda functor type
template <
class T0 = null_type, class T1 = null_type, class T2 = null_type,
class T3 = null_type, class T4 = null_type, class T5 = null_type,
class T6 = null_type, class T7 = null_type, class T8 = null_type,
class T9 = null_type
>
class bind_type_generator {
typedef typename
detail::bind_tuple_mapper<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9
>::type args_t;
BOOST_STATIC_CONSTANT(int, nof_elems = boost::tuples::length<args_t>::value);
typedef
action<
nof_elems,
function_action<nof_elems>
> action_type;
public:
typedef
lambda_functor<
lambda_functor_base<
action_type,
args_t
>
> type;
};
} // detail
template <class T> inline const T& make_const(const T& t) { return t; }
} // end of namespace lambda
} // end of namespace boost
#endif // BOOST_LAMBDA_TRAITS_HPP
@@ -0,0 +1,200 @@
///////////////////////////////////////////////////////////////////////////////
/// \file deduce_domain.hpp
/// Contains definition of deduce_domain\<\> class templates
/// for finding the domain that is common among the specified
/// domains
//
// Copyright 2010 Daniel Wallin, 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)
//
// Many thanks to Daniel Wallin who first implemented this code. Thanks
// also to Jeremiah Willcock, John Bytheway and Krishna Achuthan who
// offered alternate solutions to this tricky programming problem.
#ifndef BOOST_PROTO_DEDUCE_DOMAIN_HPP_EAN_05_22_2010
#define BOOST_PROTO_DEDUCE_DOMAIN_HPP_EAN_05_22_2010
#include <boost/config.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/iteration/local.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/proto/proto_fwd.hpp>
#ifndef BOOST_PROTO_ASSERT_VALID_DOMAIN
# define BOOST_PROTO_ASSERT_VALID_DOMAIN(DOM) BOOST_MPL_ASSERT_NOT((boost::is_same<DOM, boost::proto::detail::not_a_domain>))
#endif
namespace boost
{
namespace proto
{
namespace detail
{
template<typename Domain>
struct domain_
: domain_<typename Domain::proto_super_domain>
{
typedef Domain type;
typedef domain_<typename Domain::proto_super_domain> base;
#ifdef BOOST_NO_CXX11_DECLTYPE
using base::deduce98;
static int const index = base::index + 1;
static typename sized_type<index>::type deduce98(domain_<Domain>*);
#else
using base::deduce0x;
static Domain deduce0x(domain_<Domain>*);
#endif
};
template<>
struct domain_<not_a_domain>
{
typedef not_a_domain type;
#ifdef BOOST_NO_CXX11_DECLTYPE
static int const index = 1;
static sized_type<1>::type deduce98(void*);
#else
static not_a_domain deduce0x(void*);
#endif
};
template<>
struct domain_<default_domain>
: domain_<not_a_domain>
{};
template<>
struct domain_<basic_default_domain>
: domain_<not_a_domain>
{};
sized_type<1>::type default_test(void*, void*);
sized_type<2>::type default_test(domain_<default_domain>*, void*);
sized_type<2>::type default_test(domain_<basic_default_domain>*, void*);
sized_type<3>::type default_test(void*, domain_<default_domain>*);
sized_type<3>::type default_test(void*, domain_<basic_default_domain>*);
sized_type<4>::type default_test(domain_<default_domain>*, domain_<default_domain>*);
sized_type<4>::type default_test(domain_<basic_default_domain>*, domain_<default_domain>*);
sized_type<4>::type default_test(domain_<default_domain>*, domain_<basic_default_domain>*);
sized_type<4>::type default_test(domain_<basic_default_domain>*, domain_<basic_default_domain>*);
#ifdef BOOST_NO_CXX11_DECLTYPE
template<int N, typename Domain>
struct nth_domain
: nth_domain<N - 1, typename Domain::base>
{};
template<typename Domain>
struct nth_domain<0, Domain>
: Domain
{};
#endif
template<typename D0>
struct common_domain1
{
typedef D0 type;
};
template<typename E0>
struct deduce_domain1
: domain_of<E0>
{};
template<
typename D0
, typename D1
, int DefaultCase = sizeof(proto::detail::default_test((domain_<D0>*)0, (domain_<D1>*)0))
>
struct common_domain2
{
#ifdef BOOST_NO_CXX11_DECLTYPE
static int const index = domain_<D0>::index - sizeof(domain_<D0>::deduce98((domain_<D1>*)0));
typedef typename nth_domain<index, domain_<D0> >::type type;
#else
typedef decltype(domain_<D0>::deduce0x((domain_<D1>*)0)) type;
#endif
};
template<typename D0, typename D1>
struct common_domain2<D0, D1, 2>
{
typedef D1 type;
};
template<typename D0, typename D1>
struct common_domain2<D0, D1, 3>
{
typedef D0 type;
};
template<typename D0>
struct common_domain2<D0, default_domain, 4>
{
typedef D0 type;
};
template<typename D0>
struct common_domain2<D0, basic_default_domain, 4>
{
typedef D0 type;
};
template<typename D1>
struct common_domain2<default_domain, D1, 4>
{
typedef D1 type;
};
template<typename D1>
struct common_domain2<basic_default_domain, D1, 4>
{
typedef D1 type;
};
template<>
struct common_domain2<default_domain, default_domain, 4>
{
typedef default_domain type;
};
template<>
struct common_domain2<basic_default_domain, default_domain, 4>
{
typedef default_domain type;
};
template<>
struct common_domain2<default_domain, basic_default_domain, 4>
{
typedef default_domain type;
};
template<>
struct common_domain2<basic_default_domain, basic_default_domain, 4>
{
typedef basic_default_domain type;
};
template<typename E0, typename E1>
struct deduce_domain2
: common_domain2<
typename domain_of<E0>::type
, typename domain_of<E1>::type
>
{};
#include <boost/proto/detail/deduce_domain_n.hpp>
}
}
}
#endif // BOOST_PROTO_DEDUCE_DOMAIN_HPP_EAN_05_22_2010
@@ -0,0 +1,34 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2010 Helge Bahmann
* Copyright (c) 2013 Tim Blechmann
* Copyright (c) 2014 Andrey Semashev
*/
/*!
* \file atomic/detail/caps_gcc_sparc.hpp
*
* This header defines feature capabilities macros
*/
#ifndef BOOST_ATOMIC_DETAIL_CAPS_GCC_SPARC_HPP_INCLUDED_
#define BOOST_ATOMIC_DETAIL_CAPS_GCC_SPARC_HPP_INCLUDED_
#include <boost/atomic/detail/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#define BOOST_ATOMIC_INT8_LOCK_FREE 2
#define BOOST_ATOMIC_INT16_LOCK_FREE 2
#define BOOST_ATOMIC_INT32_LOCK_FREE 2
#define BOOST_ATOMIC_INT64_LOCK_FREE 2
#define BOOST_ATOMIC_POINTER_LOCK_FREE 2
#define BOOST_ATOMIC_THREAD_FENCE 2
#define BOOST_ATOMIC_SIGNAL_FENCE 2
#endif // BOOST_ATOMIC_DETAIL_CAPS_GCC_SPARC_HPP_INCLUDED_
@@ -0,0 +1,32 @@
#ifndef BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED
#define BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-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/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/aux_/config/workaround.hpp>
#include <boost/mpl/aux_/adl_barrier.hpp>
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
#if BOOST_WORKAROUND(__HP_aCC, <= 53800)
// the type of non-type template arguments may not depend on template arguments
template< typename T, long N > struct integral_c;
#else
template< typename T, T N > struct integral_c;
#endif
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
BOOST_MPL_AUX_ADL_BARRIER_DECL(integral_c)
#endif // BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED
@@ -0,0 +1,114 @@
// Copyright (c) 2006 Xiaogang Zhang, 2015 John Maddock
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// History:
// XZ wrote the original of this file as part of the Google
// Summer of Code 2006. JM modified it to fit into the
// Boost.Math conceptual framework better, and to correctly
// handle the y < 0 case.
// Updated 2015 to use Carlson's latest methods.
//
#ifndef BOOST_MATH_ELLINT_RC_HPP
#define BOOST_MATH_ELLINT_RC_HPP
#ifdef _MSC_VER
#pragma once
#endif
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/tools/config.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/constants/constants.hpp>
#include <iostream>
// Carlson's degenerate elliptic integral
// R_C(x, y) = R_F(x, y, y) = 0.5 * \int_{0}^{\infty} (t+x)^{-1/2} (t+y)^{-1} dt
// Carlson, Numerische Mathematik, vol 33, 1 (1979)
namespace boost { namespace math { namespace detail{
template <typename T, typename Policy>
T ellint_rc_imp(T x, T y, const Policy& pol)
{
BOOST_MATH_STD_USING
static const char* function = "boost::math::ellint_rc<%1%>(%1%,%1%)";
if(x < 0)
{
return policies::raise_domain_error<T>(function,
"Argument x must be non-negative but got %1%", x, pol);
}
if(y == 0)
{
return policies::raise_domain_error<T>(function,
"Argument y must not be zero but got %1%", y, pol);
}
// for y < 0, the integral is singular, return Cauchy principal value
T prefix, result;
if(y < 0)
{
prefix = sqrt(x / (x - y));
x = x - y;
y = -y;
}
else
prefix = 1;
if(x == 0)
{
result = constants::half_pi<T>() / sqrt(y);
}
else if(x == y)
{
result = 1 / sqrt(x);
}
else if(y > x)
{
result = atan(sqrt((y - x) / x)) / sqrt(y - x);
}
else
{
if(y / x > 0.5)
{
T arg = sqrt((x - y) / x);
result = (boost::math::log1p(arg) - boost::math::log1p(-arg)) / (2 * sqrt(x - y));
}
else
{
result = log((sqrt(x) + sqrt(x - y)) / sqrt(y)) / sqrt(x - y);
}
}
return prefix * result;
}
} // namespace detail
template <class T1, class T2, class Policy>
inline typename tools::promote_args<T1, T2>::type
ellint_rc(T1 x, T2 y, const Policy& pol)
{
typedef typename tools::promote_args<T1, T2>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
return policies::checked_narrowing_cast<result_type, Policy>(
detail::ellint_rc_imp(
static_cast<value_type>(x),
static_cast<value_type>(y), pol), "boost::math::ellint_rc<%1%>(%1%,%1%)");
}
template <class T1, class T2>
inline typename tools::promote_args<T1, T2>::type
ellint_rc(T1 x, T2 y)
{
return ellint_rc(x, y, policies::policy<>());
}
}} // namespaces
#endif // BOOST_MATH_ELLINT_RC_HPP
@@ -0,0 +1,51 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2005, 2014 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(FUSION_NIL_04232014_0843)
#define FUSION_NIL_04232014_0843
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/list/cons_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct void_;
struct cons_tag;
struct forward_traversal_tag;
struct fusion_sequence_tag;
struct nil_ : sequence_base<nil_>
{
typedef mpl::int_<0> size;
typedef cons_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef forward_traversal_tag category;
typedef void_ car_type;
typedef void_ cdr_type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
nil_() BOOST_NOEXCEPT {}
template <typename Iterator>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
nil_(Iterator const& /*iter*/, mpl::true_ /*this_is_an_iterator*/) BOOST_NOEXCEPT
{}
template <typename Iterator>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void assign_from_iter(Iterator const& /*iter*/) BOOST_NOEXCEPT
{
}
};
}}
#endif
@@ -0,0 +1,304 @@
#ifndef BOOST_BIND_PROTECT_HPP_INCLUDED
#define BOOST_BIND_PROTECT_HPP_INCLUDED
//
// protect.hpp
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2009 Steven Watanabe
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
namespace boost
{
namespace _bi
{
template<class F> class protected_bind_t
{
public:
typedef typename F::result_type result_type;
explicit protected_bind_t(F f): f_(f)
{
}
result_type operator()()
{
return f_();
}
result_type operator()() const
{
return f_();
}
template<class A1> result_type operator()(A1 & a1)
{
return f_(a1);
}
template<class A1> result_type operator()(A1 & a1) const
{
return f_(a1);
}
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template<class A1> result_type operator()(const A1 & a1)
{
return f_(a1);
}
template<class A1> result_type operator()(const A1 & a1) const
{
return f_(a1);
}
#endif
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2)
{
return f_(a1, a2);
}
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const
{
return f_(a1, a2);
}
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2)
{
return f_(a1, a2);
}
template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2) const
{
return f_(a1, a2);
}
template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2)
{
return f_(a1, a2);
}
template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2) const
{
return f_(a1, a2);
}
template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2)
{
return f_(a1, a2);
}
template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2) const
{
return f_(a1, a2);
}
#endif
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3)
{
return f_(a1, a2, a3);
}
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) const
{
return f_(a1, a2, a3);
}
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3)
{
return f_(a1, a2, a3);
}
template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const
{
return f_(a1, a2, a3);
}
#endif
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4)
{
return f_(a1, a2, a3, a4);
}
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const
{
return f_(a1, a2, a3, a4);
}
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4)
{
return f_(a1, a2, a3, a4);
}
template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const
{
return f_(a1, a2, a3, a4);
}
#endif
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5)
{
return f_(a1, a2, a3, a4, a5);
}
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const
{
return f_(a1, a2, a3, a4, a5);
}
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5)
{
return f_(a1, a2, a3, a4, a5);
}
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const
{
return f_(a1, a2, a3, a4, a5);
}
#endif
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6)
{
return f_(a1, a2, a3, a4, a5, a6);
}
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const
{
return f_(a1, a2, a3, a4, a5, a6);
}
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6)
{
return f_(a1, a2, a3, a4, a5, a6);
}
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const
{
return f_(a1, a2, a3, a4, a5, a6);
}
#endif
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7)
{
return f_(a1, a2, a3, a4, a5, a6, a7);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const
{
return f_(a1, a2, a3, a4, a5, a6, a7);
}
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7)
{
return f_(a1, a2, a3, a4, a5, a6, a7);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const
{
return f_(a1, a2, a3, a4, a5, a6, a7);
}
#endif
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8)
{
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const
{
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
}
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8)
{
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const
{
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
}
#endif
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9)
{
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const
{
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(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)
{
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(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) const
{
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
#endif
private:
F f_;
};
} // namespace _bi
template<class F> _bi::protected_bind_t<F> protect(F f)
{
return _bi::protected_bind_t<F>(f);
}
} // namespace boost
#endif // #ifndef BOOST_BIND_PROTECT_HPP_INCLUDED
@@ -0,0 +1,81 @@
/*
*
* Copyright (c) 2002
* John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE char_regex_traits.cpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: Declares deprecated traits classes char_regex_traits<>.
*/
#ifndef BOOST_REGEX_V4_CHAR_REGEX_TRAITS_HPP
#define BOOST_REGEX_V4_CHAR_REGEX_TRAITS_HPP
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
namespace boost{
namespace deprecated{
//
// class char_regex_traits_i
// provides case insensitive traits classes (deprecated):
template <class charT>
class char_regex_traits_i : public regex_traits<charT> {};
template<>
class char_regex_traits_i<char> : public regex_traits<char>
{
public:
typedef char char_type;
typedef unsigned char uchar_type;
typedef unsigned int size_type;
typedef regex_traits<char> base_type;
};
#ifndef BOOST_NO_WREGEX
template<>
class char_regex_traits_i<wchar_t> : public regex_traits<wchar_t>
{
public:
typedef wchar_t char_type;
typedef unsigned short uchar_type;
typedef unsigned int size_type;
typedef regex_traits<wchar_t> base_type;
};
#endif
} // namespace deprecated
} // namespace boost
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#endif // include
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,43 @@
/*=============================================================================
Copyright (c) 2009 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_FUSION_ITERATOR_KEY_OF_HPP
#define BOOST_FUSION_ITERATOR_KEY_OF_HPP
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/tag_of.hpp>
namespace boost { namespace fusion
{
struct iterator_facade_tag;
namespace extension
{
template <typename>
struct key_of_impl;
template <>
struct key_of_impl<iterator_facade_tag>
{
template <typename It>
struct apply
: It::template key_of<It>
{};
};
}
namespace result_of
{
template <typename It>
struct key_of
: extension::key_of_impl<typename traits::tag_of<It>::type>::
template apply<It>
{};
}
}}
#endif
@@ -0,0 +1,192 @@
#ifndef BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP
#define BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// wchar_from_mb.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// 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)
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/assert.hpp>
#include <cctype>
#include <cstddef> // size_t
#include <cwchar> // mbstate_t
#include <algorithm> // copy
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::mbstate_t;
} // namespace std
#endif
#include <boost/array.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
#include <boost/archive/iterators/dataflow_exception.hpp>
#include <boost/serialization/throw_exception.hpp>
#include <iostream>
namespace boost {
namespace archive {
namespace iterators {
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// class used by text archives to translate char strings to wchar_t
// strings of the currently selected locale
template<class Base>
class wchar_from_mb
: public boost::iterator_adaptor<
wchar_from_mb<Base>,
Base,
wchar_t,
single_pass_traversal_tag,
wchar_t
>
{
friend class boost::iterator_core_access;
typedef typename boost::iterator_adaptor<
wchar_from_mb<Base>,
Base,
wchar_t,
single_pass_traversal_tag,
wchar_t
> super_t;
typedef wchar_from_mb<Base> this_t;
void drain();
wchar_t dereference() const {
if(m_output.m_next == m_output.m_next_available)
return static_cast<wchar_t>(0);
return * m_output.m_next;
}
void increment(){
if(m_output.m_next == m_output.m_next_available)
return;
if(++m_output.m_next == m_output.m_next_available){
if(m_input.m_done)
return;
drain();
}
}
bool equal(this_t const & rhs) const {
return dereference() == rhs.dereference();
}
boost::archive::detail::utf8_codecvt_facet m_codecvt_facet;
std::mbstate_t m_mbs;
template<typename T>
struct sliding_buffer {
boost::array<T, 32> m_buffer;
typename boost::array<T, 32>::const_iterator m_next_available;
typename boost::array<T, 32>::iterator m_next;
bool m_done;
// default ctor
sliding_buffer() :
m_next_available(m_buffer.begin()),
m_next(m_buffer.begin()),
m_done(false)
{}
// copy ctor
sliding_buffer(const sliding_buffer & rhs) :
m_next_available(
std::copy(
rhs.m_buffer.begin(),
rhs.m_next_available,
m_buffer.begin()
)
),
m_next(
m_buffer.begin() + (rhs.m_next - rhs.m_buffer.begin())
),
m_done(rhs.m_done)
{}
};
sliding_buffer<typename iterator_value<Base>::type> m_input;
sliding_buffer<typename iterator_value<this_t>::type> m_output;
public:
// make composible buy using templated constructor
template<class T>
wchar_from_mb(T start) :
super_t(Base(static_cast< T >(start))),
m_mbs(std::mbstate_t())
{
BOOST_ASSERT(std::mbsinit(&m_mbs));
drain();
}
// default constructor used as an end iterator
wchar_from_mb(){}
// copy ctor
wchar_from_mb(const wchar_from_mb & rhs) :
super_t(rhs.base_reference()),
m_mbs(rhs.m_mbs),
m_input(rhs.m_input),
m_output(rhs.m_output)
{}
};
template<class Base>
void wchar_from_mb<Base>::drain(){
BOOST_ASSERT(! m_input.m_done);
for(;;){
typename boost::iterators::iterator_reference<Base>::type c = *(this->base_reference());
// a null character in a multibyte stream is takes as end of string
if(0 == c){
m_input.m_done = true;
break;
}
++(this->base_reference());
* const_cast<typename iterator_value<Base>::type *>(
(m_input.m_next_available++)
) = c;
// if input buffer is full - we're done for now
if(m_input.m_buffer.end() == m_input.m_next_available)
break;
}
const typename boost::iterators::iterator_value<Base>::type * input_new_start;
typename iterator_value<this_t>::type * next_available;
std::codecvt_base::result r = m_codecvt_facet.in(
m_mbs,
m_input.m_buffer.begin(),
m_input.m_next_available,
input_new_start,
m_output.m_buffer.begin(),
m_output.m_buffer.end(),
next_available
);
BOOST_ASSERT(std::codecvt_base::ok == r);
m_output.m_next_available = next_available;
m_output.m_next = m_output.m_buffer.begin();
// we're done with some of the input so shift left.
m_input.m_next_available = std::copy(
input_new_start,
m_input.m_next_available,
m_input.m_buffer.begin()
);
m_input.m_next = m_input.m_buffer.begin();
}
} // namespace iterators
} // namespace archive
} // namespace boost
#endif // BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

File diff suppressed because it is too large Load Diff
@@ -0,0 +1,108 @@
program psk_parse
character line*256,callsign*12,callsign0*12,progname*30
integer nc(6),ntot(6),nsingle(6)
logical zap
data callsign0/' '/
open(10,file='jt65-2',status='old')
nc=0
ntot=0
ncalls=0
nsingle=0
zap=.false.
do iline=1,9999999
read(10,'(a256)',end=900) line
n=len(trim(line))
i1=0
i2=0
i3=0
do i=1,n
if(ichar(line(i:i)).eq.9) then
if(i1.eq.0) then
i1=i
cycle
endif
if(i2.eq.0) then
i2=i
cycle
endif
if(i3.eq.0) then
i3=i
exit
endif
endif
enddo
callsign=line(1:i1-1)
if(zap) then
if(callsign(1:1).ge.'0' .and. callsign(1:1).le.'9' .and. &
callsign(2:2).ge.'0' .and. callsign(2:2).le.'9' .and. &
callsign(3:3).ge.'0' .and. callsign(3:3).le.'9') cycle
if(callsign(1:1).ge.'A' .and. callsign(1:1).le.'Z' .and. &
callsign(2:2).ge.'A' .and. callsign(2:2).le.'Z' .and. &
callsign(3:3).ge.'A' .and. callsign(3:3).le.'Z' .and. &
callsign(4:4).ge.'A' .and. callsign(4:4).le.'Z') cycle
if(callsign(1:1).eq.'N' .and. &
callsign(2:2).ge.'0' .and. callsign(2:2).le.'9' .and. &
callsign(3:3).ge.'0' .and. callsign(3:3).le.'9') cycle
endif
progname=line(i1+1:i2-1)
do i=1,len(trim(progname))
if(progname(i:i).eq.' ') progname(i:i)='_'
enddo
read(line(i2+1:i3-1),*) ndecodes
read(line(i3+1:),*) nreporters
j=6
if(index(progname,'WSJT-X').gt.0) j=1
if(index(progname,'HB9HQX').gt.0) j=2
if(index(progname,'JTDX').gt.0) j=3
if(index(progname,'Comfort').gt.0) j=4
if(index(progname,'COMFORT').gt.0) j=4
if(index(progname,'JT65-HF').gt.0 .and. j.eq.6) j=5
nctot=sum(nc)
if(callsign.ne.callsign0 .and. nctot.gt.0) then
write(13,1000) callsign0,nc,nctot
1000 format(a12,6i8,i10)
if(nctot.eq.1) nsingle(j)=nsingle(j)+1
nc=0
callsign0=callsign
ncalls=ncalls+1
endif
nc(j)=nc(j) + ndecodes
ntot(j)=ntot(j) + ndecodes
write(12,1010) iline,callsign,ndecodes,nreporters,progname
1010 format(i8,2x,a12,2x,2i8,2x,a30)
enddo
900 nctot=sum(nc)
if(nctot.gt.0) write(13,1000) callsign0,nc,nctot
write(*,1018)
1018 format(' Total WSJT-X HB9HQX JTDX Comfort JT65-HF Other'/ &
'----------------------------------------------------------')
write(*,1019)
1019 format('Spots reported; fraction of total:')
write(*,1020) sum(ntot),ntot
1020 format(i8,2x,6i8)
fac=1.0/sum(ntot)
write(*,1030) 1.0000,fac*ntot
1030 format(f8.4,2x,6f8.4,f10.4)
write(*,1038)
1038 format(/'Singletons; as fraction of spots by same program')
write(*,1040) sum(nsingle),nsingle
1040 format(i8,2x,6i8)
write(*,1030) float(sum(nsingle))/sum(ntot),float(nsingle)/ntot
write(*,1050) ncalls
1050 format(/'Distinct calls spotted:',i6)
end program psk_parse
@@ -0,0 +1,46 @@
# /* Copyright (C) 2001
# * Housemarque Oy
# * http://www.housemarque.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)
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_COMPARISON_LESS_HPP
# define BOOST_PREPROCESSOR_COMPARISON_LESS_HPP
#
# include <boost/preprocessor/comparison/less_equal.hpp>
# include <boost/preprocessor/comparison/not_equal.hpp>
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/control/iif.hpp>
# include <boost/preprocessor/logical/bitand.hpp>
# include <boost/preprocessor/tuple/eat.hpp>
#
# /* BOOST_PP_LESS */
#
# if BOOST_PP_CONFIG_FLAGS() & (BOOST_PP_CONFIG_MWCC() | BOOST_PP_CONFIG_DMC())
# define BOOST_PP_LESS(x, y) BOOST_PP_BITAND(BOOST_PP_NOT_EQUAL(x, y), BOOST_PP_LESS_EQUAL(x, y))
# elif ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_LESS(x, y) BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(x, y), BOOST_PP_LESS_EQUAL, 0 BOOST_PP_TUPLE_EAT_2)(x, y)
# else
# define BOOST_PP_LESS(x, y) BOOST_PP_LESS_I(x, y)
# define BOOST_PP_LESS_I(x, y) BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(x, y), BOOST_PP_LESS_EQUAL, 0 BOOST_PP_TUPLE_EAT_2)(x, y)
# endif
#
# /* BOOST_PP_LESS_D */
#
# if BOOST_PP_CONFIG_FLAGS() & (BOOST_PP_CONFIG_MWCC() | BOOST_PP_CONFIG_DMC())
# define BOOST_PP_LESS_D(d, x, y) BOOST_PP_BITAND(BOOST_PP_NOT_EQUAL(x, y), BOOST_PP_LESS_EQUAL_D(d, x, y))
# elif ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_LESS_D(d, x, y) BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(x, y), BOOST_PP_LESS_EQUAL_D, 0 BOOST_PP_TUPLE_EAT_3)(d, x, y)
# else
# define BOOST_PP_LESS_D(d, x, y) BOOST_PP_LESS_D_I(d, x, y)
# define BOOST_PP_LESS_D_I(d, x, y) BOOST_PP_IIF(BOOST_PP_NOT_EQUAL(x, y), BOOST_PP_LESS_EQUAL_D, 0 BOOST_PP_TUPLE_EAT_3)(d, x, y)
# endif
#
# endif